squared 0.5.7 → 0.5.8
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 +38 -0
- data/README.md +16 -12
- data/lib/squared/common/format.rb +3 -7
- data/lib/squared/common/utils.rb +5 -2
- 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 +80 -86
- data/lib/squared/workspace/project/docker.rb +15 -16
- data/lib/squared/workspace/project/git.rb +11 -13
- data/lib/squared/workspace/project/node.rb +22 -26
- data/lib/squared/workspace/project/python.rb +20 -28
- data/lib/squared/workspace/project/ruby.rb +103 -103
- data/lib/squared/workspace/project/support/class.rb +184 -56
- data/lib/squared/workspace/series.rb +16 -18
- metadata +1 -1
@@ -104,11 +104,11 @@ module Squared
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def rev_timeutc(*keys)
|
107
|
-
rev_entry(*keys, val:
|
107
|
+
rev_entry(*keys, val: time_epoch)
|
108
108
|
end
|
109
109
|
|
110
110
|
def rev_timesince(*keys, clock: false)
|
111
|
-
epoch =
|
111
|
+
epoch = time_epoch - rev_entry(*keys).to_i
|
112
112
|
rescue StandardError
|
113
113
|
nil
|
114
114
|
else
|
@@ -1236,10 +1236,10 @@ module Squared
|
|
1236
1236
|
return
|
1237
1237
|
end
|
1238
1238
|
end
|
1239
|
-
start =
|
1239
|
+
start = time_epoch
|
1240
1240
|
build(@output, sync: sync, from: :'git:revbuild')
|
1241
1241
|
rescue StandardError => e
|
1242
|
-
|
1242
|
+
print_error(e, pass: true)
|
1243
1243
|
else
|
1244
1244
|
print_status(name, subject: 'revbuild', start: start, from: :completed)
|
1245
1245
|
workspace.rev_write(name, { 'revision' => sha, 'files' => status_digest(*args, **kwargs) },
|
@@ -1601,9 +1601,7 @@ module Squared
|
|
1601
1601
|
end
|
1602
1602
|
on :last, from
|
1603
1603
|
end
|
1604
|
-
if ret == 0
|
1605
|
-
warn log_message(Logger::WARN, name, 'no ref found', subject: 'branch', hint: 'head', pass: true)
|
1606
|
-
end
|
1604
|
+
print_error(name, 'no ref found', subject: 'branch', hint: 'head', pass: true) if ret == 0
|
1607
1605
|
return
|
1608
1606
|
end
|
1609
1607
|
return unless success?(source(stdout: stdout))
|
@@ -1746,8 +1744,8 @@ module Squared
|
|
1746
1744
|
end)
|
1747
1745
|
case flag
|
1748
1746
|
when :blame
|
1749
|
-
raise_error 'no file found' unless (n = op.index { |s| (
|
1750
|
-
op << '--' << shell_quote(
|
1747
|
+
raise_error 'no file found' unless (n = op.index { |s| basepath(s).file? })
|
1748
|
+
op << '--' << shell_quote(basepath(op.delete_at(n)))
|
1751
1749
|
op.clear
|
1752
1750
|
when :revert
|
1753
1751
|
if VAL_GIT[:rebase][:send].any? { |val| op.arg?(val) }
|
@@ -1950,7 +1948,7 @@ module Squared
|
|
1950
1948
|
next if !glob.empty? && glob.none? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
|
1951
1949
|
next if !pass.empty? && pass.any? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
|
1952
1950
|
|
1953
|
-
ret[file] = algorithm.hexdigest(File.read(
|
1951
|
+
ret[file] = algorithm.hexdigest(File.read(basepath(file)))
|
1954
1952
|
end
|
1955
1953
|
ret
|
1956
1954
|
end
|
@@ -1982,7 +1980,7 @@ module Squared
|
|
1982
1980
|
when 'recurse-submodules'
|
1983
1981
|
op.append?($1, $2, type: :basic)
|
1984
1982
|
when 'refspec'
|
1985
|
-
refspec <<
|
1983
|
+
refspec << shell_quote($2)
|
1986
1984
|
end
|
1987
1985
|
elsif op.arg?('multiple')
|
1988
1986
|
op.found << opt
|
@@ -2000,12 +1998,12 @@ module Squared
|
|
2000
1998
|
end
|
2001
1999
|
op.delete('--all')
|
2002
2000
|
elsif op.arg?('multiple')
|
2003
|
-
op.
|
2001
|
+
op.add_quote(*op.found)
|
2004
2002
|
return
|
2005
2003
|
elsif option('all')
|
2006
2004
|
op << '--all'
|
2007
2005
|
end
|
2008
|
-
op.clear(errors: true, subject: flag
|
2006
|
+
op.clear(errors: true, subject: flag) if flag
|
2009
2007
|
end
|
2010
2008
|
|
2011
2009
|
def append_commit(*val, target: @session, head: false)
|
@@ -5,7 +5,7 @@ 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,
|
8
|
+
common: %w[dry-run=!? include-workspace-root=!? loglevel=b workspaces=!? w|workspace=v].freeze,
|
9
9
|
install: %w[prefer-dedupe=!? package-lock-only=!? audit=! bin-links=! cpu=b fund=! libc=b os=b
|
10
10
|
package-lock=!].freeze,
|
11
11
|
install_base: %w[ignore-scripts=!? install-links=!? strict-peer-deps=!? include=b omit=b
|
@@ -109,7 +109,7 @@ module Squared
|
|
109
109
|
initialize_build(Node.ref, prod: prod?, **kwargs)
|
110
110
|
initialize_env(**kwargs)
|
111
111
|
end
|
112
|
-
@dependfile =
|
112
|
+
@dependfile = basepath 'package.json'
|
113
113
|
@pm = { __: init }
|
114
114
|
end
|
115
115
|
|
@@ -268,11 +268,6 @@ module Squared
|
|
268
268
|
otp = args.first
|
269
269
|
else
|
270
270
|
tag, otp = param_guard(action, flag, args: args)
|
271
|
-
unless SEM_VER.match?(tag)
|
272
|
-
a = sub_style(project, styles: theme[:active])
|
273
|
-
b = sub_style(tag, styles: theme[:inline])
|
274
|
-
exit 1 unless confirm("Publish #{a}@#{b}?", 'N')
|
275
|
-
end
|
276
271
|
end
|
277
272
|
publish(flag, otp: otp, tag: tag, dryrun: dryrun, access: access)
|
278
273
|
end
|
@@ -379,12 +374,10 @@ module Squared
|
|
379
374
|
target.mkpath
|
380
375
|
subdir << target.to_s
|
381
376
|
end
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
errors += 1
|
387
|
-
end
|
377
|
+
FileUtils.cp(basepath(s), dest, verbose: verbose.is_a?(Numeric) && verbose > 0)
|
378
|
+
rescue StandardError => e
|
379
|
+
print_error e
|
380
|
+
errors += 1
|
388
381
|
end
|
389
382
|
rescue StandardError => e
|
390
383
|
on_error e, :copy
|
@@ -395,7 +388,7 @@ module Squared
|
|
395
388
|
end
|
396
389
|
glob = Array(glob || '**/*')
|
397
390
|
target = []
|
398
|
-
from =
|
391
|
+
from = basepath from
|
399
392
|
if workspace
|
400
393
|
from.glob('*').each do |entry|
|
401
394
|
next unless entry.directory?
|
@@ -423,11 +416,9 @@ module Squared
|
|
423
416
|
end
|
424
417
|
target.each do |src, to|
|
425
418
|
glob.each { |val| log.info "cp #{from + val} #{to}" }
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
on_error e, :copy
|
430
|
-
end
|
419
|
+
copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbose)
|
420
|
+
rescue StandardError => e
|
421
|
+
on_error e, :copy
|
431
422
|
end
|
432
423
|
end
|
433
424
|
on :last, :copy
|
@@ -480,7 +471,7 @@ module Squared
|
|
480
471
|
if flag == :add
|
481
472
|
cmd << "--save-#{save}"
|
482
473
|
cmd << '--save-exact' if exact
|
483
|
-
cmd.merge(packages.map { |pkg|
|
474
|
+
cmd.merge(packages.map { |pkg| shell_quote(pkg) })
|
484
475
|
end
|
485
476
|
cmd << '--workspaces=false' if env('NODE_WORKSPACES', equals: '0')
|
486
477
|
cmd << '--package-lock=false' if option('package-lock', equals: '0')
|
@@ -663,14 +654,19 @@ module Squared
|
|
663
654
|
end
|
664
655
|
|
665
656
|
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil)
|
666
|
-
|
667
|
-
|
657
|
+
unless version && !read_packagemanager(:private)
|
658
|
+
print_error('invalid task "publish"', subject: name, hint: version ? 'private' : nil)
|
668
659
|
return
|
669
660
|
end
|
670
661
|
cmd = session 'npm', 'publish'
|
671
662
|
cmd << basic_option('otp', otp) if otp ||= option('otp')
|
672
|
-
cmd << basic_option('tag', tag) if tag ||= option('tag')
|
673
|
-
|
663
|
+
cmd << basic_option('tag', tag.tr(' ', '-')) if tag ||= option('tag')
|
664
|
+
case access || option('access')
|
665
|
+
when 'p', 'public'
|
666
|
+
cmd << '--access=public'
|
667
|
+
when 'r', 'restricted'
|
668
|
+
cmd << '--access=restricted'
|
669
|
+
end
|
674
670
|
dryrun ||= dryrun?('npm')
|
675
671
|
if dryrun
|
676
672
|
cmd << '--dry-run'
|
@@ -727,7 +723,7 @@ module Squared
|
|
727
723
|
if opt =~ op.values
|
728
724
|
case $1
|
729
725
|
when 'w', 'workspace'
|
730
|
-
op << ($2.match?(%r{[\\/]}) ? quote_option($1,
|
726
|
+
op << ($2.match?(%r{[\\/]}) ? quote_option($1, basepath($2)) : shell_option($1, $2))
|
731
727
|
end
|
732
728
|
elsif opt.include?('=')
|
733
729
|
op.errors << opt
|
@@ -819,7 +815,7 @@ module Squared
|
|
819
815
|
|
820
816
|
case $1
|
821
817
|
when 'w', 'workspace'
|
822
|
-
op << ($2.match?(%r{[\\/]}) ? quote_option($1,
|
818
|
+
op << ($2.match?(%r{[\\/]}) ? quote_option($1, basepath($2)) : shell_option($1, $2))
|
823
819
|
op.found << opt
|
824
820
|
end
|
825
821
|
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.prepend('upgrade')
|
250
|
-
args.append('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*"
|
@@ -360,7 +357,7 @@ module Squared
|
|
360
357
|
when :user
|
361
358
|
cmd << '--user'
|
362
359
|
when :target
|
363
|
-
cmd << quote_option('target',
|
360
|
+
cmd << quote_option('target', basepath(target))
|
364
361
|
when :force
|
365
362
|
cmd << '--force-reinstall'
|
366
363
|
end
|
@@ -483,11 +480,7 @@ module Squared
|
|
483
480
|
cmd << '--user' if user
|
484
481
|
cmd << basic_option('upgrade-strategy', strategy) if strategy
|
485
482
|
append_value out
|
486
|
-
if workspace.windows?
|
487
|
-
pip = cmd.to_a.drop(1)
|
488
|
-
cmd = python_session '-m pip'
|
489
|
-
cmd.merge(pip)
|
490
|
-
end
|
483
|
+
python_session('-m pip', *cmd.to_a.drop(1)) if workspace.windows?
|
491
484
|
end
|
492
485
|
run(from: :install)
|
493
486
|
end
|
@@ -524,7 +517,7 @@ module Squared
|
|
524
517
|
if op.arg?(*args)
|
525
518
|
op.push(srcdir)
|
526
519
|
else
|
527
|
-
op << quote_option(args.last,
|
520
|
+
op << quote_option(args.last, basepath(srcdir))
|
528
521
|
end
|
529
522
|
srcdir = nil
|
530
523
|
end
|
@@ -558,7 +551,7 @@ module Squared
|
|
558
551
|
end
|
559
552
|
op = OptionPartition.new(opts, list, @session, project: self, single: singleopt(flag))
|
560
553
|
dist = lambda do
|
561
|
-
|
554
|
+
basepath('dist').tap do |dir|
|
562
555
|
raise_error('no source files found', hint: dir) unless dir.directory? && !dir.empty?
|
563
556
|
end
|
564
557
|
end
|
@@ -574,7 +567,7 @@ module Squared
|
|
574
567
|
if op.empty?
|
575
568
|
op.push("#{dist.call}/*")
|
576
569
|
else
|
577
|
-
op.map! { |val|
|
570
|
+
op.map! { |val| basepath(val) }
|
578
571
|
end
|
579
572
|
op.append
|
580
573
|
else
|
@@ -650,7 +643,7 @@ module Squared
|
|
650
643
|
|
651
644
|
def poetry_session(*cmd)
|
652
645
|
ret = session('poetry', *cmd, *preopts)
|
653
|
-
option('project', ignore: false) { |val| ret << quote_option('project',
|
646
|
+
option('project', ignore: false) { |val| ret << quote_option('project', basepath(val)) }
|
654
647
|
ret
|
655
648
|
end
|
656
649
|
|
@@ -671,7 +664,7 @@ module Squared
|
|
671
664
|
end
|
672
665
|
|
673
666
|
def append_pip(flag, opts, target: @session, from: nil)
|
674
|
-
|
667
|
+
unless from && !opts.empty?
|
675
668
|
append_global(target: target)
|
676
669
|
return []
|
677
670
|
end
|
@@ -695,11 +688,11 @@ module Squared
|
|
695
688
|
op << '--no-build-isolation' if option('build-isolation', equals: '0')
|
696
689
|
op.swap
|
697
690
|
if edit
|
698
|
-
edit =
|
691
|
+
edit = basepath(edit) unless %r{\A[a-z]+(?:\+[a-z]+)?://}i.match?(edit)
|
699
692
|
if flag == :editable
|
700
693
|
op.push(edit)
|
701
694
|
else
|
702
|
-
|
695
|
+
op << quote_option('e', edit)
|
703
696
|
end
|
704
697
|
end
|
705
698
|
case flag
|
@@ -710,25 +703,25 @@ module Squared
|
|
710
703
|
[]
|
711
704
|
end
|
712
705
|
else
|
713
|
-
|
706
|
+
op.extras
|
714
707
|
end
|
715
708
|
end
|
716
709
|
|
717
710
|
def append_editable(target: @session)
|
718
|
-
return if requirements?
|
711
|
+
return if requirements? && editable == '.'
|
719
712
|
|
720
713
|
if (val = option('editable', 'e', target: target, ignore: false))
|
721
|
-
|
714
|
+
OptionPartition.delete_key(target, 'e', 'editable')
|
722
715
|
case val
|
723
716
|
when '0', 'false'
|
724
717
|
return
|
725
718
|
else
|
726
|
-
val =
|
719
|
+
val = basepath val
|
727
720
|
end
|
728
721
|
elsif session_arg?('e', 'editable', target: target) || !(val = editable)
|
729
722
|
return
|
730
723
|
end
|
731
|
-
target << quote_option('e', val)
|
724
|
+
target << quote_option('e', basepath(val))
|
732
725
|
end
|
733
726
|
|
734
727
|
def append_global(target: @session)
|
@@ -737,11 +730,11 @@ module Squared
|
|
737
730
|
when '0', 'false'
|
738
731
|
'--no-cache-dir'
|
739
732
|
else
|
740
|
-
quote_option('cache-dir',
|
733
|
+
quote_option('cache-dir', basepath(val))
|
741
734
|
end
|
742
735
|
end
|
743
736
|
option('proxy', target: target) { |val| target << shell_option('proxy', val) }
|
744
|
-
option('python', target: target) { |val| target << quote_option('python',
|
737
|
+
option('python', target: target) { |val| target << quote_option('python', basepath(val)) }
|
745
738
|
append_nocolor(target: target)
|
746
739
|
end
|
747
740
|
|
@@ -863,7 +856,7 @@ module Squared
|
|
863
856
|
when '.', Pathname
|
864
857
|
val
|
865
858
|
when String
|
866
|
-
Pathname.new(
|
859
|
+
Pathname.new(val) unless val.empty?
|
867
860
|
end
|
868
861
|
end
|
869
862
|
|
@@ -874,8 +867,7 @@ module Squared
|
|
874
867
|
val, *opts = val
|
875
868
|
@venvopts = opts
|
876
869
|
end
|
877
|
-
@venv =
|
878
|
-
@venv = @path + @venv unless @venv.absolute?
|
870
|
+
@venv = basepath(val)
|
879
871
|
if projectpath?(@venv)
|
880
872
|
if @venv.exist?
|
881
873
|
log.debug "venv found: #{@venv}"
|