squared 0.4.33 → 0.4.35
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 +35 -0
- data/lib/squared/common/prompt.rb +6 -2
- data/lib/squared/common/shell.rb +1 -0
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +4 -4
- data/lib/squared/workspace/project/base.rb +17 -5
- data/lib/squared/workspace/project/docker.rb +6 -7
- data/lib/squared/workspace/project/git.rb +3 -3
- data/lib/squared/workspace/project/node.rb +5 -3
- data/lib/squared/workspace/project/python.rb +34 -18
- data/lib/squared/workspace/project/ruby.rb +24 -23
- data/lib/squared/workspace/project/support/class.rb +3 -3
- data/lib/squared/workspace/repo.rb +3 -3
- data/lib/squared/workspace/series.rb +7 -3
- 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: 87083dafc757443f6f6afb994664bbb3089d4c57af8f32e06e2a9b76a21f520d
|
|
4
|
+
data.tar.gz: 8025828b76fce4826e3572e2546977ee7d998027aed144d9b119d84ba0a6e05d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 868a4f6d3fbbd406eab3ce1d2c87850f7a59fe2161314b001e8a20b540f9c98bd71a8f4250699d463220337be7124e7d437d34178e5f6036f40087c188e4ab98
|
|
7
|
+
data.tar.gz: 60e6625462ad8f9d6efbf4b9029629f6eceee0316647be5bf19098c9c951a7de42b6411395135b1664c76f598ac63a40656541f3e669775cfefa6f9261d356cc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.35] - 2025-12-31
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Ruby task copy uses GEM_HOME as fallback for autodetect.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Git commands [rebase|clone] did not forward sync flag.
|
|
12
|
+
- Pip command install carelessly used an undefined method.
|
|
13
|
+
- Common prompt method readline with multiline did not permit empty lines.
|
|
14
|
+
- Application method with using pass did not ignore exceptions.
|
|
15
|
+
|
|
16
|
+
## [0.4.34] - 2025-12-26
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Project public base method scope for nested tasks was created.
|
|
21
|
+
- Ruby task copy can autodetect "env" using [GEM_HOME|GEM_ROOT].
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Python virtual environment did not install poetry during initialization.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Workspace global banner never referenced the correct hash key.
|
|
30
|
+
- Python task depend without editable did not append context directory.
|
|
31
|
+
- Docker task build did not parse DOCKER_OPTIONS as command options.
|
|
32
|
+
- Project base method build did not call Method routines.
|
|
33
|
+
- Bundler autodetect did not check for valid gems directory.
|
|
34
|
+
- Ruby copy to version detection did not check for valid gemspec.
|
|
35
|
+
|
|
3
36
|
## [0.4.33] - 2025-12-07
|
|
4
37
|
|
|
5
38
|
### Added
|
|
@@ -1144,6 +1177,8 @@
|
|
|
1144
1177
|
|
|
1145
1178
|
- Changelog was created.
|
|
1146
1179
|
|
|
1180
|
+
[0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
|
|
1181
|
+
[0.4.34]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.34
|
|
1147
1182
|
[0.4.33]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.33
|
|
1148
1183
|
[0.4.32]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.32
|
|
1149
1184
|
[0.4.31]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.31
|
|
@@ -60,7 +60,7 @@ module Squared
|
|
|
60
60
|
while (ch = Readline.readline(msg))
|
|
61
61
|
unless (ch = ch.strip).empty?
|
|
62
62
|
if multiple
|
|
63
|
-
a = ch.split(
|
|
63
|
+
a = ch.split(',').map!(&:strip)
|
|
64
64
|
b = a.select { |s| valid.call(s) }.map!(&:to_i).sort
|
|
65
65
|
next unless a.size == b.size
|
|
66
66
|
return items ? b.map! { |i| items[i - 1] } : b unless multiple.is_a?(::Numeric) && multiple != b.size
|
|
@@ -94,7 +94,11 @@ module Squared
|
|
|
94
94
|
elsif block_given?
|
|
95
95
|
Readline.readmultiline(msg, history, &blk)
|
|
96
96
|
else
|
|
97
|
-
Readline.readmultiline(msg, history)
|
|
97
|
+
Readline.readmultiline(msg, history) do |line|
|
|
98
|
+
next if line.strip.empty?
|
|
99
|
+
|
|
100
|
+
multiline.any? { |val| line.split.last.end_with?(val.to_s) }
|
|
101
|
+
end
|
|
98
102
|
end
|
|
99
103
|
end
|
|
100
104
|
case force
|
data/lib/squared/common/shell.rb
CHANGED
|
@@ -110,6 +110,7 @@ module Squared
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def shell_bin(name, env: true)
|
|
113
|
+
require_relative 'base'
|
|
113
114
|
key = name.to_s.upcase
|
|
114
115
|
key = File.basename(key, '.*') if Rake::Win32.windows?
|
|
115
116
|
shell_quote((env && ENV["PATH_#{key}"]) || PATH[key] || PATH[key.to_sym] || name,
|
data/lib/squared/version.rb
CHANGED
|
@@ -179,7 +179,7 @@ module Squared
|
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
def with(*val, pass: false, group: nil, **kwargs, &blk)
|
|
182
|
-
return self if pass == true || (pass &&
|
|
182
|
+
return self if pass == true || (pass && as_a(pass, :to_s).any? { |s| respond_to?(s) && __send__(s) rescue nil })
|
|
183
183
|
|
|
184
184
|
@group = nil
|
|
185
185
|
@ref = nil
|
|
@@ -274,9 +274,9 @@ module Squared
|
|
|
274
274
|
|
|
275
275
|
def pass(name, group: @group, ref: @ref, &blk)
|
|
276
276
|
data = if group
|
|
277
|
-
@pass[:group][group]
|
|
277
|
+
@pass[:group][group.to_s]
|
|
278
278
|
elsif ref
|
|
279
|
-
@pass[:ref][ref]
|
|
279
|
+
@pass[:ref][ref.to_sym]
|
|
280
280
|
else
|
|
281
281
|
@pass[:global]
|
|
282
282
|
end
|
|
@@ -573,7 +573,7 @@ module Squared
|
|
|
573
573
|
return ret if group && (ret = @banner[:group][group.to_sym])
|
|
574
574
|
|
|
575
575
|
ref.reverse_each { |val| return ret if (ret = @banner[:ref][val]) }
|
|
576
|
-
@banner[:ref][:
|
|
576
|
+
@banner[:ref][:_]
|
|
577
577
|
end
|
|
578
578
|
|
|
579
579
|
def enabled?
|
|
@@ -460,8 +460,14 @@ module Squared
|
|
|
460
460
|
cmd = []
|
|
461
461
|
var = {}
|
|
462
462
|
args.each do |val|
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
case val.first
|
|
464
|
+
when Proc
|
|
465
|
+
instance_exec(*val[1..-1], &val.first)
|
|
466
|
+
next
|
|
467
|
+
when Method
|
|
468
|
+
val.first.call(*val[1..-1])
|
|
469
|
+
next
|
|
470
|
+
end
|
|
465
471
|
a, b, c, d, e = val
|
|
466
472
|
case b
|
|
467
473
|
when Hash
|
|
@@ -859,6 +865,12 @@ module Squared
|
|
|
859
865
|
end
|
|
860
866
|
end
|
|
861
867
|
|
|
868
|
+
def scope(*args, **kwargs, &blk)
|
|
869
|
+
namespace name do
|
|
870
|
+
task(*args, **kwargs, &blk)
|
|
871
|
+
end
|
|
872
|
+
end
|
|
873
|
+
|
|
862
874
|
def variable_set(key, *args, **kwargs, &blk)
|
|
863
875
|
if variables.include?(key) || blocks.include?(key)
|
|
864
876
|
val = case args.size
|
|
@@ -891,7 +903,8 @@ module Squared
|
|
|
891
903
|
when :env
|
|
892
904
|
run_set(output[0], *args, **kwargs)
|
|
893
905
|
when :dependfile
|
|
894
|
-
@
|
|
906
|
+
@dependindex = nil
|
|
907
|
+
@dependfile = val.nil? ? nil : basepath(*args)
|
|
895
908
|
else
|
|
896
909
|
if block_given?
|
|
897
910
|
if blocks.include?(key)
|
|
@@ -1052,8 +1065,7 @@ module Squared
|
|
|
1052
1065
|
begin
|
|
1053
1066
|
cmd.flatten.each { |val| run(val, env, sync: sync, banner: banner, **kwargs) }
|
|
1054
1067
|
rescue StandardError => e
|
|
1055
|
-
|
|
1056
|
-
raise unless ret == true
|
|
1068
|
+
on_error(e, from, exception: kwargs.fetch(:exception, exception))
|
|
1057
1069
|
end
|
|
1058
1070
|
on :last, from
|
|
1059
1071
|
end
|
|
@@ -262,21 +262,20 @@ module Squared
|
|
|
262
262
|
def compose(opts, flags = nil, script: false, args: nil, from: :run, **)
|
|
263
263
|
return opts if script == false
|
|
264
264
|
|
|
265
|
-
ret = docker_session
|
|
266
265
|
if from == :run
|
|
267
266
|
if bake?(n = filetype)
|
|
268
|
-
ret
|
|
267
|
+
ret = docker_session 'buildx bake'
|
|
269
268
|
append_file n
|
|
270
269
|
from = :bake
|
|
271
270
|
elsif compose?(n)
|
|
272
|
-
ret
|
|
271
|
+
ret = docker_session 'compose build'
|
|
273
272
|
append_file n
|
|
274
273
|
from = :compose
|
|
275
274
|
else
|
|
276
|
-
ret
|
|
275
|
+
ret = docker_session 'build'
|
|
277
276
|
end
|
|
278
277
|
else
|
|
279
|
-
ret
|
|
278
|
+
ret = docker_session from
|
|
280
279
|
end
|
|
281
280
|
case opts
|
|
282
281
|
when String
|
|
@@ -666,8 +665,8 @@ module Squared
|
|
|
666
665
|
end
|
|
667
666
|
end
|
|
668
667
|
|
|
669
|
-
def list_image(flag, cmd, hint: nil,
|
|
670
|
-
pwd_set do
|
|
668
|
+
def list_image(flag, cmd, hint: nil, no: true, from: nil)
|
|
669
|
+
pwd_set(from: from) do
|
|
671
670
|
found = false
|
|
672
671
|
index = 0
|
|
673
672
|
all = option('all', prefix: 'docker')
|
|
@@ -1049,7 +1049,7 @@ module Squared
|
|
|
1049
1049
|
|
|
1050
1050
|
cmd << "--#{command}"
|
|
1051
1051
|
end
|
|
1052
|
-
source
|
|
1052
|
+
source(sync: sync)
|
|
1053
1053
|
end
|
|
1054
1054
|
|
|
1055
1055
|
def autostash(*, sync: invoked_sync?('autostash'), **)
|
|
@@ -1090,7 +1090,7 @@ module Squared
|
|
|
1090
1090
|
append_hash opts
|
|
1091
1091
|
cmd << '--quiet' unless verbose
|
|
1092
1092
|
append_value(data[0], path, delim: true)
|
|
1093
|
-
source(banner: sync && !quiet?, multiple: !sync || quiet?)
|
|
1093
|
+
source(sync: sync, banner: sync && !quiet?, multiple: !sync || quiet?)
|
|
1094
1094
|
end
|
|
1095
1095
|
|
|
1096
1096
|
def stash(flag = nil, opts = [], sync: invoked_sync?('stash', flag))
|
|
@@ -1835,7 +1835,7 @@ module Squared
|
|
|
1835
1835
|
return args ? [IO.popen(cmd), banner || '', from] : IO.popen(cmd)
|
|
1836
1836
|
elsif stdin? ? sync : stdout
|
|
1837
1837
|
print_item banner unless multiple
|
|
1838
|
-
ret = `#{cmd}
|
|
1838
|
+
ret = `#{cmd}`.chomp
|
|
1839
1839
|
if !ret.empty?
|
|
1840
1840
|
puts ret
|
|
1841
1841
|
elsif success?(!banner.nil?)
|
|
@@ -27,7 +27,8 @@ module Squared
|
|
|
27
27
|
use-running-store-server use-store-server child-concurrency=i hoist-pattern=q lockfile-dir=p
|
|
28
28
|
modules-dir=p network-concurrency=i package-import-method=b public-hoist-pattern=q
|
|
29
29
|
reporter=b].freeze,
|
|
30
|
-
install_base: %w[global-dir ignore-scripts offline prefer-offline store-dir=p
|
|
30
|
+
install_base: %w[dangerously-allow-all-builds global-dir ignore-scripts offline prefer-offline store-dir=p
|
|
31
|
+
virtual-store-dir=p].freeze,
|
|
31
32
|
install_no: %w[frozen-lockfile verify-store-integrity].freeze,
|
|
32
33
|
install_as: %w[D|dev no-optional P|prod].freeze,
|
|
33
34
|
update: %w[g|global i|interactive L|latest depth=i].freeze,
|
|
@@ -448,6 +449,7 @@ module Squared
|
|
|
448
449
|
split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
|
|
449
450
|
end
|
|
450
451
|
cmd << '--ignore-workspace' if env('NODE_WORKSPACES', equals: '0')
|
|
452
|
+
cmd << '--dangerously-allow-all-builds' if option('approve-builds')
|
|
451
453
|
append_nocolor
|
|
452
454
|
else
|
|
453
455
|
cmd = session 'npm', 'install'
|
|
@@ -676,7 +678,7 @@ module Squared
|
|
|
676
678
|
log.info cmd.to_s
|
|
677
679
|
end
|
|
678
680
|
if sync
|
|
679
|
-
run(
|
|
681
|
+
run(sync: sync, from: from, interactive: !dryrun && "Publish #{sub_style(npmname, styles: theme[:active])}")
|
|
680
682
|
else
|
|
681
683
|
require 'open3'
|
|
682
684
|
on :first, from
|
|
@@ -799,7 +801,7 @@ module Squared
|
|
|
799
801
|
raise_error('version not found', hint: dependfile)
|
|
800
802
|
end
|
|
801
803
|
rescue StandardError => e
|
|
802
|
-
on_error
|
|
804
|
+
on_error(e, :bump, dryrun: dryrun?)
|
|
803
805
|
end
|
|
804
806
|
end
|
|
805
807
|
|
|
@@ -30,15 +30,15 @@ module Squared
|
|
|
30
30
|
OPT_POETRY = {
|
|
31
31
|
common: %w[ansi no-ansi no-cache n|no-interaction no-plugins q|quiet v|verbose P|project=p].freeze,
|
|
32
32
|
build: %w[clean config-settings=qq f|format=b o|output=p].freeze,
|
|
33
|
-
publish: %w[build dry-run skip-existing cert=p client-cert=p dist-dir=p p|password=
|
|
34
|
-
u|username=
|
|
33
|
+
publish: %w[build dry-run skip-existing cert=p client-cert=p dist-dir=p p|password=q r|repository=b
|
|
34
|
+
u|username=qq].freeze
|
|
35
35
|
}.freeze
|
|
36
36
|
OPT_PDM = {
|
|
37
37
|
common: %w[I|ignore-python no-cache n|non-interactive].freeze,
|
|
38
38
|
build: %w[C=bm no-clean no-isolation no-sdist no-wheel quiet verbose config-setting=q d|dest=p p|project=p
|
|
39
39
|
k|skip=b].freeze,
|
|
40
40
|
publish: %w[no-build no-very-ssl quiet S|sign skip-existing verbose ca-certs=p c|comment=q d|dest=p
|
|
41
|
-
i|identity=b P|password=q p|project=p r|repository=q k|skip=b u|username=
|
|
41
|
+
i|identity=b P|password=q p|project=p r|repository=q k|skip=b u|username=qq].freeze
|
|
42
42
|
}.freeze
|
|
43
43
|
OPT_HATCH = {
|
|
44
44
|
common: %w[color interactive no-color no-interactive cache-dir=p config=p data-dir=p e|env=b p|project=b
|
|
@@ -50,7 +50,7 @@ module Squared
|
|
|
50
50
|
OPT_TWINE = {
|
|
51
51
|
publish: %w[attestations disable-progress-bar non-interactive s|sign skip-existing verbose cert=p
|
|
52
52
|
client-cert=p c|comment=q config-file=p i|identity=b p|password=q r|repository=b repository-url=q
|
|
53
|
-
sign-with=b u|username=
|
|
53
|
+
sign-with=b u|username=qq].freeze
|
|
54
54
|
}.freeze
|
|
55
55
|
private_constant :DEP_PYTHON, :DIR_PYTHON, :OPT_PYTHON, :OPT_PIP, :OPT_POETRY, :OPT_PDM, :OPT_HATCH, :OPT_TWINE
|
|
56
56
|
|
|
@@ -343,6 +343,7 @@ module Squared
|
|
|
343
343
|
cmd << '--no-root' if option('no-root')
|
|
344
344
|
else
|
|
345
345
|
cmd = pip_session 'install'
|
|
346
|
+
cmd << '--upgrade-strategy=eager' if env('PYTHON_UPDATE')
|
|
346
347
|
if flag
|
|
347
348
|
case flag
|
|
348
349
|
when :user
|
|
@@ -497,7 +498,6 @@ module Squared
|
|
|
497
498
|
if !ENV['HATCH_BUILD_LOCATION'] && (outdir ||= op.shift)
|
|
498
499
|
op.add_path(outdir)
|
|
499
500
|
end
|
|
500
|
-
op << basic_option('p', project) unless ENV['HATCH_PROJECT'] || op.arg?('p', 'project')
|
|
501
501
|
else
|
|
502
502
|
unless op.empty?
|
|
503
503
|
args = case flag
|
|
@@ -573,17 +573,21 @@ module Squared
|
|
|
573
573
|
def variable_set(key, *val, **)
|
|
574
574
|
case key
|
|
575
575
|
when :dependfile
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
@dependindex = index
|
|
579
|
-
@dependfile = req
|
|
576
|
+
if val.first.nil?
|
|
577
|
+
super
|
|
580
578
|
else
|
|
581
|
-
|
|
579
|
+
req = basepath(*val)
|
|
580
|
+
if (index = DEP_PYTHON.index(req.basename.to_s))
|
|
581
|
+
@dependindex = index
|
|
582
|
+
@dependfile = req
|
|
583
|
+
else
|
|
584
|
+
log.warn "variable_set: @#{key}=#{req} (not supported)"
|
|
585
|
+
end
|
|
582
586
|
end
|
|
583
587
|
when :editable
|
|
584
588
|
editable_set val.first
|
|
585
589
|
when :venv
|
|
586
|
-
|
|
590
|
+
@venv = val.empty? || val.first.nil? ? nil : basepath(*val)
|
|
587
591
|
else
|
|
588
592
|
super
|
|
589
593
|
end
|
|
@@ -604,10 +608,11 @@ module Squared
|
|
|
604
608
|
end
|
|
605
609
|
|
|
606
610
|
def python_session(*cmd, opts: nil)
|
|
607
|
-
|
|
611
|
+
pre = preopts(quiet: false)
|
|
612
|
+
return session('python', *pre, *cmd, path: venv.nil?) unless opts
|
|
608
613
|
|
|
609
614
|
op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: singleopt(:python))
|
|
610
|
-
ret = session('python', *op.to_a, *cmd, path: venv.nil?)
|
|
615
|
+
ret = session('python', *pre, *op.to_a, *cmd, path: venv.nil?)
|
|
611
616
|
[ret, op.extras]
|
|
612
617
|
end
|
|
613
618
|
|
|
@@ -630,8 +635,8 @@ module Squared
|
|
|
630
635
|
def create_session(*cmd, name:, common:, opts: nil)
|
|
631
636
|
return session(name, *preopts, *cmd, path: venv.nil?) unless opts
|
|
632
637
|
|
|
633
|
-
op = OptionPartition.new(opts, common, project: self, single: singleopt)
|
|
634
|
-
ret = session(name, *op.to_a, *cmd, path: venv.nil?)
|
|
638
|
+
op = OptionPartition.new(opts, common, project: self, single: singleopt(name.to_sym))
|
|
639
|
+
ret = session(name, *preopts, *op.to_a, *cmd, path: venv.nil?)
|
|
635
640
|
[ret, op.extras]
|
|
636
641
|
end
|
|
637
642
|
|
|
@@ -685,14 +690,16 @@ module Squared
|
|
|
685
690
|
OptionPartition.delete_key(target, 'e', 'editable')
|
|
686
691
|
case val
|
|
687
692
|
when '0', 'false'
|
|
688
|
-
return
|
|
693
|
+
return unless installable?
|
|
689
694
|
else
|
|
690
695
|
val = basepath val
|
|
691
696
|
end
|
|
692
|
-
elsif session_arg?('e', 'editable', target: target) || !
|
|
697
|
+
elsif session_arg?('e', 'editable', target: target) || !installable?
|
|
693
698
|
return
|
|
699
|
+
else
|
|
700
|
+
val = editable
|
|
694
701
|
end
|
|
695
|
-
target << quote_option('e', basepath(val))
|
|
702
|
+
target << (val ? quote_option('e', basepath(val)) : '.')
|
|
696
703
|
end
|
|
697
704
|
|
|
698
705
|
def append_global(target: @session)
|
|
@@ -868,9 +875,18 @@ module Squared
|
|
|
868
875
|
.clear(pass: false)
|
|
869
876
|
status = op.arg?(/\A-v+\z/)
|
|
870
877
|
run(op, env, exception: true, banner: banner)
|
|
878
|
+
install(:upgrade, ['poetry']) if poetry?
|
|
871
879
|
puts(dir.directory? ? "Success: #{dir}" : 'Failed') if banner && !status
|
|
872
880
|
end
|
|
873
881
|
|
|
882
|
+
def installable?
|
|
883
|
+
setuptools? || !!pyprojectfile
|
|
884
|
+
end
|
|
885
|
+
|
|
886
|
+
def setuptools?
|
|
887
|
+
dependtype == 2 || dependtype == 4
|
|
888
|
+
end
|
|
889
|
+
|
|
874
890
|
def poetry?
|
|
875
891
|
dependtype == 1
|
|
876
892
|
end
|
|
@@ -855,7 +855,16 @@ module Squared
|
|
|
855
855
|
def copy?
|
|
856
856
|
return true if @copy.is_a?(Hash) ? copy[:into] : super
|
|
857
857
|
return gemdir? if gemdir
|
|
858
|
+
return false unless @autodetect
|
|
859
|
+
|
|
860
|
+
set = lambda do |val, path|
|
|
861
|
+
base = Pathname.new(path.strip)
|
|
862
|
+
return false unless base.join(gempath(val, 'specifications')).exist?
|
|
858
863
|
|
|
864
|
+
log.warn "using version #{val} (given #{version})" if version && version != val
|
|
865
|
+
self.version = val
|
|
866
|
+
self.gemdir = base + gempath
|
|
867
|
+
end
|
|
859
868
|
if version
|
|
860
869
|
begin
|
|
861
870
|
case @autodetect
|
|
@@ -866,38 +875,28 @@ module Squared
|
|
|
866
875
|
self.gemdir = File.join($1, 'lib/ruby/gems', "#{$2}.0")
|
|
867
876
|
end
|
|
868
877
|
when 'asdf'
|
|
869
|
-
val = pwd_set { `asdf where ruby
|
|
878
|
+
val = pwd_set { `asdf where ruby`.chomp }
|
|
870
879
|
self.gemdir = File.join(val, 'lib/ruby/gems', "#{$1}.0") if val =~ /(\d\.\d)\.[^.]+$/
|
|
871
880
|
when /bundler?/
|
|
872
|
-
|
|
881
|
+
path = pwd_set { `bundle env` }[/^\s+Gem Path\s+(.+)$/, 1]
|
|
882
|
+
self.gemdir = path.split(File::PATH_SEPARATOR).find { |val| Dir.exist?(val) }
|
|
883
|
+
else
|
|
884
|
+
self.gemdir = ENV['GEM_HOME'] || ENV['GEM_ROOT']
|
|
873
885
|
end
|
|
886
|
+
return true if gemdir?
|
|
874
887
|
rescue StandardError => e
|
|
875
888
|
log.debug e
|
|
876
889
|
end
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
set = lambda do |val, path|
|
|
882
|
-
if (ver = version) && ver != val
|
|
883
|
-
log.warn "using version #{val} (given #{ver})"
|
|
884
|
-
end
|
|
885
|
-
self.version = val
|
|
886
|
-
self.gemdir = Pathname.new(path.strip) + gempath
|
|
887
|
-
end
|
|
888
|
-
if version
|
|
889
|
-
opt = gempwd
|
|
890
|
-
pwd_set(pass: !opt.nil?) do
|
|
891
|
-
out = `#{gem_output(opt, 'list --local -d', gemname)}`
|
|
892
|
-
if out =~ /#{Regexp.escape(gemname)} \(([^)]+)\)/
|
|
890
|
+
pwd_set(pass: !gempwd.nil?) do
|
|
891
|
+
out = `#{gem_output(gempwd, 'list --local -d', gemname)}`
|
|
892
|
+
if out =~ /#{Regexp.escape(gemname)}\s+\((.+)\)$/
|
|
893
893
|
split_escape($1)
|
|
894
894
|
.unshift(@version)
|
|
895
895
|
.uniq
|
|
896
896
|
.each do |val|
|
|
897
|
-
next unless out =~
|
|
897
|
+
next unless out =~ /(?:\(#{Regexp.escape(val)}[^)]*\)|Installed at):\s+(.+)$/
|
|
898
898
|
|
|
899
|
-
set.call(val, $1)
|
|
900
|
-
return gemdir? if gemdir
|
|
899
|
+
return gemdir? if set.call(val, $1)
|
|
901
900
|
end
|
|
902
901
|
end
|
|
903
902
|
end
|
|
@@ -1050,8 +1049,10 @@ module Squared
|
|
|
1050
1049
|
end
|
|
1051
1050
|
end
|
|
1052
1051
|
|
|
1053
|
-
def gempath(val = version)
|
|
1054
|
-
File.join(
|
|
1052
|
+
def gempath(val = version, dir = 'gems')
|
|
1053
|
+
ret = File.join(dir, "#{gemname}-#{val}")
|
|
1054
|
+
ret += '.gemspec' if dir == 'specifications'
|
|
1055
|
+
ret
|
|
1055
1056
|
end
|
|
1056
1057
|
|
|
1057
1058
|
def gemdir?
|
|
@@ -135,9 +135,9 @@ module Squared
|
|
|
135
135
|
|
|
136
136
|
def_delegators :@target, :+, :-, :<<, :any?, :none?, :include?, :add, :add?, :find, :find_all, :find_index,
|
|
137
137
|
:merge, :compact, :delete, :delete?, :delete_if, :grep, :grep_v, :inspect, :to_a, :to_s
|
|
138
|
-
def_delegators :@extras, :empty?, :each, :each_with_index, :
|
|
139
|
-
:
|
|
140
|
-
:
|
|
138
|
+
def_delegators :@extras, :empty?, :member?, :each, :each_with_index, :each_with_object, :partition, :dup,
|
|
139
|
+
:first, :last, :shift, :unshift, :pop, :push, :concat, :index, :join, :map, :map!, :detect,
|
|
140
|
+
:select, :select!, :reject, :size
|
|
141
141
|
|
|
142
142
|
def_delegator :@extras, :delete, :remove
|
|
143
143
|
def_delegator :@extras, :delete_at, :remove_at
|
|
@@ -228,10 +228,10 @@ module Squared
|
|
|
228
228
|
return false unless root.directory?
|
|
229
229
|
|
|
230
230
|
path = sub_style(root, styles: theme[:inline])
|
|
231
|
+
timeout = env('REPO_TIMEOUT').to_i
|
|
232
|
+
timeout = 15 unless timeout > 0
|
|
231
233
|
@repo_override = Common::Prompt.confirm(
|
|
232
|
-
"#{log_title(:warn)} \"#{path}\" is not empty. Continue with installation? [y/N] ",
|
|
233
|
-
'N',
|
|
234
|
-
timeout: env('REPO_TIMEOUT', 15, ignore: '0')
|
|
234
|
+
"#{log_title(:warn)} \"#{path}\" is not empty. Continue with installation? [y/N] ", 'N', timeout: timeout
|
|
235
235
|
)
|
|
236
236
|
end
|
|
237
237
|
|
|
@@ -31,7 +31,10 @@ module Squared
|
|
|
31
31
|
end
|
|
32
32
|
elsif (data = TASK_BATCH[obj])
|
|
33
33
|
args.each { |ref| data.delete(ref) }
|
|
34
|
-
|
|
34
|
+
if data.empty?
|
|
35
|
+
TASK_KEYS.delete(obj)
|
|
36
|
+
TASK_BATCH.delete(obj)
|
|
37
|
+
end
|
|
35
38
|
end
|
|
36
39
|
end
|
|
37
40
|
|
|
@@ -40,6 +43,7 @@ module Squared
|
|
|
40
43
|
obj.each { |key, val| TASK_ALIAS[key][ref] = val }
|
|
41
44
|
elsif TASK_ALIAS.key?(obj)
|
|
42
45
|
TASK_ALIAS[obj].delete(ref)
|
|
46
|
+
TASK_ALIAS.delete(obj) if TASK_ALIAS[obj].empty?
|
|
43
47
|
end
|
|
44
48
|
end
|
|
45
49
|
|
|
@@ -191,7 +195,7 @@ module Squared
|
|
|
191
195
|
TASK_EXTEND[key].each do |kind|
|
|
192
196
|
next unless obj.is_a?(kind)
|
|
193
197
|
|
|
194
|
-
if kind.
|
|
198
|
+
if kind.method_defined?(meth)
|
|
195
199
|
out = obj.__send__(meth)
|
|
196
200
|
return true if out == 1
|
|
197
201
|
return out if obj.ref?(kind.ref)
|
|
@@ -232,7 +236,7 @@ module Squared
|
|
|
232
236
|
end
|
|
233
237
|
|
|
234
238
|
def exclude?(key, empty = false)
|
|
235
|
-
@exclude.include?(key) || (empty && @data[key].empty?)
|
|
239
|
+
@exclude.include?(key) || (empty && (!@data.key?(key) || @data[key].empty?))
|
|
236
240
|
end
|
|
237
241
|
|
|
238
242
|
private
|
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.4.
|
|
4
|
+
version: 0.4.35
|
|
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:
|
|
128
|
+
rubygems_version: 4.0.3
|
|
129
129
|
specification_version: 4
|
|
130
130
|
summary: Rake task generator for managing multi-language workspaces.
|
|
131
131
|
test_files: []
|