squared 0.1.0 → 0.1.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 +24 -0
- data/README.md +1 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +11 -4
- data/lib/squared/workspace/project/base.rb +18 -17
- data/lib/squared/workspace/project/git.rb +34 -16
- data/lib/squared/workspace/project/node.rb +52 -14
- data/lib/squared/workspace/project/python.rb +2 -2
- data/lib/squared/workspace/project/ruby.rb +15 -12
- data/lib/squared/workspace/series.rb +28 -5
- 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: e2fd23c5964fe7c987966b8d237b569883b2dae5b70d9c120a924e2cc0227873
|
4
|
+
data.tar.gz: 8ef09d80e13c53fda678aa6a7194e33abf04728fb9d1c17739a5dc6c814e3b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c41b98512dfc370a056716c3af2a599321b6113fa4883ab1f9c6b1418332f6b973560ce2cb1550c3813521eaa326150371ef3e60906cb694d6a6fd41ac1e0f05
|
7
|
+
data.tar.gz: cedbdcb188a6fb4a8407fc36836ffbeb4b93893217cec168d291845ce9a4f3f4dede9936022b8c950efa48ec21e2f93d013dc7e6fa929397ac80df7d6e3b099a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.1.1] - 2024-12-14
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Node package manager update command was implemented.
|
8
|
+
- Git pull and fetch retrieve options were expanded.
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Git show does not require an object argument.
|
13
|
+
- Project base class is implemented through Application.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Listing tasks did not check for rake -C option availability.
|
18
|
+
- Listing gems did not check for gem -C option availability.
|
19
|
+
- Disabled extension tasks by individual project were being created.
|
20
|
+
- Git commit did not locate origin from nested branches.
|
21
|
+
- Project clean command used incompatible folder delete option.
|
22
|
+
- Rake did not set original dir when calling itself.
|
23
|
+
- Rake did not set original rakefile when calling itself.
|
24
|
+
- Extended tasks were not associated to their supporting class method.
|
25
|
+
|
3
26
|
## [0.1.0] - 2024-12-7
|
4
27
|
|
5
28
|
### Added
|
@@ -27,5 +50,6 @@
|
|
27
50
|
|
28
51
|
- Changelog was created.
|
29
52
|
|
53
|
+
[0.1.1]: https://github.com/anpham6/squared/releases/tag/v0.1.1-ruby
|
30
54
|
[0.1.0]: https://github.com/anpham6/squared/releases/tag/v0.1.0-ruby
|
31
55
|
[0.0.12]: https://github.com/anpham6/squared/releases/tag/v0.0.12-ruby
|
data/README.md
CHANGED
@@ -108,7 +108,7 @@ Workspace management uses [Ruby](https://www.ruby-lang.org/en/documentation/inst
|
|
108
108
|
mkdir workspaces
|
109
109
|
cd workspaces # REPO_ROOT
|
110
110
|
|
111
|
-
wget https://
|
111
|
+
wget https://unpkg.com/squared/Rakefile
|
112
112
|
|
113
113
|
rake -T # List tasks
|
114
114
|
|
data/lib/squared/version.rb
CHANGED
@@ -18,12 +18,19 @@ module Squared
|
|
18
18
|
private_constant :SCRIPT_OBJ
|
19
19
|
|
20
20
|
class << self
|
21
|
-
def implement(*objs)
|
21
|
+
def implement(*objs, base: false)
|
22
|
+
return if base && objs.size > 1
|
23
|
+
|
22
24
|
objs.each do |obj|
|
23
|
-
next unless obj < impl_project
|
25
|
+
next unless base || obj < impl_project
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
if base
|
28
|
+
@impl_project = obj
|
29
|
+
impl_series.base_set(obj)
|
30
|
+
else
|
31
|
+
kind_project.unshift(obj)
|
32
|
+
obj.tasks&.each { |task| impl_series.add(task, obj) }
|
33
|
+
end
|
27
34
|
if (args = obj.batchargs)
|
28
35
|
impl_series.batch(*args)
|
29
36
|
end
|
@@ -14,7 +14,7 @@ module Squared
|
|
14
14
|
include Utils
|
15
15
|
include Rake::DSL
|
16
16
|
|
17
|
-
VAR_SET = %i[parent global envname dependfile theme run script env
|
17
|
+
VAR_SET = %i[parent global envname dependfile theme run script env].freeze
|
18
18
|
SEM_VER = /(\d+)(?:(\.)(\d+))?(?:(\.)(\d+)(\S+)?)?/.freeze
|
19
19
|
private_constant :VAR_SET, :SEM_VER
|
20
20
|
|
@@ -25,7 +25,7 @@ module Squared
|
|
25
25
|
def bannerargs(*); end
|
26
26
|
|
27
27
|
def tasks
|
28
|
-
[].freeze
|
28
|
+
%i[build depend graph doc test copy clean].freeze
|
29
29
|
end
|
30
30
|
|
31
31
|
def as_path(val)
|
@@ -288,10 +288,10 @@ module Squared
|
|
288
288
|
|
289
289
|
def add(path, name = nil, **kwargs, &blk)
|
290
290
|
checkdir = lambda do |val|
|
291
|
-
if val.directory? && val.
|
291
|
+
if val.directory? && !val.empty?
|
292
292
|
true
|
293
293
|
else
|
294
|
-
log.warn "workspace \"#{val}\" (not found)"
|
294
|
+
log.warn "workspace \"#{val}\" (#{val.empty? ? 'empty' : 'not found'})"
|
295
295
|
false
|
296
296
|
end
|
297
297
|
end
|
@@ -383,7 +383,7 @@ module Squared
|
|
383
383
|
next unless dir.directory?
|
384
384
|
|
385
385
|
log.warn "rm -rf #{dir}"
|
386
|
-
dir.rmtree
|
386
|
+
dir.rmtree
|
387
387
|
else
|
388
388
|
files = val.include?('*') ? Dir[basepath(val)] : [basepath(val)]
|
389
389
|
files.each do |file|
|
@@ -419,7 +419,7 @@ module Squared
|
|
419
419
|
def variable_set(key, *val, **kwargs)
|
420
420
|
if variables.include?(key)
|
421
421
|
case key
|
422
|
-
when :run
|
422
|
+
when :build, :run
|
423
423
|
run_set(*val, **kwargs)
|
424
424
|
when :script
|
425
425
|
script_set(*val, **kwargs)
|
@@ -546,18 +546,17 @@ module Squared
|
|
546
546
|
puts_oe(*args, pipe: pipe)
|
547
547
|
end
|
548
548
|
|
549
|
-
def run(cmd = @session, var = nil, exception: @exception, sync: true, banner: true, **)
|
549
|
+
def run(cmd = @session, var = nil, exception: @exception, sync: true, banner: true, chdir: path, **)
|
550
550
|
cmd = session_done(cmd)
|
551
551
|
log.info cmd
|
552
552
|
begin
|
553
|
-
if cmd =~
|
554
|
-
print_item if sync
|
553
|
+
if cmd =~ /^[^:]+:[^:]/ && workspace.task_defined?(cmd)
|
555
554
|
log.warn "ENV was discarded: #{var}" if var
|
556
555
|
task_invoke(cmd, exception: exception, warning: warning?)
|
557
556
|
else
|
558
557
|
print_item format_banner(cmd, banner: banner) if sync
|
559
558
|
args = var.is_a?(Hash) ? [var, cmd] : [cmd]
|
560
|
-
shell(*args, chdir:
|
559
|
+
shell(*args, chdir: chdir, exception: exception)
|
561
560
|
end
|
562
561
|
rescue StandardError => e
|
563
562
|
log.error e
|
@@ -837,7 +836,8 @@ module Squared
|
|
837
836
|
opts.each { |val| @session << "--#{flag}=#{shell_escape(val, quote: true)}" }
|
838
837
|
end
|
839
838
|
|
840
|
-
def append_value(opts)
|
839
|
+
def append_value(opts, delim: false)
|
840
|
+
@session << '--' if delim && !opts.empty?
|
841
841
|
opts.each { |val| @session << shell_escape(val) }
|
842
842
|
end
|
843
843
|
|
@@ -900,16 +900,17 @@ module Squared
|
|
900
900
|
ret && !ret.empty? ? ret : [val]
|
901
901
|
end
|
902
902
|
|
903
|
-
def pwd_set(done = nil, &blk)
|
903
|
+
def pwd_set(done = nil, pass: false, &blk)
|
904
904
|
pwd = Pathname.pwd
|
905
905
|
if block_given?
|
906
|
-
if path == pwd
|
907
|
-
instance_eval(&blk)
|
906
|
+
if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join >= RUBY_VERSION)
|
907
|
+
ret = instance_eval(&blk)
|
908
908
|
else
|
909
909
|
Dir.chdir(path)
|
910
|
-
instance_eval(&blk)
|
910
|
+
ret = instance_eval(&blk)
|
911
911
|
Dir.chdir(pwd)
|
912
912
|
end
|
913
|
+
ret
|
913
914
|
elsif @pwd == pwd
|
914
915
|
@pwd = nil
|
915
916
|
pwd unless done
|
@@ -1003,7 +1004,7 @@ module Squared
|
|
1003
1004
|
end
|
1004
1005
|
|
1005
1006
|
def variables
|
1006
|
-
VAR_SET
|
1007
|
+
Base.tasks + VAR_SET
|
1007
1008
|
end
|
1008
1009
|
|
1009
1010
|
def borderstyle
|
@@ -1021,7 +1022,7 @@ module Squared
|
|
1021
1022
|
end
|
1022
1023
|
end
|
1023
1024
|
|
1024
|
-
Application.
|
1025
|
+
Application.implement(Base, base: true)
|
1025
1026
|
Application.attr_banner = Common::SymSet.new(%i[name project path ref group parent])
|
1026
1027
|
end
|
1027
1028
|
end
|
@@ -4,8 +4,8 @@ module Squared
|
|
4
4
|
module Workspace
|
5
5
|
module Project
|
6
6
|
class Git < Base
|
7
|
-
OPT_PULL = %w[all
|
8
|
-
OPT_FETCH = %w[
|
7
|
+
OPT_PULL = %w[all ff-only autostash prune tags depth=n since=d jobs=n dry-run].freeze
|
8
|
+
OPT_FETCH = %w[prune-tags].concat(OPT_PULL[3..-1]).freeze
|
9
9
|
private_constant :OPT_PULL, :OPT_FETCH
|
10
10
|
|
11
11
|
class << self
|
@@ -202,16 +202,16 @@ module Squared
|
|
202
202
|
end
|
203
203
|
when :show
|
204
204
|
if flag == :oneline
|
205
|
-
desc format_desc(action, flag, 'object
|
205
|
+
desc format_desc(action, flag, 'object*')
|
206
206
|
task flag, [:object] do |_, args|
|
207
|
-
objs =
|
207
|
+
objs = args.to_a
|
208
208
|
show(objs, pretty: 'oneline', abbrev: true)
|
209
209
|
end
|
210
210
|
else
|
211
|
-
desc format_desc(action, flag, 'format,object
|
211
|
+
desc format_desc(action, flag, 'format,object*')
|
212
212
|
task flag, [:format, :object] do |_, args|
|
213
213
|
format = guard_params(action, flag, args: args, key: :format)
|
214
|
-
objs =
|
214
|
+
objs = args.to_a[1..-1] || []
|
215
215
|
show(objs, "#{flag}": format)
|
216
216
|
end
|
217
217
|
end
|
@@ -422,12 +422,29 @@ module Squared
|
|
422
422
|
end
|
423
423
|
origin = nil
|
424
424
|
branch = nil
|
425
|
+
upstream = false
|
425
426
|
source('git fetch --no-tags --quiet', io: true, banner: false)
|
426
427
|
source('git branch -vv --list', io: true, banner: false).first.each do |val|
|
427
|
-
next unless (data =
|
428
|
-
|
429
|
-
|
430
|
-
|
428
|
+
next unless (data = /^\*\s(\S+)\s+(\h+)(?:\s\[(.+?)(?=\]\s)\])?\s/.match(val))
|
429
|
+
|
430
|
+
branch = data[1]
|
431
|
+
sha = data[2]
|
432
|
+
if !data[3]
|
433
|
+
unless (origin = option('repository', prefix: 'git', ignore: false))
|
434
|
+
out = source('git log -n1 --format=%h%d', io: true, stdout: true, banner: false).first
|
435
|
+
if (data = /^#{sha} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/m.match(out))
|
436
|
+
split_escape(data[1]).each do |val|
|
437
|
+
next unless val.end_with?("/#{branch}")
|
438
|
+
|
439
|
+
origin = val[0..val.size - branch.size - 2]
|
440
|
+
break
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
upstream = !origin.nil?
|
445
|
+
elsif (data = Regexp.new("^(.+)/#{Regexp.escape(branch)}$").match(data[3]))
|
446
|
+
origin = data[1]
|
447
|
+
end
|
431
448
|
break
|
432
449
|
end
|
433
450
|
raise_error('commit', 'work tree is not usable') unless origin && branch
|
@@ -445,6 +462,7 @@ module Squared
|
|
445
462
|
end
|
446
463
|
a = ['git add --verbose']
|
447
464
|
b = ['git push']
|
465
|
+
b << '--set-upstream' if upstream
|
448
466
|
if dry_run?
|
449
467
|
a << '--dry-run'
|
450
468
|
b << '--dry-run'
|
@@ -493,10 +511,10 @@ module Squared
|
|
493
511
|
cmd = session_done(cmd)
|
494
512
|
log.info cmd
|
495
513
|
banner = format_banner(cmd.gsub(File.join(path, ''), ''), banner: banner)
|
496
|
-
cmd = cmd.sub(/^git\b/, "git --work-tree
|
514
|
+
cmd = cmd.sub(/^git\b/, "git --work-tree=#{shell_quote(path)} --git-dir=#{shell_quote(gitpath)}")
|
497
515
|
begin
|
498
516
|
if io
|
499
|
-
[IO.popen(cmd), banner]
|
517
|
+
[stdout ? `#{cmd}` : IO.popen(cmd), banner]
|
500
518
|
elsif stdin? ? sync : stdout
|
501
519
|
print_item banner
|
502
520
|
ret = `#{cmd}`
|
@@ -572,10 +590,10 @@ module Squared
|
|
572
590
|
def append_pull(opts, list, flag = nil)
|
573
591
|
append_submodules flag
|
574
592
|
opts.each do |opt|
|
575
|
-
if list.include?(opt)
|
593
|
+
if list.include?(opt) || opt.match(/^(?:depth|jobs)=\d+$/)
|
576
594
|
@session << "--#{opt}"
|
577
|
-
elsif opt.match(/^
|
578
|
-
@session << "--
|
595
|
+
elsif opt.match(/^since=(.+)$/) && (val = Date.parse($1))
|
596
|
+
@session << "--shallow-since=\"#{val.strftime('%F %T')}\""
|
579
597
|
end
|
580
598
|
end
|
581
599
|
end
|
@@ -598,7 +616,7 @@ module Squared
|
|
598
616
|
end
|
599
617
|
|
600
618
|
def append_message(val)
|
601
|
-
@session << "--message
|
619
|
+
@session << "--message=\"#{double_quote(val)}\"" if val
|
602
620
|
end
|
603
621
|
|
604
622
|
def append_head
|
@@ -38,6 +38,7 @@ module Squared
|
|
38
38
|
install: %i[force frozen dedupe].freeze,
|
39
39
|
outdated: %i[major minor patch].freeze,
|
40
40
|
bump: %i[major minor patch].freeze,
|
41
|
+
update: nil,
|
41
42
|
run: nil
|
42
43
|
}.freeze
|
43
44
|
|
@@ -89,6 +90,11 @@ module Squared
|
|
89
90
|
end
|
90
91
|
end
|
91
92
|
end
|
93
|
+
when :update
|
94
|
+
desc format_desc(action, nil, 'packages*')
|
95
|
+
task action, [:packages] do |_, args|
|
96
|
+
update args.to_a
|
97
|
+
end
|
92
98
|
end
|
93
99
|
else
|
94
100
|
namespace action do
|
@@ -128,7 +134,7 @@ module Squared
|
|
128
134
|
into = @copy[:into] if @copy.key?(:into)
|
129
135
|
workspace = @copy[:workspace] if @copy.key?(:workspace)
|
130
136
|
glob = @copy[:include]
|
131
|
-
|
137
|
+
exclude = @copy[:exclude]
|
132
138
|
scope = @copy[:scope]
|
133
139
|
also = @copy[:also]
|
134
140
|
create = @copy[:create]
|
@@ -150,7 +156,7 @@ module Squared
|
|
150
156
|
log.warn message("copy project :#{dir}", hint: 'not found') unless dest
|
151
157
|
when Hash
|
152
158
|
glob = dir[:include]
|
153
|
-
|
159
|
+
exclude = dir[:exclude]
|
154
160
|
from = dir[:from] if dir.key?(:from)
|
155
161
|
into = dir[:into] if dir.key?(:into)
|
156
162
|
scope = dir[:scope] if dir.key?(:scope)
|
@@ -179,7 +185,7 @@ module Squared
|
|
179
185
|
doc = JSON.parse(file.read)
|
180
186
|
doc['name']
|
181
187
|
rescue StandardError => e
|
182
|
-
log.
|
188
|
+
log.error e
|
183
189
|
raise if exception
|
184
190
|
end
|
185
191
|
end
|
@@ -194,7 +200,7 @@ module Squared
|
|
194
200
|
end
|
195
201
|
target.each do |src, to|
|
196
202
|
glob.each { |val| log.info "cp #{from.join(val)} #{to}" }
|
197
|
-
copy_d(src, to, glob: glob, create: create, pass:
|
203
|
+
copy_d(src, to, glob: glob, create: create, pass: exclude, verbose: verbose)
|
198
204
|
end
|
199
205
|
end
|
200
206
|
end
|
@@ -262,7 +268,7 @@ module Squared
|
|
262
268
|
end
|
263
269
|
end
|
264
270
|
|
265
|
-
def outdated(rev = nil, opts: [])
|
271
|
+
def outdated(rev = nil, opts: [], sync: invoked_sync?('outdated', rev))
|
266
272
|
dryrun = opts.include?('dry-run')
|
267
273
|
if pnpm? && read_packagemanager(version: '7.15')
|
268
274
|
cmd = 'pnpm outdated'
|
@@ -273,22 +279,31 @@ module Squared
|
|
273
279
|
end
|
274
280
|
log.info cmd
|
275
281
|
banner = format_banner("#{cmd}#{dryrun ? ' --dry-run' : ''}")
|
276
|
-
if
|
282
|
+
if sync
|
277
283
|
print_item banner
|
278
284
|
banner = nil
|
279
285
|
end
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
286
|
+
begin
|
287
|
+
data = pwd_set { `#{cmd} --json --loglevel=error` }
|
288
|
+
json = JSON.parse(doc = dependfile.read)
|
289
|
+
rescue StandardError => e
|
290
|
+
log.error e
|
291
|
+
raise if exception
|
292
|
+
|
293
|
+
warn log_message(Logger::WARN, e) if warning?
|
294
|
+
return
|
295
|
+
else
|
296
|
+
dep1 = json['dependencies'] || {}
|
297
|
+
dep2 = json['devDependencies'] || {}
|
298
|
+
target = json['name']
|
299
|
+
end
|
285
300
|
found = []
|
286
301
|
avail = []
|
287
302
|
rev ||= (prod? ? :patch : :minor)
|
288
303
|
inter = opts.include?('interactive')
|
289
304
|
unless data.empty?
|
290
305
|
JSON.parse(data).each_pair do |key, val|
|
291
|
-
val = val.find { |obj| obj['dependent'] ==
|
306
|
+
val = val.find { |obj| obj['dependent'] == target } if val.is_a?(Array)
|
292
307
|
next unless val && (file = dep1[key] || dep2[key]) && file != '*'
|
293
308
|
|
294
309
|
latest = val['latest']
|
@@ -417,7 +432,7 @@ module Squared
|
|
417
432
|
end
|
418
433
|
end
|
419
434
|
|
420
|
-
def bump(flag = nil
|
435
|
+
def bump(flag = nil)
|
421
436
|
return unless (ver = version)
|
422
437
|
|
423
438
|
seg = semscan(ver, fill: false)
|
@@ -461,8 +476,31 @@ module Squared
|
|
461
476
|
end
|
462
477
|
rescue StandardError => e
|
463
478
|
log.debug e
|
464
|
-
raise if
|
479
|
+
raise if exception
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
def update(pkgs = [])
|
484
|
+
if (yarn = dependtype(:yarn)) > 0
|
485
|
+
cmd = session 'yarn'
|
486
|
+
if yarn > 1
|
487
|
+
cmd << 'up'
|
488
|
+
else
|
489
|
+
cmd << 'upgrade'
|
490
|
+
cmd << '--ignore-engines' unless option('ignore-engines', equals: '0')
|
491
|
+
end
|
492
|
+
elsif pnpm?
|
493
|
+
cmd = session 'pnpm', 'update'
|
494
|
+
cmd << '--prod' if prod?
|
495
|
+
append_nocolor option('no-color')
|
496
|
+
else
|
497
|
+
cmd = session 'npm', 'update'
|
498
|
+
cmd << '--omit=dev' if prod?
|
499
|
+
append_nocolor option('no-color')
|
465
500
|
end
|
501
|
+
append_loglevel
|
502
|
+
append_value pkgs
|
503
|
+
run
|
466
504
|
end
|
467
505
|
|
468
506
|
def compose(opts, flags = nil, script: false)
|
@@ -212,7 +212,7 @@ module Squared
|
|
212
212
|
|
213
213
|
from = @copy[:from] if @copy.key?(:from)
|
214
214
|
glob = @copy[:include] if @copy.key?(:include)
|
215
|
-
|
215
|
+
exclude = @copy[:exclude] if @copy.key?(:exclude)
|
216
216
|
into = @copy[:into] if @copy.key?(:into)
|
217
217
|
end
|
218
218
|
return unless into
|
@@ -225,17 +225,17 @@ module Squared
|
|
225
225
|
b = dest.join(val)
|
226
226
|
c = glob[i] || glob[0]
|
227
227
|
log.info "cp #{a.join(c)} #{b}"
|
228
|
-
copy_d(a, b, glob: c, pass:
|
228
|
+
copy_d(a, b, glob: c, pass: exclude, verbose: verbose)
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
-
def outdated(rev = nil, opts: [])
|
232
|
+
def outdated(rev = nil, opts: [], sync: invoked_sync?('outdated', rev))
|
233
233
|
cmd = bundle_session 'outdated', rev && "--#{rev}"
|
234
234
|
append_bundle opts, OPT_OUTDATED
|
235
235
|
cmd = session_done(cmd)
|
236
236
|
log.info cmd
|
237
237
|
banner = format_banner(cmd)
|
238
|
-
if
|
238
|
+
if sync
|
239
239
|
print_item banner
|
240
240
|
banner = nil
|
241
241
|
end
|
@@ -364,10 +364,11 @@ module Squared
|
|
364
364
|
end
|
365
365
|
|
366
366
|
def rake(*cmd)
|
367
|
+
file = shell_quote(Rake.application.rakefile)
|
367
368
|
if cmd.empty?
|
368
|
-
run_s
|
369
|
+
run_s("rake --rakefile=#{file}", chdir: workspace.pwd)
|
369
370
|
else
|
370
|
-
run_s(*cmd.map { |val| "rake #{val}" }, banner: false)
|
371
|
+
run_s(*cmd.map { |val| "rake --rakefile=#{file} #{val}" }, chdir: workspace.pwd, banner: false)
|
371
372
|
end
|
372
373
|
end
|
373
374
|
|
@@ -386,9 +387,8 @@ module Squared
|
|
386
387
|
return false unless @autodetect
|
387
388
|
|
388
389
|
unsafe = ->(hint) { raise_error('failed to parse', hint: hint) }
|
389
|
-
out = `gem
|
390
|
-
data = /#{Regexp.escape(project)} \(([^)]+)\)/.match(out)
|
391
|
-
unsafe.('version') unless data
|
390
|
+
out = pwd_set { `gem list --local -d #{project}` }
|
391
|
+
unsafe.('version') unless (data = /#{Regexp.escape(project)} \(([^)]+)\)/.match(out))
|
392
392
|
ver = data[1].split(/\s*,\s*/)
|
393
393
|
ver.unshift(@version).uniq! if @version
|
394
394
|
ver.each do |v|
|
@@ -453,10 +453,13 @@ module Squared
|
|
453
453
|
return @rakelist if @rakelist
|
454
454
|
|
455
455
|
ret = []
|
456
|
-
|
457
|
-
|
456
|
+
pass = Rake::VERSION >= '13.0.4'
|
457
|
+
pwd_set(pass: pass) do
|
458
|
+
IO.popen("rake#{pass ? " -C #{shell_quote(path)}" : ''} -AT").each do |line|
|
459
|
+
next unless (data = /^rake ((?:[^\[: ]+:?)+)(\[[^\]]+\])?/.match(line))
|
458
460
|
|
459
|
-
|
461
|
+
ret << [data[1], data[2]]
|
462
|
+
end
|
460
463
|
end
|
461
464
|
@rakelist = ret
|
462
465
|
end
|
@@ -8,13 +8,13 @@ module Squared
|
|
8
8
|
include Rake::DSL
|
9
9
|
extend Forwardable
|
10
10
|
|
11
|
-
TASK_BASE =
|
11
|
+
TASK_BASE = []
|
12
12
|
TASK_BATCH = {}
|
13
13
|
TASK_EXTEND = {}
|
14
|
-
TASK_KEYS =
|
14
|
+
TASK_KEYS = []
|
15
15
|
TASK_ALIAS = {}
|
16
16
|
TASK_NAME = {}
|
17
|
-
private_constant :TASK_BASE, :TASK_BATCH, :TASK_KEYS, :
|
17
|
+
private_constant :TASK_BASE, :TASK_BATCH, :TASK_EXTEND, :TASK_KEYS, :TASK_ALIAS, :TASK_NAME
|
18
18
|
|
19
19
|
class << self
|
20
20
|
def add(task, obj)
|
@@ -47,6 +47,15 @@ module Squared
|
|
47
47
|
TASK_NAME[key.to_sym] = task.to_sym
|
48
48
|
end
|
49
49
|
|
50
|
+
def base_set(obj)
|
51
|
+
TASK_BASE.clear
|
52
|
+
.concat((if TASK_KEYS.empty?
|
53
|
+
obj.tasks.dup
|
54
|
+
else
|
55
|
+
obj.tasks.reject { |val| TASK_KEYS.include?(val) }
|
56
|
+
end).freeze)
|
57
|
+
end
|
58
|
+
|
50
59
|
private
|
51
60
|
|
52
61
|
def key_set(val)
|
@@ -72,7 +81,7 @@ module Squared
|
|
72
81
|
id: []
|
73
82
|
}
|
74
83
|
@data = {}
|
75
|
-
TASK_KEYS.each { |key| @data[key] = [] }
|
84
|
+
(TASK_BASE + TASK_KEYS).each { |key| @data[key] = [] }
|
76
85
|
end
|
77
86
|
|
78
87
|
def populate(proj)
|
@@ -154,7 +163,21 @@ module Squared
|
|
154
163
|
end
|
155
164
|
|
156
165
|
def extend?(obj, key)
|
157
|
-
|
166
|
+
return false unless (items = TASK_EXTEND[key]) && !(items = items.select { |kind| obj.is_a?(kind) }).empty?
|
167
|
+
|
168
|
+
meth = :"#{key}?"
|
169
|
+
allref = obj.allref.to_a
|
170
|
+
ret = false
|
171
|
+
items.each do |kind|
|
172
|
+
if kind.instance_methods.include?(meth)
|
173
|
+
out = obj.__send__(meth)
|
174
|
+
return true if out == 1
|
175
|
+
return out if obj.ref?(kind.ref)
|
176
|
+
elsif allref.include?(kind.ref)
|
177
|
+
ret = true
|
178
|
+
end
|
179
|
+
end
|
180
|
+
ret
|
158
181
|
end
|
159
182
|
|
160
183
|
def multiple?(val = nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|