squared 0.7.14 → 0.8.0
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 +44 -196
- data/README.md +38 -35
- data/lib/squared/common/base.rb +0 -9
- data/lib/squared/common/format.rb +5 -14
- data/lib/squared/common/prompt.rb +30 -32
- data/lib/squared/common/shell.rb +11 -11
- data/lib/squared/common/system.rb +9 -19
- data/lib/squared/common/utils.rb +19 -23
- data/lib/squared/config.rb +5 -12
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +99 -31
- data/lib/squared/workspace/project/base.rb +86 -106
- data/lib/squared/workspace/project/docker.rb +85 -117
- data/lib/squared/workspace/project/git.rb +187 -94
- data/lib/squared/workspace/project/node.rb +184 -177
- data/lib/squared/workspace/project/python.rb +73 -73
- data/lib/squared/workspace/project/ruby.rb +63 -68
- data/lib/squared/workspace/project/support/class.rb +2 -2
- data/lib/squared/workspace/project/support/optionpartition.rb +17 -42
- data/lib/squared/workspace/project/support/utils.rb +15 -22
- data/lib/squared/workspace/repo.rb +10 -7
- data/lib/squared/workspace/series.rb +12 -5
- metadata +2 -2
|
@@ -36,9 +36,9 @@ module Squared
|
|
|
36
36
|
root-user-action=b t|target=p upgrade-strategy=b].freeze,
|
|
37
37
|
install_a: %w[no-index pre prefer-binary all-releases=b extra-index-url=q f|find-links=q i|index-url=q
|
|
38
38
|
no-binary=q only-binary=q only-final=b].freeze,
|
|
39
|
-
install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps require-hashes
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
install_b: %w[build-constraint check-build-dependencies no-build-isolation no-clean no-deps require-hashes
|
|
40
|
+
use-pep517 c|constraint=p group=q progress-bar=b r|requirement=p requirements-from-script=p
|
|
41
|
+
src=p].freeze,
|
|
42
42
|
install_c: %w[C|config-settings=q e|editable=v].freeze,
|
|
43
43
|
install_d: %w[ignore-requires-python uploaded-prior-to=q].freeze,
|
|
44
44
|
hash: %w[a|algorithm].freeze,
|
|
@@ -79,12 +79,12 @@ module Squared
|
|
|
79
79
|
OPT_MESON = {
|
|
80
80
|
build: %w[D=q clearcache debug errorlogs fatal-meson-warnings pkgconfig.relocatable prefer-static
|
|
81
81
|
python.allow-limited-api reconfigure stdsplit strip vsenv werror wipe auto-features=b backend=b
|
|
82
|
-
bindir=
|
|
83
|
-
cross-file=p datadir=
|
|
84
|
-
includedir=
|
|
85
|
-
localstatedir=
|
|
86
|
-
python.bytecompile=
|
|
87
|
-
sharedstatedir=
|
|
82
|
+
bindir=p build.cmake-prefix-path=p build.pkg-config-path=p buildtype=b cmake-prefix-path=p
|
|
83
|
+
cross-file=p datadir=p default-library=b default-both-libraries=b force-fallback-for=q genvslite=b
|
|
84
|
+
includedir=p infodir=p install-umask=b layout=b libdir=p libexecdir=p licensedir=p localedir=p
|
|
85
|
+
localstatedir=p mandir=p native-file=p optimization=b pkg-config-path=p prefix=p
|
|
86
|
+
python.bytecompile=i python.platlibdir=p python.purelibdir=p python.install-env=b sbindir=p
|
|
87
|
+
sharedstatedir=p sysconfdir=p unity=b unity-size=i warnlevel=b wrap-mode=b].freeze,
|
|
88
88
|
compile: %w[clean v|verbose j|jobs=i l|load-average=b ninja-args=q vs-args=q xcode-args=q].freeze
|
|
89
89
|
}.freeze
|
|
90
90
|
PASS_PYTHON = {
|
|
@@ -105,7 +105,7 @@ module Squared
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def bannerargs
|
|
108
|
-
%i[version dependfile venv].freeze
|
|
108
|
+
%i[version dependfile venv editable].freeze
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def venv?
|
|
@@ -181,8 +181,8 @@ module Squared
|
|
|
181
181
|
format_desc action, nil, "script+|#{indexchar}index+|#,pattern*"
|
|
182
182
|
task action, [:command] do |_, args|
|
|
183
183
|
found = 0
|
|
184
|
-
%w[tool.poetry tool.pdm project].each_with_index do |table, i|
|
|
185
|
-
next if (list = read_pyproject(
|
|
184
|
+
%w[tool.poetry.scripts tool.pdm.scripts project.scripts].each_with_index do |table, i|
|
|
185
|
+
next if (list = read_pyproject(table)).empty?
|
|
186
186
|
|
|
187
187
|
if args.command == '#'
|
|
188
188
|
format_list(list, "run[#{indexchar}N]", 'scripts', grep: args.extras, from: pyprojectfile)
|
|
@@ -208,7 +208,7 @@ module Squared
|
|
|
208
208
|
log.warn "run script #{n} of #{list.size}".subhint('out of range')
|
|
209
209
|
end
|
|
210
210
|
else
|
|
211
|
-
case
|
|
211
|
+
case i
|
|
212
212
|
when 0
|
|
213
213
|
found |= 1
|
|
214
214
|
run(session_output('poetry', 'run', val), from: :run)
|
|
@@ -216,7 +216,7 @@ module Squared
|
|
|
216
216
|
found |= 1
|
|
217
217
|
run(pdm_session('run', val), from: :run)
|
|
218
218
|
else
|
|
219
|
-
raise
|
|
219
|
+
raise message('script', val) if exception?
|
|
220
220
|
|
|
221
221
|
found |= 2
|
|
222
222
|
log.warn "run script \"#{val}\"".subhint('not indexed')
|
|
@@ -265,10 +265,10 @@ module Squared
|
|
|
265
265
|
|
|
266
266
|
format_desc action, flag, 'c/reate?,d/epend?,opts*'
|
|
267
267
|
task flag do |_, args|
|
|
268
|
-
|
|
269
|
-
rm_rf(venv, verbose:
|
|
270
|
-
venv_init if has_value!(
|
|
271
|
-
depend :force,
|
|
268
|
+
opts = args.to_a
|
|
269
|
+
rm_rf(venv, verbose: !silent?)
|
|
270
|
+
venv_init if has_value!(opts, 'c', 'create')
|
|
271
|
+
depend :force, opts if has_value!(opts, 'd', 'depend')
|
|
272
272
|
end
|
|
273
273
|
when :exec
|
|
274
274
|
format_desc action, flag, 'command,args*'
|
|
@@ -276,7 +276,7 @@ module Squared
|
|
|
276
276
|
args = args.to_a
|
|
277
277
|
if args.empty?
|
|
278
278
|
args = readline('Enter command', force: true).split(' ', 2)
|
|
279
|
-
elsif args.size == 1 && option('interactive', notequals: '0', prefix:
|
|
279
|
+
elsif args.size == 1 && option('interactive', notequals: '0', prefix: ref)
|
|
280
280
|
args << readline('Enter arguments', force: false) unless args.first.include?(' ')
|
|
281
281
|
end
|
|
282
282
|
venv_init
|
|
@@ -297,7 +297,7 @@ module Squared
|
|
|
297
297
|
install flag, ['upgrade', *args.to_a, 'pip']
|
|
298
298
|
end
|
|
299
299
|
when :freeze
|
|
300
|
-
format_desc action, flag, "file?=#{DEP_PYTHON[4]},u/
|
|
300
|
+
format_desc action, flag, "file?=#{DEP_PYTHON[4]},u/uninstall,opts*"
|
|
301
301
|
task flag do |_, args|
|
|
302
302
|
opts = args.to_a
|
|
303
303
|
if has_value!(opts, 'u', 'uninstall')
|
|
@@ -312,7 +312,7 @@ module Squared
|
|
|
312
312
|
end
|
|
313
313
|
file = pip(flag, opts: opts, banner: requirement.nil?, requirement: requirement)
|
|
314
314
|
puts File.read(file) unless silent?
|
|
315
|
-
if requirement && confirm_basic('Uninstall?', file
|
|
315
|
+
if requirement && confirm_basic('Uninstall?', file)
|
|
316
316
|
pip(:uninstall, opts: ['y', "r=#{shell_quote(file)}"])
|
|
317
317
|
end
|
|
318
318
|
end
|
|
@@ -346,18 +346,18 @@ module Squared
|
|
|
346
346
|
case flag
|
|
347
347
|
when :upgrade
|
|
348
348
|
task flag, [:strategy] do |_, args|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
349
|
+
install flag, (case args.strategy
|
|
350
|
+
when 'eager'
|
|
351
|
+
'eager'
|
|
352
|
+
when /^only-if|needed$/
|
|
353
|
+
'only-if-needed'
|
|
354
|
+
end.yield_self do |val|
|
|
355
|
+
if val
|
|
356
|
+
args.extras << "upgrade-strategy=#{val}"
|
|
357
|
+
else
|
|
358
|
+
args.to_a
|
|
359
|
+
end
|
|
360
|
+
end)
|
|
361
361
|
end
|
|
362
362
|
when :requirement, :target
|
|
363
363
|
task flag, [:path] do |_, args|
|
|
@@ -391,7 +391,7 @@ module Squared
|
|
|
391
391
|
else 'outdir?,srcdir?'
|
|
392
392
|
end)
|
|
393
393
|
task flag do |_, args|
|
|
394
|
-
|
|
394
|
+
build_ flag, args.to_a
|
|
395
395
|
end
|
|
396
396
|
break if be
|
|
397
397
|
when 'publish'
|
|
@@ -438,9 +438,9 @@ module Squared
|
|
|
438
438
|
if flag
|
|
439
439
|
cmd << case flag
|
|
440
440
|
when :requirement, :target
|
|
441
|
-
quote_option
|
|
441
|
+
quote_option flag, basepath(target)
|
|
442
442
|
else
|
|
443
|
-
shell_option
|
|
443
|
+
shell_option flag
|
|
444
444
|
end
|
|
445
445
|
op = append_pip flag, opts, pipopts(:install)
|
|
446
446
|
op.clear
|
|
@@ -482,7 +482,7 @@ module Squared
|
|
|
482
482
|
:patch
|
|
483
483
|
end
|
|
484
484
|
end
|
|
485
|
-
'--not-required' if option('not-required', notequals: '0')
|
|
485
|
+
'--not-required' if option('not-required', notequals: '0') && !env('PYTHON_DEFAULT')
|
|
486
486
|
end
|
|
487
487
|
cmd << '--local' if option('l', 'local')
|
|
488
488
|
append_global
|
|
@@ -607,22 +607,23 @@ module Squared
|
|
|
607
607
|
project: self, strict: strict?, single: singleopt(flag))
|
|
608
608
|
else
|
|
609
609
|
op = append_pip(flag, opts, pipopts(:install), target: pip_session('install'))
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
610
|
+
end
|
|
611
|
+
case flag
|
|
612
|
+
when :editable
|
|
613
|
+
op << quote_option('e', op.pop || editable || '.')
|
|
614
|
+
op.clear
|
|
615
|
+
when :user, :upgrade
|
|
616
|
+
op.concat(packages)
|
|
617
|
+
raise ArgumentError, message('no packages listed', hint: flag) if op.empty?
|
|
618
|
+
|
|
619
|
+
op << "--#{flag}"
|
|
620
|
+
op.append
|
|
621
|
+
python_session('-m pip', *op.to_a.drop(1)) if workspace.windows?
|
|
621
622
|
end
|
|
622
623
|
run(banner: banner, from: :install)
|
|
623
624
|
end
|
|
624
625
|
|
|
625
|
-
def
|
|
626
|
+
def build_(flag, opts = [], outdir: nil, srcdir: nil)
|
|
626
627
|
list = case flag
|
|
627
628
|
when :poetry
|
|
628
629
|
cmd = poetry_session 'build'
|
|
@@ -685,7 +686,6 @@ module Squared
|
|
|
685
686
|
run(from: from)
|
|
686
687
|
end
|
|
687
688
|
end
|
|
688
|
-
alias build_ build!
|
|
689
689
|
|
|
690
690
|
def publish(flag, opts = [], test: false)
|
|
691
691
|
list = case flag
|
|
@@ -706,12 +706,9 @@ module Squared
|
|
|
706
706
|
dist = lambda do
|
|
707
707
|
dir = basepath 'dist'
|
|
708
708
|
return dir if dir.directory? && !dir.empty?
|
|
709
|
+
raise message('no source to publish', hint: dir) if dir.exist?
|
|
709
710
|
|
|
710
|
-
|
|
711
|
-
raise_error 'no source to publish', hint: dir
|
|
712
|
-
else
|
|
713
|
-
raise_error Errno::ENOENT, dir, hint: 'publish'
|
|
714
|
-
end
|
|
711
|
+
raise Errno::ENOENT, message(dir, hint: 'publish')
|
|
715
712
|
end
|
|
716
713
|
if test
|
|
717
714
|
if op.arg?('r', flag == :hatch ? 'repo' : 'repository')
|
|
@@ -726,7 +723,7 @@ module Squared
|
|
|
726
723
|
op.clear(pass: false)
|
|
727
724
|
else
|
|
728
725
|
if op.empty?
|
|
729
|
-
op
|
|
726
|
+
op << "#{dist.call}/*"
|
|
730
727
|
else
|
|
731
728
|
op.add_path
|
|
732
729
|
end
|
|
@@ -738,7 +735,7 @@ module Squared
|
|
|
738
735
|
op = OptionPartition.new(session_opts(with, args: args, kwargs: kwargs, pass: pass), OPT_PYTHON[:common],
|
|
739
736
|
session('python', path: !venv?),
|
|
740
737
|
project: self, strict: strict?, multiple: [/^-c/], single: singleopt(:python),
|
|
741
|
-
|
|
738
|
+
args: true, stdin: true)
|
|
742
739
|
op.concat(args)
|
|
743
740
|
if op.include?('-')
|
|
744
741
|
op.exist?(add: true)
|
|
@@ -772,7 +769,7 @@ module Squared
|
|
|
772
769
|
when :install, :uninstall
|
|
773
770
|
op << '.' if installable? && !op.arg?('r', 'requirement')
|
|
774
771
|
else
|
|
775
|
-
|
|
772
|
+
raise ArgumentError, message('no packages listed', hint: flag)
|
|
776
773
|
end
|
|
777
774
|
elsif flag == :install
|
|
778
775
|
op.append_any
|
|
@@ -795,27 +792,32 @@ module Squared
|
|
|
795
792
|
.clear
|
|
796
793
|
when :cache
|
|
797
794
|
op.concat(args)
|
|
798
|
-
|
|
795
|
+
raise message('no subcommand', hint: flag) if op.empty?
|
|
796
|
+
|
|
799
797
|
op << (action = op.shift)
|
|
800
798
|
case action
|
|
801
|
-
when 'dir', 'info', 'purge'
|
|
799
|
+
when 'dir', 'info', 'purge'
|
|
800
|
+
nil
|
|
802
801
|
when 'list', 'remove'
|
|
803
802
|
op.add_first(quote: true)
|
|
804
803
|
else
|
|
805
|
-
|
|
804
|
+
raise ArgumentError, message('unrecognized args', action, hint: flag)
|
|
806
805
|
end
|
|
807
806
|
op.clear
|
|
808
807
|
when :config
|
|
809
808
|
op.concat(args)
|
|
810
|
-
|
|
811
|
-
|
|
809
|
+
raise message('no subcommand', hint: flag) if op.empty?
|
|
810
|
+
|
|
811
|
+
action = op.shift
|
|
812
|
+
op << action
|
|
812
813
|
case action
|
|
813
|
-
when 'list', 'edit', 'debug'
|
|
814
|
+
when 'list', 'edit', 'debug'
|
|
815
|
+
nil
|
|
814
816
|
when 'get', 'unset', 'set'
|
|
815
817
|
op.add_first
|
|
816
818
|
op.add_first(quote: true, expect: true) if action == 'set'
|
|
817
819
|
else
|
|
818
|
-
|
|
820
|
+
raise ArgumentError, message('unrecognized args', action, hint: flag)
|
|
819
821
|
end
|
|
820
822
|
op.clear
|
|
821
823
|
when :hash
|
|
@@ -852,7 +854,7 @@ module Squared
|
|
|
852
854
|
def variable_set(key, *args, **, &blk)
|
|
853
855
|
if block_given?
|
|
854
856
|
case key
|
|
855
|
-
when :dependfile, :
|
|
857
|
+
when :dependfile, :venv
|
|
856
858
|
args = block_args args, &blk
|
|
857
859
|
end
|
|
858
860
|
end
|
|
@@ -869,8 +871,6 @@ module Squared
|
|
|
869
871
|
log.warn "variable_set: @dependfile=#{val}".subhint('not supported')
|
|
870
872
|
end
|
|
871
873
|
end
|
|
872
|
-
when :editable
|
|
873
|
-
editable_set args.first
|
|
874
874
|
when :venv
|
|
875
875
|
@venv = (basepath(*args) unless args.empty? || args.first.nil?)
|
|
876
876
|
else
|
|
@@ -937,8 +937,7 @@ module Squared
|
|
|
937
937
|
pre = preopts(quiet: quiet)
|
|
938
938
|
return session(name, *pre, *cmd, path: !venv?) unless opts
|
|
939
939
|
|
|
940
|
-
op = OptionPartition.new(opts, common, project: self, strict: strict?,
|
|
941
|
-
single: singleopt(name.to_sym))
|
|
940
|
+
op = OptionPartition.new(opts, common, project: self, strict: strict?, single: singleopt(name.to_sym))
|
|
942
941
|
[session(name, *pre, *op.to_a, *cmd, path: !venv?), op.extras]
|
|
943
942
|
end
|
|
944
943
|
|
|
@@ -1025,7 +1024,7 @@ module Squared
|
|
|
1025
1024
|
|
|
1026
1025
|
if found
|
|
1027
1026
|
line.chomp!($1) if line =~ /(?<=[\d"'{}\[\]]|true|false)(\s*#.*)$/
|
|
1028
|
-
break if line.match?(/^\s*\[(
|
|
1027
|
+
break if line.match?(/^\s*\[([\w.\-"' ]+|".+"|'.+')\]\s*$/)
|
|
1029
1028
|
|
|
1030
1029
|
if ch
|
|
1031
1030
|
val = line.rstrip
|
|
@@ -1090,7 +1089,8 @@ module Squared
|
|
|
1090
1089
|
/\A(?:v+|q+|b+|V+|O+)\z/
|
|
1091
1090
|
when :pdm, :poetry
|
|
1092
1091
|
/\Av+\z/
|
|
1093
|
-
when :twine, :meson
|
|
1092
|
+
when :twine, :meson
|
|
1093
|
+
nil
|
|
1094
1094
|
else
|
|
1095
1095
|
/\A(?:v+|q+)\z/
|
|
1096
1096
|
end
|
|
@@ -1128,7 +1128,7 @@ module Squared
|
|
|
1128
1128
|
end
|
|
1129
1129
|
|
|
1130
1130
|
def variables
|
|
1131
|
-
(super + %i[venv
|
|
1131
|
+
(super + %i[venv]).freeze
|
|
1132
1132
|
end
|
|
1133
1133
|
|
|
1134
1134
|
def runenv
|