ronin-support 0.1.0.rc3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.1.0 / 2011-03-15
1
+ ### 0.1.0 / 2011-03-20
2
2
 
3
3
  * Initial release:
4
4
  * Split out of [ronin](http://github.com/ronin-ruby/ronin) 0.3.0.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  * [Source](http://github.com/ronin-ruby/ronin-support)
4
4
  * [Issues](http://github.com/ronin-ruby/ronin-support/issues)
5
- * [Documentation](http://rubydoc.info/github/ronin-ruby/ronin-support/frames)
5
+ * [Documentation](http://rubydoc.info/gems/ronin-support/frames)
6
6
  * [Mailing List](http://groups.google.com/group/ronin-ruby)
7
7
  * irc.freenode.net #ronin
8
8
 
@@ -19,34 +19,75 @@
19
19
 
20
20
  module Ronin
21
21
  module Support
22
- inflectors = [
23
- {
22
+ # The Inflectors supported by ronin-support
23
+ INFLECTORS = {
24
+ :datamapper => {
24
25
  :path => 'dm-core/support/inflector',
25
26
  :const => 'DataMapper::Inflector'
26
27
  },
27
- {
28
+ :active_support => {
28
29
  :path => 'active_support/inflector',
29
30
  :const => 'ActiveSupport::Inflector'
30
31
  },
31
- {
32
+ :extlib => {
32
33
  :path => 'extlib/inflection',
33
34
  :const => 'Extlib::Inflection'
34
35
  }
35
- ]
36
- inflector_const = 'Inflector'
36
+ }
37
+
38
+ #
39
+ # Loads an Inflector library and sets the `Ronin::Support::Inflector`
40
+ # constant.
41
+ #
42
+ # @param [Symbol, String] name
43
+ # The name of the Inflector library to load. May be either
44
+ # `:datamapper`, `:active_support` or `:extlib`.
45
+ #
46
+ # @return [true]
47
+ # Specifies that the Inflector library was successfully loaded.
48
+ #
49
+ # @raise [ArgumentError]
50
+ # The Inflector library is not supported.
51
+ #
52
+ # @raise [LoadError]
53
+ # The Inflector library could not be loaded.
54
+ #
55
+ # @raise [NameError]
56
+ # The constant could not be found.
57
+ #
58
+ def Support.load_inflector!(name)
59
+ name = name.to_sym
60
+
61
+ unless (inflector = INFLECTORS[name])
62
+ raise(ArgumentError,"unsupported Inflector: #{name}")
63
+ end
37
64
 
38
- inflectors.each do |inflector|
39
65
  begin
40
66
  require inflector[:path]
41
- rescue LoadError
42
- next
67
+ rescue Gem::LoadError => e
68
+ raise(e)
69
+ rescue ::LoadError
70
+ raise(LoadError,"unable to load #{inflector[:path]}")
71
+ end
72
+
73
+ begin
74
+ const_set('Inflector', eval("::#{inflector[:const]}"))
75
+ rescue NameError
76
+ raise(NameError,"unable to find #{inflector[:const]}")
43
77
  end
44
78
 
45
- const_set(inflector_const, eval("::#{inflector[:const]}"))
46
- break
79
+ return true
80
+ end
81
+
82
+ [:datamapper, :active_support, :extlib].each do |name|
83
+ begin
84
+ Support.load_inflector!(name)
85
+ break
86
+ rescue LoadError
87
+ end
47
88
  end
48
89
 
49
- unless const_defined?(inflector_const)
90
+ unless const_defined?('Inflector')
50
91
  raise(LoadError,"unable to load or find any Inflectors")
51
92
  end
52
93
  end
@@ -20,6 +20,6 @@
20
20
  module Ronin
21
21
  module Support
22
22
  # ronin-support version
23
- VERSION = '0.1.0.rc3'
23
+ VERSION = '0.1.0'
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-support
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: 6
5
- version: 0.1.0.rc3
4
+ prerelease:
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-11 00:00:00 -08:00
13
+ date: 2011-03-20 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -254,23 +254,23 @@ signing_key:
254
254
  specification_version: 3
255
255
  summary: A support library for Ronin.
256
256
  test_files:
257
- - spec/network/network_spec.rb
257
+ - spec/templates/template_spec.rb
258
+ - spec/templates/erb_spec.rb
259
+ - spec/path_spec.rb
260
+ - spec/network/ssl_spec.rb
258
261
  - spec/network/http/http_spec.rb
259
262
  - spec/network/http/proxy_spec.rb
260
- - spec/network/ssl_spec.rb
261
- - spec/templates/erb_spec.rb
262
- - spec/templates/template_spec.rb
263
+ - spec/network/network_spec.rb
264
+ - spec/support_spec.rb
263
265
  - spec/support/inflector_spec.rb
264
- - spec/path_spec.rb
265
- - spec/extensions/file_spec.rb
266
- - spec/extensions/kernel_spec.rb
267
266
  - spec/extensions/string_spec.rb
268
267
  - spec/extensions/ip_addr_spec.rb
269
- - spec/formatting/binary/integer_spec.rb
270
- - spec/formatting/binary/string_spec.rb
268
+ - spec/extensions/file_spec.rb
269
+ - spec/extensions/kernel_spec.rb
270
+ - spec/formatting/http/string_spec.rb
271
+ - spec/formatting/http/integer_spec.rb
271
272
  - spec/formatting/digest/string_spec.rb
272
- - spec/formatting/text/array_spec.rb
273
+ - spec/formatting/binary/string_spec.rb
274
+ - spec/formatting/binary/integer_spec.rb
273
275
  - spec/formatting/text/string_spec.rb
274
- - spec/formatting/http/integer_spec.rb
275
- - spec/formatting/http/string_spec.rb
276
- - spec/support_spec.rb
276
+ - spec/formatting/text/array_spec.rb