moneypools-rake_helpers 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Hoe.plugin :newgem
13
13
  $hoe = Hoe.spec 'rake_helpers' do
14
14
  self.developer 'moneypools', 'support@mymoneypools.com'
15
15
  self.rubyforge_name = self.name # TODO this is default value
16
- self.extra_deps = [['activesupport','>= 2.2.2']]
16
+ # self.extra_deps = [['activesupport','>= 2.2.2']]
17
17
  end
18
18
 
19
19
  require 'newgem/tasks'
@@ -1,5 +1,3 @@
1
- require 'active_support'
2
-
3
1
  module MP
4
2
  class Config
5
3
  include Singleton
@@ -37,7 +35,7 @@ module MP
37
35
  end
38
36
 
39
37
  def read(*args)
40
- required = args.empty? ? @required : args.first
38
+ required = args.empty? ? @required : args[0]
41
39
  value = fetch(nil)
42
40
 
43
41
  raise OptionNotGivenError.new(message) if value.nil? && required
@@ -57,7 +55,7 @@ module MP
57
55
  # lookup each variant of the key
58
56
  all_possible_values = hash.values_at(*name_variants)
59
57
  # grab the first non-nil value out of the possible values
60
- all_possible_values.compact.first
58
+ all_possible_values.compact[0]
61
59
  end
62
60
  end
63
61
 
@@ -102,7 +100,7 @@ module MP
102
100
  end
103
101
 
104
102
  def expose_as_method
105
- method_name = self.class.name.underscore
103
+ method_name = underscore(self.class.name)
106
104
  config_class = self
107
105
  Object.class_eval do
108
106
  define_method(method_name) do
@@ -111,16 +109,19 @@ module MP
111
109
  end
112
110
  end
113
111
 
114
- # def merge(more_overrides)
115
- # self.class.new(@overrides.to_hash.merge(more_overrides))
116
- # end
117
- #
118
- # def reverse_merge(more_overrides)
119
- # self.class.new(@overrides.to_hash.reverse_merge(more_overrides))
120
- # end
121
- #
122
- # def to_hash
123
- # @overrides.to_hash
124
- # end
112
+ # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
113
+ #
114
+ # Changes '::' to '/' to convert namespaces to paths.
115
+ #
116
+ # Examples:
117
+ # "ActiveRecord".underscore # => "active_record"
118
+ # "ActiveRecord::Errors".underscore # => active_record/errors
119
+ def underscore(camel_cased_word)
120
+ camel_cased_word.to_s.gsub(/::/, '/').
121
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
122
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
123
+ tr("-", "_").
124
+ downcase
125
+ end
125
126
  end
126
127
  end
data/lib/rake_helpers.rb CHANGED
@@ -5,5 +5,5 @@ require 'rake_helpers/config'
5
5
  require 'rake_helpers/erb_helper'
6
6
 
7
7
  module RakeHelpers
8
- VERSION = '0.0.2'
8
+ VERSION = '0.0.3'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneypools-rake_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - moneypools
@@ -9,19 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-09 00:00:00 -07:00
12
+ date: 2009-07-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: activesupport
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.2.2
24
- version:
25
15
  - !ruby/object:Gem::Dependency
26
16
  name: hoe
27
17
  type: :development