wile 0.9.261203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.version +1 -0
- data/CREDITS.md +20 -0
- data/README.md +253 -0
- data/bin/wile +102 -0
- data/cache/.bin/pane +99 -0
- data/cache/.bin/panes +54 -0
- data/cache/.config.fish +2 -0
- data/cache/.dictionary +0 -0
- data/cache/.gemignore +16 -0
- data/cache/.gitignore +9 -0
- data/cache/.greeting.erb +1 -0
- data/cache/.irbrc +30 -0
- data/cache/.lexicon +0 -0
- data/cache/.prompt.erb +1 -0
- data/cache/.reek-strict.yml +1 -0
- data/cache/.reek.yml +1 -0
- data/cache/.rubocop-strict.yml +4 -0
- data/cache/.rubocop.yml +4 -0
- data/cache/.ruby-version-floor +1 -0
- data/cache/.ruby-version.erb +1 -0
- data/cache/.solargraph.yml +21 -0
- data/cache/.title.erb +1 -0
- data/cache/.version +1 -0
- data/cache/.wile/example.rb +56 -0
- data/cache/.wileignore +3 -0
- data/cache/CREDITS.md +10 -0
- data/cache/Gemfile +5 -0
- data/cache/Gemfile.lock +1 -0
- data/cache/History.txt +0 -0
- data/cache/README.md.erb +54 -0
- data/cache/TODO.md +3 -0
- data/cache/bin/project.erb +12 -0
- data/cache/cucumber.yml +1 -0
- data/cache/examples/README.md +3 -0
- data/cache/features/help.feature.erb +30 -0
- data/cache/features/step_definitions/command_steps.rb +171 -0
- data/cache/features/support/env.rb +11 -0
- data/cache/features/version.feature.erb +19 -0
- data/cache/git/hooks/pre-commit +93 -0
- data/cache/lib/project.rb.erb +4 -0
- data/cache/man/project.md.erb +24 -0
- data/cache/pkg/README.md +3 -0
- data/cache/test/cons.gz +0 -0
- data/cache/test/tc_comments +216 -0
- data/cache/test/tc_cucumber_slow +67 -0
- data/cache/test/tc_dependency_scrapes +126 -0
- data/cache/test/tc_dictionary +51 -0
- data/cache/test/tc_encoding +53 -0
- data/cache/test/tc_lexicon +34 -0
- data/cache/test/tc_lib_tests +37 -0
- data/cache/test/tc_lints +71 -0
- data/cache/test/tc_readme_rocket_check +128 -0
- data/cache/test/tc_reek +20 -0
- data/cache/test/tc_rubocop +20 -0
- data/cache/test/tc_ruby_syntax +28 -0
- data/cache/test/tc_tags +32 -0
- data/cache/test/tc_tasks_test +31 -0
- data/cache/test/tc_version +97 -0
- data/cache/test/tc_weird_filenames +23 -0
- data/cache/test/test_helper.rb +230 -0
- data/cache/tmp/README.md +8 -0
- data/data/command_version.tsv +281 -0
- data/dependencies.txt +70 -0
- data/lib/wile/autoloads/cache.rb +123 -0
- data/lib/wile/autoloads/code_content.rb +225 -0
- data/lib/wile/autoloads/code_data.rb +153 -0
- data/lib/wile/autoloads/code_data_function.rb +79 -0
- data/lib/wile/autoloads/code_data_valuation.rb +60 -0
- data/lib/wile/autoloads/code_stats.rb +185 -0
- data/lib/wile/autoloads/command_version.rb +119 -0
- data/lib/wile/autoloads/content.rb +196 -0
- data/lib/wile/autoloads/dependencies.rb +170 -0
- data/lib/wile/autoloads/gem_utils.rb +69 -0
- data/lib/wile/autoloads/gemspec.rb +163 -0
- data/lib/wile/autoloads/git.rb +59 -0
- data/lib/wile/autoloads/info.rb +91 -0
- data/lib/wile/autoloads/manpage.rb +44 -0
- data/lib/wile/autoloads/methods.rb +130 -0
- data/lib/wile/autoloads/nvim_files.rb +54 -0
- data/lib/wile/autoloads/options_dictionary.rb +345 -0
- data/lib/wile/autoloads/order_optimizer.rb +185 -0
- data/lib/wile/autoloads/project.rb +60 -0
- data/lib/wile/autoloads/readme.rb +137 -0
- data/lib/wile/autoloads/receivers.rb +101 -0
- data/lib/wile/autoloads/responds.rb +36 -0
- data/lib/wile/autoloads/test.rb +78 -0
- data/lib/wile/autoloads/thread_pool.rb +64 -0
- data/lib/wile/help.rb +41 -0
- data/lib/wile/requires.rb +7 -0
- data/lib/wile/run.rb +108 -0
- data/lib/wile/sysexits.rb +43 -0
- data/lib/wile/tasks/build.rb +46 -0
- data/lib/wile/tasks/bump.rb +61 -0
- data/lib/wile/tasks/compare.rb +139 -0
- data/lib/wile/tasks/content.rb +44 -0
- data/lib/wile/tasks/cp.rb +52 -0
- data/lib/wile/tasks/dependencies.rb +58 -0
- data/lib/wile/tasks/dictionary.rb +59 -0
- data/lib/wile/tasks/gemcheck.rb +142 -0
- data/lib/wile/tasks/gemfile.rb +60 -0
- data/lib/wile/tasks/help.rb +29 -0
- data/lib/wile/tasks/info.rb +77 -0
- data/lib/wile/tasks/install.rb +53 -0
- data/lib/wile/tasks/lexicon.rb +59 -0
- data/lib/wile/tasks/list.rb +97 -0
- data/lib/wile/tasks/methods.rb +154 -0
- data/lib/wile/tasks/mkdir.rb +19 -0
- data/lib/wile/tasks/note.rb +49 -0
- data/lib/wile/tasks/nvim.rb +60 -0
- data/lib/wile/tasks/order.rb +93 -0
- data/lib/wile/tasks/oscheck.rb +49 -0
- data/lib/wile/tasks/publish.rb +67 -0
- data/lib/wile/tasks/receivers.rb +34 -0
- data/lib/wile/tasks/review.rb +157 -0
- data/lib/wile/tasks/ruby.rb +38 -0
- data/lib/wile/tasks/tc.rb +114 -0
- data/lib/wile/tasks/test.rb +57 -0
- data/lib/wile/tasks/todo.rb +55 -0
- data/lib/wile/tasks/update.rb +67 -0
- data/lib/wile/tasks.rb +34 -0
- data/lib/wile/usage.rb +56 -0
- data/lib/wile/usage_error.rb +18 -0
- data/lib/wile/utilities.rb +283 -0
- data/lib/wile/utilities_refinements.rb +41 -0
- data/lib/wile/wile_refinements.rb +137 -0
- data/lib/wile.rb +39 -0
- data/man/wile.1 +1121 -0
- data/man/wile.md +786 -0
- data/pkg/README.md +3 -0
- metadata +399 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
7z :man
|
|
2
|
+
GET GET -v
|
|
3
|
+
R R --version
|
|
4
|
+
agetty agetty --version
|
|
5
|
+
agy agy --version
|
|
6
|
+
apt apt --version
|
|
7
|
+
apt-cache apt-cache --version
|
|
8
|
+
apt-get apt-get --version
|
|
9
|
+
apt-key :man
|
|
10
|
+
ar ar --version
|
|
11
|
+
arp arp --version
|
|
12
|
+
as as --version
|
|
13
|
+
awk awk --version
|
|
14
|
+
b2sum b2sum --version
|
|
15
|
+
basename basename --version
|
|
16
|
+
bash bash --version
|
|
17
|
+
blkid blkid --version
|
|
18
|
+
bridge bridge -V
|
|
19
|
+
bundle bundle --version
|
|
20
|
+
busctl busctl --version
|
|
21
|
+
bzcat bzcat --version
|
|
22
|
+
bzip2 bzip2 --version
|
|
23
|
+
cal :man
|
|
24
|
+
cargo cargo --version
|
|
25
|
+
carlosjhr64/pkg-goto fish -c 'goto --version'
|
|
26
|
+
carlosjhr64/theme-local :fish_plugin
|
|
27
|
+
cat cat --version
|
|
28
|
+
chfn :man
|
|
29
|
+
chpasswd :man
|
|
30
|
+
chrt chrt --version
|
|
31
|
+
chsh :man
|
|
32
|
+
cksum cksum --version
|
|
33
|
+
clear clear -V
|
|
34
|
+
cmake cmake --version
|
|
35
|
+
cmp cmp --version
|
|
36
|
+
col col --version
|
|
37
|
+
colora colora --version
|
|
38
|
+
column column --version
|
|
39
|
+
comm comm --version
|
|
40
|
+
cp cp --version
|
|
41
|
+
cpio cpio --version
|
|
42
|
+
csplit csplit --version
|
|
43
|
+
cucumber cucumber --version
|
|
44
|
+
curl curl --version
|
|
45
|
+
cut cut --version
|
|
46
|
+
dash :man
|
|
47
|
+
date date --version
|
|
48
|
+
df df --version
|
|
49
|
+
diff diff --version
|
|
50
|
+
diff3 diff3 --version
|
|
51
|
+
dig dig -v
|
|
52
|
+
dirname dirname --version
|
|
53
|
+
dmesg dmesg --version
|
|
54
|
+
docker docker --version
|
|
55
|
+
dpkg dpkg --version
|
|
56
|
+
dpkg-query dpkg-query --version
|
|
57
|
+
du du --version
|
|
58
|
+
echo :man
|
|
59
|
+
egrep egrep --version
|
|
60
|
+
emacs emacs --version
|
|
61
|
+
env env --version
|
|
62
|
+
ethtool ethtool --version
|
|
63
|
+
ex ex --version
|
|
64
|
+
expand expand --version
|
|
65
|
+
expr expr --version
|
|
66
|
+
factor factor --version
|
|
67
|
+
fallocate fallocate --version
|
|
68
|
+
fdisk fdisk --version
|
|
69
|
+
ffmpeg ffmpeg -version
|
|
70
|
+
ffprobe ffprobe -version
|
|
71
|
+
file file --version
|
|
72
|
+
find find --version
|
|
73
|
+
fish fish --version
|
|
74
|
+
flatpak flatpak --version
|
|
75
|
+
flock flock --version
|
|
76
|
+
fmt fmt --version
|
|
77
|
+
fold fold --version
|
|
78
|
+
free free --version
|
|
79
|
+
g++ g++ --version
|
|
80
|
+
gawk gawk --version
|
|
81
|
+
gcc gcc --version
|
|
82
|
+
gem gem --version
|
|
83
|
+
getent getent --version
|
|
84
|
+
gh gh --version
|
|
85
|
+
git git --version
|
|
86
|
+
go go version
|
|
87
|
+
gpasswd :man
|
|
88
|
+
gpg gpg --version
|
|
89
|
+
grep grep --version
|
|
90
|
+
groups groups --version
|
|
91
|
+
grpck :man
|
|
92
|
+
gunzip gunzip --version
|
|
93
|
+
gzip gzip --version
|
|
94
|
+
head head --version
|
|
95
|
+
hexdump hexdump --version
|
|
96
|
+
host host -V
|
|
97
|
+
hostnamectl hostnamectl --version
|
|
98
|
+
htop htop --version
|
|
99
|
+
hwclock hwclock --version
|
|
100
|
+
id id --version
|
|
101
|
+
ifconfig ifconfig --version
|
|
102
|
+
install install --version
|
|
103
|
+
ionice ionice --version
|
|
104
|
+
ip ip -V
|
|
105
|
+
iptables iptables --version
|
|
106
|
+
irb irb --version
|
|
107
|
+
java java -version
|
|
108
|
+
join join --version
|
|
109
|
+
jorgebucaran/fisher fish -c 'fisher --version'
|
|
110
|
+
journalctl journalctl --version
|
|
111
|
+
jq jq --version
|
|
112
|
+
kill :man
|
|
113
|
+
ld ld --version
|
|
114
|
+
ldconfig ldconfig --version
|
|
115
|
+
ldd ldd --version
|
|
116
|
+
less less --version
|
|
117
|
+
link link --version
|
|
118
|
+
ln ln --version
|
|
119
|
+
locale locale --version
|
|
120
|
+
locate locate --version
|
|
121
|
+
logger logger --version
|
|
122
|
+
loginctl loginctl --version
|
|
123
|
+
look look --version
|
|
124
|
+
ls ls --version
|
|
125
|
+
lsblk lsblk --version
|
|
126
|
+
lscpu lscpu --version
|
|
127
|
+
lslogins lslogins --version
|
|
128
|
+
lsns lsns --version
|
|
129
|
+
lua lua -v
|
|
130
|
+
machinectl machinectl --version
|
|
131
|
+
make make --version
|
|
132
|
+
man man --version
|
|
133
|
+
mawk mawk -W version
|
|
134
|
+
md5sum md5sum --version
|
|
135
|
+
mesg mesg --version
|
|
136
|
+
mkdir mkdir --version
|
|
137
|
+
mktemp mktemp --version
|
|
138
|
+
more more --version
|
|
139
|
+
mount mount --version
|
|
140
|
+
mv mv --version
|
|
141
|
+
nano nano --version
|
|
142
|
+
nc nc -h
|
|
143
|
+
ncal :man
|
|
144
|
+
netstat netstat --version
|
|
145
|
+
newgrp :man
|
|
146
|
+
nice nice --version
|
|
147
|
+
nl nl --version
|
|
148
|
+
nm nm --version
|
|
149
|
+
node node --version
|
|
150
|
+
nohup nohup --version
|
|
151
|
+
npm npm --version
|
|
152
|
+
nsenter nsenter --version
|
|
153
|
+
nslookup nslookup -version
|
|
154
|
+
numfmt numfmt --version
|
|
155
|
+
nvim nvim --version
|
|
156
|
+
objdump objdump --version
|
|
157
|
+
od od --version
|
|
158
|
+
openssl openssl version
|
|
159
|
+
pandoc pandoc -v
|
|
160
|
+
passwd :man
|
|
161
|
+
paste paste --version
|
|
162
|
+
patch patch --version
|
|
163
|
+
perl perl --version
|
|
164
|
+
pgrep pgrep --version
|
|
165
|
+
php php -v
|
|
166
|
+
ping ping -V
|
|
167
|
+
pip3 pip3 --version
|
|
168
|
+
pkg-config pkg-config --version
|
|
169
|
+
pkill pkill --version
|
|
170
|
+
podman podman --version
|
|
171
|
+
pr pr --version
|
|
172
|
+
printenv printenv --version
|
|
173
|
+
printf :man
|
|
174
|
+
ps ps --version
|
|
175
|
+
pstree pstree --version
|
|
176
|
+
pwck :man
|
|
177
|
+
pwd pwd --version
|
|
178
|
+
python3 python3 --version
|
|
179
|
+
rake rake --version
|
|
180
|
+
rbenv rbenv --version
|
|
181
|
+
readelf readelf --version
|
|
182
|
+
readlink readlink --version
|
|
183
|
+
realpath realpath --version
|
|
184
|
+
reek reek --version
|
|
185
|
+
renice renice --version
|
|
186
|
+
rev rev --version
|
|
187
|
+
ripper-tags ripper-tags --version
|
|
188
|
+
rm rm --version
|
|
189
|
+
rmdir rmdir --version
|
|
190
|
+
route route --version
|
|
191
|
+
rsync rsync --version
|
|
192
|
+
rubocop rubocop --version
|
|
193
|
+
ruby ruby --version
|
|
194
|
+
ruby-parse ruby-parse --version
|
|
195
|
+
runuser runuser --version
|
|
196
|
+
rustc rustc --version
|
|
197
|
+
scp :man
|
|
198
|
+
screen screen --version
|
|
199
|
+
script script --version
|
|
200
|
+
sed sed --version
|
|
201
|
+
seq seq --version
|
|
202
|
+
setpriv setpriv --version
|
|
203
|
+
setsid setsid --version
|
|
204
|
+
sfdisk sfdisk --version
|
|
205
|
+
sftp :man
|
|
206
|
+
sg :man
|
|
207
|
+
sh :man
|
|
208
|
+
sha256sum sha256sum --version
|
|
209
|
+
shred shred --version
|
|
210
|
+
shuf shuf --version
|
|
211
|
+
sleep sleep --version
|
|
212
|
+
snap :man
|
|
213
|
+
sort sort --version
|
|
214
|
+
split split --version
|
|
215
|
+
sqlite3 sqlite3 --version
|
|
216
|
+
ss ss -V
|
|
217
|
+
ssh ssh -V
|
|
218
|
+
ssh-keygen :man
|
|
219
|
+
stat stat --version
|
|
220
|
+
stree stree version
|
|
221
|
+
strings strings --version
|
|
222
|
+
stty stty --version
|
|
223
|
+
su su --version
|
|
224
|
+
sudo sudo -V
|
|
225
|
+
sum sum --version
|
|
226
|
+
sysctl sysctl --version
|
|
227
|
+
systemctl systemctl --version
|
|
228
|
+
tac tac --version
|
|
229
|
+
tail tail --version
|
|
230
|
+
tar tar --version
|
|
231
|
+
taskset taskset --version
|
|
232
|
+
tc tc -V
|
|
233
|
+
tee tee --version
|
|
234
|
+
test :man
|
|
235
|
+
timedatectl timedatectl --version
|
|
236
|
+
timeout timeout --version
|
|
237
|
+
tmux tmux -V
|
|
238
|
+
tmuxinator tmuxinator -v
|
|
239
|
+
todo.sh todo.sh -V
|
|
240
|
+
top top --version
|
|
241
|
+
touch touch --version
|
|
242
|
+
tput tput -V
|
|
243
|
+
tr tr --version
|
|
244
|
+
traceroute traceroute -V
|
|
245
|
+
truncate truncate --version
|
|
246
|
+
tsort tsort --version
|
|
247
|
+
tty tty --version
|
|
248
|
+
ufw ufw version
|
|
249
|
+
ul ul --version
|
|
250
|
+
umount umount --version
|
|
251
|
+
uname uname --version
|
|
252
|
+
unexpand unexpand --version
|
|
253
|
+
uniq uniq --version
|
|
254
|
+
unshare unshare --version
|
|
255
|
+
unzip unzip -v
|
|
256
|
+
uptime uptime --version
|
|
257
|
+
useradd :man
|
|
258
|
+
userdel :man
|
|
259
|
+
usermod :man
|
|
260
|
+
users users --version
|
|
261
|
+
vi vi --version
|
|
262
|
+
vipw :man
|
|
263
|
+
vmstat vmstat --version
|
|
264
|
+
w w --version
|
|
265
|
+
wall wall --version
|
|
266
|
+
watch watch --version
|
|
267
|
+
wc wc --version
|
|
268
|
+
wget wget --version
|
|
269
|
+
which :man
|
|
270
|
+
who who --version
|
|
271
|
+
whoami whoami --version
|
|
272
|
+
write write --version
|
|
273
|
+
xargs xargs --version
|
|
274
|
+
xdg-open xdg-open --version
|
|
275
|
+
xz xz --version
|
|
276
|
+
xzcat xzcat --version
|
|
277
|
+
yes yes --version
|
|
278
|
+
zcat zcat --version
|
|
279
|
+
zip zip --version
|
|
280
|
+
zsh zsh --version
|
|
281
|
+
zstd zstd --version
|
data/dependencies.txt
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
## runtime ##
|
|
2
|
+
colora 1.0.250401
|
|
3
|
+
colorize 1.1.0
|
|
4
|
+
cucumber 12.0.1
|
|
5
|
+
help_parser 9.0.240926
|
|
6
|
+
parser 3.3.13
|
|
7
|
+
reek 6.6.0
|
|
8
|
+
ripper-tags 1.0.2
|
|
9
|
+
rubocop 1.92.2
|
|
10
|
+
test-unit 3.7.8
|
|
11
|
+
tmuxinator 3.4.2
|
|
12
|
+
## development ##
|
|
13
|
+
colora 1.0.250401
|
|
14
|
+
colorize 1.1.0
|
|
15
|
+
cucumber 12.0.1
|
|
16
|
+
irbtools 4.2.0
|
|
17
|
+
parser 3.3.13
|
|
18
|
+
reek 6.6.0
|
|
19
|
+
ripper-tags 1.0.2
|
|
20
|
+
rubocop 1.92.2
|
|
21
|
+
test-unit 3.7.8
|
|
22
|
+
## system-run ##
|
|
23
|
+
agy 1.5
|
|
24
|
+
apt-get 2.6
|
|
25
|
+
clear 6.4
|
|
26
|
+
colora 1.0
|
|
27
|
+
cucumber 12.0
|
|
28
|
+
diff 3.8
|
|
29
|
+
dpkg-query 1.21
|
|
30
|
+
fish 4.9
|
|
31
|
+
gem 4.0
|
|
32
|
+
git 2.39
|
|
33
|
+
man 2.11
|
|
34
|
+
md5sum 9.1
|
|
35
|
+
ncal 2019
|
|
36
|
+
pandoc 2.17
|
|
37
|
+
rbenv 1.3
|
|
38
|
+
reek 6.6
|
|
39
|
+
ripper-tags 1.0
|
|
40
|
+
rubocop 1.92
|
|
41
|
+
ruby 4.0
|
|
42
|
+
ruby-parse 3.3
|
|
43
|
+
sudo 1.9
|
|
44
|
+
tmux 3.3
|
|
45
|
+
tput 6.4
|
|
46
|
+
uname 9.1
|
|
47
|
+
## system-dev ##
|
|
48
|
+
agy 1.5
|
|
49
|
+
apt-cache 2.6
|
|
50
|
+
chsh 4.13
|
|
51
|
+
clear 6.4
|
|
52
|
+
colora 1.0
|
|
53
|
+
cucumber 12.0
|
|
54
|
+
curl 7.88
|
|
55
|
+
diff 3.8
|
|
56
|
+
false 9.1
|
|
57
|
+
fish 4.9
|
|
58
|
+
gem 4.0
|
|
59
|
+
git 2.39
|
|
60
|
+
ncal 2019
|
|
61
|
+
ps 4.0
|
|
62
|
+
rbenv 1.3
|
|
63
|
+
reek 6.6
|
|
64
|
+
ripper-tags 1.0
|
|
65
|
+
rubocop 1.92
|
|
66
|
+
ruby 4.0
|
|
67
|
+
ruby-parse 3.3
|
|
68
|
+
tmux 3.3
|
|
69
|
+
true 9.1
|
|
70
|
+
uname 9.1
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Wile namespace.
|
|
4
|
+
module Wile
|
|
5
|
+
# Manages template files in cache/ and scaffolds new Wile projects.
|
|
6
|
+
class Cache
|
|
7
|
+
attr_reader :info
|
|
8
|
+
|
|
9
|
+
# :reek:BooleanParameter
|
|
10
|
+
def initialize(info = Info.info, trace: false)
|
|
11
|
+
@info = info
|
|
12
|
+
@trace = trace
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.prune_git?(path, dir)
|
|
16
|
+
git = "#{dir}/.git"
|
|
17
|
+
File.directory?(path) && path.start_with?(git) &&
|
|
18
|
+
path != git && !path.start_with?("#{git}/hooks")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.move_git_file(file, git, dirname)
|
|
22
|
+
dest = File.join(dirname, '.git', file.delete_prefix("#{git}/"))
|
|
23
|
+
FileUtils.mkdir_p(File.dirname(dest))
|
|
24
|
+
File.rename(file, dest)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.find(dir)
|
|
28
|
+
[].tap do |res|
|
|
29
|
+
Find.find(dir) do |path|
|
|
30
|
+
Find.prune if prune_git?(path, dir)
|
|
31
|
+
res << path if File.file?(path)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.install_git_files(git, dirname)
|
|
37
|
+
Find.find(git) { move_git_file(it, git, dirname) if File.file?(it) }
|
|
38
|
+
FileUtils.rm_r(git)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def pfiles
|
|
42
|
+
files('.')
|
|
43
|
+
.select { %r{^[.]git/hooks/}.match?(it) || !/^[.]git\b/.match?(it) }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def make
|
|
47
|
+
dirname = @info.dirname
|
|
48
|
+
FileUtils.mkdir_p(File.dirname(dirname))
|
|
49
|
+
FileUtils.cp_r(@info.cache, dirname)
|
|
50
|
+
erb_convert
|
|
51
|
+
git_init
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# :reek:BooleanParameter :reek:UncommunicativeVariableName
|
|
55
|
+
def copy2project(cfile, pfile = cfile2pfile(cfile), force: false)
|
|
56
|
+
return false if !force && skip_existing?(pfile)
|
|
57
|
+
|
|
58
|
+
c2p(cfile, pfile)
|
|
59
|
+
rescue StandardError => e
|
|
60
|
+
warn "#{pfile}: #{e.message}".red
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def p2c_hash = cfiles.to_h { [cfile2pfile(it), it] }
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def files(dir) = Cache.find(dir).map { it.delete_prefix("#{dir}/") }
|
|
68
|
+
|
|
69
|
+
def git_init
|
|
70
|
+
dirname = @info.dirname
|
|
71
|
+
Git.init!(dirname)
|
|
72
|
+
Cache.install_git_files(File.join(dirname, 'git'), dirname)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def cfiles(ignore: @info.wileignore, cache: @info.cache)
|
|
76
|
+
files(cache).grep_v(ignore)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def skip_existing?(pfile)
|
|
80
|
+
return false unless File.exist?(pfile)
|
|
81
|
+
|
|
82
|
+
warn pfile.light_black if @trace
|
|
83
|
+
true
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def cfile2pfile(cfile)
|
|
87
|
+
cfile.chomp('.erb')
|
|
88
|
+
.sub(%r{/project(\.\w+)?$}, "/#{@info.project}\\1")
|
|
89
|
+
.sub(/^git\b/, '.git')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def erb_convert
|
|
93
|
+
cache = @info.cache
|
|
94
|
+
dirname = @info.dirname
|
|
95
|
+
Find.find(cache) do |file|
|
|
96
|
+
convert_erb(file, cache, dirname) if file.end_with?('.erb')
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def c2p(rel, dest)
|
|
101
|
+
FileUtils.mkdir_p(File.dirname(dest))
|
|
102
|
+
copy_template(File.join(@info.cache, rel), dest)
|
|
103
|
+
warn dest.green
|
|
104
|
+
dest
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def convert_erb(file, cache, dirname)
|
|
108
|
+
rel = file.delete_prefix("#{cache}/")
|
|
109
|
+
erb = File.join(dirname, rel)
|
|
110
|
+
erb_cp(erb, File.join(dirname, cfile2pfile(rel)))
|
|
111
|
+
File.delete(erb)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def copy_template(src, dest)
|
|
115
|
+
src.end_with?('.erb') ? erb_cp(src, dest) : FileUtils.cp(src, dest)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def erb_cp(src, dest)
|
|
119
|
+
File.open(dest, 'w') { it.puts @info.erb_result(src) }
|
|
120
|
+
File.chmod(File.stat(src).mode, dest)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Wile namespace.
|
|
4
|
+
module Wile
|
|
5
|
+
CASGN_TYPES = {
|
|
6
|
+
array_node: 'array', float_node: 'float', hash_node: 'hash',
|
|
7
|
+
integer_node: 'int', interpolated_regular_expression_node: 'regexp',
|
|
8
|
+
interpolated_string_node: 'dstr', interpolated_symbol_node: 'sym',
|
|
9
|
+
keyword_hash_node: 'hash', lambda_node: 'lambda',
|
|
10
|
+
regular_expression_node: 'regexp', string_node: 'str', symbol_node: 'sym'
|
|
11
|
+
}.freeze
|
|
12
|
+
|
|
13
|
+
ATTR_SUFFIXES = {
|
|
14
|
+
attr_reader: [''], attr_writer: ['='], attr_accessor: ['', '=']
|
|
15
|
+
}.freeze
|
|
16
|
+
CALL_NAME = /\A(?:\w+[!=?]?|\[\])\z/
|
|
17
|
+
DUCK_NAME = /\A(?:[@$]{1,2})?[a-z_]\w*\z/
|
|
18
|
+
CONST_NODES = [Prism::ConstantReadNode, Prism::ConstantPathNode].freeze
|
|
19
|
+
|
|
20
|
+
private_constant :ATTR_SUFFIXES, :CASGN_TYPES, :CALL_NAME, :DUCK_NAME,
|
|
21
|
+
:CONST_NODES
|
|
22
|
+
|
|
23
|
+
# CodeContent class generates code content for the Wile framework.
|
|
24
|
+
# :reek:InstanceVariableAssumption
|
|
25
|
+
class CodeContent < Prism::Visitor
|
|
26
|
+
STRUCT_TYPES = {
|
|
27
|
+
'Struct' => %i[new attr_accessor],
|
|
28
|
+
'Data' => %i[define attr_reader]
|
|
29
|
+
}.freeze
|
|
30
|
+
private_constant :STRUCT_TYPES
|
|
31
|
+
def generate(fnm, &blk)
|
|
32
|
+
@emitter = Emitter.new(blk)
|
|
33
|
+
Prism.parse_file(fnm).value.accept(self)
|
|
34
|
+
ensure
|
|
35
|
+
@emitter = nil
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.generate(filename, &) = new.generate(filename, &)
|
|
39
|
+
|
|
40
|
+
def visit_def_node(node_, receiver_ = node_.receiver)
|
|
41
|
+
return super(node_) if receiver_ && !receiver_.is_a?(Prism::SelfNode) &&
|
|
42
|
+
!CONST_NODES.include?(receiver_.class)
|
|
43
|
+
|
|
44
|
+
@emitter.def_body(node_.name_loc.slice, receiver_) { super(node_) }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def visit_lambda_node(node_)
|
|
48
|
+
@emitter.emit_call("#{@emitter.dot}lambda")
|
|
49
|
+
super
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def visit_local_variable_write_node(node_)
|
|
53
|
+
@emitter.track_class_var(node_.name, node_.value)
|
|
54
|
+
super
|
|
55
|
+
end
|
|
56
|
+
alias visit_optional_parameter_node visit_local_variable_write_node
|
|
57
|
+
|
|
58
|
+
def visit_module_node(node_)
|
|
59
|
+
@emitter.with_scope(node_.constant_path.slice.delete_prefix('::')) do
|
|
60
|
+
super
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
alias visit_class_node visit_module_node
|
|
64
|
+
|
|
65
|
+
def visit_singleton_class_node(_node)
|
|
66
|
+
@emitter.with_scope('.') { super }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def self.ast(fnm) = Prism::Translation::Parser.parse_file(fnm).inspect.lines
|
|
70
|
+
|
|
71
|
+
def visit_call_node(node_)
|
|
72
|
+
receiver_ = node_.receiver
|
|
73
|
+
name = node_.name
|
|
74
|
+
return if !receiver_ && special_call?(node_, name)
|
|
75
|
+
|
|
76
|
+
@emitter.handle_call(receiver_, name) if CALL_NAME.match?(name)
|
|
77
|
+
super
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def visit_constant_write_node(node_)
|
|
81
|
+
full = [@emitter.scope_str, node_.name].reject(&:empty?).join('::')
|
|
82
|
+
emit_casgn(full, node_)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def visit_constant_path_write_node(node_)
|
|
86
|
+
emit_casgn(node_.target.slice.delete_prefix('::'), node_)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
private
|
|
90
|
+
|
|
91
|
+
def emit_casgn(full, node_)
|
|
92
|
+
val_ = node_.value
|
|
93
|
+
type = @emitter.emit_casgn(full, val_)
|
|
94
|
+
emit_struct(full, val_, type) if STRUCT_TYPES.key?(type)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def special_call?(node_, name)
|
|
98
|
+
return visit_refine(node_) || true if name == :refine && node_.block
|
|
99
|
+
return false unless ATTR_SUFFIXES.key?(name)
|
|
100
|
+
|
|
101
|
+
@emitter.emit_attrs(name, node_)
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def visit_refine(node_, target = node_.arguments.arguments.first.slice)
|
|
106
|
+
scopes = target.delete_prefix('::').sub('.singleton_class', ' .').split
|
|
107
|
+
@emitter.with_scope(*scopes) { node_.block.accept(self) }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def emit_struct(full, call_, type)
|
|
111
|
+
ctor, attr = STRUCT_TYPES[type]
|
|
112
|
+
return unless call_.is_a?(Prism::CallNode) && call_.name == ctor
|
|
113
|
+
|
|
114
|
+
@emitter.with_scope(full.delete_prefix("#{@emitter.scope_str}::")) do
|
|
115
|
+
@emitter.emit_attrs(attr, call_)
|
|
116
|
+
call_.block&.accept(self)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Tracks lexical scope and emits deduplicated content lines.
|
|
122
|
+
# rubocop:disable-next Style/ClassAndModuleChildren
|
|
123
|
+
class CodeContent::Emitter
|
|
124
|
+
attr_reader :dot
|
|
125
|
+
|
|
126
|
+
def initialize(block)
|
|
127
|
+
@block = block
|
|
128
|
+
@dot = '#'
|
|
129
|
+
@scope = []
|
|
130
|
+
@frames = [[Set.new, Set['self.class']]]
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def track_class_var(name, val_)
|
|
134
|
+
@frames.last.last << name.to_s if val_.slice == 'self.class'
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def with_scope(*names)
|
|
138
|
+
@scope.push(*names)
|
|
139
|
+
yield
|
|
140
|
+
ensure
|
|
141
|
+
names.size.times { @scope.pop }
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def self.casgn_type(val_)
|
|
145
|
+
while val_.is_a?(Prism::CallNode)
|
|
146
|
+
return val_.name unless (receiver_ = val_.receiver)
|
|
147
|
+
|
|
148
|
+
val_ = receiver_
|
|
149
|
+
end
|
|
150
|
+
CASGN_TYPES[val_.type] || val_.slice.delete_prefix('::')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def emit_casgn(full, val_)
|
|
154
|
+
type = self.class.casgn_type(val_)
|
|
155
|
+
@block["casgn #{full} #{type}"]
|
|
156
|
+
type
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def def_scope(receiver_)
|
|
160
|
+
return scope_str unless CONST_NODES.include?(receiver_&.class)
|
|
161
|
+
|
|
162
|
+
named = receiver_.slice.delete_prefix('::')
|
|
163
|
+
return scope_str if scope_str.split('::').last == named
|
|
164
|
+
return named if scope_str.empty? || named.start_with?(scope_str)
|
|
165
|
+
|
|
166
|
+
"#{scope_str}::#{named}"
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def scope_str = @scope.reject { it == '.' }.join('::')
|
|
170
|
+
|
|
171
|
+
def singleton_scope? = @scope.last == '.'
|
|
172
|
+
|
|
173
|
+
def emit_attrs(macro, node_)
|
|
174
|
+
prefix = "##{macro} #{scope_str}#{singleton_scope? ? '.' : '#'}"
|
|
175
|
+
syms = (node_.arguments&.arguments || []).grep(Prism::SymbolNode)
|
|
176
|
+
syms.product(ATTR_SUFFIXES[macro]).each do |sym_, sfx|
|
|
177
|
+
emit_call("#{prefix}#{sym_.unescaped}#{sfx}")
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def def_body(method_name, receiver_)
|
|
182
|
+
@dot = '.' if receiver_ || singleton_scope?
|
|
183
|
+
@frames.push([Set.new, Set['self.class']])
|
|
184
|
+
@block["def #{def_scope(receiver_)}#{@dot}#{method_name}"]
|
|
185
|
+
yield
|
|
186
|
+
ensure
|
|
187
|
+
leave_def
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def emit_call(name)
|
|
191
|
+
prefix = @frames.size > 1 ? ' ' : ''
|
|
192
|
+
@block["#{prefix}#{name}"] if @frames.last.first.add?(name)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def handle_call(receiver_, name)
|
|
196
|
+
return emit_call("#{@dot}#{name}") unless receiver_
|
|
197
|
+
|
|
198
|
+
emit_receiver_call(receiver_, name)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
private
|
|
202
|
+
|
|
203
|
+
def leave_def
|
|
204
|
+
@dot = '#'
|
|
205
|
+
@frames.pop
|
|
206
|
+
@block['end']
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def emit_new_call(name)
|
|
210
|
+
emit_call("#{@dot}new")
|
|
211
|
+
emit_call("##{name}")
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def emit_receiver_call(receiver_, name)
|
|
215
|
+
slice = receiver_.slice
|
|
216
|
+
return emit_call("#{slice.delete_prefix('::')}.#{name}") if
|
|
217
|
+
CONST_NODES.include?(receiver_.class)
|
|
218
|
+
return emit_call(".#{name}") if @frames.last.last.include?(slice)
|
|
219
|
+
return emit_new_call(name) if slice == 'new'
|
|
220
|
+
|
|
221
|
+
emit_call("#{slice[DUCK_NAME] || '*'}##{name}")
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
CodeContent.private_constant :Emitter
|
|
225
|
+
end
|