squared 0.7.3 → 0.7.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82923f41d47824239a45fb31f694e85d30c1cf0f73c099df00d2d7a210f6b156
4
- data.tar.gz: e80edb54f73431248fb26d11ff53c5424ae791ef28b5a5ddcc3bb3f0da20622b
3
+ metadata.gz: cbb8baead0c85c247f6c587d2fce277c6e405d3426bcf64c081df7a5f00d4fc4
4
+ data.tar.gz: d9e1eb35ad8d447e3884f74a4a2baf42aee82a39bc729214f16b26a1dfbcb697
5
5
  SHA512:
6
- metadata.gz: cbb9aaa755322f262c820b8f0cabb8e9bf6596e440e4d660311b5804b5c4f347c478c3bc2fddafdeddf4ff9643642da8c74445c118028e6ea904f59909232360
7
- data.tar.gz: d0457af211645c310de59ae11cb693fbdb1c0fddd49989f805317dffb9db251693da9268fa2ad25b1739e94216b243521044502051ac8dbd111a65efdc31b1c0
6
+ metadata.gz: 6e4e0e6a5e48e0d8c7e1059df7ff4e38dac032b584a5c4468d05c11932c28a5e74dfb25b4a5c6384928d5e51c45dc09a8eadb8e9d0871eaf98e58cbd3cf58f71
7
+ data.tar.gz: 430bde498c8b0eeccf4eb546441cbb2afdc77b920dd7d0b00c4621b51eb612ece6f786622df624cfdf758d55898762db56e54e804f2af951b3584b8258f47650
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.4] - 2026-03-20
4
+
5
+ ### Added
6
+
7
+ - Ruby command bundle action check was implemented.
8
+ - Ruby command pry with stored command options was created.
9
+ - Node command tsc options were updated to 6.0.
10
+ - Ruby command rdbg with stored command options was created.
11
+
12
+ ### Changed
13
+
14
+ - Project base method dependindex replaces private instance variable.
15
+
16
+ ### Fixed
17
+
18
+ - Repo completely ignored group and ref method arguments since inception.
19
+ - Ruby command version did not abort asdf "Not installed" error.
20
+
3
21
  ## [0.7.3] - 2026-03-11
4
22
 
5
23
  ### Added
@@ -13,7 +31,6 @@
13
31
 
14
32
  - Python command publish detects twine through the file system.
15
33
  - Git revbuild can bypass checksum by project name using GIT_FORCE.
16
- - Git internal data calls do not write to logs.
17
34
  - Ruby method serve uses as default port 3000 due to Errno::EACCES.
18
35
 
19
36
  ### Fixed
@@ -42,7 +59,7 @@
42
59
  - OptionPartition methods with escape parameter were reordered.
43
60
  - OptionPartition methods with quote parameter were revised.
44
61
 
45
- ## [0.6.10] - 2025-02-23
62
+ ## [0.6.10] - 2026-02-23
46
63
 
47
64
  ### Added
48
65
 
@@ -1753,6 +1770,7 @@
1753
1770
 
1754
1771
  - Changelog was created.
1755
1772
 
1773
+ [0.7.4]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.4
1756
1774
  [0.7.3]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.3
1757
1775
  [0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
1758
1776
  [0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
data/README.md CHANGED
@@ -133,7 +133,7 @@ Node = Workspace::Project::Node # tsc
133
133
  Node.options("build:dev", "target=es2022", project: "tsconfig.json") # :node (ref)
134
134
  Node.options("build:dev", "outDir=tmp", :squared) # squared (project name)
135
135
 
136
- Ruby = Workspace::Project::Ruby # ruby | gem | rake | bundle | irb | rbs | rubocop
136
+ Ruby = Workspace::Project::Ruby # ruby | gem | rake | bundle | irb | rdbg | rbs | rubocop | pry
137
137
  Ruby.options("lint", "rubocop", opts: ["gemfile=Gemfile"]) # :ruby
138
138
  Ruby.options("lint", "--parallel", :squared)
139
139
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.7.3'
4
+ VERSION = '0.7.4'
5
5
  end
@@ -1005,7 +1005,7 @@ module Squared
1005
1005
  run_set(output[0], *args, **kwargs)
1006
1006
  when :dependfile
1007
1007
  @dependindex = nil
1008
- @dependfile = val.nil? ? nil : basepath(*args)
1008
+ @dependfile = (basepath(*args) if val)
1009
1009
  else
1010
1010
  instance_variable_set(:"@#{key}", val)
1011
1011
  end
@@ -1113,7 +1113,7 @@ module Squared
1113
1113
  end
1114
1114
 
1115
1115
  def dependtype(*)
1116
- @dependindex ? @dependindex.succ : 0
1116
+ dependindex&.succ || 0
1117
1117
  end
1118
1118
 
1119
1119
  def dependname
@@ -2565,13 +2565,19 @@ module Squared
2565
2565
  end
2566
2566
  end
2567
2567
 
2568
- def dependfile_set(list)
2568
+ def dependfile_set(list, default: 0)
2569
2569
  @dependindex = if @dependname
2570
2570
  @dependfile = basepath @dependname
2571
2571
  list.index(@dependname)
2572
2572
  else
2573
- list.index { |file| exist?(file) }.tap { |i: 0| @dependfile = basepath(list[i]) }
2574
- end
2573
+ list.index { |file| exist?(file) }.tap { |i| @dependfile = basepath(list[i || default]) }
2574
+ end || (list unless enabled?)
2575
+ end
2576
+
2577
+ def dependindex
2578
+ dependfile_set @dependindex if @dependindex.is_a?(Array)
2579
+
2580
+ @dependindex unless @dependindex.is_a?(Array)
2575
2581
  end
2576
2582
 
2577
2583
  def as_get(val, from, *type)
@@ -72,16 +72,14 @@ module Squared
72
72
  }.freeze
73
73
  OPT_TSC = {
74
74
  base: %w[all b|build init listFilesOnly locale=b p|project=p showConfig w|watch].freeze,
75
- compiler: %w[allowArbitraryExtensions=!? allowImportingTsExtensions=!? allowJs=!?
76
- allowSyntheticDefaultImports=!? allowUmdGlobalAccess=!? allowUnreachableCode=!?
77
- allowUnusedLabels=!? alwaysStrict=!? assumeChangesOnlyAffectDirectDependencies=!? baseUrl=p
75
+ compiler: %w[allowArbitraryExtensions=!? allowImportingTsExtensions=!? allowJs=!? allowUmdGlobalAccess=!?
76
+ allowUnreachableCode=!? allowUnusedLabels=!? assumeChangesOnlyAffectDirectDependencies=!?
78
77
  charset=b checkJs=!? composite=!? customConditions=q d|declaration=!? declarationDir=p
79
78
  declarationMap=!? diagnostics=!? disableReferencedProjectLoad=!? disableSizeLimit=!?
80
- disableSolutionSearching=!? downlevelIteration=!? emitBOM=!? emitDeclarationOnly=!?
81
- emitDecoratorMetadata=!? erasableSyntaxOnly=!? esModuleInterop=!? exactOptionalPropertyTypes=!?
82
- experimentalDecorators=!? explainFiles=!? extendedDiagnostics=!?
83
- forceConsistentCasingInFileNames=!? generateCpuProfile=b importHelpers=!?
84
- importsNotUsedAsValues=b incremental=!? inlineSourceMap=!? inlineSources=!?
79
+ disableSolutionSearching=!? emitBOM=!? emitDeclarationOnly=!? emitDecoratorMetadata=!?
80
+ erasableSyntaxOnly=!? exactOptionalPropertyTypes=!? experimentalDecorators=!? explainFiles=!?
81
+ extendedDiagnostics=!? forceConsistentCasingInFileNames=!? generateCpuProfile=b ignoreConfig=!?
82
+ importHelpers=!? importsNotUsedAsValues=b incremental=!? inlineSourceMap=!? inlineSources=!?
85
83
  isolatedDeclarations=!? isolatedModules=!? jsx=b jsxFactory=q jsxFragmentFactory=q
86
84
  jsxImportSource=q keyofStringsOnly=!? lib=q libReplacement=!? listEmittedFiles=!? listFiles=!?
87
85
  mapRoot=p maxNodeModuleJsDepth=i m|module=b moduleDetection=b moduleResolution=b moduleSuffixes=b
@@ -89,18 +87,22 @@ module Squared
89
87
  noFallthroughCasesInSwitch=!? noImplicitAny=!? noImplicitOverride=!? noImplicitReturns=!?
90
88
  noImplicitThis=!? noImplicitUseStrict=!? noLib=!? noPropertyAccessFromIndexSignature=!?
91
89
  noResolve=!? noStrictGenericChecks=!? noUncheckedIndexedAccess=!? noUncheckedSideEffectImports=!?
92
- noUnusedLocals=!? noUnusedParameters=!? outDir=p outFile=p paths=q plugins=b
93
- preserveConstEnums=!? preserveSymlinks=!? preserveValueImports=!? preserveWatchOutput=!?
94
- pretty=!? reactNamespace=b removeComments=!? resolveJsonModule=!? resolvePackageJsonExports=!?
95
- resolvePackageJsonImports=!? rewriteRelativeImportExtensions=!? rootDir=p rootDirs=p
96
- skipDefaultLibCheck=!? skipLibCheck=!? sourceMap=!? sourceRoot=p stopBuildOnErrors=!? strict=!?
90
+ noUnusedLocals=!? noUnusedParameters=!? outDir=p paths=q plugins=b preserveConstEnums=!?
91
+ preserveSymlinks=!? preserveValueImports=!? preserveWatchOutput=!? pretty=!? reactNamespace=b
92
+ removeComments=!? resolveJsonModule=!? resolvePackageJsonExports=!? resolvePackageJsonImports=!?
93
+ rewriteRelativeImportExtensions=!? rootDir=p rootDirs=p skipDefaultLibCheck=!? skipLibCheck=!?
94
+ sourceMap=!? sourceRoot=p stableTypeOrdering=!? stopBuildOnErrors=!? strict=!?
97
95
  strictBindCallApply=!? strictBuiltinIteratorReturn=!? strictFunctionTypes=!? strictNullChecks=!?
98
96
  strictPropertyInitialization=!? stripInternal=!? suppressExcessPropertyErrors=!?
99
97
  suppressImplicitAnyIndexErrors=!? t|target=b traceResolution=!? tsBuildInfoFile=p typeRoots=p
100
98
  types=b useDefineForClassFields=!? useUnknownInCatchVariables=!? verbatimModuleSyntax=!?].freeze,
101
99
  build: %w[clean=!? dry=!? force=!? v|verbose=!?].freeze,
102
100
  watch: %w[excludeDirectories=p excludeFiles=p fallbackPolling=b synchronousWatchDirectory=!? watchDirectory=b
103
- watchFile=b].freeze
101
+ watchFile=b].freeze,
102
+ v5: {
103
+ compiler: %w[allowSyntheticDefaultImports=!? alwaysStrict=!? baseUrl=p downlevelIteration=!?
104
+ esModuleInterop=!? outFile=p].freeze
105
+ }.freeze
104
106
  }.freeze
105
107
  PASS_NODE = {
106
108
  tsc: %w[excludeDirectories excludeFiles customConditions lib moduleSuffixes plugins rootDirs typeRoots
@@ -1117,6 +1119,7 @@ module Squared
1117
1119
  b = kwargs[:build]
1118
1120
  w = kwargs[:watch]
1119
1121
  list = OPT_TSC[:base] + OPT_TSC[:compiler]
1122
+ list.concat(Array(kwargs.fetch(:legacy, 5)).flat_map { |n| OPT_TSC.fetch(:"v#{n}", {}).fetch(:compiler, []) })
1120
1123
  cmd = session 'tsc', if p
1121
1124
  quote_option 'p', basepath(p)
1122
1125
  elsif b
@@ -131,7 +131,7 @@ module Squared
131
131
  initialize_build(Python.ref, **kwargs)
132
132
  initialize_env(**kwargs)
133
133
  end
134
- dependfile_set DEP_PYTHON
134
+ dependfile_set(DEP_PYTHON, default: 2)
135
135
  serve_set kwargs[:serve]
136
136
  editable_set editable
137
137
  venv_set kwargs[:venv]
@@ -16,11 +16,13 @@ module Squared
16
16
  D|describe=q? e|execute=q E|execute-continue=q p|execute-print=q f|rakefile=p job-stats=b? j|jobs=i?
17
17
  I|libdir=p R|rakelib=p rakelibdir=p r|require=b suppress-backtrace=q T|tasks=q? t|trace=b?
18
18
  W|where=q?].freeze,
19
- irb: %w[d f U w E=b I=p r=b W=im? autocomplete colorize echo echo-on-assignment extra-doc-dir inf-ruby-mode
19
+ irb: %w[d f U w E=b I=p r=bm W=im? autocomplete colorize echo echo-on-assignment extra-doc-dir inf-ruby-mode
20
20
  inspect multiline no-pager noautocomplete nocolorize noecho noecho-on-assignment noinspect
21
21
  nomultiline noprompt noscript nosingleline noverbose regexp-completor sample-book-mode script
22
22
  simple-prompt single-irb singleline tracer truncate-echo-on-assignment type-completor verbose
23
23
  back-trace-limit=i context-mode=i prompt=b prompt-mode=b].freeze,
24
+ rdbg: %w[no-color no-rc no-sigint-hook c|command n|nonstop stop-at-load cookie=q e=q host=q x|init-script=p
25
+ O|open=q? port=i port-range=b session-name=q sock-path=q util=q].freeze,
24
26
  rbs: %w[I=pm r=bm no-stdlib no-collection collection=p log-level=b log-output=p repo=p].freeze,
25
27
  rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
26
28
  display-only-correctable display-only-fail-level-offenses display-only-failed
@@ -32,6 +34,8 @@ module Squared
32
34
  start-server stderr stop-server C|cache=b cache-root=p config=p exclude-limit=i fail-level=b
33
35
  f|format=b except=q only=q o|out=p plugin=p require=p show-cops=q show-docs-url=q
34
36
  s|stdin=p].freeze,
37
+ pry: %w[f I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
38
+ d|disable-plugin=q e=q gem=b r|require=bm s|select-plugin=q].freeze,
35
39
  no: {
36
40
  rubocop: %w[auto-gen-enforced-style auto-gen-only-exclude auto-gen-timestamp color display-cop-names
37
41
  offense-counts parallel server].freeze
@@ -158,7 +162,9 @@ module Squared
158
162
  rake: %w[I libdir r require].freeze,
159
163
  irb: %w[I r].freeze,
160
164
  rbs: %w[I r repo].freeze,
165
+ rdbg: %w[cookie].freeze,
161
166
  rubocop: %w[format plugin r require].freeze,
167
+ pry: %w[I d disable-plugin r require].freeze,
162
168
  gem: {
163
169
  contents: %w[s spec-dir].freeze,
164
170
  dependency: %w[s source].freeze,
@@ -194,11 +200,13 @@ module Squared
194
200
  'outdated' => %i[major minor patch].freeze,
195
201
  'ruby' => %i[file script version reshim].freeze,
196
202
  'gem' => %i[install uninstall outdated update pristine build push exec command].freeze,
197
- 'bundle' => %i[config install update cache exec reinstall command].freeze,
203
+ 'bundle' => %i[config install update cache exec check reinstall command].freeze,
198
204
  'rake' => nil,
199
205
  'irb' => nil,
206
+ 'rdbg' => nil,
200
207
  'rbs' => nil,
201
- 'rubocop' => nil
208
+ 'rubocop' => nil,
209
+ 'pry' => nil
202
210
  })
203
211
 
204
212
  attr_reader :gemdir
@@ -303,13 +311,36 @@ module Squared
303
311
  queue.call
304
312
  end
305
313
  end
306
- when 'irb'
314
+ when 'irb', 'pry'
315
+ next unless action == 'irb' || gemspec?(action)
316
+
307
317
  format_desc action, nil, 'opts*,args*|:'
308
318
  task action do |_, args|
309
319
  opts = args.to_a
310
320
  args = Array(opts.delete(':') && readline('Enter file [arguments]', force: false))
311
321
  name = gemname if gemlib.any? { |file| exist?(file, "#{gemname}.rb") }
312
- irb(*args, opts: opts, name: name, verbose: false)
322
+ __send__(action, *args, opts: opts, name: name, verbose: false)
323
+ end
324
+ when 'rdbg'
325
+ format_desc action, nil, 'file?/:,opts*,debuggee?/::'
326
+ task action do |_, args|
327
+ opts = args.to_a
328
+ cmd = opts.delete('::')
329
+ if (n = opts.index('c'))
330
+ args = opts.slice!(n.succ..-1)
331
+ else
332
+ file = opts.shift
333
+ args = []
334
+ if (file == ':' && (d = path)) || (file && (d = basepath(file)).directory?)
335
+ args << choice_index('Select file', d.glob('*.rb').map { |f| f.relative_path_from(path) })
336
+ elsif exist?(file, type: 'f')
337
+ args << file
338
+ else
339
+ opts.unshift(file)
340
+ end
341
+ end
342
+ args << readline('Enter debuggee [arguments]', force: false) if cmd
343
+ rdbg(*args.compact, opts: opts, banner: false, verbose: false)
313
344
  end
314
345
  when 'rbs'
315
346
  next unless @steepfile
@@ -322,9 +353,9 @@ module Squared
322
353
  data[$1 || $3.gsub(/[: ]/, '-')] = target
323
354
  next
324
355
  end
325
- next unless target && line =~ /^\s*(check|signature)\s+(["'])(.+)\2/
356
+ next unless target && line =~ /^\s*(?:(check)|signature)\s+(["'])(.+)\2/
326
357
 
327
- target[$1 == 'check' ? 1 : 0] << $3
358
+ target[$1 ? 1 : 0] << $3
328
359
  end
329
360
  next if data.empty?
330
361
 
@@ -459,6 +490,16 @@ module Squared
459
490
  task flag do |_, args|
460
491
  bundle(flag, opts: args.to_a, banner: flag == :exec ? verbose? : true)
461
492
  end
493
+ when :check
494
+ format_desc action, flag, 'gemfile?,d/ry-run?'
495
+ task flag do |_, args|
496
+ args = args.to_a
497
+ opts = []
498
+ opts << 'dry-run' if has_value!(args, 'd', 'dry-run')
499
+ opts << "gemfile=#{shell_quote(args.pop, option: false, force: false)}" if exist?(args.first)
500
+ opts.concat(args)
501
+ bundle(:check, opts: opts, banner: true)
502
+ end
462
503
  when :reinstall
463
504
  format_desc action, flag, 'f/orce?,l/ocal?,opts*'
464
505
  task flag do |_, args|
@@ -592,7 +633,7 @@ module Squared
592
633
  end
593
634
  opt = [@asdf.first]
594
635
  opt.unshift('--no-header') unless @@asdf.version == 15
595
- cur = `asdf current #{opt.join(' ')}`
636
+ exit 1 unless (cur = `asdf current #{opt.join(' ')}`)
596
637
  if cur.match?(/\sfalse\b/)
597
638
  `ruby --version`
598
639
  else
@@ -626,7 +667,7 @@ module Squared
626
667
  when 'mise'
627
668
  `mise which #{tool}`
628
669
  else
629
- `which #{tool}`
670
+ `which ruby`
630
671
  end)
631
672
  rescue => e
632
673
  log.debug e
@@ -851,10 +892,8 @@ module Squared
851
892
  when '~>'
852
893
  if c < v && cur[0] == val[0] && !semmajor?(cur, val)
853
894
  styles[0] = :yellow
854
- elsif semmajor?(val, lat)
855
- styles[1] = :underline
856
- else
857
- styles[1] = :bold
895
+ else
896
+ styles[1] = semmajor?(val, lat) ? :underline : :bold
858
897
  end
859
898
  end
860
899
  end
@@ -1481,16 +1520,30 @@ module Squared
1481
1520
 
1482
1521
  def irb(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:irb], **kwargs)
1483
1522
  opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
1484
- op = OptionPartition.new(opts, OPT_RUBY[:irb], session('irb'), project: self, first: [/\.rb$/])
1485
- r = []
1486
- r << 'bundler/setup' if !op.arg?('r') && bundle_load
1487
- r.concat(Array(kwargs[:name])) if kwargs[:name]
1488
- r.each { |val| op.add_option('r', val, merge: true) }
1489
- op.merge((gemlib + Array(kwargs[:path])).map { |val| quote_option('I', val, merge: true) })
1523
+ run_repl(*args, opts: opts, banner: banner, from: :irb, **kwargs)
1524
+ end
1525
+
1526
+ def pry(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:pry], **kwargs)
1527
+ opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
1528
+ run_repl(*args, opts: opts, banner: banner, from: :pry, delim: false, **kwargs)
1529
+ end
1530
+
1531
+ def rdbg(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:rdbg], **kwargs)
1532
+ opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
1533
+ cmd = session 'rdbg'
1534
+ args.each_with_index do |val, index|
1535
+ break if val == '--'
1536
+ next unless exist?(val, type: 'f')
1537
+
1538
+ args[index] = shell_quote(basepath(val))
1539
+ cmd.merge(args.slice!(0, index + 1))
1540
+ break
1541
+ end
1542
+ op = OptionPartition.new(opts, OPT_RUBY[:rdbg], cmd, project: self, first: [/\.rb$/])
1490
1543
  op.concat(args)
1491
- op.append(delim: true)
1544
+ op.append(quote: false, delim: true)
1492
1545
  print_run(op, banner, **kwargs)
1493
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: :irb)
1546
+ run(banner: false, exception: kwargs.fetch(:exception, exception?), from: :rdbg)
1494
1547
  end
1495
1548
 
1496
1549
  def rbs(flag, *args, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1725,8 +1778,8 @@ module Squared
1725
1778
  end
1726
1779
  rescue => e
1727
1780
  log.error e
1728
- self.version = nil
1729
1781
  @gemdir = nil
1782
+ self.version = nil
1730
1783
  self.autodetect = false
1731
1784
  else
1732
1785
  gemdir?
@@ -1738,6 +1791,19 @@ module Squared
1738
1791
 
1739
1792
  private
1740
1793
 
1794
+ def run_repl(*args, opts:, banner:, from:, delim: true, **kwargs)
1795
+ op = OptionPartition.new(opts, OPT_RUBY[from], session(from), project: self, first: [/\.rb$/])
1796
+ r = []
1797
+ r << 'bundler/setup' if !op.arg?('r') && bundle_load
1798
+ r.concat(Array(kwargs[:name])) if kwargs[:name]
1799
+ r.each { |val| op.add_option('r', val, merge: true) }
1800
+ op.merge((gemlib + Array(kwargs[:path])).map { |val| quote_option('I', val, merge: true) })
1801
+ op.concat(args)
1802
+ op.append(delim: delim)
1803
+ print_run(op, banner, **kwargs)
1804
+ run(banner: false, exception: kwargs.fetch(:exception, exception?), from: from)
1805
+ end
1806
+
1741
1807
  def ruby_session(*cmd, **kwargs)
1742
1808
  session('ruby', *preopts, *cmd, **kwargs)
1743
1809
  end
@@ -1943,13 +2009,11 @@ module Squared
1943
2009
  end
1944
2010
 
1945
2011
  def gemdir?
1946
- return false unless gemdir
1947
-
1948
- gemdir.exist? && !gemdir.empty? && gemdir.writable?
2012
+ !gemdir.nil? && gemdir.exist? && !gemdir.empty? && gemdir.writable?
1949
2013
  end
1950
2014
 
1951
2015
  def compat?(min, max = Float::INFINITY, gem: nil)
1952
- return false unless !gem || (bundle = gem.match?(/bundler?/))
2016
+ return false if gem && !gem.match?(/bundler?/)
1953
2017
 
1954
2018
  n = @rubygems
1955
2019
  if n.is_a?(Numeric) && n > 0
@@ -1960,14 +2024,20 @@ module Squared
1960
2024
  when String
1961
2025
  n
1962
2026
  when Array
1963
- n[bundle ? 1 : 0]
2027
+ n[gem ? 1 : 0]
1964
2028
  else
1965
- min.tap { min = (bundle && bundle_load) || Gem::VERSION }
2029
+ min.tap { min = (gem && bundle_load) || Gem::VERSION }
1966
2030
  end
1967
2031
  semgte?(ver.to_s, min.to_s) && (max == Float::INFINITY || !semgte?(ver.to_s, max.to_s))
1968
2032
  end
1969
2033
  end
1970
2034
 
2035
+ def gemspec?(name)
2036
+ !Gem::Specification.find_by_name(name).nil?
2037
+ rescue Gem::MissingSpecError
2038
+ false
2039
+ end
2040
+
1971
2041
  def serve?
1972
2042
  !Gem::Specification.find_by_name('webrick').nil?
1973
2043
  rescue Gem::MissingSpecError => e
@@ -47,8 +47,8 @@ module Squared
47
47
  envargs = name ? { suffix: name.upcase, strict: true } : {}
48
48
  data = scriptobj
49
49
  if repo?
50
- group = env('REPO_GROUP', **envargs) { |val| split_escape(val) }
51
- ref = env('REPO_REF', **envargs) { |val| split_escape(val) }
50
+ env('REPO_GROUP', **envargs) { |val| group = split_escape(val) }
51
+ env('REPO_REF', **envargs) { |val| ref = split_escape(val) }
52
52
  data[:dev] = env_match('REPO_DEV', dev, **envargs)
53
53
  data[:prod] = env_match('REPO_PROD', prod, **envargs)
54
54
  @warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo'])) != false unless name
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.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham