squared 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.ruby.md +14 -8
- data/lib/squared/common/class.rb +2 -2
- data/lib/squared/common/format.rb +3 -3
- data/lib/squared/common/prompt.rb +2 -2
- data/lib/squared/common/shell.rb +33 -20
- data/lib/squared/common/system.rb +1 -1
- data/lib/squared/config.rb +13 -10
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +30 -6
- data/lib/squared/workspace/project/base.rb +33 -15
- data/lib/squared/workspace/project/git.rb +100 -60
- data/lib/squared/workspace/project/node.rb +17 -19
- data/lib/squared/workspace/project/python.rb +11 -11
- data/lib/squared/workspace/project/ruby.rb +40 -40
- data/lib/squared/workspace/repo.rb +12 -12
- data/lib/squared/workspace/series.rb +3 -2
- metadata +3 -6
@@ -7,9 +7,9 @@ module Squared
|
|
7
7
|
VAR_SET = %i[version autodetect].freeze
|
8
8
|
GEMFILE = %w[Gemfile Gemfile.lock gem.deps.rb Isolate].freeze
|
9
9
|
RUBY_DIR = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
|
10
|
-
OPT_INSTALL = %w[no-cache
|
11
|
-
OPT_UPDATE = %w[redownload local strict
|
12
|
-
OPT_OUTDATED = %w[
|
10
|
+
OPT_INSTALL = %w[system frozen no-cache no-prune].freeze
|
11
|
+
OPT_UPDATE = %w[all redownload conservative local strict group=s].freeze
|
12
|
+
OPT_OUTDATED = %w[pre only-explicit local strict group=s].freeze
|
13
13
|
private_constant :VAR_SET, :GEMFILE, :RUBY_DIR, :OPT_INSTALL, :OPT_UPDATE, :OPT_OUTDATED
|
14
14
|
|
15
15
|
class << self
|
@@ -103,9 +103,10 @@ module Squared
|
|
103
103
|
elsif exception
|
104
104
|
indexerror n, list
|
105
105
|
else
|
106
|
-
|
106
|
+
log.warn "rake task #{n} of #{list.size} (out of range)"
|
107
|
+
next
|
107
108
|
end
|
108
|
-
rake(args.extras.empty? ? cmd : "#{cmd}[#{args.extras.join(',')}]")
|
109
|
+
rake(args.extras.empty? ? cmd : "#{cmd}#{shell_escape("[#{args.extras.join(',')}]")}")
|
109
110
|
else
|
110
111
|
rake(*args.to_a)
|
111
112
|
end
|
@@ -177,25 +178,25 @@ module Squared
|
|
177
178
|
gem_session 'install'
|
178
179
|
append_value opts
|
179
180
|
when :with, :without
|
180
|
-
|
181
|
+
bundle_session 'install'
|
181
182
|
append_repeat flag, opts
|
182
183
|
when :redownload, :local, :'prefer-local'
|
183
184
|
cmd = bundle_session 'install', "--#{flag}"
|
184
185
|
if (val = option('trust-policy', ignore: false))
|
185
|
-
cmd <<
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
186
|
+
cmd << shell_option('trust-policy', case val
|
187
|
+
when '0'
|
188
|
+
'NoSecurity'
|
189
|
+
when '1'
|
190
|
+
'AlmostNoSecurity'
|
191
|
+
when '2'
|
192
|
+
'LowSecurity'
|
193
|
+
when '3'
|
194
|
+
'MediumSecurity'
|
195
|
+
when '4'
|
196
|
+
'HighSecurity'
|
197
|
+
else
|
198
|
+
val
|
199
|
+
end, escape: false)
|
199
200
|
end
|
200
201
|
append_bundle opts, OPT_INSTALL
|
201
202
|
else
|
@@ -218,7 +219,7 @@ module Squared
|
|
218
219
|
return unless into
|
219
220
|
|
220
221
|
dest = Pathname.new(into).realpath
|
221
|
-
print_item unless @output[0] || task_invoked?(
|
222
|
+
print_item unless @output[0] || task_invoked?(/\Acopy(?::#{Ruby.ref}|\z)/)
|
222
223
|
glob = as_a(glob || '**/*')
|
223
224
|
as_a(from).each_with_index do |val, i|
|
224
225
|
a = basepath(val)
|
@@ -235,14 +236,13 @@ module Squared
|
|
235
236
|
cmd = session_done(cmd)
|
236
237
|
log.info cmd
|
237
238
|
banner = format_banner(cmd)
|
238
|
-
if sync
|
239
|
-
print_item banner
|
240
|
-
banner = nil
|
241
|
-
end
|
239
|
+
print_item banner if sync
|
242
240
|
start = 0
|
243
241
|
found = 0
|
244
242
|
major = 0
|
245
243
|
pwd_set do
|
244
|
+
buffer = []
|
245
|
+
out = ->(val) { sync ? puts(val) : buffer << val }
|
246
246
|
IO.popen("#{cmd} --no-color").each do |line|
|
247
247
|
if start > 0
|
248
248
|
unless stdin?
|
@@ -302,24 +302,24 @@ module Squared
|
|
302
302
|
when :yellow
|
303
303
|
found += 1
|
304
304
|
end
|
305
|
-
styles = styles.compact
|
306
|
-
|
307
|
-
.flatten
|
308
|
-
line = sub_style(line, pat: /^((?:\S+\s+){2})(#{Regexp.escape(l)})(.*)$/, styles: styles,
|
309
|
-
index: 2)
|
305
|
+
styles = styles.compact.map { |s| color(s) }.flatten
|
306
|
+
line = sub_style(line, pat: /^((?:\S+\s+){2})(#{Regexp.escape(l)})(.*)$/, index: 2, styles: styles)
|
310
307
|
end
|
311
308
|
end
|
312
|
-
|
309
|
+
out.("#{start.to_s.rjust(2)}. #{line}")
|
313
310
|
start += 1
|
314
311
|
elsif line =~ /^Gem /
|
315
|
-
print_item banner if banner
|
316
312
|
unless stdin?
|
317
313
|
sub = { pat: /^(.+)(?<!\dm)(Gem|Latest)(.+)$/, styles: theme[:header], index: 2 }
|
318
|
-
|
314
|
+
out.(print_footer(" # #{line.chomp}", reverse: true, sub: [sub, sub]))
|
319
315
|
end
|
320
316
|
start += 1
|
321
317
|
end
|
322
318
|
end
|
319
|
+
unless sync
|
320
|
+
print_item banner
|
321
|
+
puts buffer
|
322
|
+
end
|
323
323
|
if found > 0
|
324
324
|
begin
|
325
325
|
if major == 0 && (data = /\b(?:source\s+(["'])(.+?)\1|remote:\s+(\S+))/.match(dependfile.read))
|
@@ -353,7 +353,7 @@ module Squared
|
|
353
353
|
cmd << '--all'
|
354
354
|
append_repeat 'skip', opts
|
355
355
|
when :version
|
356
|
-
cmd << project <<
|
356
|
+
cmd << project << shell_option('version', version)
|
357
357
|
end
|
358
358
|
run_rb
|
359
359
|
end
|
@@ -364,11 +364,11 @@ module Squared
|
|
364
364
|
end
|
365
365
|
|
366
366
|
def rake(*cmd)
|
367
|
-
|
367
|
+
rakefile = shell_option('rakefile', Rake.application.rakefile, quote: true, escape: false)
|
368
368
|
if cmd.empty?
|
369
|
-
run_s("rake
|
369
|
+
run_s("rake #{rakefile}", chdir: workspace.pwd)
|
370
370
|
else
|
371
|
-
run_s(*cmd.map { |val| "rake
|
371
|
+
run_s(*cmd.map { |val| "rake #{rakefile} #{val}" }, chdir: workspace.pwd, banner: false)
|
372
372
|
end
|
373
373
|
end
|
374
374
|
|
@@ -429,7 +429,7 @@ module Squared
|
|
429
429
|
if list.include?(opt)
|
430
430
|
@session << "--#{opt}"
|
431
431
|
elsif opt.match(/^g(?:roup)?=(.+)$/)
|
432
|
-
@session <<
|
432
|
+
@session << shell_option('group', $1)
|
433
433
|
end
|
434
434
|
end
|
435
435
|
end
|
@@ -437,7 +437,7 @@ module Squared
|
|
437
437
|
def gem_session(*cmd)
|
438
438
|
ret = session('gem', *cmd)
|
439
439
|
if (val = option('config-file', ignore: false))
|
440
|
-
ret <<
|
440
|
+
ret << shell_option('config-file', basepath(val), quote: true)
|
441
441
|
end
|
442
442
|
ret << '--norc' if option('norc')
|
443
443
|
ret
|
@@ -456,7 +456,7 @@ module Squared
|
|
456
456
|
pass = Rake::VERSION >= '13.0.4'
|
457
457
|
pwd_set(pass: pass) do
|
458
458
|
IO.popen("rake#{pass ? " -C #{shell_quote(path)}" : ''} -AT").each do |line|
|
459
|
-
next unless (data =
|
459
|
+
next unless (data = /\Arake ((?:[^\[: ]+:?)+)(\[[^\]]+\])?/.match(line))
|
460
460
|
|
461
461
|
ret << [data[1], data[2]]
|
462
462
|
end
|
@@ -33,11 +33,11 @@ module Squared
|
|
33
33
|
|
34
34
|
def repo(url, manifest = 'latest', run: nil, script: nil, dev: nil, prod: nil, ref: @ref, group: @group)
|
35
35
|
@home = if (val = env('REPO_HOME'))
|
36
|
-
|
37
|
-
if main ==
|
38
|
-
@root =
|
39
|
-
if
|
40
|
-
@root = nil unless
|
36
|
+
path = Pathname.new(val)
|
37
|
+
if main == path.basename.to_s
|
38
|
+
@root = path.parent
|
39
|
+
if path.exist?
|
40
|
+
@root = nil unless path.directory?
|
41
41
|
elsif !@root.exist?
|
42
42
|
@root.mkpath
|
43
43
|
elsif !repo_install?
|
@@ -45,7 +45,7 @@ module Squared
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
raise_error('REPO_HOME', val, hint: 'invalid') unless @root
|
48
|
-
|
48
|
+
path.realdirpath
|
49
49
|
elsif (val = env('REPO_ROOT'))
|
50
50
|
@root = Pathname.new(val).realdirpath
|
51
51
|
if !@root.exist?
|
@@ -54,12 +54,12 @@ module Squared
|
|
54
54
|
raise_error('REPO_ROOT', val, hint: 'exist') unless repo_confirm
|
55
55
|
end
|
56
56
|
@root.join(main).realdirpath
|
57
|
+
elsif repo_install?(parent: true) && (!@home.exist? || @root.join(main) == @home)
|
58
|
+
@home
|
57
59
|
elsif repo_install?(@home)
|
58
60
|
@home.join(main)
|
59
|
-
elsif @home != pwd && repo_install?(pwd)
|
60
|
-
pwd.join(main)
|
61
61
|
else
|
62
|
-
@home
|
62
|
+
(path = pwd) == @home || !repo_install?(path) ? @home : path.join(main)
|
63
63
|
end
|
64
64
|
@root = @home.parent
|
65
65
|
@manifest_url = url
|
@@ -106,7 +106,7 @@ module Squared
|
|
106
106
|
found = true
|
107
107
|
end
|
108
108
|
script_set(data, group: group, ref: ref) unless found
|
109
|
-
@warning = env_match('REPO_WARN', @warning && !
|
109
|
+
@warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo']), suffix: @envname) != false
|
110
110
|
@extensions << :__repo__
|
111
111
|
elsif script || run
|
112
112
|
if script
|
@@ -153,7 +153,7 @@ module Squared
|
|
153
153
|
status = lambda do |val, alt = nil|
|
154
154
|
return 'inactive' unless (ver = branch || alt)
|
155
155
|
|
156
|
-
message(
|
156
|
+
message(task_name('repo'), val.sub('{0}', 'opts*=force,rebase,detach,gc,no-update,no-fail'), ver)
|
157
157
|
end
|
158
158
|
|
159
159
|
namespace(name = task_name('repo')) do |repo|
|
@@ -230,7 +230,7 @@ module Squared
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def repo_install?(dir = root, parent: false)
|
233
|
-
return true if
|
233
|
+
return true if root?(dir, pass: ['.repo']) || dir.join('.repo').directory?
|
234
234
|
|
235
235
|
parent && root.children.none? { |ent| ent.directory? && ent.basename.to_s[0] != '.' && ent != home }
|
236
236
|
end
|
@@ -97,8 +97,9 @@ module Squared
|
|
97
97
|
items.concat(tasks)
|
98
98
|
end
|
99
99
|
if tasks.size > 1 && (data = batch_get(key)) && data.keys.any? { |ref| proj.ref?(ref) }
|
100
|
-
|
101
|
-
|
100
|
+
t = ws.task_join(proj.name, key)
|
101
|
+
desc Common::Format.message(*t.split(':'))
|
102
|
+
task t => tasks
|
102
103
|
end
|
103
104
|
next unless (b = ws.find_base(proj)) && (n = b.ref.to_s) != g
|
104
105
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rake
|
@@ -93,7 +92,6 @@ metadata:
|
|
93
92
|
homepage_uri: https://github.com/anpham6/squared
|
94
93
|
source_code_uri: https://github.com/anpham6/squared
|
95
94
|
documentation_uri: https://squared.readthedocs.io
|
96
|
-
post_install_message:
|
97
95
|
rdoc_options: []
|
98
96
|
require_paths:
|
99
97
|
- lib
|
@@ -108,8 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
106
|
- !ruby/object:Gem::Version
|
109
107
|
version: '0'
|
110
108
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
109
|
+
rubygems_version: 3.6.2
|
113
110
|
specification_version: 4
|
114
111
|
summary: Rake task generator for managing multi-language workspaces.
|
115
112
|
test_files: []
|