squared 0.9.0 → 0.9.2
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 +84 -1
- data/README.md +13 -6
- data/exe/sqd +264 -73
- data/lib/squared/common/base.rb +2 -0
- data/lib/squared/common/format.rb +1 -1
- data/lib/squared/common/prompt.rb +26 -8
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +5 -0
- data/lib/squared/workspace/project/base.rb +13 -11
- data/lib/squared/workspace/project/docker.rb +4 -4
- data/lib/squared/workspace/project/git.rb +4 -4
- data/lib/squared/workspace/project/node.rb +36 -23
- data/lib/squared/workspace/project/python.rb +123 -56
- data/lib/squared/workspace/project/ruby.rb +30 -20
- data/lib/squared/workspace/project/support/optionpartition.rb +20 -18
- metadata +2 -2
|
@@ -227,7 +227,7 @@ module Squared
|
|
|
227
227
|
serve_set kwargs[:serve]
|
|
228
228
|
gemfile_set kwargs[:gemspec]
|
|
229
229
|
self.autodetect = autodetect
|
|
230
|
-
@bundle = { exec: exec
|
|
230
|
+
@bundle = { exec: exec }
|
|
231
231
|
@steepfile = basepath! steep if steep
|
|
232
232
|
rubocop = rootpath('.rubocop.yml', ascend: Dir.home) if rubocop == true
|
|
233
233
|
@rubocopfile = basepath! rubocop if rubocop
|
|
@@ -304,7 +304,7 @@ module Squared
|
|
|
304
304
|
elsif exception?
|
|
305
305
|
indexerror n, tasks
|
|
306
306
|
else
|
|
307
|
-
log.
|
|
307
|
+
log.debug "rake task #{n} of #{tasks.size}".subhint('out of range')
|
|
308
308
|
opts.clear
|
|
309
309
|
next
|
|
310
310
|
end
|
|
@@ -572,10 +572,10 @@ module Squared
|
|
|
572
572
|
when ';', /^#+$/
|
|
573
573
|
args.shift
|
|
574
574
|
else
|
|
575
|
-
%w[## ;]
|
|
575
|
+
Prompt.multiline || %w[## ;]
|
|
576
576
|
end
|
|
577
577
|
unless (command = ENV['RUBY_E'])
|
|
578
|
-
command = if Prompt.
|
|
578
|
+
command = if Prompt.multiline?
|
|
579
579
|
require 'ripper'
|
|
580
580
|
readline('ruby>', force: true, multiline: multiline) do |code|
|
|
581
581
|
next if code.strip.empty? || !Ripper.sexp(code)
|
|
@@ -956,7 +956,7 @@ module Squared
|
|
|
956
956
|
end
|
|
957
957
|
s = '%2d. %s' % [start, line]
|
|
958
958
|
if ia
|
|
959
|
-
unless confirm_semver(s.ljust(col +
|
|
959
|
+
unless confirm_semver(s.ljust(col + ARG[:TAB] + line.size - n), type)
|
|
960
960
|
start += 1
|
|
961
961
|
next
|
|
962
962
|
end
|
|
@@ -1049,7 +1049,7 @@ module Squared
|
|
|
1049
1049
|
if op.arg?('e')
|
|
1050
1050
|
op.clear
|
|
1051
1051
|
else
|
|
1052
|
-
op.append(delim: true,
|
|
1052
|
+
op.append(delim: true, context: kwargs)
|
|
1053
1053
|
end
|
|
1054
1054
|
end
|
|
1055
1055
|
print_run(op, banner, **kwargs) unless flag || op.stdout
|
|
@@ -1394,10 +1394,10 @@ module Squared
|
|
|
1394
1394
|
end
|
|
1395
1395
|
if flag == :install
|
|
1396
1396
|
op.append_any(escape: true)
|
|
1397
|
+
op.delim << post if post
|
|
1397
1398
|
else
|
|
1398
1399
|
op.append(escape: true)
|
|
1399
1400
|
end
|
|
1400
|
-
op.delim << post if post
|
|
1401
1401
|
when :check, :cleanup, :contents, :fetch, :list, :lock, :rdoc
|
|
1402
1402
|
op.append
|
|
1403
1403
|
when :dependency, :info, :search
|
|
@@ -1601,7 +1601,7 @@ module Squared
|
|
|
1601
1601
|
|
|
1602
1602
|
def rdbg(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:rdbg], **kwargs)
|
|
1603
1603
|
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1604
|
-
cmd = session
|
|
1604
|
+
cmd = session(*bundle_args('rdbg'))
|
|
1605
1605
|
args.each_with_index do |val, i|
|
|
1606
1606
|
break if val == '--'
|
|
1607
1607
|
next unless exist?(val, type: 'f')
|
|
@@ -1630,7 +1630,7 @@ module Squared
|
|
|
1630
1630
|
case flag
|
|
1631
1631
|
when :prototype
|
|
1632
1632
|
sig = args.shift
|
|
1633
|
-
y = option('y', ignore: false)
|
|
1633
|
+
y = option('y', 'yes', ignore: false)
|
|
1634
1634
|
i = 1
|
|
1635
1635
|
args.map { |val| basepath(val).relative_path_from(path) }.each do |file|
|
|
1636
1636
|
dir = basepath sig, file.dirname
|
|
@@ -1769,7 +1769,7 @@ module Squared
|
|
|
1769
1769
|
end
|
|
1770
1770
|
|
|
1771
1771
|
def gemname
|
|
1772
|
-
@gemname ||=
|
|
1772
|
+
@gemname ||= gemspec&.name || project
|
|
1773
1773
|
end
|
|
1774
1774
|
|
|
1775
1775
|
def project
|
|
@@ -1881,7 +1881,7 @@ module Squared
|
|
|
1881
1881
|
end
|
|
1882
1882
|
|
|
1883
1883
|
def ruby_session(*cmd, **kwargs)
|
|
1884
|
-
session('ruby', *preopts, *cmd, **kwargs)
|
|
1884
|
+
session(*bundle_args('ruby'), *preopts, *cmd, **kwargs)
|
|
1885
1885
|
end
|
|
1886
1886
|
|
|
1887
1887
|
def gem_session(*cmd, **kwargs)
|
|
@@ -1899,11 +1899,10 @@ module Squared
|
|
|
1899
1899
|
end
|
|
1900
1900
|
|
|
1901
1901
|
def rbs_session(*cmd, opts: nil)
|
|
1902
|
-
|
|
1903
|
-
return session(*args, *cmd) unless opts
|
|
1902
|
+
return session(*bundle_args('rbs'), *cmd) unless opts
|
|
1904
1903
|
|
|
1905
1904
|
op = OptionPartition.new(opts, OPT_RUBY[:rbs], project: self, strict: strict?)
|
|
1906
|
-
[session(*
|
|
1905
|
+
[session(*bundle_args('rbs'), *op.to_a, *cmd), op.extras]
|
|
1907
1906
|
end
|
|
1908
1907
|
|
|
1909
1908
|
def gem_output(*cmd, **kwargs)
|
|
@@ -1911,7 +1910,7 @@ module Squared
|
|
|
1911
1910
|
end
|
|
1912
1911
|
|
|
1913
1912
|
def ruby_output(*cmd, **kwargs)
|
|
1914
|
-
session_output('ruby', *cmd, **kwargs)
|
|
1913
|
+
session_output(*bundle_args('ruby'), *cmd, **kwargs)
|
|
1915
1914
|
end
|
|
1916
1915
|
|
|
1917
1916
|
def bundle_output(*cmd, **kwargs)
|
|
@@ -1923,11 +1922,22 @@ module Squared
|
|
|
1923
1922
|
end
|
|
1924
1923
|
|
|
1925
1924
|
def bundle_args(*args)
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1925
|
+
gemfile = ARG[:APP][:ruby_gemfile]
|
|
1926
|
+
val = gemfile.is_a?(Hash) ? gemfile : @bundle[:exec]
|
|
1927
|
+
return args unless gemfile || (val && gemfile != false)
|
|
1928
|
+
|
|
1929
|
+
app = args.first
|
|
1930
|
+
if val.is_a?(Hash)
|
|
1931
|
+
val = val[app.to_s] || val[app.to_sym]
|
|
1932
|
+
elsif app == 'ruby' && !gemfile
|
|
1933
|
+
return args
|
|
1929
1934
|
end
|
|
1930
|
-
|
|
1935
|
+
case val
|
|
1936
|
+
when String, Pathname
|
|
1937
|
+
val = basepath!(val, type: 'f')
|
|
1938
|
+
args.unshift("--gemfile=#{shell_escape(val.relative_path_from(path), quote: true)}") if val
|
|
1939
|
+
end
|
|
1940
|
+
val ? args.unshift('bundle', 'exec') : args
|
|
1931
1941
|
end
|
|
1932
1942
|
|
|
1933
1943
|
def bundle_load
|
|
@@ -2121,7 +2131,7 @@ module Squared
|
|
|
2121
2131
|
def serve?
|
|
2122
2132
|
!Gem::Specification.find_by_name('webrick').nil?
|
|
2123
2133
|
rescue Gem::MissingSpecError => e
|
|
2124
|
-
log.
|
|
2134
|
+
log.debug e if @serve
|
|
2125
2135
|
false
|
|
2126
2136
|
end
|
|
2127
2137
|
end
|
|
@@ -58,10 +58,10 @@ module Squared
|
|
|
58
58
|
ret.map! do |val|
|
|
59
59
|
next val if opt?(val)
|
|
60
60
|
|
|
61
|
-
if
|
|
62
|
-
shell_escape(val, quote: quote, double: double)
|
|
63
|
-
elsif quote || pa
|
|
61
|
+
if (quote && !escape) || val.is_a?(Pathname)
|
|
64
62
|
shell_quote(val, double: double, **kwargs)
|
|
63
|
+
elsif escape
|
|
64
|
+
shell_escape(val, quote: quote, double: double)
|
|
65
65
|
else
|
|
66
66
|
val
|
|
67
67
|
end
|
|
@@ -248,7 +248,7 @@ module Squared
|
|
|
248
248
|
end
|
|
249
249
|
|
|
250
250
|
def parse(list, opts = extras, no: nil, single: nil, args: false, multiple: nil, first: nil, underscore: nil,
|
|
251
|
-
explicit: false, bool: %w[true false], auto: [], stdin: false, &blk)
|
|
251
|
+
explicit: false, bool: %w[true false], auto: [], regexp: {}, enum: {}, stdin: false, &blk)
|
|
252
252
|
@extras = []
|
|
253
253
|
@values = []
|
|
254
254
|
bare = []
|
|
@@ -265,8 +265,6 @@ module Squared
|
|
|
265
265
|
bl = []
|
|
266
266
|
ex = []
|
|
267
267
|
ml = []
|
|
268
|
-
re = {}
|
|
269
|
-
ar = {}
|
|
270
268
|
sw = {}
|
|
271
269
|
se = {}
|
|
272
270
|
list.flat_map do |val|
|
|
@@ -288,10 +286,10 @@ module Squared
|
|
|
288
286
|
end
|
|
289
287
|
if (n = val.index('='))
|
|
290
288
|
flag = val[0, n]
|
|
291
|
-
|
|
292
|
-
mod = if
|
|
293
|
-
pre =
|
|
294
|
-
|
|
289
|
+
opt = flag.split(':')
|
|
290
|
+
mod = if opt.size > 1
|
|
291
|
+
pre = opt.shift
|
|
292
|
+
opt.map { |s| "#{pre}:#{s}" }
|
|
295
293
|
else
|
|
296
294
|
[flag]
|
|
297
295
|
end
|
|
@@ -326,14 +324,14 @@ module Squared
|
|
|
326
324
|
pat = eval(val)
|
|
327
325
|
raise SyntaxError unless pat.is_a?(Regexp)
|
|
328
326
|
|
|
329
|
-
mod.each { |key|
|
|
327
|
+
mod.each { |key| regexp[key] = pat }
|
|
330
328
|
rescue SyntaxError
|
|
331
329
|
warn "#{self.class}: invalid pattern (#{val})"
|
|
332
330
|
end
|
|
333
331
|
when '{'
|
|
334
332
|
group = val[(n + 2)..].chomp!('}')&.split(',')
|
|
335
333
|
if group
|
|
336
|
-
mod.each { |key|
|
|
334
|
+
mod.each { |key| enum[key] = group }
|
|
337
335
|
else
|
|
338
336
|
warn "#{self.class}: invalid group (#{val})"
|
|
339
337
|
end
|
|
@@ -440,8 +438,8 @@ module Squared
|
|
|
440
438
|
else
|
|
441
439
|
push opt
|
|
442
440
|
end
|
|
443
|
-
elsif !
|
|
444
|
-
group = get.call(
|
|
441
|
+
elsif !enum.empty? && has.call(enum.keys, key)
|
|
442
|
+
group = get.call(enum)
|
|
445
443
|
if group.include?(val)
|
|
446
444
|
add shell_option(key, val, force: false, **kwargs)
|
|
447
445
|
elsif @strict
|
|
@@ -449,10 +447,10 @@ module Squared
|
|
|
449
447
|
else
|
|
450
448
|
push opt
|
|
451
449
|
end
|
|
452
|
-
elsif !
|
|
453
|
-
pat = get.call(
|
|
450
|
+
elsif !regexp.empty? && has.call(regexp.keys, key)
|
|
451
|
+
pat = get.call(regexp)
|
|
454
452
|
if val.match?(pat)
|
|
455
|
-
add quote_option
|
|
453
|
+
add __send__(kwargs[:merge] ? :basic_option : :quote_option, key, val, **kwargs)
|
|
456
454
|
elsif @strict
|
|
457
455
|
clear([opt], hint: "match != /#{pat.source}/")
|
|
458
456
|
else
|
|
@@ -489,7 +487,11 @@ module Squared
|
|
|
489
487
|
self
|
|
490
488
|
end
|
|
491
489
|
|
|
492
|
-
def append(*args, clear: false, preserve: '"', **kwargs, &blk)
|
|
490
|
+
def append(*args, clear: false, preserve: '"', context: nil, **kwargs, &blk)
|
|
491
|
+
if context
|
|
492
|
+
kwargs[:escape] = context.fetch(:escape, false) unless kwargs.key?(:escape)
|
|
493
|
+
kwargs[:quote] = context.fetch(:quote, false) unless kwargs.key?(:quote)
|
|
494
|
+
end
|
|
493
495
|
args = clear ? extras.dup.tap { extras.clear } : extras if args.empty?
|
|
494
496
|
pass = kwargs[:pass] ||= []
|
|
495
497
|
OptionPartition.append(target, *args, preserve: preserve, **kwargs, &blk)
|
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.9.
|
|
4
|
+
version: 0.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- An Pham
|
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
143
|
version: '0'
|
|
144
144
|
requirements: []
|
|
145
|
-
rubygems_version: 4.0.
|
|
145
|
+
rubygems_version: 4.0.20
|
|
146
146
|
specification_version: 4
|
|
147
147
|
summary: Rake task generator for managing multi-language workspaces.
|
|
148
148
|
test_files: []
|