squared 0.4.20 → 0.4.21
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 +31 -0
- data/README.md +17 -13
- data/lib/squared/common/format.rb +3 -7
- data/lib/squared/config.rb +3 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +3 -1
- data/lib/squared/workspace/project/base.rb +75 -79
- data/lib/squared/workspace/project/docker.rb +13 -14
- data/lib/squared/workspace/project/git.rb +9 -11
- data/lib/squared/workspace/project/node.rb +19 -19
- data/lib/squared/workspace/project/python.rb +20 -28
- data/lib/squared/workspace/project/ruby.rb +105 -105
- data/lib/squared/workspace/project/support/class.rb +161 -41
- data/lib/squared/workspace/series.rb +16 -18
- metadata +1 -1
@@ -5,11 +5,11 @@ module Squared
|
|
5
5
|
module Project
|
6
6
|
class Node < Git
|
7
7
|
OPT_NPM = {
|
8
|
-
common: %w[dry-run=!? include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
|
9
|
-
install: %w[
|
8
|
+
common: %w[dry-run=!? include-workspace-root=!? loglevel=b workspaces=!? w|workspace=v].freeze,
|
9
|
+
install: %w[package-lock-only=!? prefer-dedupe=!? audit=! bin-links=! cpu=b fund=! libc=b os=b
|
10
10
|
package-lock=!].freeze,
|
11
|
-
install_base: %w[ignore-scripts=!? install-links=!? strict-peer-deps=!? include=b
|
12
|
-
|
11
|
+
install_base: %w[ignore-scripts=!? install-links=!? strict-peer-deps=!? include=b install-strategy=b
|
12
|
+
omit=b].freeze,
|
13
13
|
install_no: %w[audit bin-links fund package-lock].freeze,
|
14
14
|
install_as: %w[no-save save-bundle save-dev save-optional save-peer save-prod foreground-scripts=!?
|
15
15
|
g|global=!? S|save=!? E|save-exact=!?].freeze,
|
@@ -108,7 +108,7 @@ module Squared
|
|
108
108
|
initialize_build(Node.ref, prod: prod?, **kwargs)
|
109
109
|
initialize_env(**kwargs)
|
110
110
|
end
|
111
|
-
@dependfile =
|
111
|
+
@dependfile = basepath 'package.json'
|
112
112
|
@pm = { __: init }
|
113
113
|
end
|
114
114
|
|
@@ -259,11 +259,6 @@ module Squared
|
|
259
259
|
otp = args.first
|
260
260
|
else
|
261
261
|
tag, otp = param_guard(action, flag, args: args)
|
262
|
-
unless SEM_VER.match?(tag)
|
263
|
-
a = sub_style(project, styles: theme[:active])
|
264
|
-
b = sub_style(tag, styles: theme[:inline])
|
265
|
-
exit 1 unless confirm("Publish #{a}@#{b}? [y/N] ", 'N')
|
266
|
-
end
|
267
262
|
end
|
268
263
|
publish(flag, otp: otp, tag: tag, dryrun: dryrun, access: access)
|
269
264
|
end
|
@@ -371,7 +366,7 @@ module Squared
|
|
371
366
|
subdir << target.to_s
|
372
367
|
end
|
373
368
|
begin
|
374
|
-
FileUtils.cp(
|
369
|
+
FileUtils.cp(basepath(s), dest, verbose: verbose.is_a?(Numeric) && verbose > 0)
|
375
370
|
rescue StandardError => e
|
376
371
|
print_error e
|
377
372
|
errors += 1
|
@@ -386,7 +381,7 @@ module Squared
|
|
386
381
|
end
|
387
382
|
glob = Array(glob || '**/*')
|
388
383
|
target = []
|
389
|
-
from =
|
384
|
+
from = basepath from
|
390
385
|
if workspace
|
391
386
|
Dir.glob(from + '*').each do |path|
|
392
387
|
next unless (path = Pathname.new(path)).directory?
|
@@ -471,7 +466,7 @@ module Squared
|
|
471
466
|
if flag == :add
|
472
467
|
cmd << "--save-#{save}"
|
473
468
|
cmd << '--save-exact' if exact
|
474
|
-
cmd.merge(packages.map { |pkg|
|
469
|
+
cmd.merge(packages.map { |pkg| shell_quote(pkg) })
|
475
470
|
end
|
476
471
|
cmd << '--workspaces=false' if env('NODE_WORKSPACES', equals: '0')
|
477
472
|
cmd << '--package-lock=false' if option('package-lock', equals: '0')
|
@@ -654,14 +649,19 @@ module Squared
|
|
654
649
|
end
|
655
650
|
|
656
651
|
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil)
|
657
|
-
|
658
|
-
|
652
|
+
unless version && !read_packagemanager(:private)
|
653
|
+
print_error('invalid task "publish"', subject: name, hint: version ? 'private' : nil)
|
659
654
|
return
|
660
655
|
end
|
661
656
|
cmd = session 'npm', 'publish'
|
662
657
|
cmd << basic_option('otp', otp) if otp ||= option('otp')
|
663
|
-
cmd << basic_option('tag', tag) if tag ||= option('tag')
|
664
|
-
|
658
|
+
cmd << basic_option('tag', tag.tr(' ', '-')) if tag ||= option('tag')
|
659
|
+
case access || option('access')
|
660
|
+
when 'p', 'public'
|
661
|
+
cmd << '--access=public'
|
662
|
+
when 'r', 'restricted'
|
663
|
+
cmd << '--access=restricted'
|
664
|
+
end
|
665
665
|
dryrun ||= dryrun?('npm')
|
666
666
|
if dryrun
|
667
667
|
cmd << '--dry-run'
|
@@ -718,7 +718,7 @@ module Squared
|
|
718
718
|
if opt =~ op.values
|
719
719
|
case $1
|
720
720
|
when 'w', 'workspace'
|
721
|
-
op << ($2.match?(%r{[\\/]}) ? quote_option($1,
|
721
|
+
op << ($2.match?(%r{[\\/]}) ? quote_option($1, basepath($2)) : shell_option($1, $2))
|
722
722
|
end
|
723
723
|
elsif opt.include?('=')
|
724
724
|
op.errors << opt
|
@@ -811,7 +811,7 @@ module Squared
|
|
811
811
|
|
812
812
|
case $1
|
813
813
|
when 'w', 'workspace'
|
814
|
-
op << ($2.match?(%r{[\\/]}) ? quote_option($1,
|
814
|
+
op << ($2.match?(%r{[\\/]}) ? quote_option($1, basepath($2)) : shell_option($1, $2))
|
815
815
|
op.found << opt
|
816
816
|
end
|
817
817
|
end
|
@@ -207,7 +207,7 @@ module Squared
|
|
207
207
|
if flag == :create
|
208
208
|
format_desc action, flag, 'dir,opts*'
|
209
209
|
task flag, [:dir] do |_, args|
|
210
|
-
dir =
|
210
|
+
dir = basepath param_guard(action, flag, args: args, key: :dir)
|
211
211
|
venv_create dir, args.extras
|
212
212
|
end
|
213
213
|
elsif venv
|
@@ -245,10 +245,7 @@ module Squared
|
|
245
245
|
when :upgrade
|
246
246
|
format_desc action, flag, 'opts*'
|
247
247
|
task flag do |_, args|
|
248
|
-
|
249
|
-
args.unshift('upgrade')
|
250
|
-
args << 'pip'
|
251
|
-
install flag, args
|
248
|
+
install flag, ['upgrade', *args.to_a, 'pip']
|
252
249
|
end
|
253
250
|
when :freeze
|
254
251
|
format_desc action, flag, "file?=#{DEP_PYTHON[4]},opts*"
|
@@ -351,7 +348,7 @@ module Squared
|
|
351
348
|
when :user
|
352
349
|
cmd << '--user'
|
353
350
|
when :target
|
354
|
-
cmd << quote_option('target',
|
351
|
+
cmd << quote_option('target', basepath(target))
|
355
352
|
when :force
|
356
353
|
cmd << '--force-reinstall'
|
357
354
|
end
|
@@ -474,11 +471,7 @@ module Squared
|
|
474
471
|
cmd << '--user' if user
|
475
472
|
cmd << basic_option('upgrade-strategy', strategy) if strategy
|
476
473
|
append_value out
|
477
|
-
if workspace.windows?
|
478
|
-
pip = cmd.to_a.drop(1)
|
479
|
-
cmd = python_session '-m pip'
|
480
|
-
cmd.merge(pip)
|
481
|
-
end
|
474
|
+
python_session('-m pip', *cmd.to_a.drop(1)) if workspace.windows?
|
482
475
|
end
|
483
476
|
run(from: :install)
|
484
477
|
end
|
@@ -515,7 +508,7 @@ module Squared
|
|
515
508
|
if op.arg?(*args)
|
516
509
|
op.push(srcdir)
|
517
510
|
else
|
518
|
-
op << quote_option(args.last,
|
511
|
+
op << quote_option(args.last, basepath(srcdir))
|
519
512
|
end
|
520
513
|
srcdir = nil
|
521
514
|
end
|
@@ -549,7 +542,7 @@ module Squared
|
|
549
542
|
end
|
550
543
|
op = OptionPartition.new(opts, list, @session, project: self, single: singleopt(flag))
|
551
544
|
dist = lambda do
|
552
|
-
(
|
545
|
+
basepath('dist').tap do |dir|
|
553
546
|
raise_error('no source files found', hint: dir) unless dir.directory? && !dir.empty?
|
554
547
|
end
|
555
548
|
end
|
@@ -558,7 +551,7 @@ module Squared
|
|
558
551
|
if op.empty?
|
559
552
|
op.push("#{dist.call}/*")
|
560
553
|
else
|
561
|
-
op.map! { |val|
|
554
|
+
op.map! { |val| basepath(val) }
|
562
555
|
end
|
563
556
|
op.append
|
564
557
|
else
|
@@ -629,7 +622,7 @@ module Squared
|
|
629
622
|
def poetry_session(*cmd)
|
630
623
|
ret = session('poetry', *cmd, *preopts)
|
631
624
|
if (val = option('project', ignore: false))
|
632
|
-
ret << quote_option('project',
|
625
|
+
ret << quote_option('project', basepath(val))
|
633
626
|
end
|
634
627
|
ret
|
635
628
|
end
|
@@ -651,7 +644,7 @@ module Squared
|
|
651
644
|
end
|
652
645
|
|
653
646
|
def append_pip(flag, opts, target: @session, from: nil)
|
654
|
-
|
647
|
+
unless from && !opts.empty?
|
655
648
|
append_global(target: target)
|
656
649
|
return []
|
657
650
|
end
|
@@ -674,11 +667,11 @@ module Squared
|
|
674
667
|
end
|
675
668
|
op.swap
|
676
669
|
if edit
|
677
|
-
edit =
|
670
|
+
edit = basepath(edit) unless %r{\A[a-z]+(?:\+[a-z]+)?://}i.match?(edit)
|
678
671
|
if flag == :editable
|
679
672
|
op.push(edit)
|
680
673
|
else
|
681
|
-
|
674
|
+
op << quote_option('e', edit)
|
682
675
|
end
|
683
676
|
end
|
684
677
|
case flag
|
@@ -689,25 +682,25 @@ module Squared
|
|
689
682
|
[]
|
690
683
|
end
|
691
684
|
else
|
692
|
-
|
685
|
+
op.extras
|
693
686
|
end
|
694
687
|
end
|
695
688
|
|
696
689
|
def append_editable(target: @session)
|
697
|
-
return if requirements?
|
690
|
+
return if requirements? && editable == '.'
|
698
691
|
|
699
692
|
if (val = option('editable', 'e', target: target, ignore: false))
|
700
|
-
|
693
|
+
OptionPartition.delete_key(target, 'e', 'editable')
|
701
694
|
case val
|
702
695
|
when '0', 'false'
|
703
696
|
return
|
704
697
|
else
|
705
|
-
val =
|
698
|
+
val = basepath val
|
706
699
|
end
|
707
700
|
elsif session_arg?('e', 'editable', target: target) || !(val = editable)
|
708
701
|
return
|
709
702
|
end
|
710
|
-
target << quote_option('e', val)
|
703
|
+
target << quote_option('e', basepath(val))
|
711
704
|
end
|
712
705
|
|
713
706
|
def append_global(target: @session)
|
@@ -716,11 +709,11 @@ module Squared
|
|
716
709
|
when '0', 'false'
|
717
710
|
'--no-cache-dir'
|
718
711
|
else
|
719
|
-
quote_option('cache-dir',
|
712
|
+
quote_option('cache-dir', basepath(val))
|
720
713
|
end
|
721
714
|
end
|
722
715
|
target << shell_option('proxy', val) if (val = option('proxy', target: target))
|
723
|
-
target << quote_option('python',
|
716
|
+
target << quote_option('python', basepath(val)) if (val = option('python', target: target))
|
724
717
|
append_nocolor(target: target)
|
725
718
|
end
|
726
719
|
|
@@ -842,7 +835,7 @@ module Squared
|
|
842
835
|
when '.', Pathname
|
843
836
|
val
|
844
837
|
when String
|
845
|
-
Pathname.new(
|
838
|
+
Pathname.new(val) unless val.empty?
|
846
839
|
end
|
847
840
|
end
|
848
841
|
|
@@ -853,8 +846,7 @@ module Squared
|
|
853
846
|
val, *opts = val
|
854
847
|
@venvopts = opts
|
855
848
|
end
|
856
|
-
@venv =
|
857
|
-
@venv = @path + @venv unless @venv.absolute?
|
849
|
+
@venv = basepath(val)
|
858
850
|
if projectpath?(@venv)
|
859
851
|
if @venv.exist?
|
860
852
|
log.debug "venv found: #{@venv}"
|
@@ -7,14 +7,13 @@ 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
|
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 y|yydebug
|
11
11
|
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
|
-
rake: %w[A|all B|build-all comments n|dry-run
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
W|where=q?].freeze,
|
13
|
+
rake: %w[A|all B|build-all comments n|dry-run m|multitask P|prereqs q|quiet X|no-deprecation-warnings
|
14
|
+
N|no-search G|no-system nosearch nosystem rules s|silent g|system v|verbose backtrace=b?
|
15
|
+
D|describe=q? e|execute=q E|execute-continue=q p|execute-print=q job-stats=b? j|jobs=i? I|libdir=p
|
16
|
+
R|rakelib=p rakelibdir=p r|require=b suppress-backtrace=q T|tasks=q? t|trace=b? W|where=q?].freeze,
|
18
17
|
irb: %w[d f U w E=b I=p r=b W=im? autocomplete colorize echo echo-on-assignment extra-doc-dir inf-ruby-mode
|
19
18
|
inspect multiline no-pager noautocomplete nocolorize noecho noecho-on-assignment noinspect
|
20
19
|
nomultiline noprompt noscript nosingleline noverbose regexp-completor sample-book-mode script
|
@@ -22,38 +21,41 @@ module Squared
|
|
22
21
|
back-trace-limit=i context-mode=i prompt=b prompt-mode=b].freeze
|
23
22
|
}.freeze
|
24
23
|
OPT_BUNDLE = {
|
25
|
-
common: %w[no-color V|verbose retry=i].freeze,
|
24
|
+
common: %w[no-color V|verbose r|retry=i].freeze,
|
26
25
|
install: %w[frozen no-cache no-prune system binstubs=p? path=p standalone=q? target-rbconfig=p trust-policy=b
|
27
26
|
with=q without=q].freeze,
|
28
|
-
install_base: %w[force full-index quiet redownload
|
29
|
-
update: %w[conservative local pre ruby strict bundler=b? g|group=q source=b].freeze,
|
27
|
+
install_base: %w[force full-index quiet redownload gemfile=p j|jobs=i].freeze,
|
28
|
+
update: %w[all conservative local major minor patch pre ruby strict bundler=b? g|group=q source=b].freeze,
|
30
29
|
outdated: %w[filter-major filter-minor filter-patch groups local parseable pre only-explicit strict
|
31
|
-
update-strict
|
30
|
+
update-strict group=q source=b].freeze,
|
32
31
|
exec: %w[gemfile=p].freeze,
|
33
|
-
cache: %w[all-platforms frozen no-install no-prune quiet cache-path=p gemfile=p path=p].freeze,
|
34
|
-
check: %w[dry-run gemfile=p].freeze
|
32
|
+
cache: %w[all all-platforms frozen no-all no-install no-prune quiet cache-path=p gemfile=p path=p].freeze,
|
33
|
+
check: %w[dry-run gemfile=p path=p].freeze
|
35
34
|
}.freeze
|
36
35
|
OPT_GEM = {
|
37
36
|
common: %w[backtrace debug q|quiet no-verbose norc silent V|verbose config-file=p].freeze,
|
38
|
-
install: %w[version=
|
39
|
-
install_base: %w[f b|both clear-sources conservative default development development-all
|
40
|
-
ignore-dependencies l|local N|no-document r|remote
|
41
|
-
bulk-threshold=i document=b? g|file=p? p|http-proxy=q i|install-dir=p platform=q
|
42
|
-
target-rbconfig=p? P|trust-policy=b without=b].freeze,
|
37
|
+
install: %w[version=q].freeze,
|
38
|
+
install_base: %w[E f w b|both clear-sources conservative default development development-all explain
|
39
|
+
ignore-dependencies l|local N|no-document r|remote vendor n|bindir=p build-root=p
|
40
|
+
B|bulk-threshold=i document=b? g|file=p? p|http-proxy=q? i|install-dir=p platform=q
|
41
|
+
s|source=q target-rbconfig=p? P|trust-policy=b without=b].freeze,
|
43
42
|
update: %w[system=b?].freeze,
|
44
|
-
uninstall: %w[a D I x vendor n|bindir=p i|install-dir=p platform=b v|version=
|
45
|
-
outdated: %w[b|both clear-sources l|local
|
43
|
+
uninstall: %w[a D I x vendor n|bindir=p i|install-dir=p platform=b v|version=q].freeze,
|
44
|
+
outdated: %w[b|both clear-sources l|local r|remote B|bulk-threshold=i p|http-proxy=q? platform=q
|
46
45
|
source=q].freeze,
|
47
|
-
push: %w[
|
48
|
-
build: %w[force strict o|output=p platform=q].freeze,
|
49
|
-
exec: %w[conservative
|
50
|
-
pristine: %w[all only-executables only-missing-extensions only-plugins n|bindir=p i|install-dir=p skip=b
|
51
|
-
v|version=
|
46
|
+
push: %w[attestation=p host=q p|http-proxy=q? k|key=b otp=b].freeze,
|
47
|
+
build: %w[C=p force strict o|output=p platform=q].freeze,
|
48
|
+
exec: %w[conservative g|gem=b v|version=q].freeze,
|
49
|
+
pristine: %w[E all only-executables only-missing-extensions only-plugins n|bindir=p i|install-dir=p skip=b
|
50
|
+
v|version=q].freeze,
|
52
51
|
no: {
|
53
52
|
install: %w[env-shebang force format-executable http-proxy lock minimal-deps post-install-message prerelease
|
54
53
|
suggestions user-install wrappers].freeze,
|
55
54
|
uninstall: %w[abort-on-dependent all check-development executables force format-executable
|
56
55
|
ignore-dependencies user-install].freeze,
|
56
|
+
outdated: %w[http-proxy].freeze,
|
57
|
+
push: %w[http-proxy].freeze,
|
58
|
+
exec: %w[prerelease].freeze,
|
57
59
|
pristine: %w[env-shebang extensions].freeze
|
58
60
|
}.freeze
|
59
61
|
}.freeze
|
@@ -67,7 +69,7 @@ module Squared
|
|
67
69
|
end
|
68
70
|
|
69
71
|
def bannerargs
|
70
|
-
[
|
72
|
+
%i[dependfile gemname].freeze
|
71
73
|
end
|
72
74
|
|
73
75
|
def config?(val)
|
@@ -105,9 +107,7 @@ module Squared
|
|
105
107
|
@gemfile = if gemspec == false
|
106
108
|
false
|
107
109
|
elsif gemspec
|
108
|
-
|
109
|
-
elsif (gemspec = path + "#{name}.gemspec").exist? || (gemspec = path + "#{project}.gemspec").exist?
|
110
|
-
gemspec
|
110
|
+
basepath(gemspec.include?('.') ? gemspec : "#{gemspec}.gemspec")
|
111
111
|
end
|
112
112
|
return if !@output[0].nil? || !@copy.nil? || version || @autodetect || !rakefile
|
113
113
|
|
@@ -235,21 +235,26 @@ module Squared
|
|
235
235
|
format_desc action, flag, 'path,opts*,args*'
|
236
236
|
task flag, [:rb] do |_, args|
|
237
237
|
file = args.rb
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
238
|
+
opts = args.extras
|
239
|
+
args = if file && !file.include?('*')
|
240
|
+
ENV['RUBY_ARGS']
|
241
|
+
else
|
242
|
+
a, b, c = choice_index('Select a file', Dir.glob(file || path.join('*.rb')),
|
243
|
+
values: (file ? [] : ['Options']).push('Arguments'),
|
244
|
+
force: true, series: true)
|
245
|
+
if file
|
246
|
+
file = a
|
247
|
+
b
|
248
|
+
else
|
249
|
+
file = a
|
250
|
+
opts.concat(OptionPartition.strip(b))
|
251
|
+
c
|
252
|
+
end
|
253
|
+
end
|
254
|
+
ruby(flag, opts, file: file, args: args)
|
250
255
|
end
|
251
256
|
when :script
|
252
|
-
format_desc action, flag, 'opts
|
257
|
+
format_desc action, flag, 'opts*'
|
253
258
|
task flag do |_, args|
|
254
259
|
command = ENV['RUBY_E'] || readline('Enter script', force: true, multiline: ['##', ';'])
|
255
260
|
ruby(flag, args.to_a, command: command)
|
@@ -302,7 +307,7 @@ module Squared
|
|
302
307
|
print_item unless @output[0] || task_invoked?(/^copy(?::#{Ruby.ref}|$)/)
|
303
308
|
glob = Array(glob || '**/*')
|
304
309
|
Array(from).each_with_index do |val, i|
|
305
|
-
a =
|
310
|
+
a = basepath val
|
306
311
|
b = dest + val
|
307
312
|
c = glob[i] || glob.first
|
308
313
|
log.info "cp #{a + c} #{b}"
|
@@ -439,7 +444,7 @@ module Squared
|
|
439
444
|
if flag != :redownload
|
440
445
|
op << '--redownload'
|
441
446
|
elsif (lock = basepath('Gemfile.lock')).exist?
|
442
|
-
config = basepath
|
447
|
+
config = basepath '.bundle', 'config'
|
443
448
|
lock.delete unless config.exist? && config.read.match?(/\bBUNDLE_FROZEN:\s+"true"/)
|
444
449
|
end
|
445
450
|
end
|
@@ -458,11 +463,11 @@ module Squared
|
|
458
463
|
when :file, :script
|
459
464
|
op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self, args: true)
|
460
465
|
if file
|
461
|
-
op.unshift(shell_quote(
|
466
|
+
op.unshift(shell_quote(basepath(file)))
|
462
467
|
elsif command
|
463
468
|
op << quote_option('e', command, option: false)
|
464
469
|
end
|
465
|
-
op.push(args) if
|
470
|
+
op.push(args) if args
|
466
471
|
op.append(delim: true, escape: false, quote: false) unless op.empty?
|
467
472
|
when :version
|
468
473
|
pwd_set do
|
@@ -539,14 +544,14 @@ module Squared
|
|
539
544
|
end
|
540
545
|
return
|
541
546
|
end
|
542
|
-
run_rb(banner:
|
547
|
+
run_rb(banner: false, from: :"ruby:#{flag}")
|
543
548
|
end
|
544
549
|
|
545
550
|
def gem!(flag, opts = [], filter: nil)
|
546
551
|
cmd = gem_session
|
547
552
|
case flag
|
548
553
|
when :outdated
|
549
|
-
cmd << gempwd <<
|
554
|
+
cmd << gempwd << flag
|
550
555
|
else
|
551
556
|
cmd << flag
|
552
557
|
end
|
@@ -559,12 +564,7 @@ module Squared
|
|
559
564
|
cmd.merge(preopts)
|
560
565
|
op = OptionPartition.new(opts, list, cmd, project: self, no: OPT_GEM[:no][flag])
|
561
566
|
op.each do |opt|
|
562
|
-
if opt
|
563
|
-
case $1
|
564
|
-
when 'g', 'gem'
|
565
|
-
op << (flag == :exec ? shell_option($1, $2) : quote_option($1, path + $2))
|
566
|
-
end
|
567
|
-
elsif opt.include?('=') && !%i[outdated build push exec].include?(flag)
|
567
|
+
if !opt.match?(/\A[A-Za-z\d][A-Za-z\d_.-]*\z/) && %i[install uninstall update pristine].include?(flag)
|
568
568
|
op.errors << opt
|
569
569
|
else
|
570
570
|
op.found << opt
|
@@ -573,17 +573,18 @@ module Squared
|
|
573
573
|
op.swap
|
574
574
|
case flag
|
575
575
|
when :outdated
|
576
|
-
log.info cmd.to_s
|
577
576
|
op.clear
|
577
|
+
cmd = cmd.done
|
578
|
+
log.info cmd
|
578
579
|
on :first, from
|
579
|
-
print_item format_banner(cmd
|
580
|
+
print_item format_banner(cmd)
|
580
581
|
major = 0
|
581
582
|
minor = 0
|
582
583
|
patch = 0
|
583
584
|
update = []
|
584
585
|
pwd_set(pass: !gempwd.nil?, from: from) do
|
585
586
|
items = [[%w[Gem Current Latest], nil]]
|
586
|
-
IO.popen(cmd
|
587
|
+
IO.popen(cmd).each do |line|
|
587
588
|
if line =~ /^(\S+) \((\S+) < ([^)]+)\)$/
|
588
589
|
cur = semscan $2
|
589
590
|
lat = semscan $3
|
@@ -710,17 +711,17 @@ module Squared
|
|
710
711
|
end
|
711
712
|
when :push
|
712
713
|
if op.empty?
|
713
|
-
file =
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
714
|
+
file = basepath(if (spec = gemspec)
|
715
|
+
"#{spec.name}-#{spec.version}.gem"
|
716
|
+
else
|
717
|
+
gems = Dir.glob(basepath('*.gem')).map { |val| File.basename(val) }
|
718
|
+
choice_index('Select a file', gems, force: true)
|
719
|
+
end)
|
719
720
|
else
|
720
|
-
file =
|
721
|
-
raise_error('gem not found', hint: file) unless file.exist?
|
721
|
+
file = op.shift
|
722
722
|
raise_error("unknown args: #{op.join(', ')}", hint: flag) unless op.empty?
|
723
723
|
end
|
724
|
+
raise_error('gem not found', hint: file) unless op.exist?(file)
|
724
725
|
op.add_path(file)
|
725
726
|
run_rb(from: from, interactive: "Push #{sub_style(gemname, styles: theme[:active])}")
|
726
727
|
return
|
@@ -740,39 +741,40 @@ module Squared
|
|
740
741
|
op.append(quote: false)
|
741
742
|
when :update
|
742
743
|
unless op.arg?('system')
|
743
|
-
|
744
|
-
|
744
|
+
if op.empty?
|
745
|
+
op << gemname
|
746
|
+
else
|
747
|
+
op.append
|
748
|
+
end
|
745
749
|
end
|
746
750
|
op.clear(errors: true)
|
747
|
-
|
751
|
+
when :install, :uninstall, :pristine
|
748
752
|
raise_error('missing gemname', hint: flag) if op.empty?
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
op.reset
|
756
|
-
else
|
757
|
-
op.clear
|
758
|
-
end
|
759
|
-
elsif (n = op.index { |val| val.match?(/(\A|[a-z])@\d/) })
|
760
|
-
name = op.delete_at(n)
|
761
|
-
if (n = name.index('@')) == 0
|
762
|
-
pre = gemname
|
763
|
-
ver = name[1..-1]
|
764
|
-
else
|
765
|
-
pre = name[0, n]
|
766
|
-
ver = name[(n + 1)..-1]
|
767
|
-
end
|
768
|
-
op.adjoin(pre, shell_option('version', ver))
|
769
|
-
.clear
|
770
|
-
elsif flag != :install
|
771
|
-
op.adjoin
|
753
|
+
if op.arg?('all')
|
754
|
+
if flag == :pristine
|
755
|
+
append_repeat 'skip', op.extras
|
756
|
+
op.reset
|
757
|
+
else
|
758
|
+
op.clear
|
772
759
|
end
|
760
|
+
elsif (n = op.index { |val| val.match?(/(\A|[a-z])@\d/) })
|
761
|
+
name = op.delete_at(n)
|
762
|
+
pre, ver = if (n = name.index('@')) == 0
|
763
|
+
[gemname, name[1..-1]]
|
764
|
+
else
|
765
|
+
[name[0, n], name[(n + 1)..-1]]
|
766
|
+
end
|
767
|
+
op.adjoin(pre, shell_option('version', ver))
|
768
|
+
.clear
|
769
|
+
elsif flag == :install
|
770
|
+
op.append_any
|
771
|
+
else
|
772
|
+
op.append
|
773
773
|
end
|
774
|
-
op.
|
775
|
-
op << '--' <<
|
774
|
+
op.clear(errors: true)
|
775
|
+
op << '--' << readline('Enter command [args]', force: true) if flag == :install && op.remove(':')
|
776
|
+
else
|
777
|
+
op.append
|
776
778
|
end
|
777
779
|
run_rb(from: from)
|
778
780
|
end
|
@@ -782,26 +784,24 @@ module Squared
|
|
782
784
|
args = case flag
|
783
785
|
when 'exec', 'cache', 'check'
|
784
786
|
list = OPT_BUNDLE[flag.to_sym] + OPT_BUNDLE[:common]
|
785
|
-
OptionPartition.new(args, list, cmd, project: self, args: flag ==
|
787
|
+
OptionPartition.new(args, list, cmd, project: self, args: flag == 'exec').extras
|
786
788
|
else
|
787
789
|
args.flatten
|
788
790
|
end
|
789
791
|
case flag
|
790
792
|
when 'exec', 'config'
|
791
|
-
if args.empty?
|
792
|
-
|
793
|
-
else
|
794
|
-
args << command_args(args)
|
795
|
-
cmd.merge(args)
|
796
|
-
end
|
797
|
-
else
|
793
|
+
cmd << readline('Enter arguments', force: true) if args.empty?
|
794
|
+
when 'cache', 'check'
|
798
795
|
option_clear args
|
796
|
+
args.clear
|
799
797
|
end
|
798
|
+
cmd.merge(args)
|
800
799
|
run(from: :"bundle:#{flag}")
|
801
800
|
end
|
802
801
|
|
803
802
|
def rake(*args, opts: [])
|
804
|
-
op = OptionPartition.new(opts, OPT_RUBY[:rake], [quote_option('f', rakefile)
|
803
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rake], [(quote_option('f', rakefile) if rakefile)].compact,
|
804
|
+
project: self)
|
805
805
|
args.concat(op.extras)
|
806
806
|
if args.empty?
|
807
807
|
args << nil
|
@@ -998,14 +998,14 @@ module Squared
|
|
998
998
|
end
|
999
999
|
|
1000
1000
|
def variables
|
1001
|
-
(super + %i[
|
1001
|
+
(super + %i[autodetect]).freeze
|
1002
1002
|
end
|
1003
1003
|
|
1004
1004
|
def rakefile
|
1005
1005
|
return @rakefile unless @rakefile.nil?
|
1006
1006
|
|
1007
1007
|
file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
|
1008
|
-
@rakefile = file ?
|
1008
|
+
@rakefile = file ? basepath(file) : false
|
1009
1009
|
end
|
1010
1010
|
|
1011
1011
|
def rakepwd
|
@@ -1036,8 +1036,8 @@ module Squared
|
|
1036
1036
|
def gemfile
|
1037
1037
|
return @gemfile unless @gemfile.nil?
|
1038
1038
|
|
1039
|
-
@gemfile = [project, name].map! { |val|
|
1040
|
-
.concat(Dir.glob(
|
1039
|
+
@gemfile = [project, name].map! { |val| basepath("#{val}.gemspec") }
|
1040
|
+
.concat(Dir.glob(basepath('*.gemspec')))
|
1041
1041
|
.find { |file| File.exist?(file) } || false
|
1042
1042
|
end
|
1043
1043
|
|