commander 4.0.5 → 4.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/DEVELOPMENT CHANGED
@@ -21,4 +21,3 @@ To build a new version of the gem:
21
21
  $ rake build
22
22
  $ rake gem
23
23
 
24
- (NOTE: there currently seem to be some bugs in our development dependencies that prevent building the gem or docs on Ruby 1.9.2.)
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ 4.0.6 / 2011-09-15
2
+ ==================
3
+
4
+ * Improved load time on Ruby 1.9. (thanks to Jonathon M. Abbott)
5
+ * Updated documentation.
6
+
1
7
  4.0.5 / 2011-08-09
2
8
  ==================
3
9
 
data/README.rdoc CHANGED
@@ -28,6 +28,12 @@ features, and an elegant API.
28
28
 
29
29
  $ gem install commander
30
30
 
31
+ == Quick Start
32
+
33
+ To generate a quick template for a commander app, run:
34
+
35
+ $ commander init yourfile.rb
36
+
31
37
  == Example
32
38
 
33
39
  For more option examples view the Commander::Command#option method. Also
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  $:.unshift 'lib'
2
2
 
3
+ require 'psych' if RUBY_VERSION >= "1.9.2"
3
4
  require 'rubygems'
4
5
 
5
6
  load_errors = ['highline', 'echoe'].map do |g|
@@ -19,10 +20,10 @@ Echoe.new "commander", Commander::VERSION do |p|
19
20
  p.email = "ggilder@tractionco.com"
20
21
  p.summary = "The complete solution for Ruby command-line executables"
21
22
  p.url = "http://visionmedia.github.com/commander"
22
- p.runtime_dependencies << "highline >=1.5.0"
23
- p.development_dependencies << "echoe >=4.0.0"
24
- p.development_dependencies << "sdoc >=0.2.20"
25
- p.development_dependencies << "rspec ~>1.3"
23
+ p.runtime_dependencies << "highline ~>1.5.0"
24
+ p.development_dependencies << "echoe ~>4.0.0"
25
+ p.development_dependencies << "sdoc ~>0.3.11"
26
+ p.development_dependencies << "rspec <2"
26
27
 
27
28
  p.eval = Proc.new do
28
29
  self.authors = ["TJ Holowaychuk", "Gabriel Gilder"]
data/commander.gemspec CHANGED
@@ -1,42 +1,42 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{commander}
5
- s.version = "4.0.5"
4
+ s.name = "commander"
5
+ s.version = "4.0.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{TJ Holowaychuk}, %q{Gabriel Gilder}]
9
- s.date = %q{2011-08-09}
10
- s.description = %q{The complete solution for Ruby command-line executables}
11
- s.email = %q{ggilder@tractionco.com}
12
- s.executables = [%q{commander}]
13
- s.extra_rdoc_files = [%q{README.rdoc}, %q{bin/commander}, %q{lib/commander.rb}, %q{lib/commander/blank.rb}, %q{lib/commander/command.rb}, %q{lib/commander/core_ext.rb}, %q{lib/commander/core_ext/array.rb}, %q{lib/commander/core_ext/object.rb}, %q{lib/commander/delegates.rb}, %q{lib/commander/help_formatters.rb}, %q{lib/commander/help_formatters/base.rb}, %q{lib/commander/help_formatters/terminal.rb}, %q{lib/commander/help_formatters/terminal/command_help.erb}, %q{lib/commander/help_formatters/terminal/help.erb}, %q{lib/commander/help_formatters/terminal_compact.rb}, %q{lib/commander/help_formatters/terminal_compact/command_help.erb}, %q{lib/commander/help_formatters/terminal_compact/help.erb}, %q{lib/commander/import.rb}, %q{lib/commander/platform.rb}, %q{lib/commander/runner.rb}, %q{lib/commander/user_interaction.rb}, %q{lib/commander/version.rb}, %q{tasks/dev_setup.rake}, %q{tasks/docs.rake}, %q{tasks/gemspec.rake}]
14
- s.files = [%q{DEVELOPMENT}, %q{History.rdoc}, %q{Manifest}, %q{README.rdoc}, %q{Rakefile}, %q{bin/commander}, %q{commander.gemspec}, %q{lib/commander.rb}, %q{lib/commander/blank.rb}, %q{lib/commander/command.rb}, %q{lib/commander/core_ext.rb}, %q{lib/commander/core_ext/array.rb}, %q{lib/commander/core_ext/object.rb}, %q{lib/commander/delegates.rb}, %q{lib/commander/help_formatters.rb}, %q{lib/commander/help_formatters/base.rb}, %q{lib/commander/help_formatters/terminal.rb}, %q{lib/commander/help_formatters/terminal/command_help.erb}, %q{lib/commander/help_formatters/terminal/help.erb}, %q{lib/commander/help_formatters/terminal_compact.rb}, %q{lib/commander/help_formatters/terminal_compact/command_help.erb}, %q{lib/commander/help_formatters/terminal_compact/help.erb}, %q{lib/commander/import.rb}, %q{lib/commander/platform.rb}, %q{lib/commander/runner.rb}, %q{lib/commander/user_interaction.rb}, %q{lib/commander/version.rb}, %q{spec/command_spec.rb}, %q{spec/core_ext/array_spec.rb}, %q{spec/core_ext/object_spec.rb}, %q{spec/help_formatters/terminal_spec.rb}, %q{spec/runner_spec.rb}, %q{spec/spec.opts}, %q{spec/spec_helper.rb}, %q{spec/ui_spec.rb}, %q{tasks/dev_setup.rake}, %q{tasks/docs.rake}, %q{tasks/gemspec.rake}]
15
- s.homepage = %q{http://visionmedia.github.com/commander}
16
- s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Commander}, %q{--main}, %q{README.rdoc}]
17
- s.require_paths = [%q{lib}]
18
- s.rubyforge_project = %q{commander}
19
- s.rubygems_version = %q{1.8.6}
20
- s.summary = %q{The complete solution for Ruby command-line executables}
8
+ s.authors = ["TJ Holowaychuk", "Gabriel Gilder"]
9
+ s.date = "2011-09-15"
10
+ s.description = "The complete solution for Ruby command-line executables"
11
+ s.email = "ggilder@tractionco.com"
12
+ s.executables = ["commander"]
13
+ s.extra_rdoc_files = ["README.rdoc", "bin/commander", "lib/commander.rb", "lib/commander/blank.rb", "lib/commander/command.rb", "lib/commander/core_ext.rb", "lib/commander/core_ext/array.rb", "lib/commander/core_ext/object.rb", "lib/commander/delegates.rb", "lib/commander/help_formatters.rb", "lib/commander/help_formatters/base.rb", "lib/commander/help_formatters/terminal.rb", "lib/commander/help_formatters/terminal/command_help.erb", "lib/commander/help_formatters/terminal/help.erb", "lib/commander/help_formatters/terminal_compact.rb", "lib/commander/help_formatters/terminal_compact/command_help.erb", "lib/commander/help_formatters/terminal_compact/help.erb", "lib/commander/import.rb", "lib/commander/platform.rb", "lib/commander/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "tasks/dev_setup.rake", "tasks/docs.rake", "tasks/gemspec.rake"]
14
+ s.files = ["DEVELOPMENT", "History.rdoc", "Manifest", "README.rdoc", "Rakefile", "bin/commander", "commander.gemspec", "lib/commander.rb", "lib/commander/blank.rb", "lib/commander/command.rb", "lib/commander/core_ext.rb", "lib/commander/core_ext/array.rb", "lib/commander/core_ext/object.rb", "lib/commander/delegates.rb", "lib/commander/help_formatters.rb", "lib/commander/help_formatters/base.rb", "lib/commander/help_formatters/terminal.rb", "lib/commander/help_formatters/terminal/command_help.erb", "lib/commander/help_formatters/terminal/help.erb", "lib/commander/help_formatters/terminal_compact.rb", "lib/commander/help_formatters/terminal_compact/command_help.erb", "lib/commander/help_formatters/terminal_compact/help.erb", "lib/commander/import.rb", "lib/commander/platform.rb", "lib/commander/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "spec/command_spec.rb", "spec/core_ext/array_spec.rb", "spec/core_ext/object_spec.rb", "spec/help_formatters/terminal_spec.rb", "spec/runner_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/ui_spec.rb", "tasks/dev_setup.rake", "tasks/docs.rake", "tasks/gemspec.rake"]
15
+ s.homepage = "http://visionmedia.github.com/commander"
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Commander", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = "commander"
19
+ s.rubygems_version = "1.8.10"
20
+ s.summary = "The complete solution for Ruby command-line executables"
21
21
 
22
22
  if s.respond_to? :specification_version then
23
23
  s.specification_version = 3
24
24
 
25
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<highline>, [">= 1.5.0"])
27
- s.add_development_dependency(%q<echoe>, [">= 4.0.0"])
28
- s.add_development_dependency(%q<sdoc>, [">= 0.2.20"])
29
- s.add_development_dependency(%q<rspec>, ["~> 1.3"])
26
+ s.add_runtime_dependency(%q<highline>, ["~> 1.5.0"])
27
+ s.add_development_dependency(%q<echoe>, ["~> 4.0.0"])
28
+ s.add_development_dependency(%q<sdoc>, ["~> 0.3.11"])
29
+ s.add_development_dependency(%q<rspec>, ["< 2"])
30
30
  else
31
- s.add_dependency(%q<highline>, [">= 1.5.0"])
32
- s.add_dependency(%q<echoe>, [">= 4.0.0"])
33
- s.add_dependency(%q<sdoc>, [">= 0.2.20"])
34
- s.add_dependency(%q<rspec>, ["~> 1.3"])
31
+ s.add_dependency(%q<highline>, ["~> 1.5.0"])
32
+ s.add_dependency(%q<echoe>, ["~> 4.0.0"])
33
+ s.add_dependency(%q<sdoc>, ["~> 0.3.11"])
34
+ s.add_dependency(%q<rspec>, ["< 2"])
35
35
  end
36
36
  else
37
- s.add_dependency(%q<highline>, [">= 1.5.0"])
38
- s.add_dependency(%q<echoe>, [">= 4.0.0"])
39
- s.add_dependency(%q<sdoc>, [">= 0.2.20"])
40
- s.add_dependency(%q<rspec>, ["~> 1.3"])
37
+ s.add_dependency(%q<highline>, ["~> 1.5.0"])
38
+ s.add_dependency(%q<echoe>, ["~> 4.0.0"])
39
+ s.add_dependency(%q<sdoc>, ["~> 0.3.11"])
40
+ s.add_dependency(%q<rspec>, ["< 2"])
41
41
  end
42
42
  end
@@ -291,10 +291,17 @@ module Commander
291
291
  # Implements ask_for_CLASS methods.
292
292
 
293
293
  module AskForClass
294
- def method_missing meth, *args, &block
295
- case meth.to_s
296
- when /^ask_for_([\w]+)/ ; $terminal.ask(args.first, Kernel.const_get($1.capitalize))
297
- else super
294
+ # All special cases in HighLine::Question#convert, except those that implement #parse
295
+ ([Float, Integer, String, Symbol, Regexp, Array, File, Pathname] +
296
+ # All Classes that respond to #parse
297
+ Object.constants.map do |const|
298
+ # const_get(:Config) issues a deprecation warning on ruby 1.8.7
299
+ Object.const_get(const) unless const == :Config
300
+ end.select do |const|
301
+ const.is_a? Class and const.respond_to? :parse
302
+ end).each do |klass|
303
+ define_method "ask_for_#{klass.to_s.downcase}" do |prompt|
304
+ $terminal.ask(prompt, klass)
298
305
  end
299
306
  end
300
307
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Commander
3
- VERSION = '4.0.5'
3
+ VERSION = '4.0.6'
4
4
  end
data/spec/command_spec.rb CHANGED
@@ -84,7 +84,7 @@ describe Commander::Command do
84
84
  @command.run '--no-toggle'
85
85
  end
86
86
 
87
- it "manditory arguments" do
87
+ it "mandatory arguments" do
88
88
  @command.option '--file FILE'
89
89
  @command.when_called { |_, options| options.file.should == 'foo' }
90
90
  @command.run '--file', 'foo'
metadata CHANGED
@@ -1,93 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: commander
3
- version: !ruby/object:Gem::Version
4
- hash: 53
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.0.6
5
5
  prerelease:
6
- segments:
7
- - 4
8
- - 0
9
- - 5
10
- version: 4.0.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - TJ Holowaychuk
14
9
  - Gabriel Gilder
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-08-09 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2011-09-15 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: highline
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2155737700 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 1
32
- - 5
33
- - 0
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
34
22
  version: 1.5.0
35
23
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: echoe
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2155737700
26
+ - !ruby/object:Gem::Dependency
27
+ name: echoe
28
+ requirement: &2155737200 !ruby/object:Gem::Requirement
41
29
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 63
46
- segments:
47
- - 4
48
- - 0
49
- - 0
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
50
33
  version: 4.0.0
51
34
  type: :development
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: sdoc
55
35
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2155737200
37
+ - !ruby/object:Gem::Dependency
38
+ name: sdoc
39
+ requirement: &2155736700 !ruby/object:Gem::Requirement
57
40
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 63
62
- segments:
63
- - 0
64
- - 2
65
- - 20
66
- version: 0.2.20
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.3.11
67
45
  type: :development
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
46
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *2155736700
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: &2155736200 !ruby/object:Gem::Requirement
73
51
  none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 9
78
- segments:
79
- - 1
80
- - 3
81
- version: "1.3"
52
+ requirements:
53
+ - - <
54
+ - !ruby/object:Gem::Version
55
+ version: '2'
82
56
  type: :development
83
- version_requirements: *id004
57
+ prerelease: false
58
+ version_requirements: *2155736200
84
59
  description: The complete solution for Ruby command-line executables
85
60
  email: ggilder@tractionco.com
86
- executables:
61
+ executables:
87
62
  - commander
88
63
  extensions: []
89
-
90
- extra_rdoc_files:
64
+ extra_rdoc_files:
91
65
  - README.rdoc
92
66
  - bin/commander
93
67
  - lib/commander.rb
@@ -113,7 +87,7 @@ extra_rdoc_files:
113
87
  - tasks/dev_setup.rake
114
88
  - tasks/docs.rake
115
89
  - tasks/gemspec.rake
116
- files:
90
+ files:
117
91
  - DEVELOPMENT
118
92
  - History.rdoc
119
93
  - Manifest
@@ -154,42 +128,32 @@ files:
154
128
  - tasks/gemspec.rake
155
129
  homepage: http://visionmedia.github.com/commander
156
130
  licenses: []
157
-
158
131
  post_install_message:
159
- rdoc_options:
132
+ rdoc_options:
160
133
  - --line-numbers
161
134
  - --inline-source
162
135
  - --title
163
136
  - Commander
164
137
  - --main
165
138
  - README.rdoc
166
- require_paths:
139
+ require_paths:
167
140
  - lib
168
- required_ruby_version: !ruby/object:Gem::Requirement
141
+ required_ruby_version: !ruby/object:Gem::Requirement
169
142
  none: false
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- hash: 3
174
- segments:
175
- - 0
176
- version: "0"
177
- required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
148
  none: false
179
- requirements:
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- hash: 11
183
- segments:
184
- - 1
185
- - 2
186
- version: "1.2"
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '1.2'
187
153
  requirements: []
188
-
189
154
  rubyforge_project: commander
190
- rubygems_version: 1.8.6
155
+ rubygems_version: 1.8.10
191
156
  signing_key:
192
157
  specification_version: 3
193
158
  summary: The complete solution for Ruby command-line executables
194
159
  test_files: []
195
-