squared 0.4.18 → 0.5.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.
@@ -10,9 +10,6 @@ module Squared
10
10
  include Common::Shell
11
11
  extend Forwardable
12
12
 
13
- OPT_VALUE = /\A([^=]+)=(.+)\z/
14
- private_constant :OPT_VALUE
15
-
16
13
  class << self
17
14
  include Common::Format
18
15
  include Shell
@@ -34,11 +31,13 @@ module Squared
34
31
  def clear(target, opts, pass: true, styles: nil, **kwargs)
35
32
  return if opts.empty?
36
33
 
37
- kwargs[:subject] ||= stripext(target.first)
34
+ kwargs[:subject] ||= stripext target.first
38
35
  kwargs[:hint] ||= 'unrecognized'
39
36
  append(target, opts, delim: true) if kwargs.delete(:append)
40
37
  warn log_message(Logger::WARN, opts.join(', '), pass: true, **kwargs)
41
- exit 1 unless pass || confirm("Run? [#{sub_style(target, styles: styles)}] [y/N] ", 'N')
38
+ return if pass || confirm("Run? [#{sub_style(target, styles: styles)}] [y/N] ", 'N')
39
+
40
+ raise_error 'user cancelled'
42
41
  end
43
42
 
44
43
  def strip(val)
@@ -48,41 +47,26 @@ module Squared
48
47
  val.map { |s| s.sub(/\A-([a-z\d])(.+)\z/i, '\1=\2').sub(/\A--?/, '') }.reject(&:empty?)
49
48
  end
50
49
 
51
- def select(list, bare: true, no: true, single: false, double: false)
52
- ret = bare ? list.grep_v(/=/) : list.grep(/=/).map! { |val| val.split('=', 2).first }
53
- ret.map! { |val| val.split('|', 2).last }
54
- ret = ret.grep_v(/^no-/) unless no
55
- return ret if single == double
56
-
57
- ret.select { |val| single ? val.size == 1 : val.size > 1 }
58
- end
59
-
60
50
  def arg?(target, *args, value: false, **)
61
51
  r, s = args.partition { |val| val.is_a?(Regexp) }
62
52
  unless s.empty?
63
- s.map! { |val| Regexp.escape(shell_option(val)) }
53
+ s.map! { |val| Regexp.escape(val.start_with?('-') ? val : shell_option(val)) }
64
54
  r << /\A(?:#{s.join('|')})#{value ? '[ =].' : '(?: |=|\z)'}/
65
55
  end
66
- target.any? { |opt| r.any? { |val| opt&.match?(val) } }
67
- end
68
-
69
- def pattern?(val)
70
- val.match?(/(?:\A\^|\$\z)/) || val.match?(/(?:\.[*+]|\(\?:|\\[dsw]|\[.+\]|\{\d+,?\d*\})/)
56
+ s = target.to_a.compact
57
+ r.any? { |pat| s.any?(pat) }
71
58
  end
72
59
  end
73
60
 
74
61
  attr_reader :target, :extras, :found, :errors, :values, :project, :path
75
62
 
76
63
  def_delegators :@target, :+, :-, :<<, :any?, :none?, :include?, :add, :add?, :find, :find_all, :find_index,
77
- :merge, :delete, :delete?, :delete_if, :grep, :grep_v, :inspect, :to_a, :to_s
64
+ :merge, :delete, :delete?, :delete_if, :grep, :inspect, :to_a, :to_s
78
65
  def_delegators :@extras, :empty?, :each, :each_with_index, :partition, :dup, :first, :last, :shift, :unshift,
79
- :pop, :push, :concat, :index, :delete_at, :join, :map, :map!, :select, :reject, :size
80
-
81
- def_delegator :@extras, :delete, :remove
82
- def_delegator :@extras, :delete_if, :remove_if
66
+ :pop, :push, :join, :map, :map!, :select, :reject, :size
83
67
 
84
68
  def initialize(opts, list, target = Set.new, project: nil, path: nil, **kwargs, &blk)
85
- @target = target.is_a?(Set) ? target : Set.new(target)
69
+ @target = target.is_a?(Set) ? target : target.to_set
86
70
  @project = project
87
71
  @path = path || project&.path
88
72
  @errors = []
@@ -156,36 +140,35 @@ module Squared
156
140
  numcheck = ->(k, v) { numtype.any? { |flag, pat| flag.include?(k) && pat.match?(v) } }
157
141
  skip = false
158
142
  opts.each do |opt|
159
- next skip = true if opt == '--'
160
- next push opt if skip
143
+ next @extras << opt if skip
161
144
 
162
145
  if single&.match?(opt)
163
- add "-#{opt}"
146
+ target << "-#{opt}"
164
147
  elsif bare.include?(opt)
165
- add(opt.size == 1 ? "-#{opt}" : "--#{opt}")
148
+ target << (opt.size == 1 ? "-#{opt}" : "--#{opt}")
166
149
  elsif opt.start_with?('no-') && no.include?(name = opt[3..-1])
167
- add "--no-#{name}"
150
+ target << "--no-#{name}"
168
151
  else
169
- if opt =~ OPT_VALUE
152
+ if opt =~ /\A([^=]+)=(.+)\z/
170
153
  key = $1
171
154
  val = $2
172
155
  merge = m.include?(key)
173
156
  if e.include?(key)
174
- add shell_option(key, val, merge: merge)
157
+ target << shell_option(key, val, merge: merge)
175
158
  elsif q.include?(key)
176
- add quote_option(key, val, double: qq.include?(key), merge: merge)
159
+ target << quote_option(key, val, double: qq.include?(key), merge: merge)
177
160
  elsif p.include?(key) && path
178
- add quote_option(key, path + val, merge: merge)
161
+ target << quote_option(key, path + val, merge: merge)
179
162
  elsif b.include?(key) || numcheck.call(key, val)
180
- add basic_option(key, val, merge: merge)
163
+ target << basic_option(key, val, merge: merge)
181
164
  elsif merge
182
- add basic_option(key, val, merge: true)
165
+ target << basic_option(key, val, merge: true)
183
166
  else
184
- push opt
167
+ @extras << opt
185
168
  end
186
169
  opt = key
187
170
  else
188
- push opt
171
+ @extras << opt
189
172
  skip = true if args
190
173
  end
191
174
  skip = true if first&.any? { |s| s.is_a?(Regexp) ? opt.match?(s) : !opt.include?(s) }
@@ -206,27 +189,10 @@ module Squared
206
189
  end
207
190
 
208
191
  def append(*args, **kwargs)
209
- args = extras if args.empty?
210
- OptionPartition.append(target, *args, **kwargs)
192
+ OptionPartition.append(target, *(args.empty? ? extras : args), **kwargs)
211
193
  self
212
194
  end
213
195
 
214
- def uniq(list)
215
- items = map { |val| nameonly(val) }
216
- list.reject do |val|
217
- next true if items.include?(s = nameonly(val))
218
-
219
- pat = /\A#{s = fill_option(s)}(?:#{s.start_with?('--') ? '[= ]' : '.*'}|\z)/
220
- any? { |opt| opt.match?(pat) }
221
- end
222
- end
223
-
224
- def uniq!(list)
225
- n = size
226
- concat uniq(list)
227
- extras if size > n
228
- end
229
-
230
196
  def clear(opts = nil, errors: false, **kwargs)
231
197
  styles = project.theme[:inline] if project
232
198
  if !opts
@@ -240,101 +206,82 @@ module Squared
240
206
  self
241
207
  end
242
208
 
243
- def adjoin(*args, start: false)
244
- i = -1
245
- (items = to_a).each_with_index do |val, index|
246
- if i == 0
247
- next unless val.start_with?('-')
248
-
249
- i = index
250
- break
251
- elsif index > 0 && !val.start_with?('-')
252
- if start
253
- i = index + (start.is_a?(Numeric) ? start : 1)
254
- break
255
- end
256
- i = 0
257
- end
258
- end
259
- if i > 0
260
- if args.empty?
261
- args = dup
262
- reset
263
- end
264
- args = items[0...i] + args + items[i..-1]
265
- target.clear
266
- end
267
- merge args
268
- self
209
+ def arg?(*args, **kwargs)
210
+ OptionPartition.arg?(target, *args, **kwargs)
269
211
  end
212
+ end
270
213
 
271
- def add_path(*args, **kwargs)
272
- add shell_quote(path ? path.join(*args) : File.join(*args), **kwargs)
273
- self
214
+ class JoinSet < Set
215
+ def self.to_s
216
+ super[/[^:]+\z/, 0]
274
217
  end
275
218
 
276
- def add_quote(*args, **kwargs)
277
- merge(args.map { |val| shell_quote(val, **kwargs) })
278
- self
219
+ attr_reader :delim
220
+
221
+ def initialize(data = [], delim: ' ')
222
+ super(data.compact)
223
+ @delim = delim
279
224
  end
280
225
 
281
- def splice(*exclude, quote: true, delim: true, path: false, pattern: false, &blk)
282
- found, other = if block_given?
283
- partition(&blk)
284
- elsif exclude.first.is_a?(Symbol)
285
- partition(&exclude.first)
286
- else
287
- partition do |val|
288
- next false if pattern && OptionPartition.pattern?(val)
289
-
290
- exclude.none? { |pat| val.match?(Regexp.new(pat)) }
291
- end
292
- end
293
- unless found.empty?
294
- add '--' if delim
295
- extras.clear
296
- concat other
297
- if path
298
- found.each { |val| add_path(val) }
299
- else
300
- merge(quote ? found.map! { |val| shell_quote(val) } : found)
226
+ def last(val, pat)
227
+ (@last ||= []).append([val, pat, $1]) if val =~ pat
228
+ self << val
229
+ end
230
+
231
+ def pass(&blk)
232
+ ret = to_a.map!(&:to_s).reject(&:empty?)
233
+ @last&.each do |val, pat, key|
234
+ i = []
235
+ j = nil
236
+ ret.each_with_index do |opt, index|
237
+ if opt == val
238
+ j = index
239
+ elsif j && opt[pat, 1] == key
240
+ i << index
241
+ end
242
+ end
243
+ next unless j && !i.empty?
244
+
245
+ val = ret[j]
246
+ cur = j
247
+ i.each do |k|
248
+ ret[cur] = ret[k]
249
+ cur = k
301
250
  end
251
+ ret[i.last] = val
302
252
  end
303
- self
253
+ block_given? ? ret.reject(&blk) : ret
304
254
  end
305
255
 
306
- def append?(key, val = nil, type: nil, **kwargs)
307
- return false if arg?(key)
308
-
309
- val = yield self if block_given?
310
- return false unless val
256
+ def and(*args)
257
+ self << '&&'
258
+ merge args
259
+ end
311
260
 
312
- type ||= :quote if kwargs.empty?
313
- op << case type
314
- when :quote
315
- quote_option(key, val)
316
- when :basic
317
- basic_option(key, val)
318
- else
319
- shell_option(key, val, **kwargs)
320
- end
321
- true
261
+ def or(*args)
262
+ self << '||'
263
+ merge args
322
264
  end
323
265
 
324
- def reset(errors: false)
325
- extras.clear
326
- clear(errors: true) if errors
327
- self
266
+ def with(*args, &blk)
267
+ temp('&&', *args, &blk)
328
268
  end
329
269
 
330
- def arg?(*args, **kwargs)
331
- OptionPartition.arg?(target, *args, **kwargs)
270
+ def temp(*args, &blk)
271
+ args.compact!
272
+ ret = pass(&blk)
273
+ ret = Set.new(ret.concat(args)).to_a unless args.empty?
274
+ ret.join(@delim)
332
275
  end
333
276
 
334
- private
277
+ def done
278
+ ret = to_s
279
+ clear
280
+ ret
281
+ end
335
282
 
336
- def nameonly(val)
337
- val[OPT_VALUE, 1] || val
283
+ def to_s
284
+ pass.join(@delim)
338
285
  end
339
286
  end
340
287
  end
@@ -3,16 +3,6 @@
3
3
  module Squared
4
4
  module Workspace
5
5
  module Project
6
- class << self
7
- attr_accessor :line_width
8
-
9
- def max_width(lines)
10
- n = [lines.max_by(&:size).size, 80].max
11
- [n, Rake.application.terminal_width].min
12
- end
13
- end
14
-
15
- @line_width = ENV.fetch('LOG_COLUMNS', 80).to_i
16
6
  end
17
7
  end
18
8
  end
@@ -57,10 +57,10 @@ module Squared
57
57
  when 'verbose'
58
58
  @verbose = 1
59
59
  if script.is_a?(Array)
60
- script[0] = task_join(script[0], 'verbose')
60
+ script[0] = task_join script[0], 'verbose'
61
61
  script
62
62
  else
63
- task_join(script, 'verbose')
63
+ task_join script, 'verbose'
64
64
  end
65
65
  when 'silent'
66
66
  @verbose = false
@@ -81,8 +81,8 @@ module Squared
81
81
  data[:run] = run
82
82
  end
83
83
  data[:global] = true
84
- data[:dev] = env_match('REPO_DEV', dev)
85
- data[:prod] = env_match('REPO_PROD', prod)
84
+ data[:dev] = env_match 'REPO_DEV', dev
85
+ data[:prod] = env_match 'REPO_PROD', prod
86
86
  if (val = env('REPO_GROUP'))
87
87
  script_set(data, group: val.split(','))
88
88
  found = true
@@ -113,41 +113,56 @@ module Squared
113
113
  def __repo__(**kwargs)
114
114
  kwargs.delete(:parallel) if env('REPO_SYNC', ignore: '0')
115
115
 
116
- namespace task_name('repo') do |ns|
117
- path = ns.scope.path
116
+ namespace(name = task_name('repo')) do |repo|
118
117
  branch = env('REPO_MANIFEST') || Repo.read_manifest(root)
119
118
  target = branch || manifest
120
- cmd = nil
121
119
  stage = nil
122
- opts = %w[force rebase detach submodules fail no-update gc]
120
+ failfast = true
121
+ cmd = []
123
122
  newline = ARGV.index { |val| val.start_with?('repo:') }.to_i > 0
123
+ parse_opts = lambda do |args|
124
+ args.to_a.each do |val|
125
+ case val
126
+ when 'no-fail'
127
+ failfast = false
128
+ when 'force'
129
+ cmd << '--force-checkout'
130
+ when 'rebase'
131
+ cmd << '--rebase'
132
+ when 'detach'
133
+ cmd << '--detach'
134
+ when 'gc'
135
+ cmd << '--auto-gc'
136
+ when 'no-update'
137
+ cmd << '--no-manifest-update'
138
+ end
139
+ end
140
+ end
124
141
  desc = lambda do |val, alt = nil|
125
142
  if (ver = branch || alt)
126
- val = val.sub('{0}', "opts*=#{opts.join(',')}")
127
- task_desc(path, val, ver)
143
+ val = val.sub('{0}', 'opts*=force,rebase,detach,gc,no-update,no-fail')
144
+ task_desc(task_name('repo'), val, ver)
128
145
  else
129
146
  task_desc 'inactive'
130
147
  end
131
148
  end
132
149
 
133
150
  desc.call('all[{0}]')
134
- task 'all' do |_, args|
135
- cmd ||= repo_opts args
151
+ task 'all', [:opts] do |_, args|
152
+ parse_opts.call(args)
136
153
  stage ||= 'all'
137
- ns['sync'].invoke
138
- next if env('REPO_STAGE', equals: '1')
154
+ repo['sync'].invoke
155
+ next if env('REPO_DRYRUN', equals: '2')
139
156
 
140
157
  @project.select do |_, proj|
141
158
  next unless proj.enabled?(proj.workspace.baseref)
142
159
 
143
160
  proj.depend(sync: true) if proj.depend?
144
- next if env('REPO_STAGE', equals: '2')
145
-
146
- proj.build?
161
+ proj.build? unless env('REPO_DRYRUN', ignore: '0')
147
162
  end
148
163
  .each_value do |proj|
149
164
  proj.build(sync: true)
150
- next unless proj.dev? && proj.copy? && !env('REPO_STAGE', equals: '3')
165
+ next unless proj.dev? && proj.copy?
151
166
 
152
167
  if (ws = proj.workspace).task_defined?(target = task_join(proj.name, 'copy'))
153
168
  task_invoke(target, **ws.invokeargs)
@@ -157,57 +172,39 @@ module Squared
157
172
  end
158
173
  end
159
174
 
160
- desc.call("init[manifest?=#{target},groups?,{0}]", target)
161
- task 'init' do |_, args|
162
- args = args.to_a
163
- u = env('REPO_URL') || manifest_url
164
- m = args.first && !opts.include?(args.first) ? args.shift : target
165
- g = case (g = env('REPO_GROUPS'))
166
- when '0', 'false'
167
- nil
168
- else
169
- g || (args.first && !opts.include?(args.first) ? args.shift : nil)
170
- end
171
- cmd = repo_opts args
172
- s = case (s = env('REPO_SUBMODULES'))
173
- when '0', 'false'
174
- false
175
- else
176
- s ? true : cmd.include?('--fetch-submodules')
177
- end
175
+ desc.call("init[manifest?=#{target},{0}]", target)
176
+ task 'init', [:manifest, :opts] do |_, args|
177
+ parse_opts.call(args)
178
178
  stage = 'init'
179
179
  puts if newline
180
- args = ["-u #{u}", "-m #{m}.xml"]
181
- args << "-g #{g}" if g
182
- args << '--submodules' if s
183
- Common::System.shell("#{repo_bin} init #{args.join(' ')}", chdir: root)
184
- next if env('REPO_STAGE', equals: '0')
185
-
186
- ns['all'].invoke
180
+ system("repo init -u #{env('REPO_URL') || manifest_url} -m #{args.manifest || target}.xml", chdir: root)
181
+ repo['all'].invoke
187
182
  end
188
183
 
189
184
  desc.call('sync[{0}]')
190
- task 'sync' do |t, args|
191
- raise_error 'repo not initialized' unless branch || stage == 'init'
192
- cmd ||= repo_opts args
185
+ task 'sync', [:opts] do |_, args|
186
+ unless branch || stage == 'init'
187
+ raise_error('repo not initialized', hint: task_name('repo:init'), kind: LoadError)
188
+ end
189
+ parse_opts.call(args)
193
190
  cmd << "-j#{ENV.fetch('REPO_JOBS', Rake::CpuCounter.count)}"
194
- puts unless !newline || stage == 'init'
191
+ cmd << '--fail-fast' if failfast
192
+ puts if newline && stage != 'init'
195
193
  begin
196
- Common::System.shell("#{repo_bin} sync #{cmd.join(' ')}", chdir: root,
197
- exception: cmd.include?('--fail-fast'))
194
+ Common::System.shell("repo sync #{cmd.join(' ')}", chdir: root, exception: failfast)
198
195
  rescue Errno::ENOENT => e
199
196
  emphasize(e, title: root)
200
197
  raise
201
198
  rescue StandardError => e
202
- emphasize(e, title: "rake stash #{t.name}")
199
+ emphasize(e, title: "rake stash #{task_name(task_join('repo', stage || 'sync'))}")
203
200
  raise
204
201
  end
205
202
  end
206
203
 
207
- series.sync.push(
208
- task_join(path, 'all'),
209
- task_join(path, 'init'),
210
- task_join(path, 'sync')
204
+ series.sync.append(
205
+ task_join(name, 'all'),
206
+ task_join(name, 'init'),
207
+ task_join(name, 'sync')
211
208
  )
212
209
  end
213
210
  end
@@ -223,31 +220,6 @@ module Squared
223
220
  )
224
221
  end
225
222
 
226
- def repo_opts(args)
227
- ret = []
228
- args.to_a.each do |val|
229
- case val
230
- when 'force'
231
- ret << '--force-checkout'
232
- when 'rebase', 'detach'
233
- ret << "--#{val}"
234
- when 'submodules'
235
- ret << '--fetch-submodules'
236
- when 'fail'
237
- ret << '--fail-fast'
238
- when 'no-update'
239
- ret << '--no-manifest-update'
240
- when 'gc'
241
- ret << '--auto-gc'
242
- end
243
- end
244
- ret
245
- end
246
-
247
- def repo_bin
248
- Common::Shell.shell_bin('repo')
249
- end
250
-
251
223
  def repo?
252
224
  !manifest_url.nil? && (repo_install? || @repo_override == true)
253
225
  end
@@ -10,16 +10,16 @@ module Squared
10
10
 
11
11
  TASK_BASE = []
12
12
  TASK_BATCH = {}
13
- TASK_EXTEND = Support.hashlist
13
+ TASK_EXTEND = {}
14
14
  TASK_KEYS = []
15
- TASK_ALIAS = Support.hashobj
15
+ TASK_ALIAS = {}
16
16
  TASK_NAME = {}
17
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)
21
21
  key_set task
22
- TASK_EXTEND[task] << obj
22
+ (TASK_EXTEND[task] ||= []) << obj
23
23
  end
24
24
 
25
25
  def batch(*args, obj)
@@ -37,7 +37,7 @@ module Squared
37
37
 
38
38
  def alias(ref, obj)
39
39
  if obj.is_a?(Hash)
40
- obj.each { |key, val| TASK_ALIAS[key][ref] = val }
40
+ obj.each { |key, val| (TASK_ALIAS[key] ||= {})[ref] = val }
41
41
  else
42
42
  TASK_ALIAS[obj]&.delete(ref)
43
43
  end
@@ -68,7 +68,7 @@ module Squared
68
68
 
69
69
  attr_reader :sync, :multiple, :parallel
70
70
 
71
- def_delegators :@data, :[], :each, :each_key, :keys, :fetch, :to_a, :to_s, :inspect, :merge!, :key?
71
+ def_delegators :@data, :[], :each, :each_key, :keys, :key?, :fetch, :update, :merge!, :to_a, :to_s, :inspect
72
72
  def_delegators :@workspace, :task_desc, :task_name, :task_namespace, :task_join, :format_desc
73
73
 
74
74
  def initialize(workspace, exclude: [])
@@ -79,8 +79,8 @@ module Squared
79
79
  @chain = {}
80
80
  @exclude = exclude.freeze
81
81
  @session = {
82
- group: Support.hashlist,
83
- parent: Support.hashlist,
82
+ group: {},
83
+ parent: {},
84
84
  id: []
85
85
  }
86
86
  @data = {}
@@ -95,7 +95,7 @@ module Squared
95
95
 
96
96
  if (g = proj.group)
97
97
  id << g
98
- group[:"#{key}:#{g}"].concat(tasks)
98
+ (group[:"#{key}:#{g}"] ||= []).concat(tasks)
99
99
  else
100
100
  items.concat(tasks)
101
101
  end
@@ -106,35 +106,35 @@ module Squared
106
106
  next unless (b = ws.find_base(proj)) && (n = b.ref.to_s) != g
107
107
 
108
108
  id << n
109
- parent[:"#{key}:#{n}"].concat(tasks)
109
+ (parent[:"#{key}:#{n}"] ||= []).concat(tasks)
110
110
  end
111
111
  end
112
112
 
113
113
  def build(parallel: [], pattern: [], **)
114
114
  subcheck = ->(val) { (ns = task_namespace(val)) && parallel.include?(ns) }
115
- @data.merge!(@session[:parent]) if @session[:id].uniq.size > 1
116
- @data.merge!(@session[:group])
115
+ @data.update(@session[:parent]) if @session[:id].uniq.size > 1
116
+ @data.update(@session[:group])
117
117
  @data.each do |key, items|
118
118
  next if exclude?(key, true) || @workspace.task_exclude?(t = name_get(key))
119
119
 
120
120
  key = task_name t
121
- val = format_desc(key, out: true)
121
+ title = format_desc(key, out: true)
122
122
  if items.size > 1
123
123
  @multiple << key
124
124
  if parallel.include?(t) || pattern.any? { |pat| t.match?(pat) } || subcheck.call(t)
125
- task_desc("#{val} (thread)", name: key)
125
+ task_desc("#{title} (thread)", name: key) if title
126
126
  multitask key => items
127
127
  @parallel << key
128
128
 
129
- s = task_join(key, 'sync')
130
- task_desc("#{val} (sync)", name: s)
129
+ s = task_join key, 'sync'
130
+ task_desc("#{title} (sync)", name: s) if title
131
131
  task s => items
132
132
  @sync << s
133
133
  next
134
134
  end
135
135
  end
136
136
 
137
- task_desc(val, name: key)
137
+ task_desc(title, name: key) if title
138
138
  task key => items
139
139
  end
140
140
  @multiple.concat(sync)
@@ -3,8 +3,9 @@
3
3
  module Squared
4
4
  module Workspace
5
5
  module Support
6
- RunData = Struct.new('RunData', :run, :block)
7
- ChainData = Struct.new('ChainData', :action, :step, :with, :before, :after, :sync)
6
+ RunData = Struct.new(:run, :block)
7
+ ChainData = Struct.new(:action, :step, :with, :before, :after, :sync)
8
+ BannerData = Struct.new(:command, :order, :styles, :border)
8
9
  end
9
10
  end
10
11
  end
@@ -1,4 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'support/base'
4
3
  require_relative 'support/data'
@@ -10,7 +10,7 @@ module Squared
10
10
  if id.is_a?(Symbol)
11
11
  project id
12
12
  else
13
- __get__(:project).find { |_, val| File.expand_path(val.path) == File.expand_path(id) }
13
+ __get__(:project).find { |_, val| File.expand_path(val.path) == File.expand_path(id, __dir__) }
14
14
  end
15
15
  end
16
16
  ret.size == 1 ? ret.first : ret