boson 0.3.0 → 0.3.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.
@@ -1,3 +1,9 @@
1
+ == 0.3.1
2
+ * Fixed MethodInspector handling anonymous classes on 1.9.2 (#16)
3
+ * Fixed get and install commands on 1.9.2 (#17)
4
+ * Fixed failed loading of Bosonfile
5
+ * Fixed RequireLibrary indicating correct load status
6
+
1
7
  == 0.3.0
2
8
  * Added --debug to executable with multiple debug hooks
3
9
  * Added --ruby_debug and -I to executable to change $LOAD_PATH and $DEBUG
@@ -28,8 +28,8 @@ module Boson::Commands::WebCore
28
28
  end
29
29
  end
30
30
 
31
- def_which_requires(:get, 'uri', 'net/http') do |url, options|
32
- options ||= {}
31
+ def_which_requires(:get, 'uri', 'net/http') do |*args|
32
+ url, options = args[0], args[1] || {}
33
33
  url = build_url(url, options[:params]) if options[:params]
34
34
  Get.new(url).request(options)
35
35
  end
@@ -41,8 +41,8 @@ module Boson::Commands::WebCore
41
41
  }.join("&")
42
42
  end
43
43
 
44
- def_which_requires(:post, 'uri', 'net/http') do |url, options|
45
- options ||= {}
44
+ def_which_requires(:post, 'uri', 'net/http') do |*args|
45
+ url, options = args[0], args[1] || {}
46
46
  (res = Net::HTTP.post_form(URI.parse(url), options)) && res.body
47
47
  end
48
48
 
@@ -52,7 +52,7 @@ module Boson::Commands::WebCore
52
52
  filename = File.join ::Boson.repo.commands_dir, "#{options[:name]}.rb"
53
53
  return puts("Library name #{options[:name]} already exists. Try a different name.") if File.exists?(filename) && !options[:force]
54
54
 
55
- file_string = get(url)
55
+ file_string = get(url) or raise "Unable to fetch url"
56
56
  file_string = "# Originally from #{url}\n"+file_string
57
57
  file_string = wrap_install(file_string, options) if options[:method_wrap] || options[:module_wrap]
58
58
 
@@ -143,4 +143,4 @@ module Boson::Commands::WebCore
143
143
  nil
144
144
  end
145
145
  end
146
- end
146
+ end
@@ -4,8 +4,7 @@ module Boson
4
4
  # can scrape their commented method attributes.
5
5
  module MethodInspector
6
6
  extend self
7
- attr_accessor :current_module
8
- attr_reader :mod_store
7
+ attr_accessor :current_module, :mod_store
9
8
  @mod_store ||= {}
10
9
  METHODS = [:config, :desc, :options, :render_options]
11
10
  METHOD_CLASSES = {:config=>Hash, :desc=>String, :options=>Hash, :render_options=>Hash}
@@ -13,7 +12,7 @@ module Boson
13
12
 
14
13
  # The method_added used while scraping method attributes.
15
14
  def new_method_added(mod, meth)
16
- return unless mod.name[/^Boson::Commands::/]
15
+ return unless mod.to_s[/^Boson::Commands::/]
17
16
  self.current_module = mod
18
17
  store[:temp] ||= {}
19
18
  METHODS.each do |e|
@@ -96,4 +95,4 @@ module Boson
96
95
  end
97
96
  #:startdoc:
98
97
  end
99
- end
98
+ end
@@ -12,8 +12,12 @@ class Boson::RequireLibrary < Boson::GemLibrary
12
12
  EXTENSIONS = ['', '.rb', '.rbw', '.so', '.bundle', '.dll', '.sl', '.jar']
13
13
  handles {|source|
14
14
  extensions_glob = "{#{EXTENSIONS.join(',')}}"
15
- $LOAD_PATH.any? {|dir|
15
+ ($LOAD_PATH - ['.']).any? {|dir|
16
16
  Dir["#{File.expand_path source.to_s, dir}#{extensions_glob}"].size > 0
17
17
  }
18
18
  }
19
- end
19
+
20
+ def loaded_correctly?
21
+ super || $".grep(/^#{@name}\.([a-z]+)?$/).size > 0
22
+ end
23
+ end
@@ -64,13 +64,14 @@ module Boson
64
64
  rescue_load_action(source, :load) do
65
65
  lib = loader_create(source)
66
66
  if loaded?(lib.name)
67
- $stderr.puts "Library #{lib.name} already exists" if options[:verbose] && !options[:dependency]
67
+ $stderr.puts "Library #{lib.name} already exists." if options[:verbose] && !options[:dependency]
68
68
  false
69
69
  else
70
70
  if lib.load { load_dependencies(lib, options) }
71
71
  lib
72
72
  else
73
- $stderr.puts "Unable to load library #{lib.name}." if !options[:dependency]
73
+ $stderr.puts "Library #{lib.name} did not load successfully." if !options[:dependency]
74
+ $stderr.puts " "+lib.inspect if Runner.debug
74
75
  false
75
76
  end
76
77
  end
@@ -165,4 +166,4 @@ module Boson
165
166
  #:startdoc:
166
167
  end
167
168
  end
168
- end
169
+ end
@@ -179,4 +179,4 @@ module Boson
179
179
  end
180
180
  #:startdoc:
181
181
  end
182
- end
182
+ end
@@ -1,3 +1,3 @@
1
1
  module Boson
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe "WebCore" do
4
+ it "#get with no options" do
5
+ request = mock { expects(:request).with({}) }
6
+ Commands::WebCore::Get.expects(:new).with('blah.com').returns(request)
7
+ Commands::WebCore.get 'blah.com'
8
+ end
9
+
10
+ it "#post with no options" do
11
+ Net::HTTP.expects(:post_form).with(anything, {}).returns(nil)
12
+ Commands::WebCore.post 'blah.com'
13
+ end
14
+
15
+ it "#build_url with string params" do
16
+ Commands::WebCore.build_url('ababd.com', :q=>'search').should == 'ababd.com?q=search'
17
+ end
18
+
19
+ it "#build_url with array params" do
20
+ Commands::WebCore.build_url('ababd.com', :q=>%w{multi word search}).should == 'ababd.com?q=multi+word+search'
21
+ end
22
+ end
@@ -189,7 +189,7 @@ describe "Loader" do
189
189
  end
190
190
 
191
191
  it "prints error when nonexistent" do
192
- capture_stderr { load('blah') }.should =~ /Unable.*load/
192
+ capture_stderr { load('blah') }.should =~ /Library blah did not/
193
193
  end
194
194
 
195
195
  it "with invalid module prints error" do
@@ -11,6 +11,14 @@ describe "MethodInspector" do
11
11
  MethodInspector.store[:options].empty?.should == true
12
12
  end
13
13
 
14
+ it "handles anonymous classes" do
15
+ MethodInspector.mod_store = {}
16
+ Inspector.enable
17
+ Class.new.module_eval "def blah; end"
18
+ Inspector.disable
19
+ MethodInspector.store.should == nil
20
+ end
21
+
14
22
  describe "commands module with" do
15
23
  def parse(string)
16
24
  Inspector.enable
@@ -79,4 +87,4 @@ describe "MethodInspector" do
79
87
  parse("desc 'desc'; def doz(arg1); end")[:args]['doz'].should == [['arg1']]
80
88
  end
81
89
  end
82
- end
90
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boson
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabriel Horner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-13 00:00:00 -04:00
18
+ date: 2010-09-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -154,6 +154,7 @@ files:
154
154
  - test/argument_inspector_test.rb
155
155
  - test/bin_runner_test.rb
156
156
  - test/command_test.rb
157
+ - test/commands_test.rb
157
158
  - test/comment_inspector_test.rb
158
159
  - test/file_library_test.rb
159
160
  - test/loader_test.rb