squared 0.7.6 → 0.7.7
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 +4 -4
- data/CHANGELOG.md +54 -0
- data/README.md +4 -3
- data/lib/squared/common/shell.rb +14 -7
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +1 -5
- data/lib/squared/workspace/project/base.rb +21 -17
- data/lib/squared/workspace/project/docker.rb +9 -2
- data/lib/squared/workspace/project/git.rb +16 -11
- data/lib/squared/workspace/project/node.rb +97 -62
- data/lib/squared/workspace/project/python.rb +3 -2
- data/lib/squared/workspace/project/ruby.rb +62 -47
- data/lib/squared/workspace/project/support/optionpartition.rb +4 -4
- data/lib/squared/workspace/repo.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31bed35054b2a63862e132897fcbe7b6bdc38e034e083f2d05c31faede547105
|
|
4
|
+
data.tar.gz: de80005a8d615de8024459d098493fb9a2d2703ddf755be5bfe571ee6b92c759
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 412dc0cee1e2419c9c1ef2e7d5da84c4f3c9e3d87a26f2222913f43e52082481d95b85a573d1e7f58a9bcff7063e418bcf998ac3e1280b5a6c21c3db7a5eeaae
|
|
7
|
+
data.tar.gz: 1830bfa1dfdd32b2af0fd2abe037b3e5a54887885c66d54e50c0f5a0c3b48ab9eb40765a0faaf4e3533dfb509b9975ec36ff00f99507e9dd363ca44362eca383
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.7] - 2026-06-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Ruby program commands can be run through bundle exec.
|
|
8
|
+
- Node task depend can run approve-scripts with NPM_APPROVE_SCRIPTS.
|
|
9
|
+
- Node command package action [approve|deny] was implemented.
|
|
10
|
+
- NPM command options were updated to 11.16.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Project method format_banner modified reference to run command.
|
|
15
|
+
- Project subtasks did not use exception? wrapper method.
|
|
16
|
+
|
|
17
|
+
## [0.6.14] - 2026-06-14
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Node task depend can run approve-scripts with NPM_APPROVE_SCRIPTS.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Docker command bake action build did not append context directory.
|
|
26
|
+
|
|
27
|
+
## [0.5.24]
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- See `0.4.38`.
|
|
32
|
+
|
|
33
|
+
## [0.4.38]
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Application project commands can be defined without a reference.
|
|
38
|
+
- Git command branch action all was implemented.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Override alias methods were created for suffix "!" to "\_".
|
|
43
|
+
- Project banners do not display boolean attributes.
|
|
44
|
+
- OptionPartition method append strips single quotes when quoting strings.
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- Application methods log and exclude were non-functional.
|
|
49
|
+
- Docker command bake action build does not support changing context.
|
|
50
|
+
- Project base method semver did not include prerelease delimiter.
|
|
51
|
+
- Project session cleanup did not compare by reference.
|
|
52
|
+
|
|
3
53
|
## [0.7.6] - 2026-05-04
|
|
4
54
|
|
|
5
55
|
### Added
|
|
@@ -1829,6 +1879,7 @@
|
|
|
1829
1879
|
|
|
1830
1880
|
- Changelog was created.
|
|
1831
1881
|
|
|
1882
|
+
[0.7.7]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.7
|
|
1832
1883
|
[0.7.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.6
|
|
1833
1884
|
[0.7.5]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.5
|
|
1834
1885
|
[0.7.4]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.4
|
|
@@ -1836,6 +1887,7 @@
|
|
|
1836
1887
|
[0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
|
|
1837
1888
|
[0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
|
|
1838
1889
|
[0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
|
|
1890
|
+
[0.6.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.14
|
|
1839
1891
|
[0.6.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.13
|
|
1840
1892
|
[0.6.12]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.12
|
|
1841
1893
|
[0.6.11]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.11
|
|
@@ -1850,6 +1902,7 @@
|
|
|
1850
1902
|
[0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
|
|
1851
1903
|
[0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
|
|
1852
1904
|
[0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
|
|
1905
|
+
[0.5.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.24
|
|
1853
1906
|
[0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
|
|
1854
1907
|
[0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
|
|
1855
1908
|
[0.5.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.21
|
|
@@ -1874,6 +1927,7 @@
|
|
|
1874
1927
|
[0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
|
|
1875
1928
|
[0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
|
|
1876
1929
|
[0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
|
|
1930
|
+
[0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
|
|
1877
1931
|
[0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
|
|
1878
1932
|
[0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
|
|
1879
1933
|
[0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
|
data/README.md
CHANGED
|
@@ -211,7 +211,6 @@ Workspace::Application
|
|
|
211
211
|
})
|
|
212
212
|
end
|
|
213
213
|
.add("squared", release: "https://github.com/anpham6/squared/archive/refs/tags/??") # squared:unpack:zip[v5.4.0,/tmp/squared]
|
|
214
|
-
end
|
|
215
214
|
```
|
|
216
215
|
|
|
217
216
|
### Clone
|
|
@@ -366,7 +365,7 @@ Workspace::Application
|
|
|
366
365
|
first("git:ls-files", override: true) { puts "2" } # puts "2"
|
|
367
366
|
last("git:ls-files") { puts workspace.root } # puts "/workspaces" (does not run when error is raised)
|
|
368
367
|
error("git:ls-files") { |err| err.is_a?(TypeError) } # return true to suppress error
|
|
369
|
-
end
|
|
368
|
+
end
|
|
370
369
|
end
|
|
371
370
|
.with(:ruby) do
|
|
372
371
|
run("gem build") # gem build
|
|
@@ -698,6 +697,7 @@ GIT_COUNT=50 # list display limit
|
|
|
698
697
|
| checkout | * | F|FORCE MERGE |
|
|
699
698
|
| clone | * | DEPTH=n ORIGIN=s BRANCH=s REVISION=s BARE=1 LOCAL=0,1 |
|
|
700
699
|
| | | SINGLE_BRANCH=0,1 NO_CHECKOUT=1 NO_TAGS=1 QUIET=1 |
|
|
700
|
+
| commit | amend | F|FORCE |
|
|
701
701
|
| commit | * | UPSTREAM=s DRY_RUN EDIT=0 M|MESSAGE=s |
|
|
702
702
|
| diff | head branch | INDEX=n |
|
|
703
703
|
| diff | * | PATHSPEC=s |
|
|
@@ -886,12 +886,13 @@ Features can be enabled through ENV when calling global tasks such as through *C
|
|
|
886
886
|
| outdated | - | U|UPDATE=major|minor|patch DIFF DRY_RUN |
|
|
887
887
|
| publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN Y |
|
|
888
888
|
| depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y |
|
|
889
|
-
| npm
|
|
889
|
+
| npm | depend | APPROVE_SCRIPTS=s |
|
|
890
890
|
| npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS |
|
|
891
891
|
| pnpm | depend | PUBLIC_HOIST_PATTERN=s APPROVE_BUILDS |
|
|
892
892
|
| pnpm | depend:add | ALLOW_BUILD=s |
|
|
893
893
|
| yarn | depend package | IGNORE_ENGINES |
|
|
894
894
|
| yarn | depend:add | W|IGNORE_WORKSPACE_ROOT_CHECK=0 |
|
|
895
|
+
| npm pnpm | depend package | CPU=s OS=s LIBC=s |
|
|
895
896
|
|
|
896
897
|
#### Python
|
|
897
898
|
|
data/lib/squared/common/shell.rb
CHANGED
|
@@ -56,15 +56,22 @@ module Squared
|
|
|
56
56
|
def shell_quote(val, option: true, force: true, double: false, preserve: true, pass: false, override: false)
|
|
57
57
|
val = val.to_s
|
|
58
58
|
return val if (!force && !val.include?(' ')) || val.empty?
|
|
59
|
+
return val if option && val.match?(/\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m)
|
|
59
60
|
|
|
60
|
-
if option
|
|
61
|
-
pat = /\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m
|
|
62
|
-
return val if val.match?(pat)
|
|
63
|
-
end
|
|
64
61
|
if val =~ QUOTE_VALUE
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
if pass == '"' || pass == "'"
|
|
63
|
+
return val if pass == $1
|
|
64
|
+
elsif pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
|
|
65
|
+
return val
|
|
66
|
+
end
|
|
67
|
+
case preserve
|
|
68
|
+
when false
|
|
69
|
+
base = $2
|
|
70
|
+
when '"'
|
|
71
|
+
base = $2 if $1 == "'"
|
|
72
|
+
when "'"
|
|
73
|
+
base = $2 if $1 == '"'
|
|
74
|
+
end
|
|
68
75
|
end
|
|
69
76
|
q = -> { (base || val).gsub("'\\\\''", "'") }
|
|
70
77
|
if double || Rake::Win32.windows? || (ARG[:QUOTE] == '"' && !override)
|
data/lib/squared/version.rb
CHANGED
|
@@ -663,11 +663,7 @@ module Squared
|
|
|
663
663
|
if group && @banner.group.key?(group = group.to_sym)
|
|
664
664
|
@banner.group[group]
|
|
665
665
|
else
|
|
666
|
-
ref.reverse_each
|
|
667
|
-
next unless @banner.ref.key?(val)
|
|
668
|
-
|
|
669
|
-
return @banner.ref[val]
|
|
670
|
-
end
|
|
666
|
+
ref.reverse_each { |val| return @banner.ref[val] if @banner.ref.key?(val) }
|
|
671
667
|
@banner.ref[:_] if @banner.ref.key?(:_)
|
|
672
668
|
end
|
|
673
669
|
end
|
|
@@ -25,7 +25,7 @@ module Squared
|
|
|
25
25
|
VAR_SET = %i[parent global script index envname desc dependfile dependname dependindex theme archive env graph
|
|
26
26
|
dev prod timeout pass only exclude serve asdf].freeze
|
|
27
27
|
BLK_SET = %i[run depend doc lint test copy clean].freeze
|
|
28
|
-
SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?[-.]?(\S+)?\b/.freeze
|
|
28
|
+
SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?(?:([-.])?(\S+))?\b/.freeze
|
|
29
29
|
URI_SCHEME = %r{\A([a-z][a-z\d+-.]*)://[^@:\[\]\\^<>|\s]}i.freeze
|
|
30
30
|
TASK_METADATA = Rake::TaskManager.record_task_metadata
|
|
31
31
|
private_constant :OPTIONS, :VAR_SET, :BLK_SET, :SEM_VER, :URI_SCHEME, :TASK_METADATA
|
|
@@ -1351,7 +1351,7 @@ module Squared
|
|
|
1351
1351
|
else
|
|
1352
1352
|
if series?(obj)
|
|
1353
1353
|
obj.each(&:call)
|
|
1354
|
-
elsif obj.is_a?(Array) && obj.any? { |val|
|
|
1354
|
+
elsif obj.is_a?(Array) && obj.any? { |val| !val.is_a?(String) }
|
|
1355
1355
|
build(*obj, **kwargs)
|
|
1356
1356
|
elsif obj
|
|
1357
1357
|
run_s(*Array(obj), **kwargs)
|
|
@@ -1576,7 +1576,9 @@ module Squared
|
|
|
1576
1576
|
command = :"#{prefix}_#{$1}"
|
|
1577
1577
|
cache[1][command] || @timeout[command]
|
|
1578
1578
|
end || cache[1][prefix.to_sym] || @timeout[prefix.to_sym]
|
|
1579
|
-
|
|
1579
|
+
return ret unless main
|
|
1580
|
+
|
|
1581
|
+
@session = ret
|
|
1580
1582
|
end
|
|
1581
1583
|
|
|
1582
1584
|
def session_timeout(cmd)
|
|
@@ -1638,7 +1640,7 @@ module Squared
|
|
|
1638
1640
|
return cmd.to_s unless cmd.respond_to?(:done)
|
|
1639
1641
|
|
|
1640
1642
|
raise_error 'no command added', hint: cmd.first unless cmd.size > 1
|
|
1641
|
-
@session = nil if cmd
|
|
1643
|
+
@session = nil if cmd.equal?(@session)
|
|
1642
1644
|
cmd.done
|
|
1643
1645
|
end
|
|
1644
1646
|
|
|
@@ -1655,12 +1657,14 @@ module Squared
|
|
|
1655
1657
|
args.each do |key|
|
|
1656
1658
|
next unless (ret = env(env_key(prefix.to_s.stripext, key), **kwargs)) && (!pat || ret.match?(pat))
|
|
1657
1659
|
|
|
1658
|
-
if
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1660
|
+
if target
|
|
1661
|
+
if path
|
|
1662
|
+
target << quote_option(key, basepath(ret))
|
|
1663
|
+
elsif quote
|
|
1664
|
+
target << quote_option(key, ret)
|
|
1665
|
+
elsif escape
|
|
1666
|
+
target << shell_option(key, ret)
|
|
1667
|
+
end
|
|
1664
1668
|
end
|
|
1665
1669
|
return block_given? ? yield(ret) : ret
|
|
1666
1670
|
end
|
|
@@ -1812,7 +1816,7 @@ module Squared
|
|
|
1812
1816
|
cmd = cmd.gsub(/(?:#{s = Regexp.escape(File.join(path, ''))}?(?=["'])|#{s})/, '')
|
|
1813
1817
|
.gsub(/(?: -[^ ])? (?:""|'')/, '')
|
|
1814
1818
|
end
|
|
1815
|
-
cmd.gsub
|
|
1819
|
+
cmd = cmd.gsub(/(?<= )(["'])([\w.-]+)\1(?= |\z)/, '\2') unless quote
|
|
1816
1820
|
end
|
|
1817
1821
|
out << cmd.subhint(hint)
|
|
1818
1822
|
end
|
|
@@ -1829,7 +1833,7 @@ module Squared
|
|
|
1829
1833
|
__send__ meth
|
|
1830
1834
|
end
|
|
1831
1835
|
end
|
|
1832
|
-
val = val.
|
|
1836
|
+
val = val.reject { |item| !item || item == true }.join(s)
|
|
1833
1837
|
next unless found && !val.empty?
|
|
1834
1838
|
elsif (val = __send__(val)).nil?
|
|
1835
1839
|
next
|
|
@@ -2233,9 +2237,9 @@ module Squared
|
|
|
2233
2237
|
|
|
2234
2238
|
a, b = [a.first, b.first].map do |c|
|
|
2235
2239
|
d = begin
|
|
2236
|
-
Integer(c[
|
|
2240
|
+
Integer(c[6]).to_s
|
|
2237
2241
|
rescue
|
|
2238
|
-
c[
|
|
2242
|
+
c[6] ? '-1' : '0'
|
|
2239
2243
|
end
|
|
2240
2244
|
[c[0], c[2], c[4] || '0', d]
|
|
2241
2245
|
end
|
|
@@ -2278,7 +2282,7 @@ module Squared
|
|
|
2278
2282
|
end
|
|
2279
2283
|
|
|
2280
2284
|
def semmajor?(cur, want)
|
|
2281
|
-
(cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[
|
|
2285
|
+
(cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[6]
|
|
2282
2286
|
end
|
|
2283
2287
|
|
|
2284
2288
|
def semgte?(val, other = nil)
|
|
@@ -2673,7 +2677,7 @@ module Squared
|
|
|
2673
2677
|
when true, false
|
|
2674
2678
|
run
|
|
2675
2679
|
else
|
|
2676
|
-
|
|
2680
|
+
$?&.success?
|
|
2677
2681
|
end
|
|
2678
2682
|
if cond.none? { |val| val == false }
|
|
2679
2683
|
if block_given?
|
|
@@ -2698,7 +2702,7 @@ module Squared
|
|
|
2698
2702
|
end
|
|
2699
2703
|
|
|
2700
2704
|
def stdout?
|
|
2701
|
-
|
|
2705
|
+
!quiet? && !stdin?
|
|
2702
2706
|
end
|
|
2703
2707
|
|
|
2704
2708
|
def verbose?
|
|
@@ -419,9 +419,15 @@ module Squared
|
|
|
419
419
|
when :bake
|
|
420
420
|
append_file(0, index: 3) unless from || op.arg?('f', 'file') || !anypath?(*COMPOSEFILE)
|
|
421
421
|
unless op.empty?
|
|
422
|
-
context
|
|
422
|
+
if !context && op.size > 1 && exist?(op.last, type: 'd')
|
|
423
|
+
pat = /\btarget\s+"#{Regexp.escape(op.last)}"/
|
|
424
|
+
context = op.pop if op.values_of('f', 'file').none? { |f| basepath!(f)&.read&.match?(pat) }
|
|
425
|
+
end
|
|
426
|
+
if context
|
|
427
|
+
context = basepath context
|
|
428
|
+
op.each { |name| op.add_option('set', "#{name}.context=#{context}", escape: false) }
|
|
429
|
+
end
|
|
423
430
|
op.append(escape: true, strip: /^:/, clear: true)
|
|
424
|
-
contextdir context if context
|
|
425
431
|
end
|
|
426
432
|
end
|
|
427
433
|
op.clear(pass: false)
|
|
@@ -472,6 +478,7 @@ module Squared
|
|
|
472
478
|
end
|
|
473
479
|
run(from: from)
|
|
474
480
|
end
|
|
481
|
+
alias compose_ compose!
|
|
475
482
|
|
|
476
483
|
def container(flag, opts = [], id: nil)
|
|
477
484
|
cmd, opts = docker_session('container', flag, opts: opts)
|
|
@@ -332,7 +332,7 @@ module Squared
|
|
|
332
332
|
end
|
|
333
333
|
|
|
334
334
|
subtasks({
|
|
335
|
-
'branch' => %i[create track delete move copy list current].freeze,
|
|
335
|
+
'branch' => %i[create track delete move copy list all current].freeze,
|
|
336
336
|
'checkout' => %i[commit branch track detach path].freeze,
|
|
337
337
|
'commit' => %i[add all amend amend-orig fixup].freeze,
|
|
338
338
|
'diff' => %i[head branch files view between contain].freeze,
|
|
@@ -730,12 +730,7 @@ module Squared
|
|
|
730
730
|
task flag do |_, args|
|
|
731
731
|
branch flag, args.to_a
|
|
732
732
|
end
|
|
733
|
-
when :
|
|
734
|
-
format_desc action, flag
|
|
735
|
-
task flag do
|
|
736
|
-
branch flag
|
|
737
|
-
end
|
|
738
|
-
else
|
|
733
|
+
when :move, :copy
|
|
739
734
|
format_desc action, flag, 'branch,oldbranch?'
|
|
740
735
|
task flag, [:branch, :oldbranch] do |_, args|
|
|
741
736
|
if (branch = args.branch)
|
|
@@ -746,6 +741,11 @@ module Squared
|
|
|
746
741
|
end
|
|
747
742
|
branch(flag, refs: [oldbranch, branch])
|
|
748
743
|
end
|
|
744
|
+
else
|
|
745
|
+
format_desc action, flag
|
|
746
|
+
task flag do
|
|
747
|
+
branch flag
|
|
748
|
+
end
|
|
749
749
|
end
|
|
750
750
|
when 'switch'
|
|
751
751
|
case flag
|
|
@@ -1169,7 +1169,7 @@ module Squared
|
|
|
1169
1169
|
option('no-tags') { opts[:'no-tags'] = true }
|
|
1170
1170
|
opts.delete(:'recurse-submodules') || opts.delete(:'no-recurse-submodules') if append_submodules(from: :clone)
|
|
1171
1171
|
append_hash opts
|
|
1172
|
-
cmd << '--quiet' if option('quiet')
|
|
1172
|
+
cmd << '--quiet' if quiet? || option('quiet')
|
|
1173
1173
|
append_value(data[0], path, delim: true)
|
|
1174
1174
|
source(sync: sync, banner: sync && !quiet?, multiple: !sync || quiet?)
|
|
1175
1175
|
end
|
|
@@ -1480,6 +1480,7 @@ module Squared
|
|
|
1480
1480
|
append_pathspec op.extras
|
|
1481
1481
|
source(exception: false)
|
|
1482
1482
|
end
|
|
1483
|
+
alias log_ log!
|
|
1483
1484
|
|
|
1484
1485
|
def diff(flag, opts = [], refs: [], branch: nil, range: [], index: [], from: :diff)
|
|
1485
1486
|
cmd, opts = git_session(from, opts: opts)
|
|
@@ -1610,7 +1611,7 @@ module Squared
|
|
|
1610
1611
|
elsif flag == :'amend-orig' || option('edit', equals: '0')
|
|
1611
1612
|
co << '--no-edit'
|
|
1612
1613
|
end
|
|
1613
|
-
pu << '--force-with-lease' if amend
|
|
1614
|
+
pu << (option('f', 'force') ? '--force' : '--force-with-lease') if amend
|
|
1614
1615
|
pu.merge(repotrack(origin, branch))
|
|
1615
1616
|
adding = git_spawn 'diff --name-only --no-color'
|
|
1616
1617
|
source op
|
|
@@ -1691,7 +1692,7 @@ module Squared
|
|
|
1691
1692
|
end
|
|
1692
1693
|
when :delete
|
|
1693
1694
|
remote&.each { |val| source git_output('push --delete', *val.split('/', 2).quote!) }
|
|
1694
|
-
force, list = refs.partition { |val| val.start_with?(
|
|
1695
|
+
force, list = refs.partition { |val| val.start_with?(/[~^]/) }
|
|
1695
1696
|
force.each do |val|
|
|
1696
1697
|
r = '-r' if val.delete!('~')
|
|
1697
1698
|
source git_output('branch', val.delete!('^') ? '-D' : '-d', r, shell_quote(val))
|
|
@@ -2001,6 +2002,10 @@ module Squared
|
|
|
2001
2002
|
|
|
2002
2003
|
def source(cmd = @session, exception: true, io: false, sync: true, stdout: false, stderr: false, banner: true,
|
|
2003
2004
|
multiple: false, hint: nil, from: nil, timeout: nil, send: :system, **kwargs)
|
|
2005
|
+
unless cmd
|
|
2006
|
+
print_error('no git session started', subject: project, hint: from, pass: true)
|
|
2007
|
+
return
|
|
2008
|
+
end
|
|
2004
2009
|
cmd = cmd.target if cmd.is_a?(OptionPartition)
|
|
2005
2010
|
if io && banner == false
|
|
2006
2011
|
from = nil
|
|
@@ -2159,7 +2164,7 @@ module Squared
|
|
|
2159
2164
|
end
|
|
2160
2165
|
op << '--verbose' if (flag || from == :fetch) && stdout? && !op.arg?('quiet')
|
|
2161
2166
|
if remote
|
|
2162
|
-
op.append(remote
|
|
2167
|
+
op.append(remote)
|
|
2163
2168
|
if (val = option('refspec', target: target, strict: true))
|
|
2164
2169
|
op.append(split_escape(val))
|
|
2165
2170
|
else
|
|
@@ -6,15 +6,18 @@ module Squared
|
|
|
6
6
|
class Node < Git
|
|
7
7
|
OPT_NPM = {
|
|
8
8
|
common: %w[dry-run=!? force=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
|
|
9
|
+
common_scripts: %w[dangerously-allow-all-scripts=!? strict-allow-scripts=!? allow-scripts=q].freeze,
|
|
9
10
|
install: %w[package-lock-only=!? prefer-dedupe=!? E|save-exact=!? before=q cpu=b libc=b os=b].freeze,
|
|
10
11
|
install_a: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!? install-links=!?
|
|
11
12
|
package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
|
12
13
|
install_b: %w[no-save B|save-bundle D|save-dev O|save-optional save-peer P|save-prod g|global=!?
|
|
13
14
|
S|save=!?].freeze,
|
|
15
|
+
install_c: %w[allow-directory=b? allow-file=b? allow-git=b? allow-remote=b?].freeze,
|
|
14
16
|
run: %w[foreground-scripts=!? if-present=!? ignore-scripts=!? script-shell=p].freeze,
|
|
15
17
|
exec: %w[c|call=q package=b].freeze,
|
|
16
18
|
pack: %w[ignore-scripts=!? json=!? pack-destination=p].freeze,
|
|
17
19
|
rebuild: %w[bin-links=! foreground-scripts=!? global=!? ignore-scripts=!? install-links=!?].freeze,
|
|
20
|
+
'approve-scripts': %w[a|all allow-scripts-pending allow-scripts-pin=!? no-allow-scripts-pin json].freeze,
|
|
18
21
|
no: {
|
|
19
22
|
install: %w[audit bin-links fund package-lock].freeze
|
|
20
23
|
}.freeze
|
|
@@ -26,15 +29,16 @@ module Squared
|
|
|
26
29
|
common_filter: %w[fail-if-no-match changed-files-ignore-pattern=q filter=q filter-prod=q
|
|
27
30
|
test-pattern=q].freeze,
|
|
28
31
|
install: %w[fix-lockfile force ignore-pnpmfile ignore-workspace lockfile-only merge-git-branch-lockfiles
|
|
29
|
-
optimistic-repeat-install no-hoist no-lockfile no-optional prefer-frozen-lockfile
|
|
30
|
-
shamefully-hoist side-effects-cache side-effects-cache-readonly s|silent
|
|
31
|
-
use-running-store-server use-store-server
|
|
32
|
-
|
|
33
|
-
reporter=b
|
|
32
|
+
optimistic-repeat-install no-hoist no-lockfile no-optional no-runtime prefer-frozen-lockfile
|
|
33
|
+
resolution-only shamefully-hoist side-effects-cache side-effects-cache-readonly s|silent
|
|
34
|
+
strict-peer-dependencies trust-lockfile use-running-store-server use-store-server
|
|
35
|
+
child-concurrency=i hoist-pattern=q lockfile-dir=p modules-dir=p network-concurrency=i
|
|
36
|
+
package-import-method=b public-hoist-pattern=q reporter=b trust-policy=b trust-policy-exclude=q
|
|
37
|
+
trust-policy-ignore-after=i].freeze,
|
|
34
38
|
install_a: %w[dangerously-allow-all-builds global-dir ignore-scripts offline prefer-offline store-dir=p
|
|
35
39
|
virtual-store-dir=p].freeze,
|
|
36
40
|
install_b: %w[D|dev no-optional P|prod].freeze,
|
|
37
|
-
add: %w[allow-build config g|global save-catalog D|save-dev O|save-optional save-peer P|save-prod
|
|
41
|
+
add: %w[allow-build config g|global registry=q save-catalog D|save-dev O|save-optional save-peer P|save-prod
|
|
38
42
|
save-catalog-name=b].freeze,
|
|
39
43
|
update: %w[g|global i|interactive L|latest depth=i].freeze,
|
|
40
44
|
dedupe: %w[check].freeze,
|
|
@@ -153,7 +157,7 @@ module Squared
|
|
|
153
157
|
end
|
|
154
158
|
|
|
155
159
|
subtasks({
|
|
156
|
-
'package' => %i[install add update dedupe rebuild reinstall].freeze,
|
|
160
|
+
'package' => %i[install add update dedupe approve deny rebuild reinstall].freeze,
|
|
157
161
|
'outdated' => %i[major minor patch].freeze,
|
|
158
162
|
'bump' => %i[version major minor patch].freeze,
|
|
159
163
|
'publish' => %i[latest tag verify].freeze,
|
|
@@ -198,7 +202,7 @@ module Squared
|
|
|
198
202
|
when 'add'
|
|
199
203
|
format_desc action, nil, 'save?=[=-]prod|dev|optional|peer|bundle,(-)name+'
|
|
200
204
|
task action, [:save] do |_, args|
|
|
201
|
-
packages = if args.save =~
|
|
205
|
+
packages = if args.save =~ /^([=-]*)(prod|dev|optional|peer|bundle)$/
|
|
202
206
|
save = [$2, $1.include?('='), $1.include?('-')]
|
|
203
207
|
args.extras
|
|
204
208
|
else
|
|
@@ -221,7 +225,7 @@ module Squared
|
|
|
221
225
|
if (n, extra = indexitem(val))
|
|
222
226
|
if (item = list[n.pred])
|
|
223
227
|
run compose([item.first, extra].compact.join(' '), script: true)
|
|
224
|
-
elsif exception
|
|
228
|
+
elsif exception?
|
|
225
229
|
indexerror n, list
|
|
226
230
|
else
|
|
227
231
|
log.warn "run script #{n} of #{list.size}".subhint('out of range')
|
|
@@ -257,7 +261,7 @@ module Squared
|
|
|
257
261
|
list = pnpmopts :exec, :common_filter
|
|
258
262
|
session 'pnpm', pre.call('r'), pre.call('c'), 'exec'
|
|
259
263
|
else
|
|
260
|
-
list = npmopts :exec
|
|
264
|
+
list = npmopts :exec, :common_scripts
|
|
261
265
|
session 'npm', 'exec'
|
|
262
266
|
end
|
|
263
267
|
op = OptionPartition.new(args, list, cmd, project: self, strict: strict?)
|
|
@@ -544,7 +548,6 @@ module Squared
|
|
|
544
548
|
end
|
|
545
549
|
save, exact, omit = save if save.is_a?(Array)
|
|
546
550
|
ws = env('NODE_WORKSPACES', equals: '0')
|
|
547
|
-
ci = option('ci')
|
|
548
551
|
om = lambda do |cmd|
|
|
549
552
|
if omit
|
|
550
553
|
save = case save
|
|
@@ -582,7 +585,7 @@ module Squared
|
|
|
582
585
|
end
|
|
583
586
|
if nolockfile?('yarn')
|
|
584
587
|
cmd << '--no-lockfile'
|
|
585
|
-
elsif ci
|
|
588
|
+
elsif option('ci')
|
|
586
589
|
if yarn == 1
|
|
587
590
|
cmd << '--frozen-lockfile'
|
|
588
591
|
elsif !flag
|
|
@@ -618,13 +621,27 @@ module Squared
|
|
|
618
621
|
'--force'
|
|
619
622
|
elsif nolockfile?('pnpm')
|
|
620
623
|
'--no-lockfile'
|
|
621
|
-
elsif ci
|
|
624
|
+
elsif option('ci')
|
|
622
625
|
'--frozen-lockfile'
|
|
623
626
|
end
|
|
624
627
|
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
625
628
|
cmd << '--dangerously-allow-all-builds' if option('approve-builds')
|
|
626
629
|
else
|
|
627
|
-
cmd = session
|
|
630
|
+
cmd = session 'npm'
|
|
631
|
+
cmd << (ci = option('ci') ? 'ci' : 'install')
|
|
632
|
+
option('approve-scripts') do |val|
|
|
633
|
+
cmd = npm_output 'approve-scripts'
|
|
634
|
+
cmd << case val
|
|
635
|
+
when '1'
|
|
636
|
+
'--all --no-allow-scripts-pin'
|
|
637
|
+
when 'true', 'all'
|
|
638
|
+
'--all'
|
|
639
|
+
else
|
|
640
|
+
val.split(/\s+/).quote!.join(' ')
|
|
641
|
+
end
|
|
642
|
+
print_run cmd, quiet?
|
|
643
|
+
run(cmd, banner: false)
|
|
644
|
+
end
|
|
628
645
|
cmd << '--workspaces=false' if ws
|
|
629
646
|
cmd << '--force' if option('force')
|
|
630
647
|
append_nocolor
|
|
@@ -738,7 +755,7 @@ module Squared
|
|
|
738
755
|
when :patch
|
|
739
756
|
a == c && b == d && f[4] != w[4]
|
|
740
757
|
end
|
|
741
|
-
if upgrade && !w[
|
|
758
|
+
if upgrade && !w[6]
|
|
742
759
|
next if file == want
|
|
743
760
|
|
|
744
761
|
found << [key, file, want, if a != c
|
|
@@ -1016,7 +1033,8 @@ module Squared
|
|
|
1016
1033
|
def package(flag, opts = [], packages: [], from: nil)
|
|
1017
1034
|
workspace.rev_clear(name)
|
|
1018
1035
|
yarn = dependtype(:yarn)
|
|
1019
|
-
if yarn > 0 && !(yarn == 1 && ((flag == :update && !packages.empty?) ||
|
|
1036
|
+
if yarn > 0 && !(yarn == 1 && ((flag == :update && !packages.empty?) || %i[approve deny
|
|
1037
|
+
rebuild].include?(flag)))
|
|
1020
1038
|
cmd = session 'yarn', case flag
|
|
1021
1039
|
when :update
|
|
1022
1040
|
if yarn == 1
|
|
@@ -1052,66 +1070,77 @@ module Squared
|
|
|
1052
1070
|
op << '--ignore-engines' if option('ignore-engines')
|
|
1053
1071
|
end
|
|
1054
1072
|
else
|
|
1073
|
+
flags = []
|
|
1055
1074
|
args = if pnpm?
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
spec =
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1075
|
+
if flag == :approve || flag == :deny
|
|
1076
|
+
opts.map! { |val| val.start_with?('!') ? val : "!#{val}" } if flag == :deny
|
|
1077
|
+
flag = :'approve-builds'
|
|
1078
|
+
spec = true
|
|
1079
|
+
else
|
|
1080
|
+
case flag
|
|
1081
|
+
when :install, :update
|
|
1082
|
+
opts << 'no-lockfile' if nolockfile?('pnpm')
|
|
1083
|
+
spec = 0 if flag == :update
|
|
1084
|
+
when :add
|
|
1085
|
+
spec = 1
|
|
1086
|
+
when :reinstall
|
|
1087
|
+
opts << 'force'
|
|
1088
|
+
flag = :install
|
|
1089
|
+
end
|
|
1090
|
+
flags << :install_a unless flag == :rebuild
|
|
1091
|
+
unless flag == :dedupe
|
|
1092
|
+
flags << :common_filter
|
|
1093
|
+
unless flag == :add
|
|
1094
|
+
flags << :install_b
|
|
1095
|
+
flags << :common_cpu unless flag == :update
|
|
1096
|
+
end
|
|
1073
1097
|
end
|
|
1098
|
+
no = OPT_PNPM[:no][flag]
|
|
1074
1099
|
end
|
|
1075
|
-
no = OPT_PNPM[:no][flag]
|
|
1076
1100
|
[
|
|
1077
1101
|
opts,
|
|
1078
|
-
pnpmopts(*flags),
|
|
1102
|
+
pnpmopts(flag, *flags),
|
|
1079
1103
|
session('pnpm', flag)
|
|
1080
1104
|
]
|
|
1081
1105
|
else
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
+
if flag == :approve || flag == :deny
|
|
1107
|
+
flag = :"#{flag}-scripts"
|
|
1108
|
+
spec = true
|
|
1109
|
+
else
|
|
1110
|
+
case flag
|
|
1111
|
+
when :install, :update
|
|
1112
|
+
opts.unshift('package-lock=false', 'save=false') if nolockfile?('npm')
|
|
1113
|
+
spec = flag == :install ? 0 : 2
|
|
1114
|
+
when :add
|
|
1115
|
+
spec = 1
|
|
1116
|
+
flag = :install
|
|
1117
|
+
when :reinstall
|
|
1118
|
+
remove_modules 'npm' if opts.delete('force')
|
|
1119
|
+
opts.unshift('package-lock=false') if lockfile(true)
|
|
1120
|
+
flag = :install
|
|
1121
|
+
end
|
|
1122
|
+
unless flag == :rebuild
|
|
1123
|
+
flags << :install_a
|
|
1124
|
+
unless flag == :dedupe
|
|
1125
|
+
%w[save ignore-scripts strict-peer-deps].each do |key|
|
|
1126
|
+
option(key, prefix: 'npm', ignore: false) do |val|
|
|
1127
|
+
opts << basic_option(key, case val
|
|
1128
|
+
when '0', 'false'
|
|
1129
|
+
false
|
|
1130
|
+
else
|
|
1131
|
+
true
|
|
1132
|
+
end)
|
|
1133
|
+
end
|
|
1106
1134
|
end
|
|
1135
|
+
flags << :install_b << :common_scripts
|
|
1107
1136
|
end
|
|
1108
|
-
flags << :
|
|
1137
|
+
flags << :install_c unless flag == :update
|
|
1138
|
+
no = OPT_NPM[:no][:install]
|
|
1109
1139
|
end
|
|
1110
|
-
no = OPT_NPM[:no][:install]
|
|
1111
1140
|
end
|
|
1112
1141
|
[
|
|
1113
1142
|
opts,
|
|
1114
|
-
npmopts(*flags),
|
|
1143
|
+
npmopts(flag, *flags),
|
|
1115
1144
|
session('npm', flag)
|
|
1116
1145
|
]
|
|
1117
1146
|
end
|
|
@@ -1139,6 +1168,8 @@ module Squared
|
|
|
1139
1168
|
|
|
1140
1169
|
op.append(quote: true)
|
|
1141
1170
|
.clear(errors: true)
|
|
1171
|
+
when true
|
|
1172
|
+
op.append(quote: true)
|
|
1142
1173
|
else
|
|
1143
1174
|
op.clear
|
|
1144
1175
|
end
|
|
@@ -1380,6 +1411,10 @@ module Squared
|
|
|
1380
1411
|
|
|
1381
1412
|
private
|
|
1382
1413
|
|
|
1414
|
+
def npm_output(*cmd, **kwargs)
|
|
1415
|
+
session_output('npm', *cmd, **kwargs)
|
|
1416
|
+
end
|
|
1417
|
+
|
|
1383
1418
|
def read_package(key = 'packageManager', update: false)
|
|
1384
1419
|
unless !update && @pm.key?(key)
|
|
1385
1420
|
doc = JSON.parse(dependfile.read)
|
|
@@ -201,7 +201,7 @@ module Squared
|
|
|
201
201
|
end
|
|
202
202
|
found |= 1
|
|
203
203
|
run(script, from: :run)
|
|
204
|
-
elsif exception
|
|
204
|
+
elsif exception?
|
|
205
205
|
indexerror n, list
|
|
206
206
|
else
|
|
207
207
|
found |= 2
|
|
@@ -216,7 +216,7 @@ module Squared
|
|
|
216
216
|
found |= 1
|
|
217
217
|
run(pdm_session('run', val), from: :run)
|
|
218
218
|
else
|
|
219
|
-
raise "script: #{val}" if exception
|
|
219
|
+
raise "script: #{val}" if exception?
|
|
220
220
|
|
|
221
221
|
found |= 2
|
|
222
222
|
log.warn "run script \"#{val}\"".subhint('not indexed')
|
|
@@ -685,6 +685,7 @@ module Squared
|
|
|
685
685
|
run(from: from)
|
|
686
686
|
end
|
|
687
687
|
end
|
|
688
|
+
alias build_ build!
|
|
688
689
|
|
|
689
690
|
def publish(flag, opts = [], test: false)
|
|
690
691
|
list = case flag
|
|
@@ -8,7 +8,7 @@ module Squared
|
|
|
8
8
|
GEMNAME = /\A[A-Za-z\d][A-Za-z\d_.-]*\z/.freeze
|
|
9
9
|
DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
|
|
10
10
|
OPT_RUBY = {
|
|
11
|
-
ruby: %w[0=im?
|
|
11
|
+
ruby: %w[a c l n p s S w 0=im? C=pm e=q E=bm F=qm i=bm? I=pm r=bm W=bm? x=pm? d|debug jit rjit verbose
|
|
12
12
|
y|yydebug backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
|
|
13
13
|
internal-encoding=b parser=b].freeze,
|
|
14
14
|
rake: %w[A|all B|build-all comments n|dry-run m|multitask P|prereqs q|quiet X|no-deprecation-warnings
|
|
@@ -16,14 +16,14 @@ module Squared
|
|
|
16
16
|
D|describe=q? e|execute=q E|execute-continue=q p|execute-print=q f|rakefile=p job-stats=b? j|jobs=i?
|
|
17
17
|
I|libdir=p R|rakelib=p rakelibdir=p r|require=b suppress-backtrace=q T|tasks=q? t|trace=b?
|
|
18
18
|
W|where=q?].freeze,
|
|
19
|
-
irb: %w[d f U w E=b I=
|
|
19
|
+
irb: %w[d f U w E=b I=pm r=bm W=im? autocomplete colorize echo echo-on-assignment extra-doc-dir inf-ruby-mode
|
|
20
20
|
inspect multiline no-pager noautocomplete nocolorize noecho noecho-on-assignment noinspect
|
|
21
21
|
nomultiline noprompt noscript nosingleline noverbose regexp-completor sample-book-mode script
|
|
22
22
|
simple-prompt single-irb singleline tracer truncate-echo-on-assignment type-completor verbose
|
|
23
23
|
back-trace-limit=i context-mode=i prompt=b prompt-mode=b].freeze,
|
|
24
24
|
rdbg: %w[no-color no-rc no-sigint-hook c|command n|nonstop stop-at-load cookie=q e=q host=q x|init-script=p
|
|
25
25
|
O|open=q? port=i port-range=b session-name=q sock-path=q util=q].freeze,
|
|
26
|
-
rbs: %w[I=pm r=bm no-
|
|
26
|
+
rbs: %w[I=pm r=bm no-collection no-stdlib collection=p log-level=b log-output=p repo=p].freeze,
|
|
27
27
|
rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
|
|
28
28
|
display-only-correctable display-only-fail-level-offenses display-only-failed
|
|
29
29
|
display-only-safe-correctable S|display-style-guide display-time editor-mode enable-pending-cops
|
|
@@ -34,8 +34,8 @@ module Squared
|
|
|
34
34
|
start-server stderr stop-server C|cache=b cache-root=p config=p exclude-limit=i fail-level=b
|
|
35
35
|
f|format=b except=q only=q o|out=p plugin=p require=p show-cops=q show-docs-url=q
|
|
36
36
|
s|stdin=p].freeze,
|
|
37
|
-
pry: %w[f I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
|
|
38
|
-
d|disable-plugin=q
|
|
37
|
+
pry: %w[f e=q I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
|
|
38
|
+
d|disable-plugin=q gem=b r|require=bm s|select-plugin=q].freeze,
|
|
39
39
|
no: {
|
|
40
40
|
rubocop: %w[auto-gen-enforced-style auto-gen-only-exclude auto-gen-timestamp color display-cop-names
|
|
41
41
|
offense-counts parallel server].freeze
|
|
@@ -69,7 +69,7 @@ module Squared
|
|
|
69
69
|
plugin: %w[source=q version=q].freeze,
|
|
70
70
|
plugin_uninstall: %w[all].freeze,
|
|
71
71
|
show: %w[paths].freeze,
|
|
72
|
-
update: %w[all
|
|
72
|
+
update: %w[all conservative pre ruby strict bundler=b? g|group=q source=q].freeze,
|
|
73
73
|
v3: {
|
|
74
74
|
binstubs: %w[all].freeze,
|
|
75
75
|
cache: %w[all frozen no-prune].freeze,
|
|
@@ -212,7 +212,8 @@ module Squared
|
|
|
212
212
|
attr_reader :gemdir
|
|
213
213
|
attr_accessor :autodetect
|
|
214
214
|
|
|
215
|
-
def initialize(*, autodetect: false, steep: 'Steepfile', rubocop: '.rubocop.yml', asdf: 'ruby',
|
|
215
|
+
def initialize(*, autodetect: false, exec: false, steep: 'Steepfile', rubocop: '.rubocop.yml', asdf: 'ruby',
|
|
216
|
+
**kwargs)
|
|
216
217
|
super
|
|
217
218
|
if @pass.include?(Ruby.ref)
|
|
218
219
|
initialize_ref Ruby.ref
|
|
@@ -225,6 +226,7 @@ module Squared
|
|
|
225
226
|
serve_set kwargs[:serve]
|
|
226
227
|
gemfile_set kwargs[:gemspec]
|
|
227
228
|
self.autodetect = autodetect
|
|
229
|
+
@bundle = { exec: exec.is_a?(String) ? basepath!(exec) : false }
|
|
228
230
|
@steepfile = basepath! steep if steep
|
|
229
231
|
@rubocopfile = Pathname.new(rubocop).realpath rescue basepath!(Dir.home, '.rubocop.yml') if rubocop
|
|
230
232
|
@rubygems = kwargs.fetch(:rubygems, 0)
|
|
@@ -297,7 +299,7 @@ module Squared
|
|
|
297
299
|
queue.call
|
|
298
300
|
if (item = tasks[n.pred])
|
|
299
301
|
cmd = [pre, item.first].compact.join(' ')
|
|
300
|
-
elsif exception
|
|
302
|
+
elsif exception?
|
|
301
303
|
indexerror n, tasks
|
|
302
304
|
else
|
|
303
305
|
log.warn "rake task #{n} of #{tasks.size}".subhint('out of range')
|
|
@@ -603,7 +605,7 @@ module Squared
|
|
|
603
605
|
pwd_set do
|
|
604
606
|
out = []
|
|
605
607
|
tool = args.name || (s && !SEM_VER.match?(s) ? s : 'ruby')
|
|
606
|
-
trim = ->(val) { val
|
|
608
|
+
trim = ->(val) { val =~ /^\D+\d+\.\d+(?:\.\S+)?/ ? $&.sub(/^([a-z]+)-/i, '\1 ') : val }
|
|
607
609
|
vm, bin = vmname(bin: true)
|
|
608
610
|
out << trim.call(case vm
|
|
609
611
|
when 'rvm'
|
|
@@ -1623,8 +1625,8 @@ module Squared
|
|
|
1623
1625
|
|
|
1624
1626
|
def rubocop(*args, sync: true, banner: verbose?, with: nil, pass: PASS_RUBY[:rubocop], **kwargs)
|
|
1625
1627
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1626
|
-
op = OptionPartition.new(opts, OPT_RUBY[:rubocop], session('rubocop'),
|
|
1627
|
-
|
|
1628
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rubocop], session(*bundle_args('rubocop')),
|
|
1629
|
+
project: self, strict: strict?, no: OPT_RUBY[:no][:rubocop])
|
|
1628
1630
|
if @rubocopfile && !op.arg?('c', 'config') && !rootpath('.rubocop.yml', ascend: true).exist?
|
|
1629
1631
|
op.add_path(@rubocopfile, option: 'c')
|
|
1630
1632
|
end
|
|
@@ -1659,7 +1661,7 @@ module Squared
|
|
|
1659
1661
|
end
|
|
1660
1662
|
|
|
1661
1663
|
def vmname(bin: false)
|
|
1662
|
-
order = { 'rbenv' => -1, 'rvm' => -1, 'chruby' => -1, 'mise' => -1 }
|
|
1664
|
+
order = { 'rbenv' => -1, 'rvm' => -1, 'chruby' => -1, 'asdf' => -1, 'mise' => -1 }
|
|
1663
1665
|
ENV.fetch('PATH', '').split(':').each_with_index do |val, index|
|
|
1664
1666
|
order.each_key do |key|
|
|
1665
1667
|
next unless val.match?(%r{[/.]#{key}/})
|
|
@@ -1668,36 +1670,40 @@ module Squared
|
|
|
1668
1670
|
break
|
|
1669
1671
|
end
|
|
1670
1672
|
end
|
|
1673
|
+
items = [
|
|
1674
|
+
"#{ENV.fetch('RBENV_ROOT', '$HOME/.rbenv')}/bin/rbenv",
|
|
1675
|
+
'$HOME/.rvm/bin/rvm',
|
|
1676
|
+
'$HOME/.local/bin/mise',
|
|
1677
|
+
'/usr/bin/rbenv',
|
|
1678
|
+
'/usr/bin/mise',
|
|
1679
|
+
'/usr/local/rvm/bin/rvm',
|
|
1680
|
+
'/usr/share/rvm/bin/rvm',
|
|
1681
|
+
'/usr/local/share/chruby/chruby.sh'
|
|
1682
|
+
]
|
|
1671
1683
|
if @asdf
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
1
|
|
1696
|
-
elsif d == -1
|
|
1697
|
-
-1
|
|
1698
|
-
else
|
|
1699
|
-
c < d ? -1 : 1
|
|
1700
|
-
end
|
|
1684
|
+
dir = File.join(ENV.fetch('ASDF_DATA_DIR', '$HOME/.asdf'), "installs/#{@asdf.first}")
|
|
1685
|
+
if @@asdf.version == 16
|
|
1686
|
+
items = [dir]
|
|
1687
|
+
else
|
|
1688
|
+
items << dir
|
|
1689
|
+
end
|
|
1690
|
+
end
|
|
1691
|
+
items.sort do |a, b|
|
|
1692
|
+
c = -1
|
|
1693
|
+
d = -1
|
|
1694
|
+
order.each do |key, val|
|
|
1695
|
+
pat = %r{/\.?#{key}}
|
|
1696
|
+
c = val if a.match?(pat)
|
|
1697
|
+
d = val if b.match?(pat)
|
|
1698
|
+
end
|
|
1699
|
+
if c == d
|
|
1700
|
+
0
|
|
1701
|
+
elsif c == -1
|
|
1702
|
+
1
|
|
1703
|
+
elsif d == -1
|
|
1704
|
+
-1
|
|
1705
|
+
else
|
|
1706
|
+
c < d ? -1 : 1
|
|
1701
1707
|
end
|
|
1702
1708
|
end
|
|
1703
1709
|
.each do |val|
|
|
@@ -1820,8 +1826,8 @@ module Squared
|
|
|
1820
1826
|
private
|
|
1821
1827
|
|
|
1822
1828
|
def run_repl(*args, opts:, banner:, from:, delim: true, **kwargs)
|
|
1823
|
-
op = OptionPartition.new(opts, OPT_RUBY[from], session(from), project: self, strict: strict?,
|
|
1824
|
-
|
|
1829
|
+
op = OptionPartition.new(opts, OPT_RUBY[from], session(*bundle_args(from)), project: self, strict: strict?,
|
|
1830
|
+
first: [/\.rb$/])
|
|
1825
1831
|
r = []
|
|
1826
1832
|
r << 'bundler/setup' if !op.arg?('r') && bundle_load
|
|
1827
1833
|
r.concat(Array(kwargs[:name])) if kwargs[:name]
|
|
@@ -1848,14 +1854,15 @@ module Squared
|
|
|
1848
1854
|
end
|
|
1849
1855
|
|
|
1850
1856
|
def rake_session(*cmd, **kwargs)
|
|
1851
|
-
session('rake', *preopts, *cmd, **kwargs)
|
|
1857
|
+
session(*bundle_args('rake'), *preopts, *cmd, **kwargs)
|
|
1852
1858
|
end
|
|
1853
1859
|
|
|
1854
1860
|
def rbs_session(*cmd, opts: nil)
|
|
1855
|
-
|
|
1861
|
+
args = bundle_args 'rbs'
|
|
1862
|
+
return session(*args, *cmd) unless opts
|
|
1856
1863
|
|
|
1857
1864
|
op = OptionPartition.new(opts, OPT_RUBY[:rbs], project: self, strict: strict?)
|
|
1858
|
-
[session(
|
|
1865
|
+
[session(*args, *op.to_a, *cmd), op.extras]
|
|
1859
1866
|
end
|
|
1860
1867
|
|
|
1861
1868
|
def gem_output(*cmd, **kwargs)
|
|
@@ -1871,7 +1878,15 @@ module Squared
|
|
|
1871
1878
|
end
|
|
1872
1879
|
|
|
1873
1880
|
def rake_output(*cmd, **kwargs)
|
|
1874
|
-
session_output('rake', *cmd, **kwargs)
|
|
1881
|
+
session_output(*bundle_args('rake'), *cmd, **kwargs)
|
|
1882
|
+
end
|
|
1883
|
+
|
|
1884
|
+
def bundle_args(*args)
|
|
1885
|
+
if (val = @bundle[:exec])
|
|
1886
|
+
args.unshift(quote_option('gemfile', val)) unless val == true
|
|
1887
|
+
args.unshift('bundle', 'exec')
|
|
1888
|
+
end
|
|
1889
|
+
args
|
|
1875
1890
|
end
|
|
1876
1891
|
|
|
1877
1892
|
def bundle_load
|
|
@@ -21,7 +21,7 @@ module Squared
|
|
|
21
21
|
include Prompt
|
|
22
22
|
|
|
23
23
|
def append(target, *args, delim: false, escape: false, quote: true, strip: nil, force: true, double: false,
|
|
24
|
-
filter: nil, pass: nil, **)
|
|
24
|
+
filter: nil, pass: nil, preserve: true, **)
|
|
25
25
|
return if (ret = args.flatten(1)).empty?
|
|
26
26
|
|
|
27
27
|
target << '--' if delim && !target.include?('--')
|
|
@@ -52,7 +52,7 @@ module Squared
|
|
|
52
52
|
if !(pa = val.is_a?(Pathname)) && escape
|
|
53
53
|
shell_escape(val, quote: quote, double: double)
|
|
54
54
|
elsif quote || pa
|
|
55
|
-
shell_quote(val, force: force, double: double)
|
|
55
|
+
shell_quote(val, force: force, double: double, preserve: preserve)
|
|
56
56
|
else
|
|
57
57
|
val
|
|
58
58
|
end
|
|
@@ -395,10 +395,10 @@ module Squared
|
|
|
395
395
|
self
|
|
396
396
|
end
|
|
397
397
|
|
|
398
|
-
def append(*args, clear: false, **kwargs, &blk)
|
|
398
|
+
def append(*args, clear: false, preserve: '"', **kwargs, &blk)
|
|
399
399
|
args = clear ? extras.dup.tap { extras.clear } : extras if args.empty?
|
|
400
400
|
pass = kwargs[:pass] ||= []
|
|
401
|
-
OptionPartition.append(target, *args, **kwargs, &blk)
|
|
401
|
+
OptionPartition.append(target, *args, preserve: preserve, **kwargs, &blk)
|
|
402
402
|
errors.concat(pass)
|
|
403
403
|
self
|
|
404
404
|
end
|
|
@@ -219,7 +219,7 @@ module Squared
|
|
|
219
219
|
opts << "--#{val}"
|
|
220
220
|
when /^(fetch-)?submodules$/
|
|
221
221
|
opts << '--fetch-submodules' if repo_submodules?(true, **envargs)
|
|
222
|
-
when /^(fail-)?
|
|
222
|
+
when /^(fail-)?fast$/
|
|
223
223
|
opts << '--fail-fast'
|
|
224
224
|
when /^no-(manifest-)?update$/
|
|
225
225
|
opts << '--no-manifest-update'
|
|
@@ -227,7 +227,9 @@ module Squared
|
|
|
227
227
|
opts << '--auto-gc'
|
|
228
228
|
end
|
|
229
229
|
end
|
|
230
|
-
|
|
230
|
+
if (jobs = ENV['REPO_JOBS']) || opts.none?(/^--?j(obs)?$/)
|
|
231
|
+
opts << "-j#{jobs || Rake::CpuCounter.count}"
|
|
232
|
+
end
|
|
231
233
|
opts << '--fetch-submodules' if repo_submodules?(**envargs)
|
|
232
234
|
begin
|
|
233
235
|
repo_run('sync', opts, exception: opts.include?('--fail-fast'), options: stage != 'init')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: squared
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- An Pham
|
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
126
|
version: '0'
|
|
127
127
|
requirements: []
|
|
128
|
-
rubygems_version: 4.0.
|
|
128
|
+
rubygems_version: 4.0.14
|
|
129
129
|
specification_version: 4
|
|
130
130
|
summary: Rake task generator for managing multi-language workspaces.
|
|
131
131
|
test_files: []
|