squared 0.4.14 → 0.5.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 +14 -58
- data/README.md +4 -4
- data/README.ruby.md +15 -12
- data/lib/squared/common/base.rb +7 -8
- data/lib/squared/common/format.rb +3 -9
- data/lib/squared/common/prompt.rb +36 -40
- data/lib/squared/common/shell.rb +13 -8
- data/lib/squared/common/system.rb +45 -48
- data/lib/squared/common/utils.rb +3 -19
- data/lib/squared/common.rb +2 -1
- data/lib/squared/config.rb +16 -16
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +27 -40
- data/lib/squared/workspace/project/base.rb +128 -196
- data/lib/squared/workspace/project/docker.rb +37 -38
- data/lib/squared/workspace/project/git.rb +113 -139
- data/lib/squared/workspace/project/node.rb +64 -49
- data/lib/squared/workspace/project/python.rb +57 -251
- data/lib/squared/workspace/project/ruby.rb +119 -139
- data/lib/squared/workspace/project/support/class.rb +73 -34
- data/lib/squared/workspace/project.rb +0 -10
- data/lib/squared/workspace/repo.rb +6 -7
- data/lib/squared/workspace/series.rb +8 -8
- data/lib/squared/workspace/support/data.rb +3 -2
- data/lib/squared/workspace.rb +1 -1
- data/squared.gemspec +1 -1
- metadata +2 -3
- data/lib/squared/common/class.rb +0 -110
@@ -94,6 +94,7 @@ module Squared
|
|
94
94
|
'add' => nil,
|
95
95
|
'run' => nil,
|
96
96
|
'exec' => nil,
|
97
|
+
'nvm' => nil,
|
97
98
|
'pack' => nil
|
98
99
|
})
|
99
100
|
|
@@ -134,7 +135,7 @@ module Squared
|
|
134
135
|
end
|
135
136
|
case save
|
136
137
|
when 'prod', 'dev', 'optional', 'peer'
|
137
|
-
packages = args.
|
138
|
+
packages = args.to_a.drop(1)
|
138
139
|
else
|
139
140
|
save = 'prod'
|
140
141
|
packages = args.to_a
|
@@ -145,10 +146,10 @@ module Squared
|
|
145
146
|
when 'run'
|
146
147
|
next if (list = read_scripts).empty?
|
147
148
|
|
148
|
-
format_desc action, nil,
|
149
|
+
format_desc action, nil, 'script,opts*|^index+|#,pattern*'
|
149
150
|
task action, [:script] do |_, args|
|
150
151
|
if args.script == '#'
|
151
|
-
format_list(list,
|
152
|
+
format_list(list, 'run[^N]', 'scripts', grep: args.extras, from: dependfile.to_s)
|
152
153
|
else
|
153
154
|
args = param_guard(action, 'script', args: args.to_a)
|
154
155
|
opts = []
|
@@ -185,7 +186,7 @@ module Squared
|
|
185
186
|
format_desc action, nil, 'pkg/cmd,opts*,args*'
|
186
187
|
task action, [:package] do |_, args|
|
187
188
|
if (package = args.package)
|
188
|
-
args = args.
|
189
|
+
args = args.to_a.drop(1)
|
189
190
|
if pnpm?
|
190
191
|
pre = ->(ch) { "-#{ch}" if (ch = args.delete(ch)) }
|
191
192
|
cmd = session 'pnpm', pre.call('r'), pre.call('c'), 'exec'
|
@@ -210,6 +211,17 @@ module Squared
|
|
210
211
|
end
|
211
212
|
run(from: :exec)
|
212
213
|
end
|
214
|
+
when 'nvm'
|
215
|
+
next unless ENV['NVM_DIR']
|
216
|
+
|
217
|
+
format_desc action, nil, 'version,args*'
|
218
|
+
task action, [:version] do |_, args|
|
219
|
+
version = param_guard(action, 'version', args: args, key: :version)
|
220
|
+
args = args.to_a.drop(1)
|
221
|
+
args << readline('Enter command', force: true) if args.empty?
|
222
|
+
args.prepend(File.join(ENV['NVM_DIR'], 'nvm-exec'))
|
223
|
+
run(args.join(' '), { 'NODE_VERSION' => version }, banner: false, from: :nvm)
|
224
|
+
end
|
213
225
|
when 'pack'
|
214
226
|
format_desc action, nil, 'opts*'
|
215
227
|
task action do |_, args|
|
@@ -226,7 +238,7 @@ module Squared
|
|
226
238
|
outdated flag, args.to_a
|
227
239
|
end
|
228
240
|
when 'package'
|
229
|
-
format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : '
|
241
|
+
format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : 'names*')
|
230
242
|
task flag do |_, args|
|
231
243
|
package flag, args.to_a
|
232
244
|
end
|
@@ -247,7 +259,7 @@ module Squared
|
|
247
259
|
format_desc(action, flag, 'otp?,dry-run?,public|restricted?', before: flag == :tag ? 'tag' : nil)
|
248
260
|
task flag do |_, args|
|
249
261
|
args = args.to_a
|
250
|
-
dryrun = true if args.delete('dry-run') || args.delete('
|
262
|
+
dryrun = true if args.delete('dry-run') || args.delete('d')
|
251
263
|
if args.delete('public') || args.delete('p')
|
252
264
|
access = 'public'
|
253
265
|
elsif args.delete('restricted') || args.delete('r')
|
@@ -336,15 +348,15 @@ module Squared
|
|
336
348
|
next unless from && dest&.directory?
|
337
349
|
|
338
350
|
from = path + from
|
339
|
-
glob =
|
351
|
+
glob = as_a(glob || '**/*')
|
340
352
|
target = []
|
341
353
|
if workspace
|
342
|
-
|
343
|
-
next unless
|
354
|
+
from.glob('*').each do |entry|
|
355
|
+
next unless entry.directory?
|
344
356
|
|
345
|
-
sub = if (proj = @workspace.find(
|
357
|
+
sub = if (proj = @workspace.find(entry))
|
346
358
|
proj.packagename
|
347
|
-
elsif (file =
|
359
|
+
elsif (file = entry + 'package.json').exist?
|
348
360
|
begin
|
349
361
|
doc = JSON.parse(file.read)
|
350
362
|
rescue StandardError => e
|
@@ -355,9 +367,9 @@ module Squared
|
|
355
367
|
end
|
356
368
|
end
|
357
369
|
if sub
|
358
|
-
target << [
|
370
|
+
target << [entry, dest.join(into, sub)]
|
359
371
|
else
|
360
|
-
log.debug message("package.json in \"#{
|
372
|
+
log.debug message("package.json in \"#{entry}\"", hint: 'not found')
|
361
373
|
end
|
362
374
|
end
|
363
375
|
else
|
@@ -402,7 +414,7 @@ module Squared
|
|
402
414
|
else
|
403
415
|
cmd << 'install'
|
404
416
|
end
|
405
|
-
|
417
|
+
option('public-hoist-pattern', ignore: false) do |val|
|
406
418
|
split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
|
407
419
|
end
|
408
420
|
cmd << '--ignore-workspace' if env('NODE_WORKSPACES', equals: '0')
|
@@ -448,7 +460,7 @@ module Squared
|
|
448
460
|
ret = on(:error, :outdated, e)
|
449
461
|
raise if exception && ret != true
|
450
462
|
end
|
451
|
-
warn log_message(Logger::WARN, e) if warning?
|
463
|
+
warn log_message(Logger::WARN, e, pass: true) if warning?
|
452
464
|
return
|
453
465
|
else
|
454
466
|
dep1 = json['dependencies'] || {}
|
@@ -532,7 +544,7 @@ module Squared
|
|
532
544
|
found.each_with_index do |item, i|
|
533
545
|
a, b, c, d, e = item
|
534
546
|
f = inter && (rev != :major || e || semmajor?(item[5], item[6]))
|
535
|
-
if f && !confirm_outdated(a, c, (d / 2.0).ceil, lock: e)
|
547
|
+
if f && !confirm_outdated(a, c, (d / 2.0).ceil, b, lock: e, col1: col1)
|
536
548
|
cur = -1
|
537
549
|
else
|
538
550
|
cur = modified
|
@@ -596,43 +608,49 @@ module Squared
|
|
596
608
|
end
|
597
609
|
|
598
610
|
def update(*)
|
599
|
-
package
|
611
|
+
package 'update'
|
600
612
|
end
|
601
613
|
|
602
614
|
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, dryrun: nil, access: nil)
|
603
|
-
if
|
604
|
-
|
615
|
+
if read_packagemanager(:private)
|
616
|
+
if warning?
|
617
|
+
warn log_message(Logger::WARN, 'invalid task "publish"', subject: name, hint: 'private', pass: true)
|
618
|
+
end
|
605
619
|
return
|
606
620
|
end
|
621
|
+
return unless version
|
622
|
+
|
607
623
|
cmd = session 'npm', 'publish'
|
624
|
+
dryrun = dryrun?('npm') if dryrun.nil?
|
608
625
|
cmd << basic_option('otp', otp) if otp ||= option('otp')
|
609
626
|
cmd << basic_option('tag', tag) if tag ||= option('tag')
|
610
627
|
cmd << basic_option('access', access) if access ||= option('access')
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
write_lines(out, banner: banner, sub: npmnotice + [
|
627
|
-
{ pat: /^(.+)(Tarball .+)$/, styles: color(:blue), index: 2 }
|
628
|
-
])
|
628
|
+
if verbose
|
629
|
+
if dryrun
|
630
|
+
cmd << '--dry-run'
|
631
|
+
else
|
632
|
+
log.info cmd.to_s
|
633
|
+
end
|
634
|
+
unless sync
|
635
|
+
on :first, :publish unless dryrun
|
636
|
+
pwd_set(from: :publish) do
|
637
|
+
require 'open3'
|
638
|
+
banner = format_banner cmd.to_s
|
639
|
+
Open3.popen2e(cmd.done) do |_, out|
|
640
|
+
write_lines(out, sub: npmnotice + [pat: /^(.+)(Tarball .+)$/, styles: color(:blue), index: 2],
|
641
|
+
banner: banner)
|
642
|
+
end
|
629
643
|
end
|
644
|
+
on :last, :publish unless dryrun
|
645
|
+
return
|
630
646
|
end
|
631
|
-
|
647
|
+
elsif dryrun
|
648
|
+
return
|
632
649
|
end
|
650
|
+
run(from: :publish, sync: sync)
|
633
651
|
end
|
634
652
|
|
635
|
-
def package(flag, opts = []
|
653
|
+
def package(flag, opts = [])
|
636
654
|
workspace.rev_clear(name)
|
637
655
|
if (yarn = dependtype(:yarn)) > 0
|
638
656
|
cmd = session 'yarn', if flag == :update
|
@@ -658,7 +676,6 @@ module Squared
|
|
658
676
|
list = OPT_NPM[:install_base] + OPT_NPM.fetch(flag, []) + OPT_NPM[:common]
|
659
677
|
list.concat(OPT_NPM[:install_as]) unless flag == :dedupe
|
660
678
|
no = OPT_NPM[:install_no]
|
661
|
-
cmd << '--save=true' if option('save')
|
662
679
|
end
|
663
680
|
op = OptionPartition.new(opts, list, cmd, no: no, project: self)
|
664
681
|
op.each do |opt|
|
@@ -683,7 +700,7 @@ module Squared
|
|
683
700
|
end
|
684
701
|
op.clear(errors: true)
|
685
702
|
end
|
686
|
-
run(from:
|
703
|
+
run(from: :"package:#{flag}")
|
687
704
|
end
|
688
705
|
|
689
706
|
def bump(flag, val = nil)
|
@@ -774,9 +791,9 @@ module Squared
|
|
774
791
|
if script
|
775
792
|
ret = session dependbin, 'run'
|
776
793
|
raise_error("#{dependbin} run: given #{target}", hint: from) unless append_any(target, build: true)
|
777
|
-
append_any opts
|
794
|
+
append_any opts
|
778
795
|
append_loglevel
|
779
|
-
append_any(args, delim: true)
|
796
|
+
append_any(args, delim: true)
|
780
797
|
ret
|
781
798
|
else
|
782
799
|
case target
|
@@ -900,11 +917,9 @@ module Squared
|
|
900
917
|
@pm[:_] = false
|
901
918
|
nil
|
902
919
|
else
|
903
|
-
if key
|
904
|
-
|
905
|
-
|
906
|
-
ret
|
907
|
-
end
|
920
|
+
return @pm[key] if key
|
921
|
+
|
922
|
+
!(ret = @pm[:_]) || (version && ret[ret.index('@') + 1..-1] < version) ? nil : ret
|
908
923
|
end
|
909
924
|
|
910
925
|
def read_install
|
@@ -920,7 +935,7 @@ module Squared
|
|
920
935
|
end
|
921
936
|
|
922
937
|
def append_loglevel(target: @session)
|
923
|
-
level = env
|
938
|
+
level = env 'NODE_LOGLEVEL'
|
924
939
|
silent = !verbose || level == 'silent'
|
925
940
|
return unless silent || level
|
926
941
|
|