squared 0.6.3 → 0.6.4
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 +32 -0
- data/README.md +2 -2
- data/lib/squared/common/format.rb +4 -0
- data/lib/squared/common/shell.rb +1 -0
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +2 -2
- data/lib/squared/workspace/project/base.rb +64 -27
- data/lib/squared/workspace/project/docker.rb +16 -22
- data/lib/squared/workspace/project/git.rb +21 -27
- data/lib/squared/workspace/project/node.rb +13 -9
- data/lib/squared/workspace/project/python.rb +71 -38
- data/lib/squared/workspace/project/ruby.rb +79 -49
- data/lib/squared/workspace/project/support/class.rb +12 -8
- data/lib/squared/workspace/project/support/optionpartition.rb +1 -1
- data/lib/squared/workspace/repo.rb +23 -5
- data/lib/squared/workspace/series.rb +17 -6
- data/lib/squared/workspace.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f66aceeba825bcfd6afd3b20e5c39431d94450639cc70e07c3c8c22725426595
|
|
4
|
+
data.tar.gz: b23a0282dbe08d322ed19931ddaa59be93c4b5caeb603fb90ca4283a0f195bb0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffa105272b8235dd427597c590d372d910edc40e2cd988dfe6b779355c2f036f32fdf6ec909d336cb84a7bf38db425e456a982b51cfad4d4fa499cb583382f27
|
|
7
|
+
data.tar.gz: cb767f0c63b833b4550199caf2d0fc2f2d98bda119e4f0c128de5e7083fe6da7813402a46aaabfabb0b19dd56c23f77d7732167673df2bf50996ca47c55d9fa0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.4] - 2025-11-16
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Python command outdated can hide non-upgradable packages.
|
|
8
|
+
- Ruby command outdated option dry-run was implemented.
|
|
9
|
+
- Ruby command outdated option interactive was implemented.
|
|
10
|
+
- Repo binary can be downloaded and run from any local directory.
|
|
11
|
+
- Python command outdated option dry-run was implemented.
|
|
12
|
+
- Common shell defined Array instance method quote!.
|
|
13
|
+
- Python command outdated option interactive was implemented.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Gem command outdated uses inline interactive prompts.
|
|
18
|
+
- Log messages with level INFO can be called without level argument.
|
|
19
|
+
- Project base attribute project was converted into an accessor.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Node command tsc did not accept a tsconfig or watch argument.
|
|
24
|
+
- Repo application tasks are not created on Windows.
|
|
25
|
+
- Repo module used conflicting REPO_URL with Repo application.
|
|
26
|
+
- Project task outdated did not check pass and only exclusions.
|
|
27
|
+
- Python command install did not include available options.
|
|
28
|
+
- Workspace static method resolve did nothing when given a String.
|
|
29
|
+
- Project base run command types did not include Struct.
|
|
30
|
+
|
|
3
31
|
## [0.6.3] - 2025-11-14
|
|
4
32
|
|
|
5
33
|
### Added
|
|
@@ -16,6 +44,9 @@
|
|
|
16
44
|
- Requiring individual project classes in Rakefile is optional.
|
|
17
45
|
- Application class uses static method register instead of series_wrap.
|
|
18
46
|
- Project support modules are required inside Base class module.
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
19
50
|
- Project graph print did not display parent and last child consequetively.
|
|
20
51
|
- Project outdated interactive prompts use exact column alignments.
|
|
21
52
|
|
|
@@ -1388,6 +1419,7 @@
|
|
|
1388
1419
|
|
|
1389
1420
|
- Changelog was created.
|
|
1390
1421
|
|
|
1422
|
+
[0.6.4]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.4
|
|
1391
1423
|
[0.6.3]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.3
|
|
1392
1424
|
[0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
|
|
1393
1425
|
[0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
|
data/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Workspace::Application.load_ref('lib/squared/workspace/project', gem: 'squared')
|
|
|
82
82
|
Workspace::Application
|
|
83
83
|
.new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
|
|
84
84
|
.banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
|
|
85
|
-
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "
|
|
85
|
+
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "prod"], install: "#{ENV["HOME"]}/.bin", ref: :node) # Repo (optional)
|
|
86
86
|
.run("rake install", ref: :ruby)
|
|
87
87
|
.depend(false, group: "default")
|
|
88
88
|
.clean("rake clean", group: "default")
|
|
@@ -792,7 +792,7 @@ REPO_DEV # pattern,0,1
|
|
|
792
792
|
REPO_PROD # pattern,0,1
|
|
793
793
|
REPO_WARN # 0,1
|
|
794
794
|
REPO_SYNC # 0,1
|
|
795
|
-
|
|
795
|
+
REPO_GIT # manifest repository
|
|
796
796
|
REPO_MANIFEST # e.g. latest,nightly,prod
|
|
797
797
|
REPO_GROUPS # e.g. base,prod,docs
|
|
798
798
|
REPO_STAGE # 0,1,2,3,4
|
|
@@ -189,6 +189,10 @@ module Squared
|
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
def log_message(level, *args, subject: nil, hint: nil, append: true, pass: false, color: ARG[:COLOR])
|
|
192
|
+
if args.empty?
|
|
193
|
+
args.concat(Array(level))
|
|
194
|
+
level = Logger::INFO
|
|
195
|
+
end
|
|
192
196
|
args = args.map(&:to_s)
|
|
193
197
|
if level.is_a?(::Numeric)
|
|
194
198
|
if append && respond_to?(:log)
|
data/lib/squared/common/shell.rb
CHANGED
data/lib/squared/version.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Squared
|
|
|
24
24
|
impl_series.base_set(obj)
|
|
25
25
|
else
|
|
26
26
|
kind_project.unshift(obj)
|
|
27
|
-
|
|
27
|
+
impl_series.extend_set(obj)
|
|
28
28
|
end
|
|
29
29
|
if (args = obj.batchargs)
|
|
30
30
|
impl_series.batch(*args)
|
|
@@ -628,7 +628,7 @@ module Squared
|
|
|
628
628
|
end
|
|
629
629
|
|
|
630
630
|
def task_include?(obj, key, ref = nil)
|
|
631
|
-
return false if
|
|
631
|
+
return false if series.exclude?(key)
|
|
632
632
|
|
|
633
633
|
task_base?(key) ? obj.has?(key, ref || baseref) : task_extend?(obj, key)
|
|
634
634
|
end
|
|
@@ -115,8 +115,9 @@ module Squared
|
|
|
115
115
|
'asdf' => %i[set exec current update latest where reshim]
|
|
116
116
|
})
|
|
117
117
|
|
|
118
|
-
attr_reader :name, :
|
|
118
|
+
attr_reader :name, :workspace, :path, :theme, :group, :parent, :children, :dependfile,
|
|
119
119
|
:exception, :pipe, :verbose, :global
|
|
120
|
+
attr_accessor :project
|
|
120
121
|
|
|
121
122
|
def initialize(workspace, path, name, *, group: nil, first: {}, last: {}, error: {}, common: ARG[:COMMON],
|
|
122
123
|
**kwargs)
|
|
@@ -559,10 +560,9 @@ module Squared
|
|
|
559
560
|
flags = append_hash(flags, target: []).join(' ') if flags.is_a?(Hash)
|
|
560
561
|
cmd = case opts
|
|
561
562
|
when Hash
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
.join(' ')
|
|
563
|
+
[cmd, flags].concat(append_hash(opts, target: [], build: true))
|
|
564
|
+
.compact
|
|
565
|
+
.join(' ')
|
|
566
566
|
when Enumerable
|
|
567
567
|
cmd = Array(cmd).concat(opts.to_a)
|
|
568
568
|
cmd.map! { |val| "#{val} #{flags}" } if flags
|
|
@@ -638,10 +638,10 @@ module Squared
|
|
|
638
638
|
case @clean
|
|
639
639
|
when Struct
|
|
640
640
|
if (val = instance_eval(&@clean.block) || @clean.run)
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
641
|
+
@clean = @clean.tap do
|
|
642
|
+
@clean = val
|
|
643
|
+
clean(*args, sync: sync, pass: true, **kwargs)
|
|
644
|
+
end
|
|
645
645
|
end
|
|
646
646
|
when String
|
|
647
647
|
run_s(@clean, sync: sync)
|
|
@@ -1865,19 +1865,12 @@ module Squared
|
|
|
1865
1865
|
end
|
|
1866
1866
|
|
|
1867
1867
|
def confirm_basic(msg, target, default = 'Y', style: :inline, **kwargs)
|
|
1868
|
-
confirm("#{msg} [#{sub_style(target.to_s, theme[style])}]", default, **kwargs)
|
|
1868
|
+
confirm("#{msg} [#{sub_style(target.to_s, style.is_a?(Symbol) ? theme[style] : style)}]", default, **kwargs)
|
|
1869
1869
|
end
|
|
1870
1870
|
|
|
1871
|
-
def confirm_outdated(pkg, ver,
|
|
1871
|
+
def confirm_outdated(pkg, ver, type, cur = nil, lock: false, col0: 0, col1: 0, col2: nil, col3: 0, col4: 0,
|
|
1872
1872
|
**kwargs)
|
|
1873
|
-
h = sub_style(
|
|
1874
|
-
when 1
|
|
1875
|
-
'MAJOR'
|
|
1876
|
-
when 2
|
|
1877
|
-
'MINOR'
|
|
1878
|
-
else
|
|
1879
|
-
'PATCH'
|
|
1880
|
-
end, (rev == 1 && theme[:major]) || theme[:header])
|
|
1873
|
+
h = sub_style(semrev(type).upcase, (type == 1 && theme[:major]) || theme[:header])
|
|
1881
1874
|
case col0
|
|
1882
1875
|
when 0
|
|
1883
1876
|
col0 = "#{h}: "
|
|
@@ -1893,11 +1886,15 @@ module Squared
|
|
|
1893
1886
|
cur = cur.ljust(col2 || cur.size.succ)
|
|
1894
1887
|
lock ? sub_style(cur, color(:red)) : cur
|
|
1895
1888
|
end
|
|
1896
|
-
d =
|
|
1889
|
+
d = type == 1 || lock ? 'N' : 'Y'
|
|
1897
1890
|
e = "#{col0}#{b}#{c}#{sub_style(col1 > 0 ? ver.ljust(col3) : ver.rjust(ver.size.succ), theme[:inline])}"
|
|
1898
1891
|
confirm("#{e}#{col4 > 0 ? ' ' * [col4 - e.stripstyle.size - 1, 2].max : ' '}", d, **kwargs)
|
|
1899
1892
|
end
|
|
1900
1893
|
|
|
1894
|
+
def confirm_semver(msg, type, style: (type == 1 && theme[:major]) || :inline, timeout: 0, **kwargs)
|
|
1895
|
+
confirm_basic(msg, semrev(type), type == 1 ? 'N' : 'Y', style: style, timeout: timeout, **kwargs)
|
|
1896
|
+
end
|
|
1897
|
+
|
|
1901
1898
|
def choice_index(msg, list, values: nil, accept: nil, series: false, trim: nil, column: nil, multiple: false,
|
|
1902
1899
|
force: true, **kwargs)
|
|
1903
1900
|
puts unless series || printfirst?
|
|
@@ -2064,6 +2061,27 @@ module Squared
|
|
|
2064
2061
|
join ? ret.join : ret
|
|
2065
2062
|
end
|
|
2066
2063
|
|
|
2064
|
+
def semtype(cur, lat)
|
|
2065
|
+
if semmajor?(cur, lat)
|
|
2066
|
+
1
|
|
2067
|
+
else
|
|
2068
|
+
cur[2] == lat[2] ? 3 : 2
|
|
2069
|
+
end
|
|
2070
|
+
end
|
|
2071
|
+
|
|
2072
|
+
def semrev(type)
|
|
2073
|
+
case type
|
|
2074
|
+
when 1
|
|
2075
|
+
'major'
|
|
2076
|
+
when 2
|
|
2077
|
+
'minor'
|
|
2078
|
+
when 3
|
|
2079
|
+
'patch'
|
|
2080
|
+
else
|
|
2081
|
+
'unknown'
|
|
2082
|
+
end
|
|
2083
|
+
end
|
|
2084
|
+
|
|
2067
2085
|
def semgte?(val, other)
|
|
2068
2086
|
semcmp(val, other) != 1
|
|
2069
2087
|
end
|
|
@@ -2080,6 +2098,30 @@ module Squared
|
|
|
2080
2098
|
workspace.windows? ? '=' : '^'
|
|
2081
2099
|
end
|
|
2082
2100
|
|
|
2101
|
+
def shortname(*args, suffix: '?', delim: ',', pass: false)
|
|
2102
|
+
return unless TASK_METADATA || pass
|
|
2103
|
+
|
|
2104
|
+
args.map! do |ch|
|
|
2105
|
+
"#{ch}/#{case ch
|
|
2106
|
+
when 'i'
|
|
2107
|
+
'nteractive'
|
|
2108
|
+
when 's'
|
|
2109
|
+
'elect'
|
|
2110
|
+
when 'u'
|
|
2111
|
+
'pdate'
|
|
2112
|
+
when 'h'
|
|
2113
|
+
'ide'
|
|
2114
|
+
when 'f'
|
|
2115
|
+
'orce'
|
|
2116
|
+
when 'd'
|
|
2117
|
+
'ry-run'
|
|
2118
|
+
else
|
|
2119
|
+
next
|
|
2120
|
+
end}#{suffix}"
|
|
2121
|
+
end.compact
|
|
2122
|
+
.join(delim)
|
|
2123
|
+
end
|
|
2124
|
+
|
|
2083
2125
|
def printsucc
|
|
2084
2126
|
@@print_order += 1
|
|
2085
2127
|
end
|
|
@@ -2322,7 +2364,7 @@ module Squared
|
|
|
2322
2364
|
|
|
2323
2365
|
def runnable?(val)
|
|
2324
2366
|
case val
|
|
2325
|
-
when String, Enumerable, Proc, Method
|
|
2367
|
+
when String, Enumerable, Proc, Method, Struct
|
|
2326
2368
|
true
|
|
2327
2369
|
else
|
|
2328
2370
|
false
|
|
@@ -2407,12 +2449,7 @@ module Squared
|
|
|
2407
2449
|
return false unless target.is_a?(Enumerable)
|
|
2408
2450
|
|
|
2409
2451
|
args = args.first if args.size == 1 && args.first.is_a?(Enumerable)
|
|
2410
|
-
|
|
2411
|
-
when Hash
|
|
2412
|
-
args.is_a?(Enumerable) ? args.any? { |obj| target.value?(obj) } : target.value?(args)
|
|
2413
|
-
else
|
|
2414
|
-
args.is_a?(Enumerable) ? args.any? { |obj| target.include?(obj) } : target.include?(args)
|
|
2415
|
-
end
|
|
2452
|
+
args.any? { |obj| target.include?(obj) }
|
|
2416
2453
|
end
|
|
2417
2454
|
|
|
2418
2455
|
def has_value!(target, *args, first: false)
|
|
@@ -154,14 +154,15 @@ module Squared
|
|
|
154
154
|
task action, [:command] do |_, args|
|
|
155
155
|
command = param_guard(action, 'command', args: args, key: :command)
|
|
156
156
|
args = args.extras
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
157
|
+
cmd = docker_output(command, case command
|
|
158
|
+
when 'image', 'container', 'network'
|
|
159
|
+
'ls'
|
|
160
|
+
when 'compose'
|
|
161
|
+
'ps'
|
|
162
|
+
else
|
|
163
|
+
raise_error ArgumentError, 'unrecognized command', hint: command
|
|
164
|
+
end)
|
|
165
|
+
cmd << '-a' if has_value!(args, 'a', 'all') && command != 'network'
|
|
165
166
|
data = VAL_DOCKER[:ls][command.to_sym]
|
|
166
167
|
if has_value!(args, 's', 'standard')
|
|
167
168
|
cols = data.first(data.index('CreatedAt'))
|
|
@@ -180,8 +181,6 @@ module Squared
|
|
|
180
181
|
cols = choice_index('Select a column', data, multiple: true, force: true, attempts: 1)
|
|
181
182
|
end
|
|
182
183
|
end
|
|
183
|
-
cmd = docker_output command, ls
|
|
184
|
-
cmd << '-a' unless command == 'network' || !has_value!(args, 'a', 'all')
|
|
185
184
|
cmd << quote_option('format', "table #{cols.map! { |val| "{{.#{val}}}" }.join("\t")}")
|
|
186
185
|
run(cmd, banner: false, from: :ls)
|
|
187
186
|
end
|
|
@@ -201,7 +200,7 @@ module Squared
|
|
|
201
200
|
|
|
202
201
|
case flag
|
|
203
202
|
when :build
|
|
204
|
-
format_desc action, flag, 'opts*,target*,context
|
|
203
|
+
format_desc action, flag, 'opts*,target*,context/:'
|
|
205
204
|
task flag do |_, args|
|
|
206
205
|
args = args.to_a
|
|
207
206
|
if args.first == ':'
|
|
@@ -374,9 +373,7 @@ module Squared
|
|
|
374
373
|
end
|
|
375
374
|
append_context
|
|
376
375
|
when :bake, :compose
|
|
377
|
-
option(from == :bake ? 'target' : 'service', ignore: false)
|
|
378
|
-
ret.merge(split_escape(val).map! { |s| shell_quote(s) })
|
|
379
|
-
end
|
|
376
|
+
option(from == :bake ? 'target' : 'service', ignore: false) { |val| ret.merge(split_escape(val).quote!) }
|
|
380
377
|
end
|
|
381
378
|
ret
|
|
382
379
|
end
|
|
@@ -494,7 +491,7 @@ module Squared
|
|
|
494
491
|
end
|
|
495
492
|
args << "#{k}=#{q + v + q}"
|
|
496
493
|
elsif !silent?
|
|
497
|
-
log_message(
|
|
494
|
+
log_message('unrecognized option', subject: from, hint: k)
|
|
498
495
|
end
|
|
499
496
|
end
|
|
500
497
|
raise_error TypeError, 'none specified', hint: flag unless type
|
|
@@ -841,7 +838,7 @@ module Squared
|
|
|
841
838
|
|
|
842
839
|
def list_empty(subject: name, hint: nil, **kwargs)
|
|
843
840
|
hint = "status: #{hint.join(', ')}" if hint.is_a?(Array)
|
|
844
|
-
puts log_message(
|
|
841
|
+
puts log_message('none detected', subject: subject, hint: hint, **kwargs)
|
|
845
842
|
end
|
|
846
843
|
|
|
847
844
|
def confirm_command(*args, title: nil, target: nil, as: nil)
|
|
@@ -854,10 +851,8 @@ module Squared
|
|
|
854
851
|
opt_style(theme[:caution], /\A(.+)\z/)
|
|
855
852
|
])
|
|
856
853
|
printsucc
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
c = sub_style as, theme[:inline] if as
|
|
860
|
-
confirm "#{a} #{b}#{" as #{c}" if c}?", 'N'
|
|
854
|
+
s = t.last.capitalize
|
|
855
|
+
confirm "#{s} #{sub_style(target, theme[:subject])}#{" as #{sub_style(as, theme[:inline])}" if as}?", 'N'
|
|
861
856
|
end
|
|
862
857
|
|
|
863
858
|
def choice_command(flag, *action)
|
|
@@ -880,8 +875,7 @@ module Squared
|
|
|
880
875
|
lines = `#{docker_output(cmd)}`.lines
|
|
881
876
|
header = lines.shift
|
|
882
877
|
if lines.empty?
|
|
883
|
-
puts log_message(
|
|
884
|
-
hint: "docker #{cmd.split(' ', 3)[0...2].join(' ')}")
|
|
878
|
+
puts log_message('none found', subject: name, hint: "docker #{cmd.split(' ', 3)[0...2].join(' ')}")
|
|
885
879
|
return
|
|
886
880
|
end
|
|
887
881
|
puts " # #{header}"
|
|
@@ -487,9 +487,9 @@ module Squared
|
|
|
487
487
|
when 'stash'
|
|
488
488
|
format_desc(action, flag, 'opts*', after: case flag
|
|
489
489
|
when :push then 'pathspec*,:'
|
|
490
|
-
when :branch then 'name,stash
|
|
490
|
+
when :branch then 'name,stash/:'
|
|
491
491
|
when :clear, :list, :all then nil
|
|
492
|
-
else 'stash
|
|
492
|
+
else 'stash/:'
|
|
493
493
|
end)
|
|
494
494
|
task flag do |_, args|
|
|
495
495
|
stash flag, args.to_a
|
|
@@ -672,7 +672,7 @@ module Squared
|
|
|
672
672
|
when 'branch'
|
|
673
673
|
case flag
|
|
674
674
|
when :create
|
|
675
|
-
format_desc action, flag, 'name,ref
|
|
675
|
+
format_desc action, flag, 'name,ref/:'
|
|
676
676
|
task flag, [:name, :ref] do |_, args|
|
|
677
677
|
target = param_guard(action, flag, args: args, key: :name)
|
|
678
678
|
ref = commithead args.ref
|
|
@@ -737,7 +737,7 @@ module Squared
|
|
|
737
737
|
when 'switch'
|
|
738
738
|
case flag
|
|
739
739
|
when :create
|
|
740
|
-
format_desc action, flag, '(^)name,ref
|
|
740
|
+
format_desc action, flag, '(^)name,ref/:'
|
|
741
741
|
task flag, [:name, :commit] do |_, args|
|
|
742
742
|
branch = param_guard(action, flag, args: args, key: :name)
|
|
743
743
|
commit = commithead args.commit
|
|
@@ -787,7 +787,7 @@ module Squared
|
|
|
787
787
|
reset(flag, flag == :index ? args.to_a : [])
|
|
788
788
|
end
|
|
789
789
|
when :mode
|
|
790
|
-
format_desc action, flag, 'mode,ref
|
|
790
|
+
format_desc action, flag, 'mode,ref/:'
|
|
791
791
|
task flag, [:mode, :ref] do |_, args|
|
|
792
792
|
mode = param_guard(action, flag, args: args, key: :mode)
|
|
793
793
|
ref = commithead args.ref
|
|
@@ -795,7 +795,7 @@ module Squared
|
|
|
795
795
|
reset(flag, mode: mode, ref: ref)
|
|
796
796
|
end
|
|
797
797
|
when :patch
|
|
798
|
-
format_desc action, flag, 'ref
|
|
798
|
+
format_desc action, flag, 'ref/:,pathspec*'
|
|
799
799
|
task flag, [:ref] do |_, args|
|
|
800
800
|
ref = commithead args.ref
|
|
801
801
|
ref = choice_commit(reflog: false) unless ref && ref != ':'
|
|
@@ -1066,7 +1066,7 @@ module Squared
|
|
|
1066
1066
|
append_head branch
|
|
1067
1067
|
else
|
|
1068
1068
|
unless gitpath('REBASE_HEAD').exist?
|
|
1069
|
-
puts log_message(
|
|
1069
|
+
puts log_message('no rebase in progress', subject: name, hint: command) if stdout?
|
|
1070
1070
|
exit 1
|
|
1071
1071
|
end
|
|
1072
1072
|
return unless VAL_GIT[:rebase][:send].include?(command)
|
|
@@ -1143,7 +1143,7 @@ module Squared
|
|
|
1143
1143
|
flag = :push
|
|
1144
1144
|
end
|
|
1145
1145
|
unless (file = gitpath('logs/refs/stash')).exist? || flag == :push
|
|
1146
|
-
puts log_message(
|
|
1146
|
+
puts log_message('no stashes were found', subject: name, hint: flag) if stdout?
|
|
1147
1147
|
exit 1
|
|
1148
1148
|
end
|
|
1149
1149
|
cmd, opts = git_session('stash', flag, opts: opts)
|
|
@@ -1237,7 +1237,7 @@ module Squared
|
|
|
1237
1237
|
end
|
|
1238
1238
|
out, banner, from = source(io: true)
|
|
1239
1239
|
ret = write_lines(out, banner: banner, sub: sub)
|
|
1240
|
-
list_result(ret, 'files',
|
|
1240
|
+
list_result(ret, 'files', action: 'modified', from: from)
|
|
1241
1241
|
end
|
|
1242
1242
|
|
|
1243
1243
|
def revbuild(flag = nil, opts = [], sync: nil, **kwargs)
|
|
@@ -1277,7 +1277,7 @@ module Squared
|
|
|
1277
1277
|
if cur['files'].size == files.size && cur['files'].find { |key, val| files[key] != val }.nil?
|
|
1278
1278
|
workspace.rev_timeutc(name, 'build') unless (since = workspace.rev_timesince(name, 'build'))
|
|
1279
1279
|
if stdout?
|
|
1280
|
-
puts log_message(
|
|
1280
|
+
puts log_message(['revbuild', 'no changes'], subject: name, hint: ("#{since} ago" if since))
|
|
1281
1281
|
end
|
|
1282
1282
|
return
|
|
1283
1283
|
end
|
|
@@ -1287,7 +1287,7 @@ module Squared
|
|
|
1287
1287
|
rescue StandardError => e
|
|
1288
1288
|
print_error(e, pass: true)
|
|
1289
1289
|
else
|
|
1290
|
-
print_status(
|
|
1290
|
+
print_status('revbuild', subject: name, start: start, from: :completed)
|
|
1291
1291
|
workspace.rev_write(name, { 'revision' => sha, 'files' => status_digest(*args, **kwargs) },
|
|
1292
1292
|
sync: sync, utc: 'build')
|
|
1293
1293
|
end
|
|
@@ -1380,15 +1380,11 @@ module Squared
|
|
|
1380
1380
|
out, banner, from = source(io: true)
|
|
1381
1381
|
print_item banner
|
|
1382
1382
|
ret = write_lines(out, grep: op.extras)
|
|
1383
|
-
list_result(ret, 'tags',
|
|
1383
|
+
list_result(ret, 'tags', grep: op.extras, from: from)
|
|
1384
1384
|
return
|
|
1385
1385
|
end
|
|
1386
1386
|
remote ||= option('remote')
|
|
1387
|
-
source.tap
|
|
1388
|
-
next unless ret && remote
|
|
1389
|
-
|
|
1390
|
-
git_spawn('push', ('-d' if flag == :delete), remote, *refs.map! { |val| shell_quote(val) })
|
|
1391
|
-
end
|
|
1387
|
+
source.tap { |ret| git_spawn('push', ('-d' if flag == :delete), remote, *refs.quote!) if ret && remote }
|
|
1392
1388
|
end
|
|
1393
1389
|
|
|
1394
1390
|
def log!(flag, opts = [], range: [], index: [], grep: [])
|
|
@@ -1545,7 +1541,7 @@ module Squared
|
|
|
1545
1541
|
if banner?
|
|
1546
1542
|
puts 'Nothing to commit'
|
|
1547
1543
|
elsif stdout?
|
|
1548
|
-
puts log_message(
|
|
1544
|
+
puts log_message('nothing to commit', subject: name, hint: flag)
|
|
1549
1545
|
end
|
|
1550
1546
|
exit 1
|
|
1551
1547
|
end
|
|
@@ -1567,7 +1563,7 @@ module Squared
|
|
|
1567
1563
|
end
|
|
1568
1564
|
else
|
|
1569
1565
|
unless gitpath('MERGE_HEAD').exist?
|
|
1570
|
-
puts log_message(
|
|
1566
|
+
puts log_message('no merge in progress', subject: name, hint: command) if stdout?
|
|
1571
1567
|
exit 1
|
|
1572
1568
|
end
|
|
1573
1569
|
return unless VAL_GIT[:merge][:send].include?(command)
|
|
@@ -1607,9 +1603,7 @@ module Squared
|
|
|
1607
1603
|
cmd << shell_quote(target) if target
|
|
1608
1604
|
end
|
|
1609
1605
|
when :delete
|
|
1610
|
-
remote&.each
|
|
1611
|
-
source git_output('push --delete', *val.split('/', 2).map! { |s| shell_quote(s) })
|
|
1612
|
-
end
|
|
1606
|
+
remote&.each { |val| source git_output('push --delete', *val.split('/', 2).quote!) }
|
|
1613
1607
|
force, list = refs.partition { |val| val.start_with?(/[~^]/) }
|
|
1614
1608
|
force.each do |val|
|
|
1615
1609
|
r = '-r' if val.delete!('~')
|
|
@@ -1624,7 +1618,7 @@ module Squared
|
|
|
1624
1618
|
s = +"-#{flag.to_s[0]}"
|
|
1625
1619
|
s.upcase! if option('f', 'force')
|
|
1626
1620
|
cmd << s
|
|
1627
|
-
refs.compact.
|
|
1621
|
+
cmd.merge(refs.compact.quote!)
|
|
1628
1622
|
stdout = true
|
|
1629
1623
|
when :current
|
|
1630
1624
|
cmd << '--show-current'
|
|
@@ -1784,7 +1778,7 @@ module Squared
|
|
|
1784
1778
|
out, banner, from = source(io: true)
|
|
1785
1779
|
print_item banner
|
|
1786
1780
|
ret = write_lines(out, grep: op.extras, prefix: "refs/#{flag}/")
|
|
1787
|
-
list_result(ret, flag.to_s,
|
|
1781
|
+
list_result(ret, flag.to_s, grep: op.extras, from: from)
|
|
1788
1782
|
end
|
|
1789
1783
|
|
|
1790
1784
|
def ls_files(flag, opts = [])
|
|
@@ -1794,7 +1788,7 @@ module Squared
|
|
|
1794
1788
|
out, banner, from = source(io: true)
|
|
1795
1789
|
print_item banner
|
|
1796
1790
|
ret = write_lines(out, grep: op.extras)
|
|
1797
|
-
list_result(ret, 'files',
|
|
1791
|
+
list_result(ret, 'files', grep: op.extras, from: from)
|
|
1798
1792
|
end
|
|
1799
1793
|
|
|
1800
1794
|
def git(flag, opts = [])
|
|
@@ -1976,7 +1970,7 @@ module Squared
|
|
|
1976
1970
|
ret
|
|
1977
1971
|
end
|
|
1978
1972
|
|
|
1979
|
-
def list_result(size, type,
|
|
1973
|
+
def list_result(size, type, action: 'found', grep: [], from: nil)
|
|
1980
1974
|
if size == 0
|
|
1981
1975
|
puts empty_status("No #{type} were #{action}", 'grep', grep.join(', '))
|
|
1982
1976
|
elsif stdout?
|
|
@@ -2198,7 +2192,7 @@ module Squared
|
|
|
2198
2192
|
raise_error(ArgumentError, "missing #{origin ? 'branch' : 'remote'} name", hint: origin)
|
|
2199
2193
|
end
|
|
2200
2194
|
branch = "#{branch}:#{origin[i.succ..-1]}" unless origin.end_with?("/#{branch}")
|
|
2201
|
-
[origin[0..i.pred], branch].tap { |ret| ret.
|
|
2195
|
+
[origin[0..i.pred], branch].tap { |ret| ret.quote! if quote }
|
|
2202
2196
|
end
|
|
2203
2197
|
|
|
2204
2198
|
def commithash(val)
|
|
@@ -280,7 +280,7 @@ module Squared
|
|
|
280
280
|
flags.each do |flag|
|
|
281
281
|
case action
|
|
282
282
|
when 'outdated'
|
|
283
|
-
format_desc action, flag,
|
|
283
|
+
format_desc action, flag, "#{shortname('i', 's', 'u', 'd')},diff"
|
|
284
284
|
task flag do |_, args|
|
|
285
285
|
outdated flag, args.to_a
|
|
286
286
|
end
|
|
@@ -331,11 +331,15 @@ module Squared
|
|
|
331
331
|
format_desc(action, flag, 'opts*', "#{flag == :project ? 'before' : 'after'}": 'config?')
|
|
332
332
|
task flag do |_, args|
|
|
333
333
|
args = args.to_a
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
334
|
+
if flag == :project
|
|
335
|
+
project = if exist?(args.first)
|
|
336
|
+
args.shift
|
|
337
|
+
else
|
|
338
|
+
@tsfile
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
watch = has_value!(args, 'w', 'watch')
|
|
342
|
+
tsc(*args, banner: true, project: project, build: flag == :build, watch: !watch.nil?)
|
|
339
343
|
end
|
|
340
344
|
end
|
|
341
345
|
end
|
|
@@ -499,7 +503,7 @@ module Squared
|
|
|
499
503
|
add = flag == :add
|
|
500
504
|
if add
|
|
501
505
|
remove, packages = packages.partition { |val| val.delete_prefix!('-') }
|
|
502
|
-
remove.
|
|
506
|
+
remove.quote!
|
|
503
507
|
end
|
|
504
508
|
save, exact, omit = save if save.is_a?(Array)
|
|
505
509
|
ws = env('NODE_WORKSPACES', equals: '0')
|
|
@@ -598,7 +602,7 @@ module Squared
|
|
|
598
602
|
if add
|
|
599
603
|
return if packages.empty?
|
|
600
604
|
|
|
601
|
-
cmd.merge(packages.
|
|
605
|
+
cmd.merge(packages.quote!)
|
|
602
606
|
end
|
|
603
607
|
run(from: flag || :depend, sync: sync)
|
|
604
608
|
end
|
|
@@ -1131,7 +1135,7 @@ module Squared
|
|
|
1131
1135
|
end
|
|
1132
1136
|
|
|
1133
1137
|
def outdated?
|
|
1134
|
-
dependfile.exist?
|
|
1138
|
+
dependfile.exist? && !task_pass?('outdated')
|
|
1135
1139
|
end
|
|
1136
1140
|
|
|
1137
1141
|
def update?
|