-
Notifications
You must be signed in to change notification settings - Fork 8
/
.justfile
120 lines (99 loc) · 2.38 KB
/
.justfile
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
114
115
116
117
118
119
120
GEM_NAME := 'tree_sitter'
LIB := 'lib'
LIB_FILE := LIB / GEM_NAME + '.rb'
VERSION_FILE := LIB / GEM_NAME / 'version.rb'
VERSION := shell("ruby -r ./" + VERSION_FILE + " -e 'puts TreeSitter::VERSION'")
TS_PARSER_VERSION := '4.2'
default: check
[group('test')]
check: compile test lint doc-stats tc
[group('compile')]
clean:
bundle exec rake clean
[group('compile')]
compile *args:
@just clean
bundle exec rake compile {{ if args == '' { '' } else { '-- ' + args } }}
[group('tree-sitter')]
dl-parsers platform:
curl -o tree-sitter-parsers.zip -L https://github.com/Faveod/tree-sitter-parsers/releases/download/v{{TS_PARSER_VERSION}}/tree-sitter-parsers-{{TS_PARSER_VERSION}}-{{platform}}.zip
unzip tree-sitter-parsers.zip
[group('doc')]
doc:
bundle exec yard
[group('doc')]
doc-stats:
bundle exec yard stats --list-undoc
[group('gem')]
gem:
bundle exec rake gem
[group('gem')]
gem-native:
bundle exec rake native gem
[group('gem')]
gem-cross:
bundle exec rake gem:cross
[group('gem')]
[group('test')]
gem-cross-test:
bin/ci-push-gems && bin/ci-test-project
[group('lint')]
lint:
bundle exec rubocop --config .rubocop.yml
[group('lint')]
lint-fix:
bundle exec rubocop --config .rubocop.yml -A
[group('develop')]
[group('test')]
nm:
#!/usr/bin/env bash
ruby_version=$(ruby -e 'print RUBY_VERSION')
extension='so'
if [[ "$(uname)" == 'Darwin' ]]; then
extension='bundle'
fi
find ./tmp \
-type f \
-path "*/${ruby_version}/*" \
-name "tree_sitter.${extension}" \
-exec nm -gu {} \; \
[group('publish')]
publish:
bin/publish
[group('setup')]
setup:
@just setup-bundler
@just setup-parsers
[group('setup')]
setup-bundler:
bundle config set --local cache_all true
bundle config set --local path vendor
bundle install
[group('setup')]
[group('tree-sitter')]
setup-ts:
#!/usr/bin/env bash
set -euo pipefail
if [ -d tree-sitter ]; then
cd tree-sitter
git reset --hard HEAD
else
mkdir -p tree-sitter
cd tree-sitter
git init
git remote add origin https://github.com/tree-sitter/tree-sitter
fi
git fetch origin --depth 1 v0.22.6
git reset --hard FETCH_HEAD
make
echo "now you can:"
echo " $ cd tree-sitter && make install"
[group('setup')]
setup-parsers:
bin/setup
[group('lint')]
tc:
bundle exec srb tc
[group('test')]
test *args:
bundle exec rake test {{ if args == '' { '' } else { '-- ' + args } }}