boson-more 0.2.1 → 0.2.2
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/.gemspec +5 -3
- data/.travis.yml +6 -0
- data/CHANGELOG.rdoc +4 -0
- data/README.md +3 -1
- data/bundle/ruby/1.9.1/gems/alias-0.2.3/test/deps.rip +4 -0
- data/bundle/ruby/1.9.1/gems/bacon-bits-0.1.0/deps.rip +1 -0
- data/bundle/ruby/1.9.1/gems/boson-1.2.0/test/deps.rip +5 -0
- data/bundle/ruby/1.9.1/gems/hirb-0.6.2/test/deps.rip +4 -0
- data/deps.rip +1 -1
- data/lib/boson/libraries.rb +2 -2
- data/lib/boson/more/version.rb +1 -1
- data/lib/boson/more_commands.rb +1 -0
- data/lib/boson/science.rb +4 -10
- data/lib/boson/url_libraries.rb +14 -0
- data/test/command_test.rb +1 -0
- data/test/comment_inspector_test.rb +1 -0
- data/test/deps.rip +4 -2
- data/test/more_method_inspector_test.rb +17 -3
- data/test/more_scientist_test.rb +37 -0
- data/test/pipes_test.rb +2 -1
- data/test/repo_index_test.rb +3 -0
- data/test/repo_test.rb +2 -1
- data/test/science_test.rb +28 -5
- data/test/scientist_test.rb +3 -0
- data/test/test_helper.rb +13 -36
- data/test/{alias_test.rb → todo/alias_test.rb} +6 -3
- data/test/{argument_inspector_test.rb → todo/argument_inspector_test.rb} +2 -2
- data/test/todo/commands_test.rb +53 -0
- data/test/{console_runner_test.rb → todo/console_test.rb} +17 -15
- data/test/{file_library_test.rb → todo/file_library_test.rb} +0 -0
- data/test/{gem_library_test.rb → todo/gem_library_test.rb} +2 -0
- data/test/{libraries_test.rb → todo/libraries_test.rb} +1 -0
- data/test/{loader_test.rb → todo/loader_test.rb} +2 -0
- data/test/{module_library_test.rb → todo/module_library_test.rb} +2 -0
- data/test/{more_manager_test.rb → todo/more_manager_test.rb} +2 -0
- data/test/{namespacer_test.rb → todo/namespacer_test.rb} +2 -0
- data/test/{runner_options_test.rb → todo/runner_options_test.rb} +10 -1
- data/test/{save_test.rb → todo/save_test.rb} +4 -0
- data/test/web_test.rb +1 -0
- metadata +92 -30
- data/test/commands_test.rb +0 -53
data/.gemspec
CHANGED
@@ -11,12 +11,14 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = "boson2 plugins"
|
12
12
|
s.description = "A collection of boson plugins that can be mixed and matched"
|
13
13
|
s.required_rubygems_version = ">= 1.3.6"
|
14
|
-
s.add_dependency 'boson', '>= 1.
|
15
|
-
s.add_development_dependency 'mocha'
|
14
|
+
s.add_dependency 'boson', '>= 1.2.0'
|
15
|
+
s.add_development_dependency 'mocha', '~> 0.10.4'
|
16
16
|
s.add_development_dependency 'bacon', '>= 1.1.0'
|
17
17
|
s.add_development_dependency 'mocha-on-bacon'
|
18
18
|
s.add_development_dependency 'bacon-bits'
|
19
|
-
s.
|
19
|
+
s.add_development_dependency 'hirb'
|
20
|
+
s.add_development_dependency 'alias'
|
21
|
+
s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec .travis.yml}
|
20
22
|
s.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
21
23
|
s.license = 'MIT'
|
22
24
|
end
|
data/.travis.yml
ADDED
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,8 @@ When using all plugins, you can use boson in irb/ripl by dropping this in ~/.irb
|
|
37
37
|
* boson/save - Allows libraries and commands to be saved and loaded quickly.
|
38
38
|
Necessary for using old boson.
|
39
39
|
* boson/viewable - Adds rendering to commands. Requires hirb.
|
40
|
+
* boson/url\_libraries - Automatically opens all commands under url/ in a browser.
|
41
|
+
Assumes commands generate url strings.Inspired by [queriac](http://github.com/cldwalker/queriac).
|
40
42
|
|
41
43
|
## Features
|
42
44
|
|
@@ -91,7 +93,7 @@ Please report them [on github](http://github.com/cldwalker/boson-more/issues).
|
|
91
93
|
* http://tagaholic.me/2009/10/19/how-boson-enhances-your-irb-experience.html
|
92
94
|
## TODO
|
93
95
|
|
94
|
-
*
|
96
|
+
* Fix todo tests
|
95
97
|
* Clean up plugins and move their files into separates directories
|
96
98
|
* Clean up plugins that unintentionally depend on each other
|
97
99
|
* Clean up docs which are currently strewn across plugins
|
@@ -0,0 +1 @@
|
|
1
|
+
bacon >=1.1.0
|
data/deps.rip
CHANGED
@@ -1 +1 @@
|
|
1
|
-
boson >=1.
|
1
|
+
boson >=1.2.0
|
data/lib/boson/libraries.rb
CHANGED
@@ -171,11 +171,11 @@ module Boson
|
|
171
171
|
module Scientist
|
172
172
|
module Libraries
|
173
173
|
def help_options
|
174
|
-
@global_options[:verbose]
|
174
|
+
{verbose: @global_options[:verbose]}
|
175
175
|
end
|
176
176
|
|
177
177
|
def run_help_option(cmd)
|
178
|
-
Boson.invoke :usage, cmd.full_name
|
178
|
+
Boson.invoke :usage, cmd.full_name, help_options
|
179
179
|
end
|
180
180
|
end
|
181
181
|
extend Libraries
|
data/lib/boson/more/version.rb
CHANGED
data/lib/boson/more_commands.rb
CHANGED
data/lib/boson/science.rb
CHANGED
@@ -2,12 +2,13 @@ require 'boson/view'
|
|
2
2
|
require 'boson/pipe'
|
3
3
|
require 'boson/pipes'
|
4
4
|
require 'boson/more_scientist'
|
5
|
+
require 'boson/save'
|
6
|
+
require 'boson/more_util'
|
5
7
|
|
6
8
|
module Boson
|
7
9
|
class OptionCommand
|
8
10
|
BASIC_OPTIONS.update(
|
9
11
|
:delete_options=>{:type=>:array, :desc=>'Deletes global options starting with given strings' },
|
10
|
-
:usage_options=>{:type=>:string, :desc=>"Render options to pass to usage/help"},
|
11
12
|
:render=> {:type=>:boolean, :desc=>"Toggle a command's default rendering behavior"})
|
12
13
|
PIPE_OPTIONS = {
|
13
14
|
:sort=>{:type=>:string, :desc=>"Sort by given field"},
|
@@ -148,15 +149,6 @@ module Boson
|
|
148
149
|
super
|
149
150
|
@rendered = true if @global_options[:pretend]
|
150
151
|
end
|
151
|
-
|
152
|
-
def help_options
|
153
|
-
super.tap do |opts|
|
154
|
-
if @global_options[:usage_options]
|
155
|
-
opts << "--render_options=#{@global_options[:usage_options]}"
|
156
|
-
end
|
157
|
-
opts
|
158
|
-
end
|
159
|
-
end
|
160
152
|
end
|
161
153
|
extend Render
|
162
154
|
end
|
@@ -267,7 +259,9 @@ module Boson
|
|
267
259
|
SCRAPEABLE_METHODS << :render_options
|
268
260
|
end
|
269
261
|
|
262
|
+
if defined? CommentInspector
|
270
263
|
module CommentInspector
|
271
264
|
EVAL_ATTRIBUTES << :render_options
|
272
265
|
end
|
266
|
+
end
|
273
267
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# depends on browser command
|
2
|
+
require 'boson/save'
|
3
|
+
|
4
|
+
module Boson
|
5
|
+
class Command
|
6
|
+
module UrlLibraries
|
7
|
+
def library_attributes(library)
|
8
|
+
!library.name.include?('url/') ? super :
|
9
|
+
super.update(:render_options=>{:pipes=>{:default=>['browser']}, :render=>true})
|
10
|
+
end
|
11
|
+
end
|
12
|
+
extend UrlLibraries
|
13
|
+
end
|
14
|
+
end
|
data/test/command_test.rb
CHANGED
data/test/deps.rip
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
require 'boson/more_method_inspector'
|
2
3
|
|
3
4
|
describe "MethodInspector" do
|
4
|
-
before_all { MethodInspector.mod_store = {} }
|
5
5
|
describe "commands module with" do
|
6
|
+
before_all { eval "module ::Boson::Commands::Zzz; end" }
|
7
|
+
before_all { MethodInspector.instance = nil }
|
8
|
+
|
9
|
+
def method_inspector
|
10
|
+
MethodInspector.instance
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse(string)
|
14
|
+
Inspector.enable
|
15
|
+
::Boson::Commands::Zzz.module_eval(string)
|
16
|
+
Inspector.disable
|
17
|
+
method_inspector.store
|
18
|
+
end
|
19
|
+
|
6
20
|
it "not all method attributes set causes method_locations to be set" do
|
7
|
-
|
21
|
+
method_inspector.stubs(:find_method_locations).returns(["/some/path", 10])
|
8
22
|
parsed = parse "desc 'yo'; def yo; end; options :yep=>1; def yep; end; " +
|
9
23
|
"option :b, :boolean; config :a=>1; desc 'z'; options :a=>1; def az; end"
|
10
24
|
parsed[:method_locations].key?('yo').should == true
|
@@ -13,7 +27,7 @@ describe "MethodInspector" do
|
|
13
27
|
end
|
14
28
|
|
15
29
|
it "no find_method_locations doesn't set method_locations" do
|
16
|
-
|
30
|
+
method_inspector.stubs(:find_method_locations).returns(nil)
|
17
31
|
parse("def bluh; end")[:method_locations].key?('bluh').should == false
|
18
32
|
end
|
19
33
|
end
|
data/test/more_scientist_test.rb
CHANGED
@@ -1,4 +1,41 @@
|
|
1
|
+
require 'test/test_helper'
|
2
|
+
require 'boson/more_scientist'
|
3
|
+
|
1
4
|
describe "Scientist" do
|
5
|
+
before_all {
|
6
|
+
Boson.in_shell = nil
|
7
|
+
eval <<-EOF
|
8
|
+
module Blah
|
9
|
+
def blah(arg1, options={})
|
10
|
+
[arg1, options]
|
11
|
+
end
|
12
|
+
def splat_blah(*args)
|
13
|
+
args
|
14
|
+
end
|
15
|
+
def default_blah(arg1, arg2=default, options={})
|
16
|
+
[arg1, arg2, options]
|
17
|
+
end
|
18
|
+
def default; 'some default'; end
|
19
|
+
def default_option(options={})
|
20
|
+
options
|
21
|
+
end
|
22
|
+
end
|
23
|
+
EOF
|
24
|
+
@opt_cmd = Object.new.extend Blah
|
25
|
+
}
|
26
|
+
|
27
|
+
def command_with_args(*args)
|
28
|
+
command({:args=>[['arg1'],['options', {}]]}, args)
|
29
|
+
end
|
30
|
+
|
31
|
+
def command(hash, args)
|
32
|
+
hash = {:name=>'blah', :lib=>'bling', :options=>{:force=>:boolean, :level=>2}}.merge(hash)
|
33
|
+
@cmd = Command.new hash
|
34
|
+
@cmd.instance_variable_set("@file_parsed_args", true) if hash[:file_parsed_args]
|
35
|
+
Scientist.redefine_command(@opt_cmd, @cmd)
|
36
|
+
@opt_cmd.send(hash[:name], *args)
|
37
|
+
end
|
38
|
+
|
2
39
|
it "with debug option prints debug" do
|
3
40
|
capture_stdout { command_with_args("-v ok") }.should =~ /Arguments.*ok/
|
4
41
|
end
|
data/test/pipes_test.rb
CHANGED
data/test/repo_index_test.rb
CHANGED
data/test/repo_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'boson/repo'
|
1
2
|
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
3
|
|
3
4
|
describe "config" do
|
@@ -20,4 +21,4 @@ describe "config" do
|
|
20
21
|
@repo.config[:libraries].class.should == Hash
|
21
22
|
end
|
22
23
|
after_all { FileUtils.rm_r File.dirname(__FILE__)+'/config', :force=>true }
|
23
|
-
end
|
24
|
+
end
|
data/test/science_test.rb
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
+
require 'boson'
|
2
|
+
require 'boson/bin_runner'
|
3
|
+
require 'boson/science'
|
4
|
+
require 'test/test_helper'
|
5
|
+
|
1
6
|
describe "BinRunner" do
|
2
|
-
|
3
|
-
|
7
|
+
def start(*args)
|
8
|
+
BinRunner.start(args)
|
4
9
|
end
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
11
|
+
# TODO: fix with commands
|
12
|
+
xdescribe "options" do
|
13
|
+
it "help option and command prints help" do
|
14
|
+
capture_stdout { start('-h', 'commands') }.should =~ /^commands/
|
15
|
+
end
|
16
|
+
|
17
|
+
it "global option takes value with whitespace" do
|
18
|
+
View.expects(:render).with {|*args| args[1][:fields] = %w{f1 f2} }
|
19
|
+
start('commands', '-f', 'f1, f2')
|
20
|
+
end
|
9
21
|
end
|
10
22
|
|
11
23
|
describe "render_output" do
|
@@ -51,7 +63,18 @@ describe "BinRunner" do
|
|
51
63
|
|
52
64
|
end
|
53
65
|
|
66
|
+
__END__
|
67
|
+
# TODO: Fix undefined render_options
|
54
68
|
describe "MethodInspector" do
|
69
|
+
def parse(string)
|
70
|
+
Inspector.enable
|
71
|
+
::Boson::Commands::Zzz.module_eval(string)
|
72
|
+
Inspector.disable
|
73
|
+
method_inspector.store
|
74
|
+
end
|
75
|
+
|
76
|
+
before_all { eval "module ::Boson::Commands::Zzz; end" }
|
77
|
+
|
55
78
|
it "render_options sets render_options" do
|
56
79
|
parse("render_options :z=>true; def zee; end")[:render_options].should == {"zee"=>{:z=>true}}
|
57
80
|
end
|
data/test/scientist_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -4,14 +4,23 @@ require 'mocha'
|
|
4
4
|
require 'mocha-on-bacon'
|
5
5
|
require 'boson'
|
6
6
|
require 'fileutils'
|
7
|
+
|
8
|
+
# hack to allow multiple tests to run so that all Boson::* constants become top-level
|
9
|
+
if ARGV.size > 1
|
10
|
+
require 'boson/bin_runner'
|
11
|
+
require 'boson/more'
|
12
|
+
end
|
7
13
|
Object.send :remove_const, :OptionParser
|
8
14
|
Boson.constants.each {|e| Object.const_set(e, Boson.const_get(e)) unless Object.const_defined?(e) }
|
15
|
+
|
9
16
|
ENV['BOSONRC'] = File.dirname(__FILE__) + '/.bosonrc'
|
10
17
|
ENV['BOSON_HOME'] = File.dirname(__FILE__)
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
Boson.
|
19
|
+
if Boson.respond_to?(:repo)
|
20
|
+
# make local so it doesn't pick up my real boson dir
|
21
|
+
Boson.repo.dir = File.dirname(__FILE__)
|
22
|
+
Boson.instance_variable_set "@repos", [Boson.repo]
|
23
|
+
end
|
15
24
|
|
16
25
|
module TestHelpers
|
17
26
|
def assert_error(error, message=nil)
|
@@ -128,38 +137,6 @@ module TestHelpers
|
|
128
137
|
end
|
129
138
|
|
130
139
|
attr_reader :stderr
|
131
|
-
|
132
|
-
if ENV['RSPEC']
|
133
|
-
def should_not_raise(&block)
|
134
|
-
block.should_not raise_error
|
135
|
-
end
|
136
|
-
else
|
137
|
-
# Since rspec doesn't allow should != or should.not
|
138
|
-
Object.send(:define_method, :should_not) {|*args, &block|
|
139
|
-
should.not(*args, &block)
|
140
|
-
}
|
141
|
-
def should_not_raise(&block)
|
142
|
-
should.not.raise &block
|
143
|
-
end
|
144
|
-
end
|
145
140
|
end
|
146
141
|
|
147
|
-
|
148
|
-
module RspecBits
|
149
|
-
def before_all(&block)
|
150
|
-
before(:all, &block)
|
151
|
-
end
|
152
|
-
|
153
|
-
def after_all(&block)
|
154
|
-
after(:all, &block)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
RSpec.configure {|c|
|
159
|
-
c.mock_with :mocha
|
160
|
-
c.extend RspecBits
|
161
|
-
c.include TestHelpers
|
162
|
-
}
|
163
|
-
else
|
164
|
-
Bacon::Context.send :include, TestHelpers
|
165
|
-
end
|
142
|
+
Bacon::Context.send :include, TestHelpers
|
@@ -1,9 +1,12 @@
|
|
1
|
+
require 'boson/alias'
|
2
|
+
require 'test/test_helper'
|
3
|
+
|
1
4
|
# Add library_loaded? and with_config
|
2
5
|
describe "Manager" do
|
3
6
|
def load_library(hash)
|
4
7
|
new_attributes = {:name=>hash[:name], :commands=>[], :created_dependencies=>[], :loaded=>true}
|
5
8
|
[:module, :commands].each {|e| new_attributes[e] = hash.delete(e) if hash[e] }
|
6
|
-
Manager.expects(:call_load_action).returns(Library.new(new_attributes))
|
9
|
+
Manager.instance.expects(:call_load_action).returns(Library.new(new_attributes))
|
7
10
|
Manager.load([hash[:name]])
|
8
11
|
end
|
9
12
|
|
@@ -15,7 +18,7 @@ describe "Manager" do
|
|
15
18
|
|
16
19
|
it "created with command specific config" do
|
17
20
|
with_config(:command_aliases=>{'frylock'=>'fr'}) do
|
18
|
-
Manager.expects(:create_instance_aliases).with({"Aquateen"=>{"frylock"=>"fr"}})
|
21
|
+
Manager.instance.expects(:create_instance_aliases).with({"Aquateen"=>{"frylock"=>"fr"}})
|
19
22
|
load_library :name=>'aquateen', :commands=>['frylock'], :module=>Aquateen
|
20
23
|
library_loaded? 'aquateen'
|
21
24
|
end
|
@@ -23,7 +26,7 @@ describe "Manager" do
|
|
23
26
|
|
24
27
|
it "created with config command_aliases" do
|
25
28
|
with_config(:command_aliases=>{"frylock"=>"fr"}) do
|
26
|
-
Manager.expects(:create_instance_aliases).with({"Aquateen"=>{"frylock"=>"fr"}})
|
29
|
+
Manager.instance.expects(:create_instance_aliases).with({"Aquateen"=>{"frylock"=>"fr"}})
|
27
30
|
load_library :name=>'aquateen', :commands=>['frylock'], :module=>Aquateen
|
28
31
|
library_loaded? 'aquateen'
|
29
32
|
end
|
@@ -7,11 +7,11 @@ describe "scrape_with_eval" do
|
|
7
7
|
Inspector.enable
|
8
8
|
::Boson::Commands::Aaa.module_eval(string)
|
9
9
|
Inspector.disable
|
10
|
-
MethodInspector.store[:args]['blah']
|
10
|
+
MethodInspector.instance.store[:args]['blah']
|
11
11
|
end
|
12
12
|
|
13
13
|
before_all { eval "module ::Boson::Commands::Aaa; end"; }
|
14
|
-
before { MethodInspector.
|
14
|
+
before { MethodInspector.instance = nil }
|
15
15
|
|
16
16
|
it "determines arguments with literal defaults" do
|
17
17
|
args_from("def blah(arg1,arg2='val2'); end").should == [['arg1'], ['arg2','val2']]
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
require 'boson/more_commands'
|
3
|
+
require 'boson/view'
|
4
|
+
|
5
|
+
describe "commands" do
|
6
|
+
before_all do
|
7
|
+
@higgs = Boson.main_object
|
8
|
+
if Boson.libraries.size.zero?
|
9
|
+
reset_boson
|
10
|
+
ancestors = class <<Boson.main_object; self end.ancestors
|
11
|
+
# allows running just this test file
|
12
|
+
Manager.load BareRunner.default_libraries unless ancestors.include?(Boson::Commands::Core)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def render_expects(&block)
|
17
|
+
Boson::View.expects(:render).with(&block)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "libraries" do
|
21
|
+
before_all {
|
22
|
+
Boson.libraries << Boson::Library.new(:name=>'blah')
|
23
|
+
Boson.libraries << Boson::Library.new(:name=>'another', :module=>"Cool")
|
24
|
+
}
|
25
|
+
|
26
|
+
it "lists all when given no argument" do
|
27
|
+
render_expects {|*args| args[0].size == Boson.libraries.size }
|
28
|
+
@higgs.libraries
|
29
|
+
end
|
30
|
+
|
31
|
+
it "searches with a given search field" do
|
32
|
+
render_expects {|*args| args[0] == [Boson.library('another')]}
|
33
|
+
@higgs.libraries('Cool', :query_fields=>[:module])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "commands" do
|
38
|
+
before_all {
|
39
|
+
Boson.commands << Command.create('some', Library.new(:name=>'thing'))
|
40
|
+
Boson.commands << Command.create('and', Library.new(:name=>'this'))
|
41
|
+
}
|
42
|
+
|
43
|
+
it "lists all when given no argument" do
|
44
|
+
render_expects {|*args| args[0].size == Boson.commands.size }
|
45
|
+
@higgs.commands
|
46
|
+
end
|
47
|
+
|
48
|
+
it "searches with a given search field" do
|
49
|
+
render_expects {|*args| args[0] == [Command.find('and')]}
|
50
|
+
@higgs.commands('this', :query_fields=>[:lib])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'boson/console'
|
1
2
|
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
3
|
|
4
|
+
# TODO: fix default_libraries picking up local defaults
|
3
5
|
describe "repl_runner" do
|
4
6
|
def start(hash={})
|
5
|
-
Hirb.stubs(:enable)
|
6
7
|
Boson.start(hash.merge(:verbose=>false))
|
7
8
|
end
|
8
9
|
|
@@ -37,22 +38,23 @@ describe "repl_runner" do
|
|
37
38
|
Boson.main_object.blah
|
38
39
|
end
|
39
40
|
after_all { FileUtils.rm_r File.dirname(__FILE__)+'/config', :force=>true }
|
40
|
-
end
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
# TODO: fix
|
43
|
+
xdescribe "console options" do
|
44
|
+
before_all { reset }
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
it "console option starts irb" do
|
47
|
+
ConsoleRunner.expects(:start)
|
48
|
+
Util.expects(:which).returns("/usr/bin/irb")
|
49
|
+
ConsoleRunner.expects(:load_repl).with("/usr/bin/irb")
|
50
|
+
start("--console")
|
51
|
+
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
it "console option but no irb found prints error" do
|
54
|
+
ConsoleRunner.expects(:start)
|
55
|
+
Util.expects(:which).returns(nil)
|
56
|
+
ConsoleRunner.expects(:abort).with {|arg| arg[/Console not found/] }
|
57
|
+
start '--console'
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
File without changes
|
@@ -1,7 +1,16 @@
|
|
1
|
+
require 'boson'
|
2
|
+
require 'boson/bin_runner'
|
3
|
+
require 'test/test_helper'
|
4
|
+
|
1
5
|
describe "BinRunner" do
|
2
6
|
describe "at commandline" do
|
7
|
+
def aborts_with(regex)
|
8
|
+
BinRunner.expects(:abort).with {|e| e[regex] }
|
9
|
+
yield
|
10
|
+
end
|
11
|
+
|
3
12
|
def start(*args)
|
4
|
-
Hirb.stubs(:enable)
|
13
|
+
# Hirb.stubs(:enable)
|
5
14
|
BinRunner.start(args)
|
6
15
|
end
|
7
16
|
|
data/test/web_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boson-more
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,43 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: boson
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.2.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: mocha
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
|
-
- -
|
35
|
+
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
37
|
+
version: 0.10.4
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.10.4
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bacon
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 1.1.0
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: mocha-on-bacon
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: bacon-bits
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,7 +85,44 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: hirb
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: alias
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
69
126
|
description: A collection of boson plugins that can be mixed and matched
|
70
127
|
email: gabriel.horner@gmail.com
|
71
128
|
executables: []
|
@@ -108,38 +165,44 @@ files:
|
|
108
165
|
- lib/boson/runner_options.rb
|
109
166
|
- lib/boson/save.rb
|
110
167
|
- lib/boson/science.rb
|
168
|
+
- lib/boson/url_libraries.rb
|
111
169
|
- lib/boson/view.rb
|
112
170
|
- lib/boson/viewable.rb
|
113
|
-
- test/alias_test.rb
|
114
|
-
- test/argument_inspector_test.rb
|
115
171
|
- test/command_test.rb
|
116
|
-
- test/commands_test.rb
|
117
172
|
- test/comment_inspector_test.rb
|
118
|
-
- test/console_runner_test.rb
|
119
|
-
- test/file_library_test.rb
|
120
|
-
- test/gem_library_test.rb
|
121
|
-
- test/libraries_test.rb
|
122
|
-
- test/loader_test.rb
|
123
|
-
- test/module_library_test.rb
|
124
|
-
- test/more_manager_test.rb
|
125
173
|
- test/more_method_inspector_test.rb
|
126
174
|
- test/more_scientist_test.rb
|
127
|
-
- test/namespacer_test.rb
|
128
175
|
- test/pipes_test.rb
|
129
176
|
- test/repo_index_test.rb
|
130
177
|
- test/repo_test.rb
|
131
|
-
- test/runner_options_test.rb
|
132
|
-
- test/save_test.rb
|
133
178
|
- test/science_test.rb
|
134
179
|
- test/scientist_test.rb
|
135
180
|
- test/test_helper.rb
|
181
|
+
- test/todo/alias_test.rb
|
182
|
+
- test/todo/argument_inspector_test.rb
|
183
|
+
- test/todo/commands_test.rb
|
184
|
+
- test/todo/console_test.rb
|
185
|
+
- test/todo/file_library_test.rb
|
186
|
+
- test/todo/gem_library_test.rb
|
187
|
+
- test/todo/libraries_test.rb
|
188
|
+
- test/todo/loader_test.rb
|
189
|
+
- test/todo/module_library_test.rb
|
190
|
+
- test/todo/more_manager_test.rb
|
191
|
+
- test/todo/namespacer_test.rb
|
192
|
+
- test/todo/runner_options_test.rb
|
193
|
+
- test/todo/save_test.rb
|
136
194
|
- test/web_test.rb
|
137
195
|
- LICENSE.txt
|
138
196
|
- CHANGELOG.rdoc
|
197
|
+
- bundle/ruby/1.9.1/gems/alias-0.2.3/test/deps.rip
|
198
|
+
- bundle/ruby/1.9.1/gems/bacon-bits-0.1.0/deps.rip
|
199
|
+
- bundle/ruby/1.9.1/gems/boson-1.2.0/test/deps.rip
|
200
|
+
- bundle/ruby/1.9.1/gems/hirb-0.6.2/test/deps.rip
|
139
201
|
- deps.rip
|
140
202
|
- test/deps.rip
|
141
203
|
- Rakefile
|
142
204
|
- .gemspec
|
205
|
+
- .travis.yml
|
143
206
|
- README.md
|
144
207
|
homepage: http://github.com/cldwalker/boson-more
|
145
208
|
licenses:
|
@@ -162,9 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
225
|
version: 1.3.6
|
163
226
|
requirements: []
|
164
227
|
rubyforge_project:
|
165
|
-
rubygems_version: 1.8.
|
228
|
+
rubygems_version: 1.8.19
|
166
229
|
signing_key:
|
167
230
|
specification_version: 3
|
168
231
|
summary: boson2 plugins
|
169
232
|
test_files: []
|
170
|
-
has_rdoc:
|
data/test/commands_test.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
-
|
3
|
-
module Boson
|
4
|
-
class CommandsTest < Test::Unit::TestCase
|
5
|
-
before(:all) {
|
6
|
-
@higgs = Boson.main_object
|
7
|
-
if Boson.libraries.size.zero?
|
8
|
-
reset_boson
|
9
|
-
ancestors = class <<Boson.main_object; self end.ancestors
|
10
|
-
# allows running just this test file
|
11
|
-
Manager.load Runner.default_libraries unless ancestors.include?(Boson::Commands::Core)
|
12
|
-
end
|
13
|
-
}
|
14
|
-
|
15
|
-
def render_expects(&block)
|
16
|
-
View.expects(:render).with(&block)
|
17
|
-
end
|
18
|
-
|
19
|
-
context "libraries" do
|
20
|
-
before(:all) {
|
21
|
-
Boson.libraries << Boson::Library.new(:name=>'blah')
|
22
|
-
Boson.libraries << Boson::Library.new(:name=>'another', :module=>"Cool")
|
23
|
-
}
|
24
|
-
|
25
|
-
test "lists all when given no argument" do
|
26
|
-
render_expects {|*args| args[0].size == Boson.libraries.size }
|
27
|
-
@higgs.libraries
|
28
|
-
end
|
29
|
-
|
30
|
-
test "searches with a given search field" do
|
31
|
-
render_expects {|*args| args[0] == [Boson.library('another')]}
|
32
|
-
@higgs.libraries('Cool', :query_fields=>[:module])
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "commands" do
|
37
|
-
before(:all) {
|
38
|
-
Boson.commands << Command.create('some', Library.new(:name=>'thing'))
|
39
|
-
Boson.commands << Command.create('and', Library.new(:name=>'this'))
|
40
|
-
}
|
41
|
-
|
42
|
-
test "lists all when given no argument" do
|
43
|
-
render_expects {|*args| args[0].size == Boson.commands.size }
|
44
|
-
@higgs.commands
|
45
|
-
end
|
46
|
-
|
47
|
-
test "searches with a given search field" do
|
48
|
-
render_expects {|*args| args[0] == [Command.find('and')]}
|
49
|
-
@higgs.commands('this', :query_fields=>[:lib])
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|