gli 2.3.0.rc1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -279,7 +279,7 @@ require '#{project_name}'
279
279
  rescue LoadError
280
280
  STDERR.puts "In development, you need to use `bundle exec bin/todo` to run your app"
281
281
  STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
282
- STDERR.puts "Feel free to remove this message from bin/todo now"
282
+ STDERR.puts "Feel free to remove this message from bin/#{project_name} now"
283
283
  exit 64
284
284
  end
285
285
 
@@ -33,8 +33,9 @@ module GLI
33
33
  def self.setup_options(opts,tokens,options)
34
34
  tokens.each do |ignore,token|
35
35
  opts.on(*token.arguments_for_option_parser) do |arg|
36
- [token.name,token.aliases].flatten.compact.each do |name|
36
+ [token.name,token.aliases].flatten.compact.map(&:to_s).each do |name|
37
37
  options[name] = arg
38
+ options[name.to_sym] = arg
38
39
  end
39
40
  end
40
41
  end
data/lib/gli/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module GLI
2
2
  unless const_defined? :VERSION
3
- VERSION = '2.3.0.rc1' #:nodoc:
3
+ VERSION = '2.3.0' #:nodoc:
4
4
  end
5
5
  end
data/test/tc_gli.rb CHANGED
@@ -245,17 +245,27 @@ class TC_testGLI < Clean::Test::TestCase
245
245
  c.action do |global,options,args|
246
246
  assert_equal 'foo',global[:f]
247
247
  assert_equal global[:f],global[:flag]
248
+ assert_equal global[:f],global['f']
249
+ assert_equal global[:f],global['flag']
250
+ assert_equal global[:f],global['big-flag-name']
248
251
  assert_equal global[:f],global[:'big-flag-name']
249
252
 
250
253
  assert global[:s]
251
254
  assert global[:switch]
252
255
  assert global[:'big-switch-name']
256
+ assert global['s']
257
+ assert global['switch']
258
+ assert global['big-switch-name']
253
259
 
254
260
  assert_equal 'bar',options[:g]
261
+ assert_equal options[:g],options['g']
262
+ assert_equal options[:g],options['gflag']
255
263
  assert_equal options[:g],options[:gflag]
256
264
 
257
265
  assert options[:h]
266
+ assert options['h']
258
267
  assert options[:hswitch]
268
+ assert options['hswitch']
259
269
  end
260
270
  end
261
271
  @app.run(%w(-f foo -s command -g bar -h some_arg))
@@ -123,8 +123,8 @@ class TC_testSubCommand < Clean::Test::TestCase
123
123
  lambda {
124
124
  @run_results.each do |command,results|
125
125
  if command == expected_command
126
- assert_equal(Hash(options[:global_options]),results[0])
127
- assert_equal(Hash(options[:command_options]),results[1])
126
+ assert_equal(indiffernt_hash(options[:global_options]),results[0])
127
+ assert_equal(indiffernt_hash(options[:command_options]),results[1])
128
128
  assert_equal(options[:args],results[2])
129
129
  else
130
130
  assert_nil results
@@ -133,8 +133,14 @@ class TC_testSubCommand < Clean::Test::TestCase
133
133
  }
134
134
  end
135
135
 
136
- def Hash(possibly_nil_hash)
137
- possibly_nil_hash || {}
136
+ def indiffernt_hash(possibly_nil_hash)
137
+ return {} if possibly_nil_hash.nil?
138
+ keys = possibly_nil_hash.keys
139
+ keys.map(&:to_s).each do |key|
140
+ possibly_nil_hash[key.to_sym] = possibly_nil_hash[key] if possibly_nil_hash[key]
141
+ possibly_nil_hash[key] = possibly_nil_hash[key.to_sym] if possibly_nil_hash[key.to_sym]
142
+ end
143
+ possibly_nil_hash
138
144
  end
139
145
 
140
146
  # options -
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.rc1
5
- prerelease: 6
4
+ version: 2.3.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Copeland
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-30 00:00:00.000000000 Z
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -365,13 +365,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
365
365
  version: '0'
366
366
  segments:
367
367
  - 0
368
- hash: -3796893543708416219
368
+ hash: 3822562624553397534
369
369
  required_rubygems_version: !ruby/object:Gem::Requirement
370
370
  none: false
371
371
  requirements:
372
- - - ! '>'
372
+ - - ! '>='
373
373
  - !ruby/object:Gem::Version
374
- version: 1.3.1
374
+ version: '0'
375
+ segments:
376
+ - 0
377
+ hash: 3822562624553397534
375
378
  requirements: []
376
379
  rubyforge_project: gli
377
380
  rubygems_version: 1.8.24