commander 4.0.0 → 4.0.1

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.
data/History.rdoc CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ 4.0.1 / 2010-01-14
3
+ ==================
4
+
5
+ * Fixed commander when using JRuby
6
+ * Fixed template; should require "commander/import"
7
+
2
8
  === 4.0.0 / 2009-10-10
3
9
 
4
10
  * Changed; Aliased #when_called as #action [#9]
data/Manifest CHANGED
@@ -20,13 +20,13 @@ lib/commander/help_formatters/terminal_compact.rb
20
20
  lib/commander/help_formatters/terminal_compact/command_help.erb
21
21
  lib/commander/help_formatters/terminal_compact/help.erb
22
22
  lib/commander/import.rb
23
+ lib/commander/platform.rb
23
24
  lib/commander/runner.rb
24
25
  lib/commander/user_interaction.rb
25
26
  lib/commander/version.rb
26
27
  spec/command_spec.rb
27
28
  spec/core_ext/array_spec.rb
28
29
  spec/core_ext/object_spec.rb
29
- spec/help_formatters/base_spec.rb
30
30
  spec/help_formatters/terminal_spec.rb
31
31
  spec/runner_spec.rb
32
32
  spec/spec.opts
data/bin/commander CHANGED
@@ -24,7 +24,7 @@ command :init do |c|
24
24
  #!/usr/bin/env ruby
25
25
 
26
26
  require 'rubygems'
27
- require 'commander'
27
+ require 'commander/import'
28
28
  require '#{name}'
29
29
 
30
30
  program :version, #{name.capitalize}::VERSION
data/commander.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{commander}
5
- s.version = "4.0.0"
5
+ s.version = "4.0.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
9
- s.date = %q{2009-10-10}
9
+ s.date = %q{2010-01-14}
10
10
  s.default_executable = %q{commander}
11
11
  s.description = %q{The complete solution for Ruby command-line executables}
12
12
  s.email = %q{tj@vision-media.ca}
13
13
  s.executables = ["commander"]
14
- 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/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "tasks/docs.rake", "tasks/gemspec.rake"]
15
- s.files = ["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/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/base_spec.rb", "spec/help_formatters/terminal_spec.rb", "spec/runner_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/ui_spec.rb", "tasks/docs.rake", "tasks/gemspec.rake"]
14
+ 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/docs.rake", "tasks/gemspec.rake"]
15
+ s.files = ["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/docs.rake", "tasks/gemspec.rake"]
16
16
  s.homepage = %q{http://visionmedia.github.com/commander}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Commander", "--main", "README.rdoc"]
18
18
  s.require_paths = ["lib"]
data/lib/commander.rb CHANGED
@@ -29,3 +29,4 @@ require 'commander/core_ext'
29
29
  require 'commander/runner'
30
30
  require 'commander/command'
31
31
  require 'commander/help_formatters'
32
+ require 'commander/platform'
@@ -0,0 +1,8 @@
1
+
2
+ module Commander
3
+ module Platform
4
+ def self.jruby?
5
+ defined? RUBY_ENGINE && RUBY_ENGINE=='jruby'
6
+ end
7
+ end
8
+ end
@@ -192,6 +192,7 @@ module Commander
192
192
 
193
193
  def enable_paging
194
194
  return unless $stdout.tty?
195
+ return if Platform::jruby? # Fork is not supported by JRuby
195
196
  read, write = IO.pipe
196
197
 
197
198
  if Kernel.fork
@@ -208,7 +209,7 @@ module Commander
208
209
  return
209
210
  end
210
211
  end
211
-
212
+
212
213
  ##
213
214
  # Output progress while iterating _arr_.
214
215
  #
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Commander
3
- VERSION = '4.0.0'
3
+ VERSION = '4.0.1'
4
4
  end
data/spec/runner_spec.rb CHANGED
@@ -2,12 +2,11 @@
2
2
  require File.dirname(__FILE__) + '/spec_helper'
3
3
 
4
4
  describe Commander do
5
-
6
- before :each do
7
- $stderr = StringIO.new
5
+ before :each do
6
+ $stderr = StringIO.new
8
7
  mock_terminal
9
- create_test_command
10
- end
8
+ create_test_command
9
+ end
11
10
 
12
11
  describe "#program" do
13
12
  it "should set / get program information" do
@@ -130,6 +129,7 @@ describe Commander do
130
129
 
131
130
  describe "--trace" do
132
131
  it "should display pretty errors by default" do
132
+ pending("JRuby's Kernel.abort implementation is not testable") if Commander::Platform::jruby?
133
133
  lambda {
134
134
  new_command_runner 'foo' do
135
135
  command(:foo) { |c| c.when_called { raise 'cookies!' } }
@@ -160,6 +160,7 @@ describe Commander do
160
160
 
161
161
  describe "with invalid options" do
162
162
  it "should output an invalid option message" do
163
+ pending("JRuby's Kernel.abort implementation is not testable") if Commander::Platform::jruby?
163
164
  lambda {
164
165
  run('test', '--invalid-option')
165
166
  }.should raise_error(SystemExit, /invalid option: --invalid-option/)
@@ -168,6 +169,7 @@ describe Commander do
168
169
 
169
170
  describe "with invalid command passed" do
170
171
  it "should output an invalid command message" do
172
+ pending("JRuby's Kernel.abort implementation is not testable") if Commander::Platform::jruby?
171
173
  lambda {
172
174
  run('foo')
173
175
  }.should raise_error(SystemExit, /invalid command. Use --help for more information/)
@@ -176,6 +178,7 @@ describe Commander do
176
178
 
177
179
  describe "with invalid command passed to help" do
178
180
  it "should output an invalid command message" do
181
+ pending("JRuby's Kernel.abort implementation is not testable") if Commander::Platform::jruby?
179
182
  lambda {
180
183
  run('help', 'does_not_exist')
181
184
  }.should raise_error(SystemExit, /invalid command. Use --help for more information/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-10 00:00:00 -07:00
12
+ date: 2010-01-14 00:00:00 -08:00
13
13
  default_executable: commander
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,6 +47,7 @@ extra_rdoc_files:
47
47
  - lib/commander/help_formatters/terminal_compact/command_help.erb
48
48
  - lib/commander/help_formatters/terminal_compact/help.erb
49
49
  - lib/commander/import.rb
50
+ - lib/commander/platform.rb
50
51
  - lib/commander/runner.rb
51
52
  - lib/commander/user_interaction.rb
52
53
  - lib/commander/version.rb
@@ -75,13 +76,13 @@ files:
75
76
  - lib/commander/help_formatters/terminal_compact/command_help.erb
76
77
  - lib/commander/help_formatters/terminal_compact/help.erb
77
78
  - lib/commander/import.rb
79
+ - lib/commander/platform.rb
78
80
  - lib/commander/runner.rb
79
81
  - lib/commander/user_interaction.rb
80
82
  - lib/commander/version.rb
81
83
  - spec/command_spec.rb
82
84
  - spec/core_ext/array_spec.rb
83
85
  - spec/core_ext/object_spec.rb
84
- - spec/help_formatters/base_spec.rb
85
86
  - spec/help_formatters/terminal_spec.rb
86
87
  - spec/runner_spec.rb
87
88
  - spec/spec.opts
@@ -1,26 +0,0 @@
1
-
2
- require File.dirname(__FILE__) + '/../spec_helper'
3
-
4
- describe Commander::HelpFormatter do
5
-
6
- before :each do
7
- mock_terminal
8
- end
9
-
10
- it "should display global help using --help switch" do
11
- run('--help').should == "Implement global help here\n"
12
- end
13
-
14
- it "should display global help using help command" do
15
- run('help').should == "Implement global help here\n"
16
- end
17
-
18
- it "should display command help" do
19
- run('help', 'test').should == "Implement help for test here\n"
20
- end
21
-
22
- it "should display command help using --help switch" do
23
- run('--help', 'test').should == "Implement help for test here\n"
24
- end
25
-
26
- end