squared 0.7.0 → 0.7.1
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 +15 -0
- data/README.md +7 -4
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/project/base.rb +26 -6
- data/lib/squared/workspace/project/git.rb +29 -9
- data/lib/squared/workspace/project/node.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 17d98e04832d29621058a1dafa1f9440f0734849aa2b68aecffed2b0c50c0e26
|
|
4
|
+
data.tar.gz: 31391a2561c19025ddd25a20c980f10cf605de2593a24e793eee87ee3d1ccc67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 246be3dde753890551351e232e8f804b7cf3e32ea610113983ad465dd863365f800142d18c91e732df7152e3cfdc6c8c727c980d85b1079dc7acc39ecde6a0aa
|
|
7
|
+
data.tar.gz: 3a9f07b19f697678bacf6d15914df6c33f74e2aa9a0d9b5f10b033b10c29e3460b34e2da3890ae62ed655858d499fb34dae49098096c73b9a2279bb8f9745bd1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.1] - 2025-01-20
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Git task revbuild can run auxiliary tasks before and after changes.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Git task revbuild can be configured to not accept a failed run.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Git task show was completely non-functional due to excessive formatting.
|
|
16
|
+
|
|
3
17
|
## [0.7.0] - 2025-01-07
|
|
4
18
|
|
|
5
19
|
### Added
|
|
@@ -1666,6 +1680,7 @@
|
|
|
1666
1680
|
|
|
1667
1681
|
- Changelog was created.
|
|
1668
1682
|
|
|
1683
|
+
[0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
|
|
1669
1684
|
[0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
|
|
1670
1685
|
[0.6.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.9
|
|
1671
1686
|
[0.6.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.8
|
data/README.md
CHANGED
|
@@ -246,12 +246,15 @@ Workspace::Application
|
|
|
246
246
|
}
|
|
247
247
|
)
|
|
248
248
|
.with(:node) do # rake clone:node
|
|
249
|
-
add("e-mc", "emc")
|
|
249
|
+
add("e-mc", "emc") do # https://github.com/anpham6/e-mc
|
|
250
|
+
revbuild(before: %w[status squared:status], # emc:status + squared:status (always)
|
|
251
|
+
after: "refresh") # emc:refresh (changed)
|
|
252
|
+
end #
|
|
250
253
|
add("pi-r", "pir") # https://github.com/anpham6/pi-r
|
|
251
254
|
add("squared") # https://github.com/anpham6/squared
|
|
252
255
|
end
|
|
253
256
|
.with(:python) do # rake clone:python
|
|
254
|
-
add("android-docs")
|
|
257
|
+
add("android-docs") { revbuild(pass: false) } # Do not update status on a failed run
|
|
255
258
|
add("chrome-docs") do
|
|
256
259
|
revbuild(include: "source/", exclude: ["source/conf.py"]) # Limit files being watched
|
|
257
260
|
end
|
|
@@ -844,7 +847,7 @@ REPO_MANIFEST # e.g. latest,nightly,prod
|
|
|
844
847
|
REPO_GROUPS # e.g. base,prod,docs
|
|
845
848
|
REPO_STAGE # 0,1|sync,2|depend,4|build,8|copy,16|lint,512|dev
|
|
846
849
|
REPO_SUBMODULES # 0,1
|
|
847
|
-
REPO_Y # 0,1
|
|
850
|
+
REPO_Y # 0,1 (bypass interactive prompt)
|
|
848
851
|
REPO_TIMEOUT # confirm dialog (seconds)
|
|
849
852
|
```
|
|
850
853
|
|
|
@@ -874,7 +877,7 @@ Features can be enabled through ENV when calling global tasks such as through *C
|
|
|
874
877
|
| :------------- | :------------- | :----------------------------------------------- |
|
|
875
878
|
| depend | - | FORCE CI IGNORE_SCRIPTS |
|
|
876
879
|
| outdated | - | U|UPDATE=major|minor|patch DIFF DRY_RUN |
|
|
877
|
-
| publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN
|
|
880
|
+
| publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN Y |
|
|
878
881
|
| depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y |
|
|
879
882
|
| npm pnpm | depend package | CPU=s OS=s LIBC=s |
|
|
880
883
|
| npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS |
|
data/lib/squared/version.rb
CHANGED
|
@@ -1339,6 +1339,24 @@ module Squared
|
|
|
1339
1339
|
end
|
|
1340
1340
|
end
|
|
1341
1341
|
|
|
1342
|
+
def run_p(*cmd, sync: true, banner: verbose?, from: nil, **kwargs)
|
|
1343
|
+
case cmd.last
|
|
1344
|
+
when Hash, true, false
|
|
1345
|
+
var = cmd.pop
|
|
1346
|
+
end
|
|
1347
|
+
ws = workspace
|
|
1348
|
+
cmd.each do |meth|
|
|
1349
|
+
meth = meth.to_s
|
|
1350
|
+
if !meth.include?(':') && has?(meth) && respond_to?(meth)
|
|
1351
|
+
__send__(meth, sync: sync)
|
|
1352
|
+
elsif ws.task_defined?(val = task_join(name, meth)) || (meth.include?(':') && ws.task_defined?(val = meth))
|
|
1353
|
+
run(val, var, sync: sync, banner: banner, **kwargs)
|
|
1354
|
+
elsif from
|
|
1355
|
+
print_error(from, "method: #{meth}", subject: name, hint: 'undefined')
|
|
1356
|
+
end
|
|
1357
|
+
end
|
|
1358
|
+
end
|
|
1359
|
+
|
|
1342
1360
|
def graph_branch(target, data, tasks = nil, out = nil, sync: true, pass: [], done: [], depth: 0, single: false,
|
|
1343
1361
|
last: false, order: nil, **kwargs)
|
|
1344
1362
|
tag = ->(proj) { "#{proj.name}#{"@#{proj.version}" if SEM_VER.match?(proj.version)}" }
|
|
@@ -1436,7 +1454,7 @@ module Squared
|
|
|
1436
1454
|
run(cmd, sync: false, banner: false)
|
|
1437
1455
|
ENV.delete(key) if key
|
|
1438
1456
|
elsif proj.has?(meth, tasks || graph ? nil : workspace.baseref)
|
|
1439
|
-
proj.__send__(meth
|
|
1457
|
+
proj.__send__(meth, sync: sync)
|
|
1440
1458
|
end
|
|
1441
1459
|
end
|
|
1442
1460
|
end
|
|
@@ -1709,7 +1727,7 @@ module Squared
|
|
|
1709
1727
|
ret.join("\n")
|
|
1710
1728
|
end
|
|
1711
1729
|
|
|
1712
|
-
def print_status(*args, from: :completed, **kwargs)
|
|
1730
|
+
def print_status(*args, loglevel: Logger::INFO, from: :completed, **kwargs)
|
|
1713
1731
|
return if stdin? || silent?
|
|
1714
1732
|
|
|
1715
1733
|
case from
|
|
@@ -1718,10 +1736,10 @@ module Squared
|
|
|
1718
1736
|
sub_style!(out[1], **opt_style(theme[:major], /^( +major )(\d+)(.+)$/, 2))
|
|
1719
1737
|
sub_style!(out[1], **opt_style(theme[:active], /^(.+)(minor )(\d+)(.+)$/, 3))
|
|
1720
1738
|
sub_style!(out[1], **opt_style(theme[:current], /^(.+)(patch )(\d+)(.+)$/, 3)) if theme[:current]
|
|
1721
|
-
when :completed
|
|
1739
|
+
when :completed, :failed
|
|
1722
1740
|
return unless kwargs[:start]
|
|
1723
1741
|
|
|
1724
|
-
out = log_message(
|
|
1742
|
+
out = log_message(loglevel, *args, sub_style(from.to_s, theme[:active]),
|
|
1725
1743
|
subject: kwargs[:subject], hint: time_format(time_epoch - kwargs[:start]))
|
|
1726
1744
|
else
|
|
1727
1745
|
return
|
|
@@ -2017,8 +2035,10 @@ module Squared
|
|
|
2017
2035
|
args
|
|
2018
2036
|
end
|
|
2019
2037
|
|
|
2020
|
-
def confirm_basic(msg,
|
|
2021
|
-
|
|
2038
|
+
def confirm_basic(msg, hint, default = 'Y', style: :inline, target: @session, prefix: nil, **kwargs)
|
|
2039
|
+
return true if prefix ? option('y', prefix: prefix) : target && option('y', target: target)
|
|
2040
|
+
|
|
2041
|
+
confirm("#{msg} [#{sub_style(hint.to_s, style.is_a?(Symbol) ? theme[style] : style)}]", default, **kwargs)
|
|
2022
2042
|
end
|
|
2023
2043
|
|
|
2024
2044
|
def confirm_semver(msg, type, style: (type == 1 && theme[:major]) || :inline, timeout: 0, **kwargs)
|
|
@@ -1278,12 +1278,24 @@ module Squared
|
|
|
1278
1278
|
kw = lambda do
|
|
1279
1279
|
{
|
|
1280
1280
|
include: relativepath(*Array(kwargs[:include]), all: true),
|
|
1281
|
-
exclude: relativepath(*Array(kwargs[:exclude]), all: true)
|
|
1281
|
+
exclude: relativepath(*Array(kwargs[:exclude]), all: true),
|
|
1282
|
+
before: kwargs[:before],
|
|
1283
|
+
after: kwargs[:after],
|
|
1284
|
+
pass: kwargs.fetch(:pass, true)
|
|
1282
1285
|
}
|
|
1283
1286
|
end
|
|
1284
1287
|
unless workspace.closed
|
|
1285
1288
|
if @revbuild
|
|
1286
|
-
kw.call.each
|
|
1289
|
+
kw.call.each do |key, val|
|
|
1290
|
+
case @revbuild[key]
|
|
1291
|
+
when Array
|
|
1292
|
+
@revbuild[key].concat(val)
|
|
1293
|
+
when Hash
|
|
1294
|
+
@revbuild[key].update(val)
|
|
1295
|
+
else
|
|
1296
|
+
@revbuild[key] = val
|
|
1297
|
+
end
|
|
1298
|
+
end
|
|
1287
1299
|
else
|
|
1288
1300
|
@revbuild = kw.call
|
|
1289
1301
|
end
|
|
@@ -1293,7 +1305,7 @@ module Squared
|
|
|
1293
1305
|
return if sha.empty?
|
|
1294
1306
|
|
|
1295
1307
|
sync = kwargs.fetch(:sync) { invoked_sync?('revbuild', flag) }
|
|
1296
|
-
kwargs = kwargs.key?(:include) || kwargs.key?(:exclude) ? kw.call : @revbuild || {}
|
|
1308
|
+
kwargs = kwargs.key?(:include) || kwargs.key?(:exclude) ? kw.call : @revbuild || { pass: true }
|
|
1297
1309
|
case flag
|
|
1298
1310
|
when :build
|
|
1299
1311
|
op = OptionPartition.new(opts, VAL_GIT[:revbuild].map { |key| "#{key}=b?" }, project: self)
|
|
@@ -1306,6 +1318,7 @@ module Squared
|
|
|
1306
1318
|
.compact
|
|
1307
1319
|
OptionPartition.uniq!(args)
|
|
1308
1320
|
end
|
|
1321
|
+
run_p(*Array(kwargs[:before]), sync: sync, from: :revbuild) if kwargs[:before]
|
|
1309
1322
|
if (cur = workspace.rev_entry(name)) && cur['revision'] == sha && !env('REVBUILD_FORCE')
|
|
1310
1323
|
files = status_digest(*args, **kwargs)
|
|
1311
1324
|
if cur['files'].size == files.size && cur['files'].find { |key, val| files[key] != val }.nil?
|
|
@@ -1315,13 +1328,19 @@ module Squared
|
|
|
1315
1328
|
end
|
|
1316
1329
|
end
|
|
1317
1330
|
start = time_epoch
|
|
1318
|
-
build(*@output, sync: sync, from: symjoin('git', 'revbuild'))
|
|
1331
|
+
ret = build(*@output, sync: sync, from: symjoin('git', 'revbuild'))
|
|
1319
1332
|
rescue => e
|
|
1320
1333
|
print_error(e, pass: true)
|
|
1321
1334
|
else
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1335
|
+
if ret == false && !kwargs[:pass]
|
|
1336
|
+
print_status('revbuild', subject: name, start: start, loglevel: Logger::WARN, from: :failed)
|
|
1337
|
+
workspace.rev_timeutc name, 'build'
|
|
1338
|
+
else
|
|
1339
|
+
run_p(*Array(kwargs[:after]), sync: sync, from: :revbuild) if kwargs[:after] && ret != false
|
|
1340
|
+
print_status('revbuild', subject: name, start: start)
|
|
1341
|
+
workspace.rev_write(name, { 'revision' => sha, 'files' => status_digest(*args, **kwargs) },
|
|
1342
|
+
sync: sync, utc: 'build')
|
|
1343
|
+
end
|
|
1325
1344
|
end
|
|
1326
1345
|
|
|
1327
1346
|
def reset(flag, opts = [], refs: nil, ref: nil, mode: nil, commit: nil)
|
|
@@ -1781,8 +1800,9 @@ module Squared
|
|
|
1781
1800
|
opts << format if format
|
|
1782
1801
|
end
|
|
1783
1802
|
list = OPT_GIT[:show] + OPT_GIT[:diff][:show] + OPT_GIT[:log][:diff] + OPT_GIT[:log][:diff_context]
|
|
1784
|
-
op = OptionPartition.new(opts, list, cmd,
|
|
1785
|
-
|
|
1803
|
+
op = OptionPartition.new(opts, list, cmd,
|
|
1804
|
+
project: self,
|
|
1805
|
+
no: OPT_GIT[:no][:show] + collect_hash(OPT_GIT[:no][:log], pass: [:base]))
|
|
1786
1806
|
op.append(delim: true)
|
|
1787
1807
|
source(exception: false, banner: flag != :oneline)
|
|
1788
1808
|
end
|
|
@@ -1331,7 +1331,7 @@ module Squared
|
|
|
1331
1331
|
|
|
1332
1332
|
def remove_modules(prefix = dependbin)
|
|
1333
1333
|
modules = basepath 'node_modules'
|
|
1334
|
-
return false unless modules.directory? && (
|
|
1334
|
+
return false unless modules.directory? && confirm_basic('Remove?', modules, prefix: prefix)
|
|
1335
1335
|
|
|
1336
1336
|
modules.rmtree
|
|
1337
1337
|
rescue Timeout::Error => e
|