squared 0.7.6 → 0.8.0

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.
@@ -7,6 +7,15 @@ module Squared
7
7
  module Utils
8
8
  private
9
9
 
10
+ def symjoin(*args, char: ':')
11
+ args.flatten.join(char).to_sym
12
+ end
13
+
14
+ def collect_hash(data, pass: [])
15
+ data = data.reject { |key,| pass.include?(key) } unless pass.empty?
16
+ data.values.flatten
17
+ end
18
+
10
19
  def rand_s(size)
11
20
  require 'random/formatter'
12
21
  Random.new.alphanumeric(size)
@@ -26,7 +35,7 @@ module Squared
26
35
  end
27
36
  end
28
37
 
29
- def matchmap(list, prefix = nil)
38
+ def matchmap(list, prefix: nil)
30
39
  list.map do |val|
31
40
  next val if val.is_a?(Regexp)
32
41
 
@@ -20,7 +20,7 @@ module Squared
20
20
  elsif !repo_install? && !repo_confirm
21
21
  @root = nil
22
22
  end
23
- raise_error Errno::EEXIST, path.cleanpath, hint: 'REPO_HOME' unless @root
23
+ raise Errno::EEXIST, message(path.cleanpath, hint: 'REPO_HOME') unless @root
24
24
  end
25
25
  path.realdirpath
26
26
  elsif (val = env('REPO_ROOT'))
@@ -28,7 +28,7 @@ module Squared
28
28
  if !@root.exist?
29
29
  @root.mkpath
30
30
  elsif !repo_install?(parent: true) && !repo_confirm
31
- raise_error Errno::EEXIST, @root, hint: 'REPO_ROOT'
31
+ raise Errno::EEXIST, message(@root, hint: 'REPO_ROOT')
32
32
  end
33
33
  @root.join(main).realdirpath
34
34
  elsif repo_install?(parent: true) && (!home.exist? || @root + main == home)
@@ -219,7 +219,7 @@ module Squared
219
219
  opts << "--#{val}"
220
220
  when /^(fetch-)?submodules$/
221
221
  opts << '--fetch-submodules' if repo_submodules?(true, **envargs)
222
- when /^(fail-)?fail$/
222
+ when /^(fail-)?fast$/
223
223
  opts << '--fail-fast'
224
224
  when /^no-(manifest-)?update$/
225
225
  opts << '--no-manifest-update'
@@ -227,7 +227,9 @@ module Squared
227
227
  opts << '--auto-gc'
228
228
  end
229
229
  end
230
- opts << "-j#{ENV.fetch('REPO_JOBS', Rake::CpuCounter.count)}" unless opts.any?(/^--?j(obs)?$/)
230
+ if (jobs = ENV['REPO_JOBS']) || opts.none?(/^--?j(obs)?$/)
231
+ opts << "-j#{jobs || Rake::CpuCounter.count}"
232
+ end
231
233
  opts << '--fetch-submodules' if repo_submodules?(**envargs)
232
234
  begin
233
235
  repo_run('sync', opts, exception: opts.include?('--fail-fast'), options: stage != 'init')
@@ -275,7 +277,7 @@ module Squared
275
277
  end
276
278
  end
277
279
 
278
- def repo_run(cmd, opts = [], exception: false, options: true, **kwargs)
280
+ def repo_run(cmd, opts = [], exception: exception?, options: true, **kwargs)
279
281
  cmd = [repo_bin, cmd]
280
282
  cmd << opts.uniq.join(' ') unless opts.empty?
281
283
  env('REPO_OPTIONS', **kwargs) { |val| cmd << val } if options
@@ -308,7 +310,7 @@ module Squared
308
310
  r = r.keys
309
311
  pass = g.empty? && r.empty?
310
312
  select do |proj|
311
- next unless proj.enabled?(baseref)
313
+ next unless proj.enabled?(ref: baseref)
312
314
 
313
315
  proj.global_set(name)
314
316
  i = -1
@@ -339,7 +341,7 @@ module Squared
339
341
  task_invoke(name, **proj.workspace.invokeargs)
340
342
  end
341
343
  rescue => e
342
- raise if exception
344
+ raise if exception?
343
345
 
344
346
  warn log_warn(e, pass: true) if warning
345
347
  end
@@ -38,10 +38,18 @@ module Squared
38
38
  end
39
39
  end
40
40
  if (args = obj.batchargs)
41
- batch_set(*args)
41
+ if args.first.is_a?(Hash)
42
+ batch_set(obj.ref, *args)
43
+ else
44
+ batch_set(*args)
45
+ end
42
46
  end
43
47
  if (args = obj.aliasargs)
44
- alias_set(*args)
48
+ if args.first.is_a?(Hash)
49
+ alias_set(obj.ref, *args)
50
+ else
51
+ alias_set(*args)
52
+ end
45
53
  end
46
54
  end
47
55
  workspace.config_get(:batch)&.each { |args| batch_set(*args) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 4.0.11
128
+ rubygems_version: 4.0.10
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []