-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmise.toml
More file actions
113 lines (98 loc) · 2.56 KB
/
mise.toml
File metadata and controls
113 lines (98 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
[settings]
experimental = true
[env]
_.file = ".env"
[tools]
ruby = ["4.0", "3.2"]
watchexec = "latest"
[tasks.lint]
run = "bundle exec rake lint"
[tasks."lint:fix"]
run = "bundle exec rake lint:fix"
[tasks."verify"]
run = "bundle exec rake lint test"
[tasks.watch-test]
description = "Runs tests when files change"
run = "watchexec --exts rb --watch lib --watch test --restart --clear -- rake test"
[tasks.precommit]
description = "Run linter before commit (full CI runs on push)"
run = """
bundle check > /dev/null 2>&1 || bundle install --quiet
if ! git diff --quiet --exit-code Gemfile.lock; then
echo ""
echo "Gemfile.lock is out of sync with gemspec"
echo ""
echo "Changes detected:"
git diff Gemfile.lock | head -20
echo ""
echo "Fix: git add Gemfile.lock"
exit 1
fi
bundle exec rake lint
"""
[tasks.example]
description = "Run example with auto-detected appraisal (e.g., mise example examples/internal/openai.rb)"
run = """
#!/usr/bin/env bash
set -e
if [ -z "$1" ]; then
echo "Usage: mise example <path>"
echo "Examples:"
echo " mise example examples/internal/openai.rb"
echo " mise example examples/internal/anthropic.rb"
echo " mise example examples/internal/alexrudall_ruby_openai.rb"
echo " mise example examples/internal/ruby_llm.rb"
exit 1
fi
EXAMPLE_FILE="$1"
# Check if file exists
if [ ! -f "${EXAMPLE_FILE}" ]; then
echo "Error: File not found: ${EXAMPLE_FILE}"
exit 1
fi
# Determine which appraisal to use based on the filename/path
case "${EXAMPLE_FILE}" in
*alexrudall*|*ruby_openai*|*ruby-openai*)
APPRAISAL="ruby-openai"
;;
*ruby_llm*|*ruby-llm*)
APPRAISAL="ruby_llm"
;;
*openai*|*kitchen-sink*)
APPRAISAL="openai"
;;
*anthropic*)
APPRAISAL="anthropic"
;;
*)
# Default to no appraisal
APPRAISAL=""
;;
esac
# Install gemfile if using appraisal and not already installed
if [ -n "${APPRAISAL}" ]; then
GEMFILE="gemfiles/${APPRAISAL//-/_}.gemfile"
if [ -f "${GEMFILE}" ]; then
if ! bundle check --gemfile "${GEMFILE}" &>/dev/null; then
bundle install --gemfile "${GEMFILE}" --quiet
fi
fi
fi
# Run the example
if [ -n "${APPRAISAL}" ]; then
echo "Running ${EXAMPLE_FILE} with ${APPRAISAL} appraisal..."
bundle exec appraisal ${APPRAISAL} ruby ${EXAMPLE_FILE}
else
echo "Running ${EXAMPLE_FILE}..."
bundle exec ruby ${EXAMPLE_FILE}
fi
"""
[hooks]
postinstall = """
if bundle --version > /dev/null 2>&1; then
echo "Installing gem dependencies..."
bundle install
echo "Setting up git pre-commit hook..."
mise generate git-pre-commit --write --task=precommit
fi
"""