squared 0.0.10 → 0.0.12
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/README.ruby.md +98 -26
- data/lib/squared/app.rb +10 -0
- data/lib/squared/common/base.rb +12 -16
- data/lib/squared/common/class.rb +26 -1
- data/lib/squared/common/format.rb +79 -24
- data/lib/squared/common/prompt.rb +36 -0
- data/lib/squared/common/shell.rb +4 -3
- data/lib/squared/common/system.rb +15 -47
- data/lib/squared/common/utils.rb +51 -16
- data/lib/squared/common.rb +1 -4
- data/lib/squared/config.rb +48 -43
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +245 -125
- data/lib/squared/workspace/project/base.rb +448 -188
- data/lib/squared/workspace/project/git.rb +97 -113
- data/lib/squared/workspace/project/node.rb +217 -109
- data/lib/squared/workspace/project/python.rb +37 -34
- data/lib/squared/workspace/project/ruby.rb +137 -100
- data/lib/squared/workspace/project.rb +0 -3
- data/lib/squared/workspace/repo.rb +32 -18
- data/lib/squared/workspace/series.rb +82 -53
- data/lib/squared/workspace.rb +6 -5
- data/lib/squared.rb +1 -11
- metadata +4 -3
- data/lib/squared/common/task.rb +0 -24
@@ -12,26 +12,27 @@ module Squared
|
|
12
12
|
|
13
13
|
class << self
|
14
14
|
def populate(*); end
|
15
|
+
def batchargs(*); end
|
15
16
|
|
16
17
|
def tasks
|
17
|
-
|
18
|
+
%i[outdated].freeze
|
19
|
+
end
|
20
|
+
|
21
|
+
def bannerargs
|
22
|
+
%i[dependfile].freeze
|
18
23
|
end
|
19
24
|
|
20
25
|
def venv?
|
21
26
|
Dir.exist?(ENV.fetch('VIRTUAL_ENV', ''))
|
22
27
|
end
|
23
28
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
super
|
29
|
-
end
|
29
|
+
def config?(val)
|
30
|
+
return false unless (val = as_path(val))
|
31
|
+
|
32
|
+
REQUIREMENTS.any? { |file| val.join(file).exist? }
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
33
|
-
attr_reader :requirements
|
34
|
-
|
35
36
|
def initialize(*, **kwargs)
|
36
37
|
super
|
37
38
|
if @pass.include?(Python.ref)
|
@@ -41,12 +42,12 @@ module Squared
|
|
41
42
|
initialize_build(Python.ref, **kwargs)
|
42
43
|
initialize_env(**kwargs)
|
43
44
|
end
|
44
|
-
@
|
45
|
-
@
|
45
|
+
@dependindex = REQUIREMENTS.index { |file| basepath(file).exist? }
|
46
|
+
@dependfile = basepath(REQUIREMENTS[@dependindex || 0])
|
46
47
|
end
|
47
48
|
|
48
49
|
@@tasks[ref] = {
|
49
|
-
install: %i[user target upgrade force]
|
50
|
+
install: %i[user target upgrade force].freeze
|
50
51
|
}.freeze
|
51
52
|
|
52
53
|
def ref
|
@@ -74,11 +75,12 @@ module Squared
|
|
74
75
|
else
|
75
76
|
OPT_USER
|
76
77
|
end
|
77
|
-
|
78
|
+
list += OPT_GENERAL
|
79
|
+
desc format_desc(action, flag, list, req: req)
|
78
80
|
if flag == :target
|
79
81
|
task flag, [:dir, :opts] do |_, args|
|
80
|
-
guard_params(action, flag, args: args, key: :dir)
|
81
|
-
depend(flag, dir:
|
82
|
+
dir = guard_params(action, flag, args: args, key: :dir)
|
83
|
+
depend(flag, dir: dir, opts: args.to_a[1..-1] || [])
|
82
84
|
end
|
83
85
|
else
|
84
86
|
task flag do |_, args|
|
@@ -92,12 +94,11 @@ module Squared
|
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
95
|
-
def depend(flag = nil, dir: nil, opts: [])
|
97
|
+
def depend(flag = nil, dir: nil, opts: [], sync: invoked_sync?('depend', flag))
|
96
98
|
if @depend && !flag
|
97
99
|
super
|
98
100
|
elsif outdated?
|
99
|
-
|
100
|
-
case (type = install_type)
|
101
|
+
case (type = dependtype)
|
101
102
|
when 1, 2
|
102
103
|
cmd = pip_session 'install'
|
103
104
|
case flag
|
@@ -105,7 +106,7 @@ module Squared
|
|
105
106
|
cmd << '--user'
|
106
107
|
append_pip opts, OPT_USER
|
107
108
|
when :target
|
108
|
-
cmd << "--target=#{shell_escape(
|
109
|
+
cmd << "--target=#{shell_escape(basepath(dir), quote: true)}"
|
109
110
|
append_pip opts, OPT_USER + ['upgrade']
|
110
111
|
append_eager opts
|
111
112
|
when :upgrade
|
@@ -129,17 +130,13 @@ module Squared
|
|
129
130
|
run
|
130
131
|
end
|
131
132
|
|
132
|
-
def install_type(*)
|
133
|
-
requirements.exist? ? @reqindex + 1 : 0
|
134
|
-
end
|
135
|
-
|
136
133
|
def variable_set(key, *val, **)
|
137
134
|
case key
|
138
|
-
when :
|
139
|
-
req =
|
135
|
+
when :dependfile
|
136
|
+
req = basepath(*val)
|
140
137
|
if (index = REQUIREMENTS.index(req.basename.to_s))
|
141
|
-
@
|
142
|
-
@
|
138
|
+
@dependindex = index
|
139
|
+
@dependfile = req
|
143
140
|
else
|
144
141
|
log.warn "variable_set: @#{key}=#{req} (not supported)"
|
145
142
|
end
|
@@ -148,8 +145,12 @@ module Squared
|
|
148
145
|
end
|
149
146
|
end
|
150
147
|
|
148
|
+
def depend?
|
149
|
+
@depend != false && (!@depend.nil? || outdated?)
|
150
|
+
end
|
151
|
+
|
151
152
|
def outdated?
|
152
|
-
|
153
|
+
dependtype > 0
|
153
154
|
end
|
154
155
|
|
155
156
|
private
|
@@ -169,21 +170,23 @@ module Squared
|
|
169
170
|
(v ? "-#{v[0]}" : "--#{opt}")
|
170
171
|
end
|
171
172
|
end
|
172
|
-
@session << '--user' if
|
173
|
-
@session << '--no-input' if
|
174
|
-
if (val =
|
173
|
+
@session << '--user' if option('user')
|
174
|
+
@session << '--no-input' if option('no-input')
|
175
|
+
if (val = option('proxy', ignore: false))
|
175
176
|
@session << "--proxy=#{shell_escape(val, quote: true)}"
|
176
177
|
end
|
177
|
-
if (val =
|
178
|
-
@session << "--log=#{shell_escape(
|
178
|
+
if (val = option('log', ignore: false))
|
179
|
+
@session << "--log=#{shell_escape(basepath(val), quote: true)}"
|
179
180
|
end
|
180
|
-
append_nocolor
|
181
|
+
append_nocolor option('no-color')
|
181
182
|
end
|
182
183
|
|
183
184
|
def append_eager(opts)
|
184
185
|
@session << '--upgrade-strategy=eager' if opts.include?('eager')
|
185
186
|
end
|
186
187
|
end
|
188
|
+
|
189
|
+
Application.implement Python
|
187
190
|
end
|
188
191
|
end
|
189
192
|
end
|
@@ -14,32 +14,33 @@ module Squared
|
|
14
14
|
|
15
15
|
class << self
|
16
16
|
def populate(*); end
|
17
|
+
def batchargs(*); end
|
17
18
|
|
18
19
|
def tasks
|
19
|
-
|
20
|
+
%i[outdated].freeze
|
20
21
|
end
|
21
22
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
def bannerargs
|
24
|
+
%i[dependfile].freeze
|
25
|
+
end
|
26
|
+
|
27
|
+
def config?(val)
|
28
|
+
return false unless (val = as_path(val))
|
29
|
+
|
30
|
+
RUBY_DIR.any? { |file| val.join(file).exist? }
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
31
34
|
@@tasks[ref] = {
|
32
|
-
install: %i[redownload local prefer-local gem with without],
|
33
|
-
update: %i[all patch minor major],
|
34
|
-
outdated: %i[patch minor major],
|
35
|
-
pristine: %i[gem all version],
|
35
|
+
install: %i[redownload local prefer-local gem with without].freeze,
|
36
|
+
update: %i[all patch minor major].freeze,
|
37
|
+
outdated: %i[patch minor major].freeze,
|
38
|
+
pristine: %i[gem all version].freeze,
|
36
39
|
exec: nil,
|
37
40
|
config: nil,
|
38
41
|
rake: nil
|
39
42
|
}.freeze
|
40
43
|
|
41
|
-
attr_reader :gemfile
|
42
|
-
|
43
44
|
def initialize(*, version: nil, autodetect: false, **kwargs)
|
44
45
|
super
|
45
46
|
if @pass.include?(Ruby.ref)
|
@@ -51,8 +52,8 @@ module Squared
|
|
51
52
|
end
|
52
53
|
@version = env('BUILD', version, suffix: 'VERSION')
|
53
54
|
@autodetect = autodetect
|
54
|
-
|
55
|
-
@
|
55
|
+
@dependindex = GEMFILE.index { |file| basepath(file).exist? }
|
56
|
+
@dependfile = basepath(GEMFILE[@dependindex || 0])
|
56
57
|
return if !@output[0].nil? || !@copy.nil? || @version || @autodetect || (file = rakefile).nil?
|
57
58
|
|
58
59
|
begin
|
@@ -89,9 +90,25 @@ module Squared
|
|
89
90
|
when :rake
|
90
91
|
next unless rakefile
|
91
92
|
|
92
|
-
desc format_desc(action, nil, 'command*')
|
93
|
+
desc format_desc(action, nil, 'command*|^index,args*|#,pattern*')
|
93
94
|
task action, [:command] do |_, args|
|
94
|
-
|
95
|
+
if args.command == '#'
|
96
|
+
format_list(read_rakefile, 'rake[^N]', 'tasks', grep: args.extras, from: rakefile.to_s,
|
97
|
+
each: ->(val) { val[0] + val[1].to_s })
|
98
|
+
elsif (data = indexdata(args.command))
|
99
|
+
n, opts = data
|
100
|
+
list = read_rakefile
|
101
|
+
if (item = list[n - 1])
|
102
|
+
cmd = opts ? "#{opts} #{item.first}" : item.first
|
103
|
+
elsif exception
|
104
|
+
indexerror n, list
|
105
|
+
else
|
106
|
+
next log.warn "rake task #{n} of #{list.size} (out of range)"
|
107
|
+
end
|
108
|
+
rake(args.extras.empty? ? cmd : "#{cmd}[#{args.extras.join(',')}]")
|
109
|
+
else
|
110
|
+
rake(*args.to_a)
|
111
|
+
end
|
95
112
|
end
|
96
113
|
end
|
97
114
|
else
|
@@ -103,16 +120,14 @@ module Squared
|
|
103
120
|
when :gem
|
104
121
|
desc format_desc(action, flag, 'name+')
|
105
122
|
task flag, [:name] do |_, args|
|
106
|
-
|
107
|
-
|
108
|
-
depend(flag, opts: name)
|
123
|
+
opts = guard_params(action, flag, args: args.to_a)
|
124
|
+
depend(flag, opts: opts)
|
109
125
|
end
|
110
126
|
when :with, :without
|
111
127
|
desc format_desc(action, flag, 'group+')
|
112
128
|
task flag, [:group] do |_, args|
|
113
|
-
|
114
|
-
|
115
|
-
depend(flag, opts: group)
|
129
|
+
opts = guard_params(action, flag, args: args.to_a)
|
130
|
+
depend(flag, opts: opts)
|
116
131
|
end
|
117
132
|
else
|
118
133
|
desc format_desc(action, flag, OPT_INSTALL)
|
@@ -130,9 +145,8 @@ module Squared
|
|
130
145
|
when :gem
|
131
146
|
desc format_desc(action, flag, 'name+')
|
132
147
|
task flag, [:name] do |_, args|
|
133
|
-
|
134
|
-
|
135
|
-
pristine(flag, opts: name)
|
148
|
+
opts = guard_params(action, flag, args: args.to_a)
|
149
|
+
pristine(flag, opts: opts)
|
136
150
|
end
|
137
151
|
when :all
|
138
152
|
desc format_desc(action, flag, 'skip*')
|
@@ -142,8 +156,8 @@ module Squared
|
|
142
156
|
when :version
|
143
157
|
desc format_desc(action, flag, 'version?')
|
144
158
|
task flag, [:version] do |_, args|
|
145
|
-
guard_params(action, flag, args: args, key: :version)
|
146
|
-
pristine(flag, version:
|
159
|
+
version = guard_params(action, flag, args: args, key: :version)
|
160
|
+
pristine(flag, version: version)
|
147
161
|
end
|
148
162
|
end
|
149
163
|
end
|
@@ -154,7 +168,7 @@ module Squared
|
|
154
168
|
end
|
155
169
|
end
|
156
170
|
|
157
|
-
def depend(flag = nil, opts: [])
|
171
|
+
def depend(flag = nil, opts: [], sync: invoked_sync?('depend', flag))
|
158
172
|
if @depend && !flag
|
159
173
|
super
|
160
174
|
elsif outdated?
|
@@ -167,7 +181,7 @@ module Squared
|
|
167
181
|
append_repeat flag, opts
|
168
182
|
when :redownload, :local, :'prefer-local'
|
169
183
|
cmd = bundle_session 'install', "--#{flag}"
|
170
|
-
if (val =
|
184
|
+
if (val = option('trust-policy', ignore: false))
|
171
185
|
cmd << "--trust-policy=#{case val
|
172
186
|
when '0'
|
173
187
|
'NoSecurity'
|
@@ -188,28 +202,28 @@ module Squared
|
|
188
202
|
bundle_session 'install'
|
189
203
|
append_bundle
|
190
204
|
end
|
191
|
-
run_rb(sync:
|
205
|
+
run_rb(sync: sync)
|
192
206
|
end
|
193
207
|
end
|
194
208
|
|
195
|
-
def copy(from: 'lib', glob:
|
209
|
+
def copy(from: 'lib', glob: nil, into: @gemdir, override: false)
|
196
210
|
if @copy && !override
|
197
211
|
return super if runnable?(@copy)
|
198
212
|
|
199
213
|
from = @copy[:from] if @copy.key?(:from)
|
200
214
|
glob = @copy[:glob] if @copy.key?(:glob)
|
201
|
-
|
215
|
+
into = @copy[:into] if @copy.key?(:into)
|
202
216
|
end
|
203
|
-
return unless
|
217
|
+
return unless into
|
204
218
|
|
205
|
-
dest = Pathname.new(
|
219
|
+
dest = Pathname.new(into).realpath
|
206
220
|
print_item unless @output[0]
|
207
|
-
glob = as_a(glob)
|
221
|
+
glob = as_a(glob || '**/*')
|
208
222
|
as_a(from).each_with_index do |val, i|
|
209
|
-
a =
|
223
|
+
a = basepath(val)
|
210
224
|
b = dest.join(val)
|
211
|
-
c = glob[i] ||
|
212
|
-
log.
|
225
|
+
c = glob[i] || glob[0]
|
226
|
+
log.info "cp #{a.join(c)} #{b}"
|
213
227
|
copy_d(a, b, glob: c, verbose: verbose)
|
214
228
|
end
|
215
229
|
end
|
@@ -217,7 +231,7 @@ module Squared
|
|
217
231
|
def outdated(rev = nil, opts: [])
|
218
232
|
cmd = bundle_session 'outdated', rev && "--#{rev}"
|
219
233
|
append_bundle opts, OPT_OUTDATED
|
220
|
-
cmd =
|
234
|
+
cmd = session_done(cmd)
|
221
235
|
log.info cmd
|
222
236
|
banner = format_banner(cmd)
|
223
237
|
if invoked_sync?('outdated', rev)
|
@@ -232,31 +246,32 @@ module Squared
|
|
232
246
|
if start > 0
|
233
247
|
unless stdin?
|
234
248
|
data = line.scan(SEM_VER)
|
235
|
-
cur = data.shift
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
249
|
+
next unless (cur = data.shift) && (lat = data.shift)
|
250
|
+
|
251
|
+
semver(cur)
|
252
|
+
semver(lat)
|
253
|
+
c = cur.join
|
254
|
+
l = lat.join
|
255
|
+
styles = []
|
256
|
+
major_set = lambda do
|
257
|
+
styles = %i[green bold]
|
258
|
+
major += 1
|
259
|
+
end
|
260
|
+
minor_set = -> { styles[0] = cur[2] == lat[2] ? :yellow : :green }
|
261
|
+
if data.empty?
|
262
|
+
semmajor?(cur, lat) ? major_set.() : minor_set.()
|
263
|
+
else
|
243
264
|
data.each do |val|
|
244
265
|
break unless (req = /(>=?|=|~>|!=|<=?) (#{Regexp.escape(val.join)})/.match(line))
|
245
266
|
|
246
267
|
v = semver(val).join
|
247
268
|
case req[1]
|
248
269
|
when '>', '>='
|
249
|
-
|
250
|
-
styles = %i[green bold]
|
251
|
-
major += 1
|
252
|
-
else
|
253
|
-
styles[0] = cur[2] == lat[2] ? :yellow : :green
|
254
|
-
end
|
270
|
+
semmajor?(cur, lat) ? major_set.() : minor_set.()
|
255
271
|
when '<', '<='
|
256
272
|
if c <= v
|
257
|
-
if semmajor(cur, lat)
|
258
|
-
|
259
|
-
major += 1
|
273
|
+
if semmajor?(cur, lat)
|
274
|
+
major_set.()
|
260
275
|
else
|
261
276
|
styles[0] = :yellow
|
262
277
|
end
|
@@ -268,29 +283,29 @@ module Squared
|
|
268
283
|
styles[1] = :bold
|
269
284
|
end
|
270
285
|
when '~>'
|
271
|
-
if c < v && cur[0] == val[0] && !semmajor(cur, val)
|
286
|
+
if c < v && cur[0] == val[0] && !semmajor?(cur, val)
|
272
287
|
styles[0] = :yellow
|
273
|
-
elsif semmajor(val, lat)
|
288
|
+
elsif semmajor?(val, lat)
|
274
289
|
styles[1] = :underline
|
275
290
|
else
|
276
291
|
styles[1] = :bold
|
277
292
|
end
|
278
293
|
end
|
279
294
|
end
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
styles = styles.compact
|
289
|
-
.map { |s| s == :green || s == :yellow ? color(s) : s }
|
290
|
-
.flatten
|
291
|
-
line = sub_style(line, pat: /^((?:\S+\s+){2})(#{Regexp.escape(l)})(.+)$/, styles: styles,
|
292
|
-
index: 2)
|
295
|
+
end
|
296
|
+
unless styles.empty?
|
297
|
+
case styles[0]
|
298
|
+
when :green
|
299
|
+
line = sub_style(line, pat: /^(\S+)(.+)$/, styles: theme[styles[1] == :bold ? :major : :active])
|
300
|
+
found += 1
|
301
|
+
when :yellow
|
302
|
+
found += 1
|
293
303
|
end
|
304
|
+
styles = styles.compact
|
305
|
+
.map { |s| s == :green || s == :yellow ? color(s) : s }
|
306
|
+
.flatten
|
307
|
+
line = sub_style(line, pat: /^((?:\S+\s+){2})(#{Regexp.escape(l)})(.*)$/, styles: styles,
|
308
|
+
index: 2)
|
294
309
|
end
|
295
310
|
end
|
296
311
|
puts "#{start.to_s.rjust(2)}. #{line}"
|
@@ -298,16 +313,24 @@ module Squared
|
|
298
313
|
elsif line =~ /^Gem /
|
299
314
|
print_item banner if banner
|
300
315
|
unless stdin?
|
301
|
-
|
302
|
-
|
303
|
-
{ pat: /^(.+)(Latest)(.+)$/, styles: theme[:header], index: 2 }
|
304
|
-
])
|
316
|
+
sub = { pat: /^(.+)(?<!\dm)(Gem|Latest)(.+)$/, styles: theme[:header], index: 2 }
|
317
|
+
puts print_footer(" # #{line.chomp}", reverse: true, sub: [sub, sub])
|
305
318
|
end
|
306
319
|
start += 1
|
307
320
|
end
|
308
321
|
end
|
309
322
|
if found > 0
|
310
|
-
|
323
|
+
begin
|
324
|
+
if major == 0 && (data = /\b(?:source\s+(["'])(.+?)\1|remote:\s+(\S+))/.match(dependfile.read))
|
325
|
+
status = (data[2] || data[3]).chomp('/')
|
326
|
+
right = true
|
327
|
+
end
|
328
|
+
rescue StandardError => e
|
329
|
+
log.debug e
|
330
|
+
ensure
|
331
|
+
status ||= 'Updates are available'
|
332
|
+
end
|
333
|
+
puts print_footer(empty_status(status, 'major', major, always: !right), right: right)
|
311
334
|
elsif start == 0
|
312
335
|
puts 'No updates were found'
|
313
336
|
end
|
@@ -340,30 +363,19 @@ module Squared
|
|
340
363
|
end
|
341
364
|
|
342
365
|
def rake(*cmd)
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
def rakefile
|
347
|
-
file = ::Rake::Application::DEFAULT_RAKEFILES.find { |val| base_path(val).exist? }
|
348
|
-
base_path(file) if file
|
349
|
-
end
|
350
|
-
|
351
|
-
def variable_set(key, *val, **)
|
352
|
-
case key
|
353
|
-
when :gemfile
|
354
|
-
@gemfile = base_path(val.first)
|
366
|
+
if cmd.empty?
|
367
|
+
run_s 'rake'
|
355
368
|
else
|
356
|
-
|
369
|
+
run_s(*cmd.map { |val| "rake #{val}" }, banner: false)
|
357
370
|
end
|
358
371
|
end
|
359
372
|
|
360
|
-
def
|
361
|
-
|
362
|
-
ret.freeze
|
373
|
+
def depend?
|
374
|
+
@depend != false && (!@depend.nil? || outdated?)
|
363
375
|
end
|
364
376
|
|
365
377
|
def copy?
|
366
|
-
return true if super || (@copy.is_a?(::Hash) && copy.fetch(:
|
378
|
+
return true if super || (@copy.is_a?(::Hash) && copy.fetch(:into, nil))
|
367
379
|
return gemdir? if @gemdir
|
368
380
|
|
369
381
|
if @version && (val = ENV['GEM_HOME'])
|
@@ -397,17 +409,22 @@ module Squared
|
|
397
409
|
end
|
398
410
|
|
399
411
|
def outdated?
|
400
|
-
|
412
|
+
dependtype > 0
|
401
413
|
end
|
402
414
|
|
403
415
|
private
|
404
416
|
|
417
|
+
def variables
|
418
|
+
ret = super + VAR_SET
|
419
|
+
ret.freeze
|
420
|
+
end
|
421
|
+
|
405
422
|
def run_rb(sync: true)
|
406
423
|
run(sync: sync, banner: !@session.include?('--quiet'))
|
407
424
|
end
|
408
425
|
|
409
426
|
def append_bundle(opts = nil, list = nil)
|
410
|
-
if (val =
|
427
|
+
if (val = option('jobs')).to_i > 0
|
411
428
|
@session << "-j#{val}"
|
412
429
|
end
|
413
430
|
return unless opts && list
|
@@ -423,16 +440,34 @@ module Squared
|
|
423
440
|
|
424
441
|
def gem_session(*cmd)
|
425
442
|
ret = session('gem', *cmd)
|
426
|
-
if (val =
|
427
|
-
ret << "--config-file=#{shell_escape(
|
443
|
+
if (val = option('config-file', ignore: false))
|
444
|
+
ret << "--config-file=#{shell_escape(basepath(val), quote: true)}"
|
428
445
|
end
|
429
|
-
ret << '--norc' if
|
446
|
+
ret << '--norc' if option('norc')
|
430
447
|
ret
|
431
448
|
end
|
432
449
|
|
433
450
|
def bundle_session(*cmd)
|
434
451
|
session('bundle', *cmd)
|
435
|
-
append_nocolor
|
452
|
+
append_nocolor option('no-color')
|
453
|
+
@session
|
454
|
+
end
|
455
|
+
|
456
|
+
def read_rakefile
|
457
|
+
return @rakelist if @rakelist
|
458
|
+
|
459
|
+
ret = []
|
460
|
+
IO.popen("rake -C #{shell_quote(path)} -AT").each do |line|
|
461
|
+
next unless (data = /^rake ((?:[^\[: ]+:?)+)(\[[^\]]+\])?/.match(line))
|
462
|
+
|
463
|
+
ret << [data[1], data[2]]
|
464
|
+
end
|
465
|
+
@rakelist = ret
|
466
|
+
end
|
467
|
+
|
468
|
+
def rakefile
|
469
|
+
file = ::Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
|
470
|
+
basepath(file) if file
|
436
471
|
end
|
437
472
|
|
438
473
|
def gempath
|
@@ -443,6 +478,8 @@ module Squared
|
|
443
478
|
@gemdir.exist? && !@gemdir.empty?
|
444
479
|
end
|
445
480
|
end
|
481
|
+
|
482
|
+
Application.implement Ruby
|
446
483
|
end
|
447
484
|
end
|
448
485
|
end
|