squared 0.4.12 → 0.4.13

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.
@@ -100,9 +100,8 @@ module Squared
100
100
  initialize_build(Ruby.ref, **kwargs)
101
101
  initialize_env(**kwargs)
102
102
  end
103
+ dependfile_set GEMFILE
103
104
  @autodetect = autodetect
104
- @dependindex = GEMFILE.index { |file| basepath(file).exist? }
105
- @dependfile = @path + GEMFILE[@dependindex || 0]
106
105
  return if !@output[0].nil? || !@copy.nil? || @version || @autodetect || (file = rakefile).nil?
107
106
 
108
107
  begin
@@ -203,7 +202,7 @@ module Squared
203
202
  gem!(flag, args, filter: filter)
204
203
  end
205
204
  when :build, :push, :exec
206
- format_desc(action, flag, 'opts*', before: flag == :exec ? 'command+' : nil)
205
+ format_desc(action, flag, 'opts*', before: flag == :exec ? 'command,args*' : nil)
207
206
  task flag do |_, args|
208
207
  gem! flag, args.to_a
209
208
  end
@@ -219,15 +218,20 @@ module Squared
219
218
  when :file
220
219
  format_desc action, flag, 'path,opts*,args*'
221
220
  task flag, [:rb] do |_, args|
222
- if (file = args.rb)
223
- args = args.to_a.drop(1)
224
- else
225
- file, opts, extra = choice_index('Select a file', Dir.glob('*.rb', base: path),
226
- values: %w[Options Arguments], force: true, series: true)
227
- args = OptionPartition.strip(opts)
228
- ENV['RUBY_ARGS'] = extra if extra
221
+ file = args.rb
222
+ args = args.to_a.drop(1)
223
+ unless file && !file.include?('*')
224
+ values = ['Arguments']
225
+ values.unshift('Options') unless file
226
+ file, opts, extra = choice_index('Select a file', Dir.glob(file || '*.rb', base: path),
227
+ values: values, force: true, series: !args.include?('v'))
228
+ if file
229
+ extra = opts
230
+ else
231
+ args.concat(OptionPartition.strip(opts))
232
+ end
229
233
  end
230
- ruby(flag, args, file: file)
234
+ ruby(flag, args, file: file, args: extra)
231
235
  end
232
236
  when :script
233
237
  format_desc action, flag, 'opts*,args*'
@@ -427,7 +431,7 @@ module Squared
427
431
  run_rb(from: :update)
428
432
  end
429
433
 
430
- def ruby(flag, opts = [], file: nil, command: nil)
434
+ def ruby(flag, opts = [], file: nil, command: nil, args: nil)
431
435
  case flag
432
436
  when :file, :script
433
437
  op = OptionPartition.new(opts, OPT_RUBY[:ruby], ruby_session, project: self, args: true)
@@ -436,9 +440,7 @@ module Squared
436
440
  elsif command
437
441
  op << quote_option('e', command, option: false)
438
442
  end
439
- if (args = ENV['RUBY_ARGS'])
440
- op.extras << args
441
- end
443
+ op.extras << args if (args = ENV.fetch('RUBY_ARGS', args))
442
444
  op.append(delim: true, escape: false, quote: false) unless op.empty?
443
445
  when :version
444
446
  pwd_set do
@@ -603,7 +605,7 @@ module Squared
603
605
  g = a.ljust(d)
604
606
  pat = [/^([^.]+\.)([^.]+\..+)$/, /^([^.]+\.[^.]+\.)(.+)$/]
605
607
  pre = b.start_with?('0.')
606
- latest = [theme[:current]]
608
+ latest = [theme[:latest]]
607
609
  case item.last
608
610
  when 1
609
611
  case filter
@@ -697,7 +699,11 @@ module Squared
697
699
  end
698
700
  when :exec
699
701
  raise_error('missing command', hint: flag) if op.empty?
700
- op << project << op.join(' ')
702
+ op << basic_option('gem', project) unless op.arg?('g', 'gem')
703
+ if (args = command_args(op.extras))
704
+ op.push(args)
705
+ end
706
+ op.append(delim: true, quote: false)
701
707
  else
702
708
  raise_error('missing gemname', hint: flag) if op.empty? && !op.arg?('system')
703
709
  if flag == :pristine
@@ -733,8 +739,12 @@ module Squared
733
739
  end
734
740
  case flag
735
741
  when 'exec', 'config'
736
- raise_error('no command args', hint: flag) if args.empty?
737
- cmd.merge(args)
742
+ if args.empty?
743
+ cmd << readline('Enter arguments', force: true)
744
+ else
745
+ args << command_args(args)
746
+ cmd.merge(args)
747
+ end
738
748
  else
739
749
  option_clear args
740
750
  end
@@ -15,7 +15,7 @@ module Squared
15
15
  include Shell
16
16
  include Prompt
17
17
 
18
- def append(target, *args, delim: false, escape: false, quote: true)
18
+ def append(target, *args, delim: false, escape: false, quote: true, **)
19
19
  return if (ret = args.flatten).empty?
20
20
 
21
21
  target << '--' if delim && !target.include?('--')
@@ -47,7 +47,7 @@ module Squared
47
47
  val.map { |s| s.sub(/\A-([a-z\d])(.+)\z/i, '\1=\2').sub(/\A--?/, '') }.reject(&:empty?)
48
48
  end
49
49
 
50
- def arg?(target, *args, value: false)
50
+ def arg?(target, *args, value: false, **)
51
51
  r, s = args.partition { |val| val.is_a?(Regexp) }
52
52
  unless s.empty?
53
53
  s.map! { |val| Regexp.escape(shell_option(val)) }
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.4.12
4
+ version: 0.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham