squared 0.5.7 → 0.5.9

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.
@@ -207,7 +207,7 @@ module Squared
207
207
  if flag == :create
208
208
  format_desc action, flag, 'dir,opts*'
209
209
  task flag, [:dir] do |_, args|
210
- dir = path + param_guard(action, flag, args: args, key: :dir)
210
+ dir = basepath param_guard(action, flag, args: args, key: :dir)
211
211
  venv_create dir, args.extras
212
212
  end
213
213
  elsif venv
@@ -245,10 +245,7 @@ module Squared
245
245
  when :upgrade
246
246
  format_desc action, flag, 'opts*'
247
247
  task flag do |_, args|
248
- args = args.to_a
249
- args.prepend('upgrade')
250
- args.append('pip')
251
- install flag, args
248
+ install flag, ['upgrade', *args.to_a, 'pip']
252
249
  end
253
250
  when :freeze
254
251
  format_desc action, flag, "file?=#{DEP_PYTHON[4]},opts*"
@@ -360,7 +357,7 @@ module Squared
360
357
  when :user
361
358
  cmd << '--user'
362
359
  when :target
363
- cmd << quote_option('target', path + target)
360
+ cmd << quote_option('target', basepath(target))
364
361
  when :force
365
362
  cmd << '--force-reinstall'
366
363
  end
@@ -483,11 +480,7 @@ module Squared
483
480
  cmd << '--user' if user
484
481
  cmd << basic_option('upgrade-strategy', strategy) if strategy
485
482
  append_value out
486
- if workspace.windows?
487
- pip = cmd.to_a.drop(1)
488
- cmd = python_session '-m pip'
489
- cmd.merge(pip)
490
- end
483
+ python_session('-m pip', *cmd.to_a.drop(1)) if workspace.windows?
491
484
  end
492
485
  run(from: :install)
493
486
  end
@@ -524,7 +517,7 @@ module Squared
524
517
  if op.arg?(*args)
525
518
  op.push(srcdir)
526
519
  else
527
- op << quote_option(args.last, path + srcdir)
520
+ op << quote_option(args.last, basepath(srcdir))
528
521
  end
529
522
  srcdir = nil
530
523
  end
@@ -558,7 +551,7 @@ module Squared
558
551
  end
559
552
  op = OptionPartition.new(opts, list, @session, project: self, single: singleopt(flag))
560
553
  dist = lambda do
561
- path.join('dist').tap do |dir|
554
+ basepath('dist').tap do |dir|
562
555
  raise_error('no source files found', hint: dir) unless dir.directory? && !dir.empty?
563
556
  end
564
557
  end
@@ -574,7 +567,7 @@ module Squared
574
567
  if op.empty?
575
568
  op.push("#{dist.call}/*")
576
569
  else
577
- op.map! { |val| path + val }
570
+ op.map! { |val| basepath(val) }
578
571
  end
579
572
  op.append
580
573
  else
@@ -650,7 +643,7 @@ module Squared
650
643
 
651
644
  def poetry_session(*cmd)
652
645
  ret = session('poetry', *cmd, *preopts)
653
- option('project', ignore: false) { |val| ret << quote_option('project', path + val) }
646
+ option('project', ignore: false) { |val| ret << quote_option('project', basepath(val)) }
654
647
  ret
655
648
  end
656
649
 
@@ -671,7 +664,7 @@ module Squared
671
664
  end
672
665
 
673
666
  def append_pip(flag, opts, target: @session, from: nil)
674
- if !from || opts.empty?
667
+ unless from && !opts.empty?
675
668
  append_global(target: target)
676
669
  return []
677
670
  end
@@ -695,11 +688,11 @@ module Squared
695
688
  op << '--no-build-isolation' if option('build-isolation', equals: '0')
696
689
  op.swap
697
690
  if edit
698
- edit = path + edit unless %r{\A[a-z]+(?:\+[a-z]+)?://}i.match?(edit)
691
+ edit = basepath(edit) unless %r{\A[a-z]+(?:\+[a-z]+)?://}i.match?(edit)
699
692
  if flag == :editable
700
693
  op.push(edit)
701
694
  else
702
- target << quote_option('e', edit)
695
+ op << quote_option('e', edit)
703
696
  end
704
697
  end
705
698
  case flag
@@ -710,25 +703,25 @@ module Squared
710
703
  []
711
704
  end
712
705
  else
713
- opts
706
+ op.extras
714
707
  end
715
708
  end
716
709
 
717
710
  def append_editable(target: @session)
718
- return if requirements?
711
+ return if requirements? && editable == '.'
719
712
 
720
713
  if (val = option('editable', 'e', target: target, ignore: false))
721
- session_delete('e', 'editable', target: target)
714
+ OptionPartition.delete_key(target, 'e', 'editable')
722
715
  case val
723
716
  when '0', 'false'
724
717
  return
725
718
  else
726
- val = path + val
719
+ val = basepath val
727
720
  end
728
721
  elsif session_arg?('e', 'editable', target: target) || !(val = editable)
729
722
  return
730
723
  end
731
- target << quote_option('e', val)
724
+ target << quote_option('e', basepath(val))
732
725
  end
733
726
 
734
727
  def append_global(target: @session)
@@ -737,11 +730,11 @@ module Squared
737
730
  when '0', 'false'
738
731
  '--no-cache-dir'
739
732
  else
740
- quote_option('cache-dir', path + val)
733
+ quote_option('cache-dir', basepath(val))
741
734
  end
742
735
  end
743
736
  option('proxy', target: target) { |val| target << shell_option('proxy', val) }
744
- option('python', target: target) { |val| target << quote_option('python', path + val) }
737
+ option('python', target: target) { |val| target << quote_option('python', basepath(val)) }
745
738
  append_nocolor(target: target)
746
739
  end
747
740
 
@@ -863,7 +856,7 @@ module Squared
863
856
  when '.', Pathname
864
857
  val
865
858
  when String
866
- Pathname.new(editable)
859
+ Pathname.new(val) unless val.empty?
867
860
  end
868
861
  end
869
862
 
@@ -874,8 +867,7 @@ module Squared
874
867
  val, *opts = val
875
868
  @venvopts = opts
876
869
  end
877
- @venv = Pathname.new(val)
878
- @venv = @path + @venv unless @venv.absolute?
870
+ @venv = basepath(val)
879
871
  if projectpath?(@venv)
880
872
  if @venv.exist?
881
873
  log.debug "venv found: #{@venv}"
@@ -7,14 +7,13 @@ module Squared
7
7
  GEMFILE = %w[Gemfile Gemfile.lock gem.deps.rb gems.rb Isolate].freeze
8
8
  DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
9
9
  OPT_RUBY = {
10
- ruby: %w[0=im? a c e=q E=bm F=qm i=bm? I=pm l n p r=bm s S w W=bm? x=pm? d|debug jit rjit v|verbose y|yydebug
11
- backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
10
+ ruby: %w[0=im? a c C=pm e=q E=bm F=qm i=bm? I=pm l n p r=bm s S w W=bm? x=pm? d|debug jit rjit verbose
11
+ y|yydebug backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
12
12
  internal-encoding=b parser=b].freeze,
13
- rake: %w[A|all B|build-all comments n|dry-run p|execute-print=q m|multitask P|prereqs q|quiet
14
- X|no-deprecation-warnings N|no-search G|no-system nosearch nosystem rules s|silent g|system
15
- v|verbose backtrace=b? D|describe=q? e|execute=q E|execute-continue=q job-stats=b? j|jobs=i?
16
- I|libdir=p R|rakelib=p rakelibdir=p r|require=b suppress-backtrace=q T|tasks=q? t|trace=b?
17
- W|where=q?].freeze,
13
+ rake: %w[A|all B|build-all comments n|dry-run m|multitask P|prereqs q|quiet X|no-deprecation-warnings
14
+ N|no-search G|no-system nosearch nosystem rules s|silent g|system v|verbose backtrace=b?
15
+ D|describe=q? e|execute=q E|execute-continue=q p|execute-print=q job-stats=b? j|jobs=i? I|libdir=p
16
+ R|rakelib=p rakelibdir=p r|require=b suppress-backtrace=q T|tasks=q? t|trace=b? W|where=q?].freeze,
18
17
  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
18
  inspect multiline no-pager noautocomplete nocolorize noecho noecho-on-assignment noinspect
20
19
  nomultiline noprompt noscript nosingleline noverbose regexp-completor sample-book-mode script
@@ -22,38 +21,41 @@ module Squared
22
21
  back-trace-limit=i context-mode=i prompt=b prompt-mode=b].freeze
23
22
  }.freeze
24
23
  OPT_BUNDLE = {
25
- common: %w[no-color V|verbose retry=i].freeze,
24
+ common: %w[no-color V|verbose r|retry=i].freeze,
26
25
  install: %w[frozen no-cache no-prune system binstubs=p? path=p standalone=q? target-rbconfig=p trust-policy=b
27
26
  with=q without=q].freeze,
28
- install_base: %w[force full-index quiet redownload retry gemfile=p j|jobs=i].freeze,
29
- update: %w[conservative local pre ruby strict bundler=b? g|group=q source=b].freeze,
27
+ install_base: %w[force full-index quiet redownload gemfile=p j|jobs=i].freeze,
28
+ update: %w[all conservative local major minor patch pre ruby strict bundler=b? g|group=q source=b].freeze,
30
29
  outdated: %w[filter-major filter-minor filter-patch groups local parseable pre only-explicit strict
31
- update-strict g|group=q source=b].freeze,
30
+ update-strict group=q source=b].freeze,
32
31
  exec: %w[gemfile=p].freeze,
33
- cache: %w[all-platforms frozen no-install no-prune quiet cache-path=p gemfile=p path=p].freeze,
34
- check: %w[dry-run gemfile=p].freeze
32
+ cache: %w[all all-platforms frozen no-all no-install no-prune quiet cache-path=p gemfile=p path=p].freeze,
33
+ check: %w[dry-run gemfile=p path=p].freeze
35
34
  }.freeze
36
35
  OPT_GEM = {
37
36
  common: %w[backtrace debug q|quiet no-verbose norc silent V|verbose config-file=p].freeze,
38
- install: %w[version=b].freeze,
39
- install_base: %w[f b|both clear-sources conservative default development development-all E|explain
40
- ignore-dependencies l|local N|no-document r|remote w|vendor n|bindir=p build-root=p
41
- bulk-threshold=i document=b? g|file=p? p|http-proxy=q i|install-dir=p platform=q s|source=q
42
- target-rbconfig=p? P|trust-policy=b without=b].freeze,
37
+ install: %w[version=q].freeze,
38
+ install_base: %w[E f w b|both clear-sources conservative default development development-all explain
39
+ ignore-dependencies l|local N|no-document r|remote vendor n|bindir=p build-root=p
40
+ B|bulk-threshold=i document=b? g|file=p? p|http-proxy=q? i|install-dir=p platform=q
41
+ s|source=q target-rbconfig=p? P|trust-policy=b without=b].freeze,
43
42
  update: %w[system=b?].freeze,
44
- uninstall: %w[a D I x vendor n|bindir=p i|install-dir=p platform=b v|version=b].freeze,
45
- outdated: %w[b|both clear-sources l|local no-http-proxy r|remote B|bulk-threshold=i p|http-proxy=q? platform=q
43
+ uninstall: %w[a D I x vendor n|bindir=p i|install-dir=p platform=b v|version=q].freeze,
44
+ outdated: %w[b|both clear-sources l|local r|remote B|bulk-threshold=i p|http-proxy=q? platform=q
46
45
  source=q].freeze,
47
- push: %w[no-http-proxy attestation=p host=q p|http-proxy=q? key=b otp=b].freeze,
48
- build: %w[force strict o|output=p platform=q].freeze,
49
- exec: %w[conservative no-prerelease prerelease g|gem=v version=b].freeze,
50
- pristine: %w[all only-executables only-missing-extensions only-plugins n|bindir=p i|install-dir=p skip=b
51
- v|version=b].freeze,
46
+ push: %w[attestation=p host=q p|http-proxy=q? k|key=b otp=b].freeze,
47
+ build: %w[C=p force strict o|output=p platform=q].freeze,
48
+ exec: %w[conservative g|gem=b v|version=q].freeze,
49
+ pristine: %w[E all only-executables only-missing-extensions only-plugins n|bindir=p i|install-dir=p skip=b
50
+ v|version=q].freeze,
52
51
  no: {
53
52
  install: %w[env-shebang force format-executable http-proxy lock minimal-deps post-install-message prerelease
54
53
  suggestions user-install wrappers].freeze,
55
54
  uninstall: %w[abort-on-dependent all check-development executables force format-executable
56
55
  ignore-dependencies user-install].freeze,
56
+ outdated: %w[http-proxy].freeze,
57
+ push: %w[http-proxy].freeze,
58
+ exec: %w[prerelease].freeze,
57
59
  pristine: %w[env-shebang extensions].freeze
58
60
  }.freeze
59
61
  }.freeze
@@ -67,7 +69,7 @@ module Squared
67
69
  end
68
70
 
69
71
  def bannerargs
70
- [:dependfile].freeze
72
+ %i[dependfile gemname].freeze
71
73
  end
72
74
 
73
75
  def config?(val)
@@ -105,9 +107,7 @@ module Squared
105
107
  @gemfile = if gemspec == false
106
108
  false
107
109
  elsif gemspec
108
- path + (gemspec.include?('.') ? gemspec : "#{gemspec}.gemspec")
109
- elsif (gemspec = path + "#{name}.gemspec").exist? || (gemspec = path + "#{project}.gemspec").exist?
110
- gemspec
110
+ basepath(gemspec.include?('.') ? gemspec : "#{gemspec}.gemspec")
111
111
  end
112
112
  return if !@output[0].nil? || !@copy.nil? || version || @autodetect || !rakefile
113
113
 
@@ -235,21 +235,26 @@ module Squared
235
235
  format_desc action, flag, 'path,opts*,args*'
236
236
  task flag, [:rb] do |_, args|
237
237
  file = args.rb
238
- args = args.extras
239
- unless file && !file.include?('*')
240
- file, opts, prog = choice_index('Select a file', Dir.glob(file || '*.rb', base: path),
241
- values: (file ? [] : ['Options']) << 'Arguments',
242
- force: true, series: !args.include?('v'))
243
- if file
244
- prog = opts
245
- else
246
- args.concat(OptionPartition.strip(opts))
247
- end
248
- end
249
- ruby(flag, args, file: file, args: prog)
238
+ opts = args.extras
239
+ args = if file && !file.include?('*')
240
+ ENV['RUBY_ARGS']
241
+ else
242
+ a, b, c = choice_index('Select a file', Dir.glob(file || '*.rb', base: path),
243
+ values: (file ? [] : ['Options']).push('Arguments'),
244
+ force: true, series: true)
245
+ if file
246
+ file = a
247
+ b
248
+ else
249
+ file = a
250
+ opts.concat(OptionPartition.strip(b))
251
+ c
252
+ end
253
+ end
254
+ ruby(flag, opts, file: file, args: args)
250
255
  end
251
256
  when :script
252
- format_desc action, flag, 'opts*,args*'
257
+ format_desc action, flag, 'opts*'
253
258
  task flag do |_, args|
254
259
  command = ENV['RUBY_E'] || readline('Enter script', force: true, multiline: ['##', ';'])
255
260
  ruby(flag, args.to_a, command: command)
@@ -302,7 +307,7 @@ module Squared
302
307
  print_item unless @output[0] || task_invoked?(/^copy(?::#{Ruby.ref}|$)/)
303
308
  glob = Array(glob || '**/*')
304
309
  Array(from).each_with_index do |val, i|
305
- a = path + val
310
+ a = basepath val
306
311
  b = dest + val
307
312
  c = glob[i] || glob.first
308
313
  log.info "cp #{a + c} #{b}"
@@ -439,7 +444,7 @@ module Squared
439
444
  if flag != :redownload
440
445
  op << '--redownload'
441
446
  elsif (lock = basepath('Gemfile.lock')).exist?
442
- config = basepath('.bundle', 'config')
447
+ config = basepath '.bundle', 'config'
443
448
  lock.delete unless config.exist? && config.read.match?(/\bBUNDLE_FROZEN:\s+"true"/)
444
449
  end
445
450
  end
@@ -458,16 +463,16 @@ module Squared
458
463
  when :file, :script
459
464
  op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self, args: true)
460
465
  if file
461
- op.unshift(shell_quote(path + file))
466
+ op.unshift(shell_quote(basepath(file)))
462
467
  elsif command
463
468
  op << quote_option('e', command, option: false)
464
469
  end
465
- op.push(args) if (args = ENV.fetch('RUBY_ARGS', args))
470
+ op.push(args) if args
466
471
  op.append(delim: true, escape: false, quote: false) unless op.empty?
467
472
  when :version
468
473
  pwd_set do
469
474
  out = []
470
- order = { 'rvm' => -1, 'rbenv' => -1, 'chruby' => -1, 'asdf' => -1 }
475
+ order = { 'rbenv' => -1, 'rvm' => -1, 'asdf' => -1, 'chruby' => -1 }
471
476
  ENV.fetch('PATH', '').split(':').each_with_index do |val, index|
472
477
  order.each_key do |key|
473
478
  if val.match?(%r{[/.]#{key}/})
@@ -477,14 +482,14 @@ module Squared
477
482
  end
478
483
  end
479
484
  paths = [
485
+ "#{ENV.fetch('RBENV_ROOT', '$HOME/.rbenv')}/bin/rbenv",
480
486
  '$HOME/.rvm/bin/rvm',
487
+ @asdf ? "#{ENV.fetch('ASDF_DATA_DIR', '$HOME/.asdf')}/installs/#{@asdf.first}" : nil,
488
+ '/usr/bin/rbenv',
481
489
  '/usr/local/rvm/bin/rvm',
482
490
  '/usr/share/rvm/bin/rvm',
483
- "#{ENV.fetch('RBENV_ROOT', '$HOME/.rbenv')}/bin/rbenv",
484
- '/usr/bin/rbenv',
485
491
  '/usr/local/share/chruby/chruby.sh'
486
- ]
487
- paths << "#{ENV.fetch('ASDF_DATA_DIR', '$HOME/.asdf')}/installs/#{@asdf.first}" if @asdf
492
+ ].compact
488
493
  paths.sort do |a, b|
489
494
  c = -1
490
495
  d = -1
@@ -571,14 +576,14 @@ module Squared
571
576
  end
572
577
  return
573
578
  end
574
- run_rb(banner: op.arg?('v'), from: :"ruby:#{flag}")
579
+ run_rb(banner: false, from: :"ruby:#{flag}")
575
580
  end
576
581
 
577
582
  def gem!(flag, opts = [], filter: nil)
578
583
  cmd = gem_session
579
584
  case flag
580
585
  when :outdated
581
- cmd << gempwd << 'outdated'
586
+ cmd << gempwd << flag
582
587
  else
583
588
  cmd << flag
584
589
  end
@@ -591,12 +596,7 @@ module Squared
591
596
  cmd.merge(preopts)
592
597
  op = OptionPartition.new(opts, list, cmd, project: self, no: OPT_GEM[:no][flag])
593
598
  op.each do |opt|
594
- if opt =~ op.values
595
- case $1
596
- when 'g', 'gem'
597
- op << (flag == :exec ? shell_option($1, $2) : quote_option($1, path + $2))
598
- end
599
- elsif opt.include?('=') && !%i[outdated build push exec].include?(flag)
599
+ if !opt.match?(/\A[A-Za-z\d][A-Za-z\d_.-]*\z/) && %i[install uninstall update pristine].include?(flag)
600
600
  op.errors << opt
601
601
  else
602
602
  op.found << opt
@@ -605,17 +605,18 @@ module Squared
605
605
  op.swap
606
606
  case flag
607
607
  when :outdated
608
- log.info cmd.to_s
609
608
  op.clear
609
+ cmd = cmd.done
610
+ log.info cmd
610
611
  on :first, from
611
- print_item format_banner(cmd.to_s)
612
+ print_item format_banner(cmd)
612
613
  major = 0
613
614
  minor = 0
614
615
  patch = 0
615
616
  update = []
616
617
  pwd_set(pass: !gempwd.nil?, from: from) do
617
618
  items = [[%w[Gem Current Latest], nil]]
618
- IO.popen(cmd.done).each do |line|
619
+ IO.popen(cmd).each do |line|
619
620
  if line =~ /^(\S+) \((\S+) < ([^)]+)\)$/
620
621
  cur = semscan $2
621
622
  lat = semscan $3
@@ -741,16 +742,16 @@ module Squared
741
742
  end
742
743
  when :push
743
744
  if op.empty? || (n = op.index(':'))
744
- file = path + (if !n && (spec = gemspec)
745
- "#{spec.name}-#{spec.version}.gem"
746
- else
747
- choice_index('Select a file', Dir.glob('*.gem', base: path), force: true)
748
- end)
745
+ file = basepath(if !n && (spec = gemspec)
746
+ "#{spec.name}-#{spec.version}.gem"
747
+ else
748
+ choice_index('Select a file', Dir.glob('*.gem', base: path), force: true)
749
+ end)
749
750
  else
750
- file = path + op.shift.yield_self { |val| val.include?('.') ? val : "#{val}.gem" }
751
- raise_error('gem not found', hint: file) unless file.exist?
751
+ file = op.shift.yield_self { |val| val.include?('.') ? val : "#{val}.gem" }
752
752
  raise_error("unknown args: #{op.join(', ')}", hint: flag) unless op.empty?
753
753
  end
754
+ raise_error('gem not found', hint: file) unless op.exist?(file)
754
755
  op.add_path(file)
755
756
  run_rb(from: from, interactive: "Push #{sub_style(gemname, styles: theme[:active])}")
756
757
  return
@@ -770,39 +771,40 @@ module Squared
770
771
  op.append(quote: false)
771
772
  when :update
772
773
  unless op.arg?('system')
773
- op.push(gemname) if op.empty?
774
- op.adjoin
774
+ if op.empty?
775
+ op << gemname
776
+ else
777
+ op.append
778
+ end
775
779
  end
776
780
  op.clear(errors: true)
777
- else
781
+ when :install, :uninstall, :pristine
778
782
  raise_error('missing gemname', hint: flag) if op.empty?
779
- case flag
780
- when :install, :uninstall, :pristine
781
- post = readline('Enter command [args]', force: true) if flag == :install && op.remove(':')
782
- if op.arg?('all')
783
- if flag == :pristine
784
- append_repeat 'skip', op.extras
785
- op.reset
786
- else
787
- op.clear
788
- end
789
- elsif (n = op.index { |val| val.match?(/(\A|[a-z])@\d/) })
790
- name = op.delete_at(n)
791
- if (n = name.index('@')) == 0
792
- pre = gemname
793
- ver = name[1..-1]
794
- else
795
- pre = name[0, n]
796
- ver = name[(n + 1)..-1]
797
- end
798
- op.adjoin(pre, shell_option('version', ver))
799
- .clear
800
- elsif flag != :install
801
- op.adjoin
783
+ if op.arg?('all')
784
+ if flag == :pristine
785
+ append_repeat 'skip', op.extras
786
+ op.reset
787
+ else
788
+ op.clear
802
789
  end
790
+ elsif (n = op.index { |val| val.match?(/(\A|[a-z])@\d/) })
791
+ name = op.delete_at(n)
792
+ pre, ver = if (n = name.index('@')) == 0
793
+ [gemname, name[1..-1]]
794
+ else
795
+ [name[0, n], name[(n + 1)..-1]]
796
+ end
797
+ op.adjoin(pre, shell_option('version', ver))
798
+ .clear
799
+ elsif flag == :install
800
+ op.append_any
801
+ else
802
+ op.append
803
803
  end
804
- op.append.clear(errors: true)
805
- op << '--' << post if post
804
+ op.clear(errors: true)
805
+ op << '--' << readline('Enter command [args]', force: true) if flag == :install && op.remove(':')
806
+ else
807
+ op.append
806
808
  end
807
809
  run_rb(from: from)
808
810
  end
@@ -812,26 +814,24 @@ module Squared
812
814
  args = case flag
813
815
  when 'exec', 'cache', 'check'
814
816
  list = OPT_BUNDLE[flag.to_sym] + OPT_BUNDLE[:common]
815
- OptionPartition.new(args, list, cmd, project: self, args: flag == :exec).extras
817
+ OptionPartition.new(args, list, cmd, project: self, args: flag == 'exec').extras
816
818
  else
817
819
  args.flatten
818
820
  end
819
821
  case flag
820
822
  when 'exec', 'config'
821
- if args.empty?
822
- cmd << readline('Enter arguments', force: true)
823
- else
824
- args << command_args(args)
825
- cmd.merge(args)
826
- end
827
- else
823
+ cmd << readline('Enter arguments', force: true) if args.empty?
824
+ when 'cache', 'check'
828
825
  option_clear args
826
+ args.clear
829
827
  end
828
+ cmd.merge(args)
830
829
  run(from: :"bundle:#{flag}")
831
830
  end
832
831
 
833
832
  def rake(*args, opts: [])
834
- op = OptionPartition.new(opts, OPT_RUBY[:rake], [quote_option('f', rakefile)], project: self)
833
+ op = OptionPartition.new(opts, OPT_RUBY[:rake], [(quote_option('f', rakefile) if rakefile)].compact,
834
+ project: self)
835
835
  args.concat(op.extras)
836
836
  if args.empty?
837
837
  args << nil
@@ -877,7 +877,7 @@ module Squared
877
877
  end
878
878
 
879
879
  def copy?
880
- return true if super || (@copy.is_a?(Hash) && copy.fetch(:into, nil))
880
+ return true if @copy.is_a?(Hash) ? copy[:into] : super
881
881
  return gemdir? if @gemdir
882
882
 
883
883
  if version
@@ -1028,14 +1028,14 @@ module Squared
1028
1028
  end
1029
1029
 
1030
1030
  def variables
1031
- (super + %i[version autodetect]).freeze
1031
+ (super + %i[autodetect]).freeze
1032
1032
  end
1033
1033
 
1034
1034
  def rakefile
1035
1035
  return @rakefile unless @rakefile.nil?
1036
1036
 
1037
1037
  @rakefile = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }.yield_self do |file|
1038
- file ? path + file : false
1038
+ file ? basepath(file) : false
1039
1039
  end
1040
1040
  end
1041
1041
 
@@ -1067,9 +1067,9 @@ module Squared
1067
1067
  def gemfile
1068
1068
  return @gemfile unless @gemfile.nil?
1069
1069
 
1070
- @gemfile = [project, name].map! { |val| path + "#{val}.gemspec" }
1070
+ @gemfile = [project, name].map! { |val| basepath("#{val}.gemspec") }
1071
1071
  .concat(path.glob('*.gemspec'))
1072
- .find { |file| File.exist?(file) } || false
1072
+ .find(&:exist?) || false
1073
1073
  end
1074
1074
 
1075
1075
  def gemlib