squared 0.5.8 → 0.5.10
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 +42 -0
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/project/base.rb +21 -20
- data/lib/squared/workspace/project/docker.rb +11 -9
- data/lib/squared/workspace/project/git.rb +11 -8
- data/lib/squared/workspace/project/node.rb +59 -35
- data/lib/squared/workspace/project/python.rb +3 -3
- data/lib/squared/workspace/project/ruby.rb +9 -9
- data/lib/squared/workspace/project/support/class.rb +17 -5
- 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: 1614a1b7a4674c33cbc895cc8ee6e475ec2ed577f431a52df251c9b1415b128f
|
4
|
+
data.tar.gz: f24f7926cda7af396f681670f35008473d56bd35f29b7c3a982826be9b2ffaa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e181a06665254466e0fffc3cb1c00e33ebeaa56354689a1b40b4c7a302e5e3554ceca1b45dea389eff4fd8653eec8e756fc8fe9921447d28fd5cd62b100235
|
7
|
+
data.tar.gz: e6ed8bbcdb2a38741f0562bf5ff00ee638d359ea0af7674c5e6346dd125e692e350999e027c560641b708ec2dbcd3438f184ab4565387a5adbe942ef014a264d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.5.10] - 2025-10-11
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- See `0.4.23`.
|
8
|
+
|
9
|
+
## [0.4.23] - 2025-10-11
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
- Node task outdated did not compare wanted and latest by semver.
|
14
|
+
- Project base method append_hash did not have target when joined.
|
15
|
+
- Docker build for compose and bake was completely incapacitated.
|
16
|
+
|
17
|
+
## [0.5.9] - 2025-10-08
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
|
21
|
+
- Git command commit did not always show files being pushed.
|
22
|
+
|
23
|
+
## [0.4.22] - 2025-10-08
|
24
|
+
|
25
|
+
### Added
|
26
|
+
|
27
|
+
- Node package managers support ENV platform options.
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- User installed Ruby is detected before system installed Ruby.
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- Yarn classic package installs did not recognize dedupe flag.
|
36
|
+
- Node command outdated option prune called undefined method.
|
37
|
+
- OptionPartition method exist? called undefined method.
|
38
|
+
- Ruby method copy? did not perform Hash property override check.
|
39
|
+
- OptionPartition static method arg? did not detect single values.
|
40
|
+
|
3
41
|
## [0.5.8] - 2025-10-01
|
4
42
|
|
5
43
|
### Fixed
|
@@ -1083,6 +1121,8 @@
|
|
1083
1121
|
|
1084
1122
|
- Changelog was created.
|
1085
1123
|
|
1124
|
+
[0.5.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.10
|
1125
|
+
[0.5.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.9
|
1086
1126
|
[0.5.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.8
|
1087
1127
|
[0.5.7]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.7
|
1088
1128
|
[0.5.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.6
|
@@ -1092,6 +1132,8 @@
|
|
1092
1132
|
[0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
|
1093
1133
|
[0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
|
1094
1134
|
[0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
|
1135
|
+
[0.4.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.23
|
1136
|
+
[0.4.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.22
|
1095
1137
|
[0.4.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.21
|
1096
1138
|
[0.4.20]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.20
|
1097
1139
|
[0.4.19]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.19
|
data/lib/squared/version.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'json'
|
4
4
|
require 'date'
|
5
|
-
require 'time'
|
6
5
|
require 'logger'
|
7
6
|
|
8
7
|
module Squared
|
@@ -221,7 +220,7 @@ module Squared
|
|
221
220
|
def initialize_env(dev: nil, prod: nil, **)
|
222
221
|
@dev = env_match('BUILD', dev, suffix: 'DEV', strict: true)
|
223
222
|
@prod = env_match('BUILD', prod, suffix: 'PROD', strict: true)
|
224
|
-
|
223
|
+
if (val = env('BUILD', suffix: 'ENV')) && @output[2] != false
|
225
224
|
@output[2] = parse_json(val, hint: "BUILD_#{@envname}_ENV") || @output[2]
|
226
225
|
end
|
227
226
|
unless @output[0] == false || @output[0].is_a?(Array)
|
@@ -496,11 +495,11 @@ module Squared
|
|
496
495
|
a, b, c, d, e = val
|
497
496
|
case b
|
498
497
|
when Hash
|
499
|
-
b = append_hash(b, build: true).join(' ')
|
498
|
+
b = append_hash(b, target: [], build: true).join(' ')
|
500
499
|
when Enumerable
|
501
500
|
b = b.to_a.join(' ')
|
502
501
|
end
|
503
|
-
d = append_hash(d).join(' ') if d.is_a?(Hash)
|
502
|
+
d = append_hash(d, target: []).join(' ') if d.is_a?(Hash)
|
504
503
|
if a
|
505
504
|
cmd << [a, d, b].compact.join(' ')
|
506
505
|
else
|
@@ -521,11 +520,13 @@ module Squared
|
|
521
520
|
if cmd
|
522
521
|
cmd = as_get(cmd, from)
|
523
522
|
opts = compose(opts, script: false) if opts && respond_to?(:compose)
|
524
|
-
flags = append_hash(flags).join(' ') if flags.is_a?(Hash)
|
523
|
+
flags = append_hash(flags, target: []).join(' ') if flags.is_a?(Hash)
|
525
524
|
case opts
|
526
525
|
when Hash
|
527
|
-
|
528
|
-
|
526
|
+
cmd = Array(cmd).append(flags)
|
527
|
+
.concat(append_hash(opts, target: [], build: true))
|
528
|
+
.compact
|
529
|
+
.join(' ')
|
529
530
|
when Enumerable
|
530
531
|
cmd = Array(cmd).concat(opts.to_a)
|
531
532
|
cmd.map! { |val| "#{val} #{flags}" } if flags
|
@@ -1325,12 +1326,12 @@ module Squared
|
|
1325
1326
|
end
|
1326
1327
|
|
1327
1328
|
def option(*args, target: @session, prefix: target&.first, **kwargs)
|
1328
|
-
|
1329
|
-
args.each do |val|
|
1330
|
-
next unless (ret = env(env_key(stripext(prefix), val), **kwargs))
|
1329
|
+
return unless prefix
|
1331
1330
|
|
1332
|
-
|
1333
|
-
|
1331
|
+
args.each do |val|
|
1332
|
+
next unless (ret = env(env_key(stripext(prefix), val), **kwargs))
|
1333
|
+
|
1334
|
+
return block_given? ? yield(ret) : ret
|
1334
1335
|
end
|
1335
1336
|
nil
|
1336
1337
|
end
|
@@ -1355,7 +1356,7 @@ module Squared
|
|
1355
1356
|
puts val unless val.empty? || (val.size == 1 && val.first.nil?)
|
1356
1357
|
end
|
1357
1358
|
|
1358
|
-
def print_banner(*lines, styles: theme[:banner], border: borderstyle,
|
1359
|
+
def print_banner(*lines, client: false, styles: theme[:banner], border: borderstyle, **)
|
1359
1360
|
pad = 0
|
1360
1361
|
if styles
|
1361
1362
|
if styles.any? { |s| s.to_s.end_with?('!') }
|
@@ -1379,14 +1380,14 @@ module Squared
|
|
1379
1380
|
(lines << sub_style(ARG[:BORDER][1] * n, styles: border)).join("\n")
|
1380
1381
|
end
|
1381
1382
|
|
1382
|
-
def print_footer(*lines, sub: nil, reverse: false, right: false, **
|
1383
|
+
def print_footer(*lines, sub: nil, reverse: false, right: false, border: borderstyle, **)
|
1383
1384
|
n = line_width lines
|
1384
1385
|
lines.map! do |val|
|
1385
1386
|
s = right ? val.rjust(n) : val.ljust(n)
|
1386
1387
|
sub&.each { |h| s = sub_style(s, **h) }
|
1387
1388
|
s
|
1388
1389
|
end
|
1389
|
-
ret = [sub_style(ARG[:BORDER][1] * n, styles:
|
1390
|
+
ret = [sub_style(ARG[:BORDER][1] * n, styles: border), *lines]
|
1390
1391
|
ret.reverse! if reverse
|
1391
1392
|
ret.join("\n")
|
1392
1393
|
end
|
@@ -1503,7 +1504,7 @@ module Squared
|
|
1503
1504
|
opts.each { |val| target << shell_option(flag, val) }
|
1504
1505
|
end
|
1505
1506
|
|
1506
|
-
def append_hash(data, target: @session, build: false)
|
1507
|
+
def append_hash(data, target: @session || [], build: false)
|
1507
1508
|
if build && (type = env('BUILD', suffix: 'TYPE') || ENV['BUILD_TYPE'])
|
1508
1509
|
type = "__#{type}__"
|
1509
1510
|
if (extra = data[type] || data[type.to_sym]).is_a?(Hash)
|
@@ -1608,7 +1609,7 @@ module Squared
|
|
1608
1609
|
when String
|
1609
1610
|
"#{base} #{data}"
|
1610
1611
|
when Hash
|
1611
|
-
"#{append_hash(base).join(' ')} #{data}"
|
1612
|
+
"#{append_hash(base, target: []).join(' ')} #{data}"
|
1612
1613
|
when Enumerable
|
1613
1614
|
"#{base.to_a.join(' ')} #{data}"
|
1614
1615
|
else
|
@@ -1617,11 +1618,11 @@ module Squared
|
|
1617
1618
|
when Hash
|
1618
1619
|
case base
|
1619
1620
|
when String
|
1620
|
-
"#{base} #{append_hash(data).join(' ')}"
|
1621
|
+
"#{base} #{append_hash(data, target: []).join(' ')}"
|
1621
1622
|
when Hash
|
1622
1623
|
base.merge(data)
|
1623
1624
|
when Enumerable
|
1624
|
-
Set.new(base.to_a + append_hash(data)).to_a
|
1625
|
+
Set.new(base.to_a + append_hash(data, target: [])).to_a
|
1625
1626
|
else
|
1626
1627
|
data
|
1627
1628
|
end
|
@@ -1630,7 +1631,7 @@ module Squared
|
|
1630
1631
|
when String
|
1631
1632
|
"#{base} #{data.to_a.join(' ')}"
|
1632
1633
|
when Hash
|
1633
|
-
"#{append_hash(base).join(' ')} #{data.to_a.join(' ')}"
|
1634
|
+
"#{append_hash(base, target: []).join(' ')} #{data.to_a.join(' ')}"
|
1634
1635
|
when Enumerable
|
1635
1636
|
Set.new(base.to_a + data.to_a).to_a
|
1636
1637
|
else
|
@@ -251,9 +251,11 @@ module Squared
|
|
251
251
|
end
|
252
252
|
|
253
253
|
def clean(*, sync: invoked_sync?('clean'), **)
|
254
|
-
|
255
|
-
|
256
|
-
|
254
|
+
if runnable?(@clean)
|
255
|
+
super
|
256
|
+
else
|
257
|
+
image(:rm, sync: sync)
|
258
|
+
end
|
257
259
|
end
|
258
260
|
|
259
261
|
def compose(opts, flags = nil, script: false, args: nil, from: :run, **)
|
@@ -262,11 +264,11 @@ module Squared
|
|
262
264
|
ret = docker_session
|
263
265
|
if from == :run
|
264
266
|
if bake?(n = filetype)
|
265
|
-
ret << 'buildx
|
267
|
+
ret << 'buildx bake'
|
266
268
|
append_file n
|
267
269
|
from = :bake
|
268
270
|
elsif compose?(n)
|
269
|
-
ret << 'compose
|
271
|
+
ret << 'compose build'
|
270
272
|
append_file n
|
271
273
|
from = :compose
|
272
274
|
else
|
@@ -279,7 +281,7 @@ module Squared
|
|
279
281
|
when String
|
280
282
|
ret << opts
|
281
283
|
when Hash
|
282
|
-
ret.merge(append_hash(opts, build: true))
|
284
|
+
ret.merge(append_hash(opts, target: [], build: true))
|
283
285
|
when Enumerable
|
284
286
|
ret.merge(opts.to_a)
|
285
287
|
end
|
@@ -646,7 +648,7 @@ module Squared
|
|
646
648
|
target << list.join(' && ') unless list.empty?
|
647
649
|
end
|
648
650
|
|
649
|
-
def append_file(type, target: @session)
|
651
|
+
def append_file(type, target: @session, index: 2)
|
650
652
|
return if !@file || (ENV['COMPOSE_FILE'] && compose?(type))
|
651
653
|
|
652
654
|
unless @file.is_a?(Array)
|
@@ -659,10 +661,10 @@ module Squared
|
|
659
661
|
end
|
660
662
|
files = Array(@file).map { |val| quote_option('file', basepath(val)) }
|
661
663
|
if target.is_a?(Set)
|
662
|
-
opts = target.to_a.insert(
|
664
|
+
opts = target.to_a.insert(index, *files)
|
663
665
|
target.clear.merge(opts)
|
664
666
|
else
|
665
|
-
target.insert(
|
667
|
+
target.insert(index, *files)
|
666
668
|
end
|
667
669
|
end
|
668
670
|
|
@@ -162,7 +162,7 @@ module Squared
|
|
162
162
|
add: %w[A|all e|edit f|force ignore-errors ignore-missing ignore-removal i|interactive no-all
|
163
163
|
no-ignore-removal n|dry-run p|patch pathspec-file-nul renormalize sparse u|update v|verbose
|
164
164
|
chmod=b pathspec-from-file=p].freeze,
|
165
|
-
branch: %w[a|all create-reflog i|ignore-case omit-empty q|quiet r|remotes v|verbose
|
165
|
+
branch: %w[a|all create-reflog i|ignore-case omit-empty q|quiet r|remotes v|verbose abbrev=i color=b
|
166
166
|
column=b contains=b format=q merged=b no-contains=b no-merged=b points-at=b u|set-upstream-to=b
|
167
167
|
sort=q t|track=b].freeze,
|
168
168
|
checkout: %w[l d|detach f|force ignore-other-worktrees ignore-skip-worktree-bits m|merge p|patch
|
@@ -607,7 +607,7 @@ module Squared
|
|
607
607
|
detach = args.detach
|
608
608
|
commit = commithead args.commit
|
609
609
|
end
|
610
|
-
param_guard(action, flag, args: { create: create }, key: :create, pat: /\
|
610
|
+
param_guard(action, flag, args: { create: create }, key: :create, pat: /\A[Bb]\z/) if create
|
611
611
|
else
|
612
612
|
branch = choice_refs 'Choose a branch to switch'
|
613
613
|
end
|
@@ -824,7 +824,7 @@ module Squared
|
|
824
824
|
[]
|
825
825
|
else
|
826
826
|
commit = choice_refs 'Choose "onto" branch'
|
827
|
-
target, opts = choice_commit(multiple: 2, values: ['Options']
|
827
|
+
target, opts = choice_commit(reflog: false, multiple: 2, values: ['Options'])
|
828
828
|
branch, upstream = target
|
829
829
|
OptionPartition.strip(opts)
|
830
830
|
end
|
@@ -1472,8 +1472,11 @@ module Squared
|
|
1472
1472
|
pu << '--force-with-lease' if amend
|
1473
1473
|
pu.merge(repotrack(origin, branch))
|
1474
1474
|
puts if pass
|
1475
|
+
adding = git_spawn 'diff --name-only --no-color'
|
1475
1476
|
source op
|
1476
|
-
|
1477
|
+
cached = git_spawn 'diff --cached --name-only --no-color'
|
1478
|
+
if amend || !cached.empty? || dryrun?
|
1479
|
+
puts cached if adding.empty? && !cached.empty? && banner?
|
1477
1480
|
source co
|
1478
1481
|
source pu
|
1479
1482
|
elsif banner?
|
@@ -1755,7 +1758,7 @@ module Squared
|
|
1755
1758
|
else
|
1756
1759
|
append_commit(*op.extras)
|
1757
1760
|
end
|
1758
|
-
when :add
|
1761
|
+
when :add
|
1759
1762
|
if flag == :add && !op.arg?('pathspec-from-file')
|
1760
1763
|
grep, list = op.partition { |val| OptionPartition.pattern?(val) }
|
1761
1764
|
unless grep.empty? && !list.empty?
|
@@ -1782,8 +1785,8 @@ module Squared
|
|
1782
1785
|
refs = projectmap op.extras
|
1783
1786
|
raise_error 'no source/destination' unless refs.size > 1
|
1784
1787
|
op.merge(refs)
|
1785
|
-
when :rm
|
1786
|
-
append_pathspec(op.extras, expect:
|
1788
|
+
when :rm, :clean
|
1789
|
+
append_pathspec(op.extras, expect: flag == :rm)
|
1787
1790
|
end
|
1788
1791
|
source(sync: false, stderr: true)
|
1789
1792
|
end
|
@@ -2139,7 +2142,7 @@ module Squared
|
|
2139
2142
|
end
|
2140
2143
|
|
2141
2144
|
def matchpathspec
|
2142
|
-
[/\A[^a-z\d-]+/i, %r{\A[^=\\/*]*[\\/*]}]
|
2145
|
+
[/\A[^a-z\d-]+/i, %r{\A[^=\\/*]*[\\/*]}, /\A--\z/]
|
2143
2146
|
end
|
2144
2147
|
|
2145
2148
|
def messageopt
|
@@ -6,33 +6,33 @@ module Squared
|
|
6
6
|
class Node < Git
|
7
7
|
OPT_NPM = {
|
8
8
|
common: %w[dry-run=!? include-workspace-root=!? loglevel=b workspaces=!? w|workspace=v].freeze,
|
9
|
-
install: %w[
|
10
|
-
|
11
|
-
|
12
|
-
install-strategy=b].freeze,
|
9
|
+
install: %w[package-lock-only=!? prefer-dedupe=!? cpu=b libc=b os=b].freeze,
|
10
|
+
install_base: %w[audit=! bin-links=! fund=! ignore-scripts=!? install-links=!? package-lock=!
|
11
|
+
strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
13
12
|
install_no: %w[audit bin-links fund package-lock].freeze,
|
14
|
-
install_as: %w[no-save save-bundle save-dev save-optional save-peer save-prod foreground-scripts=!?
|
13
|
+
install_as: %w[no-save save-bundle save-dev save-optional save-peer save-prod before=q foreground-scripts=!?
|
15
14
|
g|global=!? S|save=!? E|save-exact=!?].freeze,
|
16
15
|
run: %w[foreground-scripts=!? if-present=!? ignore-scripts=!? script-shell=p].freeze,
|
17
16
|
exec: %w[c|call=q package=b].freeze,
|
18
|
-
pack: %w[json=!? pack-destination=p].freeze
|
17
|
+
pack: %w[ignore-scripts=!? json=!? pack-destination=p].freeze
|
19
18
|
}.freeze
|
20
19
|
OPT_PNPM = {
|
21
20
|
common: %w[aggregate-output color no-color stream use-stderr C|dir=p loglevel=b w|workspace-root].freeze,
|
21
|
+
cpu: %w[cpu=b libc=b os=b].freeze,
|
22
22
|
filter: %w[fail-if-no-match changed-files-ignore-pattern=q filter=q filter-prod=q test-pattern=q].freeze,
|
23
23
|
install: %w[fix-lockfile force ignore-pnpmfile ignore-workspace lockfile-only merge-git-branch-lockfiles
|
24
|
-
no-hoist no-lockfile no-optional prefer-frozen-lockfile resolution-only
|
25
|
-
side-effects-cache side-effects-cache-readonly s|silent strict-peer-dependencies
|
24
|
+
optimistic-repeat-install no-hoist no-lockfile no-optional prefer-frozen-lockfile resolution-only
|
25
|
+
shamefully-hoist side-effects-cache side-effects-cache-readonly s|silent strict-peer-dependencies
|
26
26
|
use-running-store-server use-store-server child-concurrency=i hoist-pattern=q lockfile-dir=p
|
27
27
|
modules-dir=p network-concurrency=i package-import-method=b public-hoist-pattern=q
|
28
28
|
reporter=b].freeze,
|
29
29
|
install_base: %w[global-dir ignore-scripts offline prefer-offline store-dir=p virtual-store-dir=p].freeze,
|
30
30
|
install_no: %w[frozen-lockfile verify-store-integrity].freeze,
|
31
31
|
install_as: %w[D|dev global-dir no-optional P|prod r|recursive].freeze,
|
32
|
-
update: %w[global interactive latest depth=i].freeze,
|
32
|
+
update: %w[g|global i|interactive L|latest depth=i].freeze,
|
33
33
|
dedupe: %w[check].freeze,
|
34
|
-
run: %w[if-present no-bail parallel r|recursive report-summary reporter-hide-prefix resume-from
|
35
|
-
|
34
|
+
run: %w[if-present no-bail parallel r|recursive report-summary reporter-hide-prefix resume-from
|
35
|
+
sequential].freeze,
|
36
36
|
exec: %w[no-reporter-hide-prefix parallel r|recursive report-summary resume-from c|shell-mode].freeze,
|
37
37
|
pack: %w[json pack-destination=p pack-gzip-level=i].freeze
|
38
38
|
}.freeze
|
@@ -132,13 +132,13 @@ module Squared
|
|
132
132
|
task action, [:save] do |_, args|
|
133
133
|
save = param_guard(action, 'save', args: args, key: :save)
|
134
134
|
exact = true if save.delete_prefix!('=')
|
135
|
-
case save
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
135
|
+
packages = case save
|
136
|
+
when 'prod', 'dev', 'optional', 'peer'
|
137
|
+
args.extras
|
138
|
+
else
|
139
|
+
save = 'prod'
|
140
|
+
args.to_a
|
141
|
+
end
|
142
142
|
param_guard(action, 'name', args: packages)
|
143
143
|
depend(:add, packages: packages, save: save, exact: exact)
|
144
144
|
end
|
@@ -232,7 +232,7 @@ module Squared
|
|
232
232
|
flags.each do |flag|
|
233
233
|
case action
|
234
234
|
when 'outdated'
|
235
|
-
format_desc(action, flag, %w[
|
235
|
+
format_desc(action, flag, %w[update interactive dry-run], arg: 'opts?')
|
236
236
|
task flag do |_, args|
|
237
237
|
outdated flag, args.to_a
|
238
238
|
end
|
@@ -460,6 +460,7 @@ module Squared
|
|
460
460
|
cmd << '--save-exact' if exact
|
461
461
|
else
|
462
462
|
cmd << 'install'
|
463
|
+
append_platform
|
463
464
|
end
|
464
465
|
option('public-hoist-pattern', ignore: false) do |val|
|
465
466
|
split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
|
@@ -472,6 +473,8 @@ module Squared
|
|
472
473
|
cmd << "--save-#{save}"
|
473
474
|
cmd << '--save-exact' if exact
|
474
475
|
cmd.merge(packages.map { |pkg| shell_quote(pkg) })
|
476
|
+
else
|
477
|
+
append_platform
|
475
478
|
end
|
476
479
|
cmd << '--workspaces=false' if env('NODE_WORKSPACES', equals: '0')
|
477
480
|
cmd << '--package-lock=false' if option('package-lock', equals: '0')
|
@@ -529,7 +532,19 @@ module Squared
|
|
529
532
|
next
|
530
533
|
end
|
531
534
|
current = val['current'] || file
|
532
|
-
want =
|
535
|
+
want = val['wanted']
|
536
|
+
unless latest[SEM_VER, 6]
|
537
|
+
case rev
|
538
|
+
when :major
|
539
|
+
want = latest
|
540
|
+
when :minor
|
541
|
+
want = latest if latest[SEM_VER, 1] == want[SEM_VER, 1]
|
542
|
+
when :patch
|
543
|
+
if (g = latest.match(SEM_VER)) && (h = want.match(SEM_VER)) && g[1] == h[1] && g[3] == h[3]
|
544
|
+
want = latest
|
545
|
+
end
|
546
|
+
end
|
547
|
+
end
|
533
548
|
next unless (current != want || file != want) && (want.match?(SEM_VER) || !file.match?(SEM_VER))
|
534
549
|
|
535
550
|
f = semscan file
|
@@ -621,10 +636,13 @@ module Squared
|
|
621
636
|
footer.call(modified, found.size)
|
622
637
|
elsif modified > 0
|
623
638
|
modified = -1
|
624
|
-
footer.call(0, found.size)
|
625
639
|
File.write(dependfile, doc)
|
640
|
+
if opts.include?('update') || opts.include?('u') || option('update')
|
641
|
+
update
|
642
|
+
else
|
643
|
+
footer.call(0, found.size)
|
644
|
+
end
|
626
645
|
commit(:add, refs: ['package.json'], pass: true)
|
627
|
-
install if opts.include?('prune') || opts.include?('p')
|
628
646
|
end
|
629
647
|
elsif !avail.empty?
|
630
648
|
col1 = size_col.call(avail, 0) + 4
|
@@ -650,7 +668,7 @@ module Squared
|
|
650
668
|
end
|
651
669
|
|
652
670
|
def update(*)
|
653
|
-
package(
|
671
|
+
package(:update, from: :update)
|
654
672
|
end
|
655
673
|
|
656
674
|
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil)
|
@@ -694,15 +712,16 @@ module Squared
|
|
694
712
|
workspace.rev_clear(name)
|
695
713
|
if (yarn = dependtype(:yarn)) > 0
|
696
714
|
cmd = session 'yarn', if flag == :update
|
697
|
-
|
715
|
+
yarn == 1 ? 'upgrade' : 'up'
|
698
716
|
else
|
699
|
-
flag
|
717
|
+
yarn == 1 && flag == :dedupe ? 'install' : flag
|
700
718
|
end
|
701
719
|
op = OptionPartition.new(opts, if yarn == 1
|
702
|
-
OPT_YARN.fetch(flag, []) + OPT_YARN[:common]
|
720
|
+
OPT_YARN.fetch(flag == :dedupe ? :install : flag, []) + OPT_YARN[:common]
|
703
721
|
else
|
704
722
|
OPT_BERRY[flag]
|
705
723
|
end, cmd, project: self)
|
724
|
+
op << '--ignore-engines' if yarn == 1 && !option('ignore-engines', equals: '0')
|
706
725
|
op.clear
|
707
726
|
append_loglevel
|
708
727
|
else
|
@@ -710,13 +729,13 @@ module Squared
|
|
710
729
|
cmd = session 'pnpm', flag
|
711
730
|
list = OPT_PNPM[:install_base] + OPT_PNPM.fetch(flag, []) + OPT_PNPM[:common]
|
712
731
|
list.concat(OPT_PNPM[:install_as] + OPT_PNPM[:filter]) unless flag == :dedupe
|
732
|
+
list.concat(OPT_PNPM[:cpu]) unless flag == :update
|
713
733
|
no = OPT_PNPM[:"#{flag}_no"]
|
714
734
|
else
|
715
735
|
cmd = session 'npm', flag
|
716
736
|
list = OPT_NPM[:install_base] + OPT_NPM.fetch(flag, []) + OPT_NPM[:common]
|
717
737
|
list.concat(OPT_NPM[:install_as]) unless flag == :dedupe
|
718
738
|
no = OPT_NPM[:install_no]
|
719
|
-
cmd << '--save=true' if option('save')
|
720
739
|
end
|
721
740
|
op = OptionPartition.new(opts, list, cmd, no: no, project: self)
|
722
741
|
op.each do |opt|
|
@@ -732,12 +751,13 @@ module Squared
|
|
732
751
|
end
|
733
752
|
end
|
734
753
|
op.swap
|
754
|
+
append_platform if flag == :install
|
735
755
|
append_nocolor
|
736
756
|
append_loglevel
|
737
757
|
if flag == :dedupe
|
738
758
|
op.clear
|
739
759
|
else
|
740
|
-
op.append(
|
760
|
+
op.append(quote: true)
|
741
761
|
end
|
742
762
|
op.clear(errors: true)
|
743
763
|
end
|
@@ -841,7 +861,7 @@ module Squared
|
|
841
861
|
when String
|
842
862
|
target
|
843
863
|
when Hash
|
844
|
-
append_hash(target).join(' ')
|
864
|
+
append_hash(target, target: []).join(' ')
|
845
865
|
when Enumerable
|
846
866
|
target.to_a.join(' ')
|
847
867
|
else
|
@@ -933,6 +953,14 @@ module Squared
|
|
933
953
|
respond_to?(meth) && __send__(meth) ? @pm[prog] : 0
|
934
954
|
end
|
935
955
|
|
956
|
+
def dependbin
|
957
|
+
if yarn?
|
958
|
+
'yarn'
|
959
|
+
else
|
960
|
+
pnpm? ? 'pnpm' : 'npm'
|
961
|
+
end
|
962
|
+
end
|
963
|
+
|
936
964
|
def version
|
937
965
|
@version ||= read_packagemanager(:version)
|
938
966
|
end
|
@@ -1008,12 +1036,8 @@ module Squared
|
|
1008
1036
|
end
|
1009
1037
|
end
|
1010
1038
|
|
1011
|
-
def
|
1012
|
-
|
1013
|
-
'yarn'
|
1014
|
-
else
|
1015
|
-
pnpm? ? 'pnpm' : 'npm'
|
1016
|
-
end
|
1039
|
+
def append_platform(target: @session)
|
1040
|
+
%w[cpu os libc].each { |name| option(name) { |val| target << basic_option(name, val) } }
|
1017
1041
|
end
|
1018
1042
|
|
1019
1043
|
def dependext
|
@@ -7,7 +7,7 @@ module Squared
|
|
7
7
|
DEP_PYTHON = %w[poetry.lock setup.cfg pyproject.toml setup.py requirements.txt].freeze
|
8
8
|
DIR_PYTHON = (DEP_PYTHON + %w[README.rst]).freeze
|
9
9
|
OPT_PYTHON = {
|
10
|
-
common: %w[b B d E h i I O
|
10
|
+
common: %w[b B d E h i I O P q s S u v x c=q m=b W=b X=q check-hash-based-pycs=b].freeze,
|
11
11
|
build: %w[n|no-isolation s|sdist x|skip-dependency-check v|verbose w|wheel C|config-setting=q installer=b
|
12
12
|
o|outdir=p].freeze,
|
13
13
|
venv: %w[clear copies symlinks system-site-packages upgrade upgrade-deps without-scm-ignore-files without-pip
|
@@ -636,7 +636,7 @@ module Squared
|
|
636
636
|
def python_session(*cmd, opts: nil)
|
637
637
|
return session('python', *preopts(quiet: false), *cmd, path: venv.nil?) unless opts
|
638
638
|
|
639
|
-
op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: /\
|
639
|
+
op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: /\A(?:v+|OO)\z/)
|
640
640
|
ret = session('python', *op.to_a, *cmd, path: venv.nil?)
|
641
641
|
[ret, op.extras]
|
642
642
|
end
|
@@ -895,7 +895,7 @@ module Squared
|
|
895
895
|
op = OptionPartition.new(opts, OPT_PYTHON[:venv], cmd, project: self)
|
896
896
|
status = op.append(dir, delim: true)
|
897
897
|
.clear(pass: false)
|
898
|
-
.arg?(/\A-v+\z
|
898
|
+
.arg?(/\A-v+\z/)
|
899
899
|
run(op, env, exception: true, banner: banner)
|
900
900
|
puts(dir.directory? ? "Success: #{dir}" : 'Failed') if banner && !status
|
901
901
|
end
|
@@ -7,8 +7,8 @@ module Squared
|
|
7
7
|
GEMFILE = %w[Gemfile Gemfile.lock gem.deps.rb gems.rb Isolate].freeze
|
8
8
|
DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
|
9
9
|
OPT_RUBY = {
|
10
|
-
ruby: %w[0=im? a c e=q E=bm F=qm i=bm? I=pm l n p r=bm s S w W=bm? x=pm? d|debug jit rjit verbose
|
11
|
-
backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
|
10
|
+
ruby: %w[0=im? a c C=pm e=q E=bm F=qm i=bm? I=pm l n p r=bm s S w W=bm? x=pm? d|debug jit rjit verbose
|
11
|
+
y|yydebug backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
|
12
12
|
internal-encoding=b parser=b].freeze,
|
13
13
|
rake: %w[A|all B|build-all comments n|dry-run m|multitask P|prereqs q|quiet X|no-deprecation-warnings
|
14
14
|
N|no-search G|no-system nosearch nosystem rules s|silent g|system v|verbose backtrace=b?
|
@@ -472,7 +472,7 @@ module Squared
|
|
472
472
|
when :version
|
473
473
|
pwd_set do
|
474
474
|
out = []
|
475
|
-
order = { '
|
475
|
+
order = { 'rbenv' => -1, 'rvm' => -1, 'asdf' => -1, 'chruby' => -1 }
|
476
476
|
ENV.fetch('PATH', '').split(':').each_with_index do |val, index|
|
477
477
|
order.each_key do |key|
|
478
478
|
if val.match?(%r{[/.]#{key}/})
|
@@ -482,14 +482,14 @@ module Squared
|
|
482
482
|
end
|
483
483
|
end
|
484
484
|
paths = [
|
485
|
+
"#{ENV.fetch('RBENV_ROOT', '$HOME/.rbenv')}/bin/rbenv",
|
485
486
|
'$HOME/.rvm/bin/rvm',
|
487
|
+
@asdf ? "#{ENV.fetch('ASDF_DATA_DIR', '$HOME/.asdf')}/installs/#{@asdf.first}" : nil,
|
488
|
+
'/usr/bin/rbenv',
|
486
489
|
'/usr/local/rvm/bin/rvm',
|
487
490
|
'/usr/share/rvm/bin/rvm',
|
488
|
-
"#{ENV.fetch('RBENV_ROOT', '$HOME/.rbenv')}/bin/rbenv",
|
489
|
-
'/usr/bin/rbenv',
|
490
491
|
'/usr/local/share/chruby/chruby.sh'
|
491
|
-
]
|
492
|
-
paths << "#{ENV.fetch('ASDF_DATA_DIR', '$HOME/.asdf')}/installs/#{@asdf.first}" if @asdf
|
492
|
+
].compact
|
493
493
|
paths.sort do |a, b|
|
494
494
|
c = -1
|
495
495
|
d = -1
|
@@ -877,7 +877,7 @@ module Squared
|
|
877
877
|
end
|
878
878
|
|
879
879
|
def copy?
|
880
|
-
return true if
|
880
|
+
return true if @copy.is_a?(Hash) ? copy[:into] : super
|
881
881
|
return gemdir? if @gemdir
|
882
882
|
|
883
883
|
if version
|
@@ -1069,7 +1069,7 @@ module Squared
|
|
1069
1069
|
|
1070
1070
|
@gemfile = [project, name].map! { |val| basepath("#{val}.gemspec") }
|
1071
1071
|
.concat(path.glob('*.gemspec'))
|
1072
|
-
.find
|
1072
|
+
.find(&:exist?) || false
|
1073
1073
|
end
|
1074
1074
|
|
1075
1075
|
def gemlib
|
@@ -19,7 +19,8 @@ module Squared
|
|
19
19
|
include Shell
|
20
20
|
include Prompt
|
21
21
|
|
22
|
-
def append(target, *args, delim: false, escape: false, quote: true, strip: nil,
|
22
|
+
def append(target, *args, delim: false, escape: false, quote: true, strip: nil, force: true, double: false,
|
23
|
+
**)
|
23
24
|
return if (ret = args.flatten).empty?
|
24
25
|
|
25
26
|
target << '--' if delim && !target.include?('--')
|
@@ -27,7 +28,15 @@ module Squared
|
|
27
28
|
pat, s = Array(strip)
|
28
29
|
ret.map! { |val| val.gsub(pat, s || '') }
|
29
30
|
end
|
30
|
-
|
31
|
+
if escape || quote
|
32
|
+
ret.map! do |val|
|
33
|
+
if escape
|
34
|
+
shell_escape(val, quote: quote, double: double)
|
35
|
+
else
|
36
|
+
shell_quote(val, force: force, double: double)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
31
40
|
if target.is_a?(Set)
|
32
41
|
target.merge(ret)
|
33
42
|
else
|
@@ -68,7 +77,7 @@ module Squared
|
|
68
77
|
def select(list, bare: true, no: true, single: false, double: false)
|
69
78
|
ret = bare ? list.grep_v(/=/) : list.grep(/=/).map! { |val| val.split('=', 2).first }
|
70
79
|
ret.map! { |val| val.split('|', 2).last }
|
71
|
-
ret = ret.grep_v(
|
80
|
+
ret = ret.grep_v(/\Ano-/) unless no
|
72
81
|
return ret if single == double
|
73
82
|
|
74
83
|
ret.select { |val| single ? val.size == 1 : val.size > 1 }
|
@@ -92,7 +101,10 @@ module Squared
|
|
92
101
|
end
|
93
102
|
|
94
103
|
def matchopts(list, value = false)
|
95
|
-
a, b = list.partition { |val| val.size == 1 || val.match?(OPT_SINGLE) }
|
104
|
+
a, b = Array(list).partition { |val| val.size == 1 || val.match?(OPT_SINGLE) }
|
105
|
+
return /\A#{shortopt(*a)}}/ if b.empty?
|
106
|
+
return /\A#{longopt(*b, value)}/ if a.empty?
|
107
|
+
|
96
108
|
/\A(?:#{shortopt(*a)}|#{longopt(*b, value)})/
|
97
109
|
end
|
98
110
|
|
@@ -471,7 +483,7 @@ module Squared
|
|
471
483
|
path.join(val).exist?.tap do |ret|
|
472
484
|
next unless add && ret
|
473
485
|
|
474
|
-
|
486
|
+
add_path(first ? shift : pop)
|
475
487
|
end
|
476
488
|
else
|
477
489
|
each_with_index do |val, index|
|
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.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
127
|
+
rubygems_version: 3.7.2
|
128
128
|
specification_version: 4
|
129
129
|
summary: Rake task generator for managing multi-language workspaces.
|
130
130
|
test_files: []
|