squared 0.7.4 → 0.7.5
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 +46 -0
- data/README.md +11 -4
- data/lib/squared/common/base.rb +1 -0
- data/lib/squared/common/prompt.rb +1 -1
- data/lib/squared/common/shell.rb +10 -10
- data/lib/squared/common/system.rb +2 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +5 -4
- data/lib/squared/workspace/project/base.rb +13 -8
- data/lib/squared/workspace/project/docker.rb +21 -21
- data/lib/squared/workspace/project/git.rb +146 -112
- data/lib/squared/workspace/project/node.rb +15 -12
- data/lib/squared/workspace/project/python.rb +49 -21
- data/lib/squared/workspace/project/ruby.rb +57 -37
- data/lib/squared/workspace/project/support/optionpartition.rb +72 -34
- data/lib/squared/workspace/project/support/utils.rb +4 -6
- data/lib/squared/workspace/repo.rb +5 -4
- metadata +2 -2
|
@@ -242,7 +242,7 @@ module Squared
|
|
|
242
242
|
else
|
|
243
243
|
npmopts :run
|
|
244
244
|
end
|
|
245
|
-
OptionPartition.new(opts, list, session(dependbin, 'run'), project: self)
|
|
245
|
+
OptionPartition.new(opts, list, session(dependbin, 'run'), project: self, strict: strict?)
|
|
246
246
|
.add_first
|
|
247
247
|
.append(delim: true, quote: false)
|
|
248
248
|
run(from: :run)
|
|
@@ -261,7 +261,7 @@ module Squared
|
|
|
261
261
|
list = npmopts :exec
|
|
262
262
|
session 'npm', 'exec'
|
|
263
263
|
end
|
|
264
|
-
op = OptionPartition.new(args, list, cmd, project: self)
|
|
264
|
+
op = OptionPartition.new(args, list, cmd, project: self, strict: strict?)
|
|
265
265
|
if op.empty?
|
|
266
266
|
op << package
|
|
267
267
|
if (args = readline('Enter arguments', force: false))
|
|
@@ -532,6 +532,7 @@ module Squared
|
|
|
532
532
|
end
|
|
533
533
|
save, exact, omit = save if save.is_a?(Array)
|
|
534
534
|
ws = env('NODE_WORKSPACES', equals: '0')
|
|
535
|
+
ci = option('ci')
|
|
535
536
|
om = lambda do |cmd|
|
|
536
537
|
if omit
|
|
537
538
|
save = case save
|
|
@@ -569,7 +570,7 @@ module Squared
|
|
|
569
570
|
end
|
|
570
571
|
if nolockfile?('yarn')
|
|
571
572
|
cmd << '--no-lockfile'
|
|
572
|
-
elsif
|
|
573
|
+
elsif ci
|
|
573
574
|
if yarn == 1
|
|
574
575
|
cmd << '--frozen-lockfile'
|
|
575
576
|
elsif !flag
|
|
@@ -605,15 +606,15 @@ module Squared
|
|
|
605
606
|
'--force'
|
|
606
607
|
elsif nolockfile?('pnpm')
|
|
607
608
|
'--no-lockfile'
|
|
608
|
-
elsif
|
|
609
|
+
elsif ci
|
|
609
610
|
'--frozen-lockfile'
|
|
610
611
|
end
|
|
611
612
|
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
612
613
|
cmd << '--dangerously-allow-all-builds' if option('approve-builds')
|
|
613
614
|
else
|
|
614
|
-
cmd = session
|
|
615
|
-
cmd << (ci = option('ci') ? 'ci' : 'install')
|
|
615
|
+
cmd = session('npm', ci ? 'ci' : 'install')
|
|
616
616
|
cmd << '--workspaces=false' if ws
|
|
617
|
+
cmd << '--force' if option('force')
|
|
617
618
|
append_nocolor
|
|
618
619
|
append_loglevel
|
|
619
620
|
if omit
|
|
@@ -958,7 +959,7 @@ module Squared
|
|
|
958
959
|
when :add, :update then OPT_BERRY[:add_a]
|
|
959
960
|
else []
|
|
960
961
|
end
|
|
961
|
-
end, cmd, project: self)
|
|
962
|
+
end, cmd, project: self, strict: strict?)
|
|
962
963
|
if yarn == 1 && flag != :reinstall
|
|
963
964
|
op << '--no-lockfile' if nolockfile?('yarn')
|
|
964
965
|
op << '--ignore-engines' if option('ignore-engines')
|
|
@@ -1027,7 +1028,7 @@ module Squared
|
|
|
1027
1028
|
session('npm', flag)
|
|
1028
1029
|
]
|
|
1029
1030
|
end
|
|
1030
|
-
op = OptionPartition.new(*args, no: no, project: self)
|
|
1031
|
+
op = OptionPartition.new(*args, no: no, project: self, strict: strict?)
|
|
1031
1032
|
append_platform if flag == :install
|
|
1032
1033
|
append_nocolor
|
|
1033
1034
|
end
|
|
@@ -1047,7 +1048,8 @@ module Squared
|
|
|
1047
1048
|
end
|
|
1048
1049
|
end
|
|
1049
1050
|
op.swap.concat(packages)
|
|
1050
|
-
|
|
1051
|
+
raise ArgumentError, 'no packages to add' if op.empty? && spec == 1
|
|
1052
|
+
|
|
1051
1053
|
op.append(quote: true)
|
|
1052
1054
|
.clear(errors: true)
|
|
1053
1055
|
else
|
|
@@ -1092,10 +1094,11 @@ module Squared
|
|
|
1092
1094
|
|
|
1093
1095
|
cmd = session dependbin, 'pack'
|
|
1094
1096
|
if dependtype(:yarn) > 1
|
|
1095
|
-
op = OptionPartition.new(opts, OPT_BERRY[:pack], cmd, project: self)
|
|
1097
|
+
op = OptionPartition.new(opts, OPT_BERRY[:pack], cmd, project: self, strict: strict?)
|
|
1096
1098
|
op.append?('out', Pathname.pwd + "#{project}-#{version}.tgz")
|
|
1097
1099
|
else
|
|
1098
|
-
op = OptionPartition.new(opts, pnpm? ? OPT_PNPM[:pack] : npmopts(:pack), cmd, project: self
|
|
1100
|
+
op = OptionPartition.new(opts, pnpm? ? OPT_PNPM[:pack] : npmopts(:pack), cmd, project: self,
|
|
1101
|
+
strict: strict?)
|
|
1099
1102
|
unless pnpm?
|
|
1100
1103
|
op.each do |opt|
|
|
1101
1104
|
next unless opt =~ op.values
|
|
@@ -1130,7 +1133,7 @@ module Squared
|
|
|
1130
1133
|
list.concat(OPT_TSC[:watch])
|
|
1131
1134
|
cmd << '-w'
|
|
1132
1135
|
end
|
|
1133
|
-
op = OptionPartition.new(args, list, cmd, project: self, sep: ' ')
|
|
1136
|
+
op = OptionPartition.new(args, list, cmd, project: self, strict: strict?, sep: ' ')
|
|
1134
1137
|
unless p
|
|
1135
1138
|
if b.is_a?(String)
|
|
1136
1139
|
op.add_path(b)
|
|
@@ -216,7 +216,8 @@ module Squared
|
|
|
216
216
|
found |= 1
|
|
217
217
|
run(pdm_session('run', val), from: :run)
|
|
218
218
|
else
|
|
219
|
-
|
|
219
|
+
raise "script: #{val}" if exception
|
|
220
|
+
|
|
220
221
|
found |= 2
|
|
221
222
|
log.warn "run script \"#{val}\"".subhint('not indexed')
|
|
222
223
|
end
|
|
@@ -232,7 +233,7 @@ module Squared
|
|
|
232
233
|
subject: name, hint: pyprojectfile)
|
|
233
234
|
end
|
|
234
235
|
when 'exec'
|
|
235
|
-
format_desc action, nil, '
|
|
236
|
+
format_desc action, nil, 'command|:,args*'
|
|
236
237
|
task action do |_, args|
|
|
237
238
|
args = args.to_a
|
|
238
239
|
cmd = if (i = args.delete(':')) && !workspace.windows?
|
|
@@ -243,7 +244,7 @@ module Squared
|
|
|
243
244
|
command_args(args, min: 1, prefix: 'python')
|
|
244
245
|
args.join(' ')
|
|
245
246
|
end
|
|
246
|
-
|
|
247
|
+
run(cmd, send: :exec, banner: false)
|
|
247
248
|
end
|
|
248
249
|
end
|
|
249
250
|
else
|
|
@@ -296,11 +297,24 @@ module Squared
|
|
|
296
297
|
install flag, ['upgrade', *args.to_a, 'pip']
|
|
297
298
|
end
|
|
298
299
|
when :freeze
|
|
299
|
-
format_desc action, flag, "file?=#{DEP_PYTHON[4]},opts*"
|
|
300
|
+
format_desc action, flag, "file?=#{DEP_PYTHON[4]},u/uninstall,opts*"
|
|
300
301
|
task flag do |_, args|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
opts = args.to_a
|
|
303
|
+
if has_value!(opts, 'u', 'uninstall')
|
|
304
|
+
unless venv
|
|
305
|
+
print_error('no venv detected', subject: name)
|
|
306
|
+
exit 1
|
|
307
|
+
end
|
|
308
|
+
require 'tempfile'
|
|
309
|
+
temp = Tempfile.new("#{name}-")
|
|
310
|
+
temp.close
|
|
311
|
+
requirement = Pathname.new(temp)
|
|
312
|
+
end
|
|
313
|
+
file = pip(flag, opts: opts, banner: requirement.nil?, requirement: requirement)
|
|
314
|
+
puts File.read(file) unless silent?
|
|
315
|
+
if requirement && confirm_basic('Uninstall?', file)
|
|
316
|
+
pip(:uninstall, opts: ['y', "r=#{shell_quote(file)}"])
|
|
317
|
+
end
|
|
304
318
|
end
|
|
305
319
|
when :uninstall
|
|
306
320
|
format_desc action, flag, 'package+,opts*'
|
|
@@ -590,7 +604,7 @@ module Squared
|
|
|
590
604
|
def install(flag, opts = [], packages: [], banner: !silent?)
|
|
591
605
|
if flag == :poetry
|
|
592
606
|
OptionPartition.new(opts, OPT_POETRY[:install] + OPT_POETRY[:common], poetry_session('install'),
|
|
593
|
-
project: self, single: singleopt(flag))
|
|
607
|
+
project: self, strict: strict?, single: singleopt(flag))
|
|
594
608
|
else
|
|
595
609
|
op = append_pip(flag, opts, pipopts(:install), target: pip_session('install'))
|
|
596
610
|
end
|
|
@@ -626,7 +640,7 @@ module Squared
|
|
|
626
640
|
cmd, opts = python_session('-m build', opts: opts)
|
|
627
641
|
OPT_PYTHON[:build]
|
|
628
642
|
end
|
|
629
|
-
op = OptionPartition.new(opts, list, cmd, project: self, single: singleopt(flag))
|
|
643
|
+
op = OptionPartition.new(opts, list, cmd, project: self, strict: strict?, single: singleopt(flag))
|
|
630
644
|
case flag
|
|
631
645
|
when :hatch
|
|
632
646
|
op.add_path(outdir) if !ENV['HATCH_BUILD_LOCATION'] && (outdir ||= op.shift)
|
|
@@ -662,7 +676,9 @@ module Squared
|
|
|
662
676
|
from = symjoin flag, 'build'
|
|
663
677
|
if flag == :meson
|
|
664
678
|
cmd = session_output 'meson', 'compile', quote_option('C', basepath(outdir))
|
|
665
|
-
|
|
679
|
+
unless op.empty?
|
|
680
|
+
OptionPartition.new(op.extras, OPT_MESON[:compile], cmd, project: self, strict: strict?).append
|
|
681
|
+
end
|
|
666
682
|
run_s(op, cmd.done, from: from)
|
|
667
683
|
else
|
|
668
684
|
op.clear
|
|
@@ -685,7 +701,7 @@ module Squared
|
|
|
685
701
|
session 'twine', 'upload'
|
|
686
702
|
OPT_TWINE[:publish]
|
|
687
703
|
end
|
|
688
|
-
op = OptionPartition.new(opts, list, @session, project: self, single: singleopt(flag))
|
|
704
|
+
op = OptionPartition.new(opts, list, @session, project: self, strict: strict?, single: singleopt(flag))
|
|
689
705
|
dist = lambda do
|
|
690
706
|
dir = basepath 'dist'
|
|
691
707
|
return dir if dir.directory? && !dir.empty?
|
|
@@ -720,8 +736,8 @@ module Squared
|
|
|
720
736
|
def python(*args, sync: true, banner: verbose?, with: nil, pass: PASS_PYTHON[:python], **kwargs)
|
|
721
737
|
op = OptionPartition.new(session_opts(with, args: args, kwargs: kwargs, pass: pass), OPT_PYTHON[:common],
|
|
722
738
|
session('python', path: !venv?),
|
|
723
|
-
project: self, multiple: [/^-c/], single: singleopt(:python),
|
|
724
|
-
stdin: true)
|
|
739
|
+
project: self, strict: strict?, multiple: [/^-c/], single: singleopt(:python),
|
|
740
|
+
args: true, stdin: true)
|
|
725
741
|
op.concat(args)
|
|
726
742
|
if op.include?('-')
|
|
727
743
|
op.exist?(add: true)
|
|
@@ -769,7 +785,12 @@ module Squared
|
|
|
769
785
|
when :freeze
|
|
770
786
|
venv_init
|
|
771
787
|
op << '>'
|
|
772
|
-
|
|
788
|
+
ret = kwargs[:requirement] || begin
|
|
789
|
+
file = op.detect { |val| op.exist?(val) }
|
|
790
|
+
op.remove(file) if file
|
|
791
|
+
basepath(file || DEP_PYTHON[4])
|
|
792
|
+
end
|
|
793
|
+
op.add_quote(ret)
|
|
773
794
|
.clear
|
|
774
795
|
when :cache
|
|
775
796
|
op.concat(args)
|
|
@@ -852,7 +873,7 @@ module Squared
|
|
|
852
873
|
when :editable
|
|
853
874
|
editable_set args.first
|
|
854
875
|
when :venv
|
|
855
|
-
@venv = args.empty? || args.first.nil?
|
|
876
|
+
@venv = (basepath(*args) unless args.empty? || args.first.nil?)
|
|
856
877
|
else
|
|
857
878
|
super
|
|
858
879
|
end
|
|
@@ -867,7 +888,7 @@ module Squared
|
|
|
867
888
|
end
|
|
868
889
|
|
|
869
890
|
def venv?
|
|
870
|
-
!venv.nil?
|
|
891
|
+
!venv.nil? && venv.directory? && !venv.empty?
|
|
871
892
|
end
|
|
872
893
|
|
|
873
894
|
def serve?
|
|
@@ -877,11 +898,18 @@ module Squared
|
|
|
877
898
|
private
|
|
878
899
|
|
|
879
900
|
def pip_session(*cmd)
|
|
880
|
-
|
|
901
|
+
main = venv?
|
|
902
|
+
ret = session('pip', *cmd, *preopts, main: main, path: false)
|
|
903
|
+
return ret if main
|
|
904
|
+
|
|
905
|
+
python_session '-m', ret.to_s
|
|
881
906
|
end
|
|
882
907
|
|
|
883
908
|
def pip_output(*cmd)
|
|
884
|
-
session_output('pip', *cmd,
|
|
909
|
+
ret = session_output('pip', *cmd, path: false)
|
|
910
|
+
return ret if venv?
|
|
911
|
+
|
|
912
|
+
session_output 'python', '-m', ret.to_s
|
|
885
913
|
end
|
|
886
914
|
|
|
887
915
|
def python_session(*cmd, opts: nil)
|
|
@@ -910,12 +938,12 @@ module Squared
|
|
|
910
938
|
pre = preopts(quiet: quiet)
|
|
911
939
|
return session(name, *pre, *cmd, path: !venv?) unless opts
|
|
912
940
|
|
|
913
|
-
op = OptionPartition.new(opts, common, project: self, single: singleopt(name.to_sym))
|
|
941
|
+
op = OptionPartition.new(opts, common, project: self, strict: strict?, single: singleopt(name.to_sym))
|
|
914
942
|
[session(name, *pre, *op.to_a, *cmd, path: !venv?), op.extras]
|
|
915
943
|
end
|
|
916
944
|
|
|
917
945
|
def append_pip(flag, opts, list, target: @session)
|
|
918
|
-
op = OptionPartition.new(opts, list, target, project: self, single: singleopt)
|
|
946
|
+
op = OptionPartition.new(opts, list, target, project: self, strict: strict?, single: singleopt)
|
|
919
947
|
append_global(target: target)
|
|
920
948
|
case flag
|
|
921
949
|
when :install, :lock, :wheel, :editable, :upgrade
|
|
@@ -1172,7 +1200,7 @@ module Squared
|
|
|
1172
1200
|
:venv
|
|
1173
1201
|
end
|
|
1174
1202
|
cmd, opts = python_session('-m', flag, opts: opts)
|
|
1175
|
-
op = OptionPartition.new(opts, OPT_PYTHON[flag], cmd, project: self)
|
|
1203
|
+
op = OptionPartition.new(opts, OPT_PYTHON[flag], cmd, project: self, strict: strict?)
|
|
1176
1204
|
op.append(dir, delim: true)
|
|
1177
1205
|
.clear(pass: false)
|
|
1178
1206
|
status ||= op.arg?(/\A-v+\z/)
|
|
@@ -578,9 +578,6 @@ module Squared
|
|
|
578
578
|
if s && (%w[system latest].include?(s) || SEM_VER.match?(s) || s.start_with?(/(path|ref):/))
|
|
579
579
|
rbvm = exist?(ver.last) && !exist?(ver.first)
|
|
580
580
|
case vmname
|
|
581
|
-
when nil
|
|
582
|
-
print_error('no version manager detected', subject: name)
|
|
583
|
-
next
|
|
584
581
|
when 'asdf'
|
|
585
582
|
unless rbvm
|
|
586
583
|
asdf(:set, **{ name: args.name, version: s, banner: verbose? }.compact)
|
|
@@ -596,6 +593,9 @@ module Squared
|
|
|
596
593
|
run(banner: verbose?)
|
|
597
594
|
next
|
|
598
595
|
end
|
|
596
|
+
when nil
|
|
597
|
+
print_error('no version manager detected', subject: name)
|
|
598
|
+
next
|
|
599
599
|
end
|
|
600
600
|
File.write(basepath(ver.last), "#{s}\n") if SEM_VER.match?(s)
|
|
601
601
|
next
|
|
@@ -604,16 +604,14 @@ module Squared
|
|
|
604
604
|
out = []
|
|
605
605
|
tool = args.name || (args.local && !SEM_VER.match?(args.local) ? args.local : 'ruby')
|
|
606
606
|
trim = ->(s) { s[/^\D+\d+\.\d+(?:\.\S+)?/, 0].sub(/^([a-z]+)-/i, '\1 ') }
|
|
607
|
-
|
|
607
|
+
vm, bin = vmname(bin: true)
|
|
608
|
+
out << trim.call(case vm
|
|
608
609
|
when 'rvm'
|
|
609
|
-
ver.shift
|
|
610
610
|
`rvm current`[/^\S+/, 0]
|
|
611
611
|
when 'rbenv'
|
|
612
|
-
ver.shift
|
|
613
612
|
name = `rbenv version-name`
|
|
614
613
|
(name =~ SEM_VER) == 0 ? "ruby #{name}" : name
|
|
615
614
|
when 'chruby'
|
|
616
|
-
ver.shift
|
|
617
615
|
chruby = session_output 'source', bin
|
|
618
616
|
`#{chruby.with('ruby --version')}`
|
|
619
617
|
when 'mise'
|
|
@@ -673,26 +671,47 @@ module Squared
|
|
|
673
671
|
log.debug e
|
|
674
672
|
end
|
|
675
673
|
if ver
|
|
676
|
-
|
|
674
|
+
if vm == 'mise'
|
|
675
|
+
ver = mise + ver
|
|
676
|
+
pat = /^\s*#{tool}\s*=\s*\[?(.+?)\]?\s*$/
|
|
677
|
+
elsif vm != 'asdf'
|
|
678
|
+
ver.shift
|
|
679
|
+
end
|
|
680
|
+
append = ->(file, hint) { out << message("found #{file}", hint: hint) }
|
|
677
681
|
catch :found do
|
|
678
682
|
path.ascend do |dir|
|
|
679
|
-
ver.
|
|
680
|
-
dir
|
|
681
|
-
file = File.read(dir)
|
|
683
|
+
ver.select { |val| dir.join(val).exist? }.each do |val|
|
|
684
|
+
file = dir + val
|
|
682
685
|
hint = if val.include?('mise')
|
|
683
|
-
|
|
684
|
-
line&.gsub(/["']/, '')
|
|
686
|
+
file.read[pat, 1]&.gsub(/["']/, '')
|
|
685
687
|
else
|
|
686
|
-
file.
|
|
688
|
+
file.read
|
|
689
|
+
.lines
|
|
687
690
|
.map { |line| line.sub(/#.*$/, '').strip }
|
|
688
691
|
.reject(&:empty?)
|
|
689
692
|
.join(', ')
|
|
690
693
|
end
|
|
691
|
-
|
|
694
|
+
append.call(file, hint)
|
|
692
695
|
throw :found if hint&.include?(out.first[/^(?:j|truffle)?ruby ([\d.]+)/, 1])
|
|
693
696
|
rescue
|
|
694
697
|
nil
|
|
695
698
|
end
|
|
699
|
+
file = case vm
|
|
700
|
+
when 'rbenv'
|
|
701
|
+
'.rbenv/version'
|
|
702
|
+
when 'rvm'
|
|
703
|
+
'.rvm/config/default'
|
|
704
|
+
when 'mise'
|
|
705
|
+
'.config/mise/config.toml'
|
|
706
|
+
else
|
|
707
|
+
next
|
|
708
|
+
end
|
|
709
|
+
if File.exist?(file = dir.join(file))
|
|
710
|
+
hint = out.first.split(' ', 2).last
|
|
711
|
+
pat ||= SEM_VER
|
|
712
|
+
append.call(file, file.read[/^(.*(?:#{Regexp.escape(hint)}|#{pat}).*)$/, 1])
|
|
713
|
+
throw :found
|
|
714
|
+
end
|
|
696
715
|
end
|
|
697
716
|
end
|
|
698
717
|
end
|
|
@@ -714,7 +733,7 @@ module Squared
|
|
|
714
733
|
when 'mise'
|
|
715
734
|
cmd = session('mise', 'reshim', args.name || 'ruby')
|
|
716
735
|
else
|
|
717
|
-
print_error('not supported by version manager', subject: args.name)
|
|
736
|
+
print_error('reshim not supported by version manager', subject: args.name)
|
|
718
737
|
end
|
|
719
738
|
success?(run(banner: verbose?), verbose?) if cmd
|
|
720
739
|
end
|
|
@@ -821,7 +840,7 @@ module Squared
|
|
|
821
840
|
elsif se || ia || up
|
|
822
841
|
items = []
|
|
823
842
|
end
|
|
824
|
-
OptionPartition.new(opts, bundleopts(:outdated), cmd << "--#{flag}", project: self)
|
|
843
|
+
OptionPartition.new(opts, bundleopts(:outdated), cmd << "--#{flag}", project: self, strict: strict?)
|
|
825
844
|
.clear
|
|
826
845
|
elsif (up = option('u', 'update', prefix: 'bundle'))
|
|
827
846
|
flag = case up
|
|
@@ -892,7 +911,7 @@ module Squared
|
|
|
892
911
|
when '~>'
|
|
893
912
|
if c < v && cur[0] == val[0] && !semmajor?(cur, val)
|
|
894
913
|
styles[0] = :yellow
|
|
895
|
-
else
|
|
914
|
+
else
|
|
896
915
|
styles[1] = semmajor?(val, lat) ? :underline : :bold
|
|
897
916
|
end
|
|
898
917
|
end
|
|
@@ -982,8 +1001,8 @@ module Squared
|
|
|
982
1001
|
from = symjoin 'ruby', flag
|
|
983
1002
|
end
|
|
984
1003
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
985
|
-
op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self,
|
|
986
|
-
stdin: true)
|
|
1004
|
+
op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self, strict: strict?,
|
|
1005
|
+
multiple: [/^-e/], args: true, stdin: true)
|
|
987
1006
|
if kwargs[:command]
|
|
988
1007
|
op << quote_option('e', kwargs[:command])
|
|
989
1008
|
elsif kwargs[:file]
|
|
@@ -1026,7 +1045,7 @@ module Squared
|
|
|
1026
1045
|
opts.concat(args)
|
|
1027
1046
|
end
|
|
1028
1047
|
op = OptionPartition.new(opts, gemopts(flag), gem_session(flag),
|
|
1029
|
-
project: self, no: OPT_GEM[:no][flag == :update ? :install : flag])
|
|
1048
|
+
project: self, strict: strict?, no: OPT_GEM[:no][flag == :update ? :install : flag])
|
|
1030
1049
|
from = symjoin 'gem', flag
|
|
1031
1050
|
if flag == :outdated
|
|
1032
1051
|
op.adjoin(gempwd, start: 0) if gempwd
|
|
@@ -1380,7 +1399,7 @@ module Squared
|
|
|
1380
1399
|
end
|
|
1381
1400
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1382
1401
|
invalid = ->(a) { raise_error ArgumentError, "unrecognized args: #{a.join(', ')}", hint: flag }
|
|
1383
|
-
cmd = bundle_session
|
|
1402
|
+
cmd = bundle_session flag
|
|
1384
1403
|
case flag
|
|
1385
1404
|
when :cache, :check, :clean, :init, :install, :lock, :pack, :package, :platform
|
|
1386
1405
|
pre = true
|
|
@@ -1426,7 +1445,8 @@ module Squared
|
|
|
1426
1445
|
flag
|
|
1427
1446
|
end),
|
|
1428
1447
|
cmd,
|
|
1429
|
-
project: self, no: OPT_BUNDLE[:no][flag],
|
|
1448
|
+
project: self, strict: strict?, no: OPT_BUNDLE[:no][flag],
|
|
1449
|
+
args: flag == :exec || flag == :config)
|
|
1430
1450
|
op.concat(args) unless pre
|
|
1431
1451
|
output = false
|
|
1432
1452
|
case flag
|
|
@@ -1437,7 +1457,7 @@ module Squared
|
|
|
1437
1457
|
a = op.dup
|
|
1438
1458
|
b, c = op.slice!(0, 2)
|
|
1439
1459
|
d = op.arg?('global', 'local')
|
|
1440
|
-
getname = -> { op <<
|
|
1460
|
+
getname = -> { b ? op << b : op.readline('Enter name') }
|
|
1441
1461
|
case pre
|
|
1442
1462
|
when 'get'
|
|
1443
1463
|
getname.call
|
|
@@ -1448,7 +1468,7 @@ module Squared
|
|
|
1448
1468
|
c = op.shift
|
|
1449
1469
|
end
|
|
1450
1470
|
getname.call
|
|
1451
|
-
op <<
|
|
1471
|
+
c ? op << c : op.readline('Enter value', quote: true)
|
|
1452
1472
|
output = true
|
|
1453
1473
|
when 'unset'
|
|
1454
1474
|
if d
|
|
@@ -1472,9 +1492,8 @@ module Squared
|
|
|
1472
1492
|
end
|
|
1473
1493
|
op.clear
|
|
1474
1494
|
else
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
output = val.start_with?('set', 'unset')
|
|
1495
|
+
output = op.readline('Enter arguments', 'list')
|
|
1496
|
+
.start_with?('set', 'unset')
|
|
1478
1497
|
end
|
|
1479
1498
|
when :plugin
|
|
1480
1499
|
case plu
|
|
@@ -1485,7 +1504,7 @@ module Squared
|
|
|
1485
1504
|
end
|
|
1486
1505
|
when :exec
|
|
1487
1506
|
if op.empty? || (op.remove(':') && op.append(quote: false))
|
|
1488
|
-
op
|
|
1507
|
+
op.readline('Enter arguments')
|
|
1489
1508
|
else
|
|
1490
1509
|
op.append(quote: false)
|
|
1491
1510
|
end
|
|
@@ -1509,7 +1528,7 @@ module Squared
|
|
|
1509
1528
|
|
|
1510
1529
|
def rake(*args, sync: true, banner: verbose?, with: nil, pass: PASS_RUBY[:rake], **kwargs)
|
|
1511
1530
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1512
|
-
op = OptionPartition.new(opts, OPT_RUBY[:rake], rake_session, project: self)
|
|
1531
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rake], rake_session, project: self, strict: strict?)
|
|
1513
1532
|
op.adjoin(quote_option('f', rakefile)) if rakefile && !op.arg?('f', 'rakefile')
|
|
1514
1533
|
op.concat(args)
|
|
1515
1534
|
op.append(escape: true)
|
|
@@ -1535,11 +1554,11 @@ module Squared
|
|
|
1535
1554
|
break if val == '--'
|
|
1536
1555
|
next unless exist?(val, type: 'f')
|
|
1537
1556
|
|
|
1538
|
-
args[index] = shell_quote
|
|
1557
|
+
args[index] = shell_quote basepath(val)
|
|
1539
1558
|
cmd.merge(args.slice!(0, index + 1))
|
|
1540
1559
|
break
|
|
1541
1560
|
end
|
|
1542
|
-
op = OptionPartition.new(opts, OPT_RUBY[:rdbg], cmd, project: self, first: [/\.rb$/])
|
|
1561
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rdbg], cmd, project: self, strict: strict?, first: [/\.rb$/])
|
|
1543
1562
|
op.concat(args)
|
|
1544
1563
|
op.append(quote: false, delim: true)
|
|
1545
1564
|
print_run(op, banner, **kwargs)
|
|
@@ -1555,7 +1574,7 @@ module Squared
|
|
|
1555
1574
|
end
|
|
1556
1575
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1557
1576
|
cmd, opts = rbs_session(opts: opts)
|
|
1558
|
-
op = OptionPartition.new(opts, [], cmd << flag, project: self)
|
|
1577
|
+
op = OptionPartition.new(opts, [], cmd << flag, project: self, strict: strict?)
|
|
1559
1578
|
case flag
|
|
1560
1579
|
when :prototype
|
|
1561
1580
|
sig = args.shift
|
|
@@ -1598,7 +1617,7 @@ module Squared
|
|
|
1598
1617
|
|
|
1599
1618
|
def rubocop(*args, sync: true, banner: verbose?, with: nil, pass: PASS_RUBY[:rubocop], **kwargs)
|
|
1600
1619
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1601
|
-
op = OptionPartition.new(opts, OPT_RUBY[:rubocop], session('rubocop'), project: self,
|
|
1620
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rubocop], session('rubocop'), project: self, strict: strict?,
|
|
1602
1621
|
no: OPT_RUBY[:no][:rubocop])
|
|
1603
1622
|
if @rubocopfile && !op.arg?('c', 'config') && !rootpath('.rubocop.yml', ascend: true).exist?
|
|
1604
1623
|
op.add_path(@rubocopfile, option: 'c')
|
|
@@ -1773,7 +1792,7 @@ module Squared
|
|
|
1773
1792
|
parse.call(target.resolve_feature_path(gemname)&.last)
|
|
1774
1793
|
end
|
|
1775
1794
|
unless gemdir || pwd_set { parse.call(`#{bundle_output('show', gemname)}`) }
|
|
1776
|
-
|
|
1795
|
+
raise Errno::ENOENT, 'gems home'
|
|
1777
1796
|
end
|
|
1778
1797
|
end
|
|
1779
1798
|
rescue => e
|
|
@@ -1792,7 +1811,8 @@ module Squared
|
|
|
1792
1811
|
private
|
|
1793
1812
|
|
|
1794
1813
|
def run_repl(*args, opts:, banner:, from:, delim: true, **kwargs)
|
|
1795
|
-
op = OptionPartition.new(opts, OPT_RUBY[from], session(from), project: self,
|
|
1814
|
+
op = OptionPartition.new(opts, OPT_RUBY[from], session(from), project: self, strict: strict?,
|
|
1815
|
+
first: [/\.rb$/])
|
|
1796
1816
|
r = []
|
|
1797
1817
|
r << 'bundler/setup' if !op.arg?('r') && bundle_load
|
|
1798
1818
|
r.concat(Array(kwargs[:name])) if kwargs[:name]
|
|
@@ -1825,7 +1845,7 @@ module Squared
|
|
|
1825
1845
|
def rbs_session(*cmd, opts: nil)
|
|
1826
1846
|
return session('rbs', *cmd) unless opts
|
|
1827
1847
|
|
|
1828
|
-
op = OptionPartition.new(opts, OPT_RUBY[:rbs], project: self)
|
|
1848
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rbs], project: self, strict: strict?)
|
|
1829
1849
|
[session('rbs', *op.to_a, *cmd), op.extras]
|
|
1830
1850
|
end
|
|
1831
1851
|
|