boson 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,7 +67,7 @@ module Boson
67
67
  end
68
68
 
69
69
  test "translate arg and normal hash options" do
70
- args_are_equal [:cool, {:ok=>true}], [:cool, {:ok=>true}]
70
+ args_are_equal [:cool, {:ok=>true}], [:cool, {:ok=>true, :level=>2}]
71
71
  end
72
72
 
73
73
  test "translate stringified arg without options sets default options" do
@@ -136,7 +136,7 @@ module Boson
136
136
  end
137
137
 
138
138
  test "with no argument defined for options" do
139
- capture_stderr { command({:args=>1}, 'ok') }.should =~ /misaligned/
139
+ assert_error(ArgumentError, '2 for 1') { command({:args=>1}, 'ok') }
140
140
  end
141
141
  end
142
142
 
@@ -173,11 +173,12 @@ module Boson
173
173
  end
174
174
 
175
175
  test "with too many args raises ArgumentError" do
176
- args = [ArgumentError, '3 for 2']
177
- assert_error(*args) { command_with_args 1,2,3 }
178
- assert_error(*args) { command_with_args '1 2 3' }
179
- assert_error(*args) { command_with_arg_size 1,2,3 }
180
- assert_error(*args) { command_with_arg_size '1 2 3' }
176
+ args3 = [ArgumentError, '3 for 2']
177
+ args4 = [ArgumentError, '4 for 2']
178
+ assert_error(*args3) { command_with_args 1,2,3 }
179
+ assert_error(*args4) { command_with_args '1 2 3' }
180
+ assert_error(*args3) { command_with_arg_size 1,2,3 }
181
+ assert_error(*args4) { command_with_arg_size '1 2 3' }
181
182
  end
182
183
  end
183
184
 
@@ -1,8 +1,19 @@
1
1
  require 'rubygems'
2
- require 'test/unit'
3
- require 'context' #gem install jeremymcanally-context --source http://gems.github.com
4
- require 'matchy' #gem install jeremymcanally-matchy --source http://gems.github.com
5
2
  require 'mocha'
3
+ if ENV['SPEC'] # run with rspec for ruby 1.9
4
+ require 'spec/test/unit'
5
+
6
+ module Spec::Example::ExampleGroupMethods
7
+ alias_method :test, :it
8
+ end
9
+ Spec::Runner.configure do |config|
10
+ config.mock_with :mocha
11
+ end
12
+ else
13
+ require 'test/unit'
14
+ require 'context' #gem install jeremymcanally-context --source http://gems.github.com
15
+ require 'matchy' #gem install jeremymcanally-matchy --source http://gems.github.com
16
+ end
6
17
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
18
  require 'boson'
8
19
  require 'test_benchmark' if ENV['BENCHMARK']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Horner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-06 00:00:00 -04:00
12
+ date: 2009-10-14 00:00:00 -04:00
13
13
  default_executable: boson
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.2.6
23
+ version: 0.2.7
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: alias
@@ -69,7 +69,7 @@ files:
69
69
  - lib/boson/repo.rb
70
70
  - lib/boson/runner.rb
71
71
  - lib/boson/runners/bin_runner.rb
72
- - lib/boson/runners/repl_runner.rb
72
+ - lib/boson/runners/console_runner.rb
73
73
  - lib/boson/scientist.rb
74
74
  - lib/boson/util.rb
75
75
  - lib/boson/view.rb
@@ -77,7 +77,6 @@ files:
77
77
  - test/bin_runner_test.rb
78
78
  - test/commands_test.rb
79
79
  - test/comment_inspector_test.rb
80
- - test/config/index.marshal
81
80
  - test/file_library_test.rb
82
81
  - test/index_test.rb
83
82
  - test/loader_test.rb
@@ -115,7 +114,7 @@ rubyforge_project: tagaholic
115
114
  rubygems_version: 1.3.5
116
115
  signing_key:
117
116
  specification_version: 3
118
- summary: Although similar to rake and thor, it's focus is not on per-project tasks. Rather it provides users with the power to turn any ruby method, into a full-fledged commandline tool. Boson achieves this with powerful options (borrowed from thor) and views (thanks to hirb). Some other unique features that differentiate it from rake and thor include being accessible from irb and the commandline, being able to write boson commands in non-dsl ruby and toggling a pretty view of a command's output without additional view code.
117
+ summary: Boson provides users with the power to turn any ruby method into a full-fledged commandline tool. Boson achieves this with powerful options (borrowed from thor) and views (thanks to hirb). Some other unique features that differentiate it from rake and thor include being accessible from irb and the commandline, being able to write boson commands in non-dsl ruby and toggling a pretty view of a command's output without additional view code.
119
118
  test_files:
120
119
  - test/argument_inspector_test.rb
121
120
  - test/bin_runner_test.rb
@@ -1,40 +0,0 @@
1
- module Boson
2
- class ReplRunner < Runner
3
- class <<self
4
- def start(options={})
5
- @options = options
6
- init unless @initialized
7
- Manager.load(@options[:libraries], load_options) if @options[:libraries]
8
- end
9
-
10
- def init
11
- super
12
- define_autoloader if @options[:autoload_libraries]
13
- @initialized = true
14
- end
15
-
16
- def bin_start(repl, libraries)
17
- start :no_defaults=>true, :libraries=>libraries
18
- repl = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' unless repl.is_a?(String)
19
- unless repl.index('/') == 0 || (repl = Util.which(repl))
20
- $stderr.puts "Repl not found. Please specify full path of repl."
21
- return
22
- end
23
- ARGV.replace ['-f']
24
- Kernel.load $0 = repl
25
- end
26
-
27
- def default_libraries
28
- defaults = super
29
- unless @options[:no_defaults]
30
- new_defaults = Boson.repos.map {|e| e.config[:defaults] }.flatten
31
- new_defaults = detected_libraries if new_defaults.empty?
32
- defaults += new_defaults
33
- defaults.uniq!
34
- end
35
- defaults
36
- end
37
- end
38
- end
39
- end
40
-
Binary file