boson 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_helper.rb CHANGED
@@ -1,24 +1,13 @@
1
- require 'rubygems'
2
1
  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
17
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'bacon'
3
+ require File.dirname(__FILE__)+'/bacon_extensions'
4
+ require 'mocha'
5
+ require 'mocha-on-bacon'
18
6
  require 'boson'
19
- require 'test_benchmark' if ENV['BENCHMARK']
7
+ Object.send :remove_const, :OptionParser
8
+ Boson.constants.each {|e| Object.const_set(e, Boson.const_get(e)) unless Object.const_defined?(e) }
20
9
 
21
- class Test::Unit::TestCase
10
+ module TestHelpers
22
11
  # make local so it doesn't pick up my real boson dir
23
12
  Boson.repo.dir = File.dirname(__FILE__)
24
13
  # prevent extra File.exists? calls which interfere with stubs for it
@@ -42,7 +31,7 @@ class Test::Unit::TestCase
42
31
  def reset_main_object
43
32
  Boson.send :remove_const, "Universe"
44
33
  eval "module ::Boson::Universe; include ::Boson::Commands::Namespace; end"
45
- Boson::Commands.send :remove_const, "Blah" if Boson::Commands.const_defined?("Blah")
34
+ Commands.send :remove_const, "Blah" if Commands.const_defined?("Blah")
46
35
  Boson.main_object = Object.new
47
36
  end
48
37
 
@@ -56,11 +45,11 @@ class Test::Unit::TestCase
56
45
  end
57
46
 
58
47
  def command_exists?(name, bool=true)
59
- (!!Boson::Command.find(name)).should == bool
48
+ (!!Command.find(name)).should == bool
60
49
  end
61
50
 
62
51
  def library_loaded?(name, bool=true)
63
- Boson::Manager.loaded?(name).should == bool
52
+ Manager.loaded?(name).should == bool
64
53
  end
65
54
 
66
55
  def library(name)
@@ -68,7 +57,7 @@ class Test::Unit::TestCase
68
57
  end
69
58
 
70
59
  def library_has_module(lib, lib_module)
71
- Boson::Manager.loaded?(lib).should == true
60
+ Manager.loaded?(lib).should == true
72
61
  test_lib = library(lib)
73
62
  (test_lib.module.is_a?(Module) && (test_lib.module.to_s == lib_module)).should == true
74
63
  end
@@ -80,17 +69,17 @@ class Test::Unit::TestCase
80
69
  # mocks as a file library
81
70
  def mock_library(lib, options={})
82
71
  options = {:file_string=>'', :exists=>true}.merge!(options)
83
- File.expects(:exists?).with(Boson::FileLibrary.library_file(lib.to_s, Boson.repo.dir)).
72
+ File.expects(:exists?).with(FileLibrary.library_file(lib.to_s, Boson.repo.dir)).
84
73
  at_least(1).returns(options.delete(:exists))
85
74
  File.expects(:read).returns(options.delete(:file_string))
86
75
  end
87
76
 
88
77
  def load(lib, options={})
89
78
  # prevent conflicts with existing File.read stubs
90
- Boson::MethodInspector.stubs(:inspector_in_file?).returns(false)
79
+ MethodInspector.stubs(:inspector_in_file?).returns(false)
91
80
  mock_library(lib, options) unless options.delete(:no_mock)
92
- result = Boson::Manager.load([lib], options)
93
- Boson::FileLibrary.reset_file_cache
81
+ result = Manager.load([lib], options)
82
+ FileLibrary.reset_file_cache
94
83
  result
95
84
  end
96
85
 
@@ -126,19 +115,13 @@ class Test::Unit::TestCase
126
115
  def create_library(libraries, attributes={})
127
116
  libraries = [libraries] unless libraries.is_a?(Array)
128
117
  libraries.map {|e|
129
- lib = Boson::Library.new({:name=>e}.update(attributes))
130
- Boson::Manager.add_library(lib); lib
118
+ lib = Library.new({:name=>e}.update(attributes))
119
+ Manager.add_library(lib); lib
131
120
  }
132
121
  end
122
+ end
133
123
 
134
- module OptionTestHelper
135
- def create(opts)
136
- @opt = Boson::OptionParser.new(opts)
137
- end
138
-
139
- def parse(*args)
140
- @non_opts = []
141
- @opt.parse(args.flatten)
142
- end
143
- end
124
+ class Bacon::Context
125
+ include TestHelpers
126
+ include BaconExtensions
144
127
  end
data/test/util_test.rb CHANGED
@@ -1,58 +1,56 @@
1
1
  require File.join(File.dirname(__FILE__), 'test_helper')
2
2
 
3
- module Boson
4
- class UtilTest < Test::Unit::TestCase
5
- test "underscore converts camelcase to underscore" do
6
- Util.underscore('Boson::MethodInspector').should == 'boson/method_inspector'
7
- end
3
+ describe "Util" do
4
+ it "underscore converts camelcase to underscore" do
5
+ Util.underscore('Boson::MethodInspector').should == 'boson/method_inspector'
6
+ end
8
7
 
9
- test "constantize converts string to class" do
10
- Util.constantize("Boson").should == ::Boson
11
- end
8
+ it "constantize converts string to class" do
9
+ Util.constantize("Boson").should == ::Boson
10
+ end
12
11
 
13
- context "underscore_search" do
14
- def search(query, list)
15
- Util.underscore_search(query, list).sort {|a,b| a.to_s <=> b.to_s }
16
- end
12
+ describe "underscore_search" do
13
+ def search(query, list)
14
+ Util.underscore_search(query, list).sort {|a,b| a.to_s <=> b.to_s }
15
+ end
17
16
 
18
- def first_search(query, list)
19
- Util.underscore_search(query, list, true)
20
- end
17
+ def first_search(query, list)
18
+ Util.underscore_search(query, list, true)
19
+ end
21
20
 
22
- test "matches non underscore strings" do
23
- search('som', %w{some words match sometimes}).should == %w{some sometimes}
24
- end
21
+ it "matches non underscore strings" do
22
+ search('som', %w{some words match sometimes}).should == %w{some sometimes}
23
+ end
25
24
 
26
- test "matches first non underscore string" do
27
- first_search('wo', %w{some work wobbles}).should == 'work'
28
- end
25
+ it "matches first non underscore string" do
26
+ first_search('wo', %w{some work wobbles}).should == 'work'
27
+ end
29
28
 
30
- test "matches non underscore symbols" do
31
- search(:som, [:some, :words, :match, :sometimes]).should == [:some, :sometimes]
32
- search('som', [:some, :words, :match, :sometimes]).should == [:some, :sometimes]
33
- end
29
+ it "matches non underscore symbols" do
30
+ search(:som, [:some, :words, :match, :sometimes]).should == [:some, :sometimes]
31
+ search('som', [:some, :words, :match, :sometimes]).should == [:some, :sometimes]
32
+ end
34
33
 
35
- test "matches underscore strings" do
36
- search('s_l', %w{some_long some_short some_lame}).should == %w{some_lame some_long}
37
- end
34
+ it "matches underscore strings" do
35
+ search('s_l', %w{some_long some_short some_lame}).should == %w{some_lame some_long}
36
+ end
38
37
 
39
- test "matches first underscore string" do
40
- first_search('s_l', %w{some_long some_short some_lame}).should == 'some_long'
41
- end
38
+ it "matches first underscore string" do
39
+ first_search('s_l', %w{some_long some_short some_lame}).should == 'some_long'
40
+ end
42
41
 
43
- test "matches underscore symbols" do
44
- search(:s_l, [:some_long, :some_short, :some_lame]).should == [:some_lame, :some_long]
45
- search('s_l', [:some_long, :some_short, :some_lame]).should == [:some_lame, :some_long]
46
- end
42
+ it "matches underscore symbols" do
43
+ search(:s_l, [:some_long, :some_short, :some_lame]).should == [:some_lame, :some_long]
44
+ search('s_l', [:some_long, :some_short, :some_lame]).should == [:some_lame, :some_long]
45
+ end
47
46
 
48
- test "matches full underscore string" do
49
- search('some_long_name', %w{some_long_name some_short some_lame}).should == %w{some_long_name}
50
- end
47
+ it "matches full underscore string" do
48
+ search('some_long_name', %w{some_long_name some_short some_lame}).should == %w{some_long_name}
49
+ end
51
50
 
52
- test "only matches exact match if multiple matches that start with exact match" do
53
- search('bl', %w{bl blang bling}).should == ['bl']
54
- first_search('bl', %w{bl blang bling}).should == 'bl'
55
- end
51
+ it "only matches exact match if multiple matches that start with exact match" do
52
+ search('bl', %w{bl blang bling}).should == ['bl']
53
+ first_search('bl', %w{bl blang bling}).should == 'bl'
56
54
  end
57
55
  end
58
56
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 4
9
+ version: 0.2.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - Gabriel Horner
@@ -9,49 +14,53 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-16 00:00:00 -05:00
13
- default_executable: boson
17
+ date: 2010-05-25 00:00:00 -04:00
18
+ default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: hirb
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 2
31
+ - 10
23
32
  version: 0.2.10
24
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: alias
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ">="
32
42
  - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
45
+ - 2
46
+ - 1
33
47
  version: 0.2.1
34
- version:
35
- description: A command/task framework similar to rake and thor that opens your ruby universe to the commandline and irb.
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ description: 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.
36
51
  email: gabriel.horner@gmail.com
37
- executables:
38
- - boson
52
+ executables: []
53
+
39
54
  extensions: []
40
55
 
41
56
  extra_rdoc_files:
42
- - LICENSE.txt
43
57
  - README.rdoc
44
- files:
45
58
  - LICENSE.txt
46
- - README.rdoc
47
- - Rakefile
48
- - VERSION.yml
49
- - bin/boson
50
- - lib/boson.rb
59
+ files:
51
60
  - lib/boson/command.rb
52
- - lib/boson/commands.rb
53
61
  - lib/boson/commands/core.rb
54
62
  - lib/boson/commands/web_core.rb
63
+ - lib/boson/commands.rb
55
64
  - lib/boson/index.rb
56
65
  - lib/boson/inspector.rb
57
66
  - lib/boson/inspectors/argument_inspector.rb
@@ -78,8 +87,11 @@ files:
78
87
  - lib/boson/runners/console_runner.rb
79
88
  - lib/boson/scientist.rb
80
89
  - lib/boson/util.rb
90
+ - lib/boson/version.rb
81
91
  - lib/boson/view.rb
92
+ - lib/boson.rb
82
93
  - test/argument_inspector_test.rb
94
+ - test/bacon_extensions.rb
83
95
  - test/bin_runner_test.rb
84
96
  - test/comment_inspector_test.rb
85
97
  - test/file_library_test.rb
@@ -95,48 +107,45 @@ files:
95
107
  - test/scientist_test.rb
96
108
  - test/test_helper.rb
97
109
  - test/util_test.rb
110
+ - bin/boson
111
+ - LICENSE.txt
112
+ - CHANGELOG.rdoc
113
+ - README.rdoc
114
+ - Rakefile
115
+ - gemspec
98
116
  has_rdoc: true
99
117
  homepage: http://tagaholic.me/boson/
100
118
  licenses: []
101
119
 
102
120
  post_install_message:
103
- rdoc_options:
104
- - --charset=UTF-8
121
+ rdoc_options: []
122
+
105
123
  require_paths:
106
124
  - lib
107
125
  required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
108
127
  requirements:
109
128
  - - ">="
110
129
  - !ruby/object:Gem::Version
130
+ segments:
131
+ - 0
111
132
  version: "0"
112
- version:
113
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
+ none: false
114
135
  requirements:
115
136
  - - ">="
116
137
  - !ruby/object:Gem::Version
117
- version: "0"
118
- version:
138
+ segments:
139
+ - 1
140
+ - 3
141
+ - 6
142
+ version: 1.3.6
119
143
  requirements: []
120
144
 
121
145
  rubyforge_project: tagaholic
122
- rubygems_version: 1.3.5
146
+ rubygems_version: 1.3.7
123
147
  signing_key:
124
148
  specification_version: 3
125
- 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.
126
- test_files:
127
- - test/argument_inspector_test.rb
128
- - test/bin_runner_test.rb
129
- - test/comment_inspector_test.rb
130
- - test/file_library_test.rb
131
- - test/loader_test.rb
132
- - test/manager_test.rb
133
- - test/method_inspector_test.rb
134
- - test/option_parser_test.rb
135
- - test/options_test.rb
136
- - test/pipes_test.rb
137
- - test/repo_index_test.rb
138
- - test/repo_test.rb
139
- - test/runner_test.rb
140
- - test/scientist_test.rb
141
- - test/test_helper.rb
142
- - test/util_test.rb
149
+ summary: A command/task framework similar to rake and thor that opens your ruby universe to the commandline and irb.
150
+ test_files: []
151
+
data/VERSION.yml DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- :minor: 2
3
- :patch: 3
4
- :build:
5
- :major: 0