autoconfig 0.0.2 → 0.0.3
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/README.markdown +1 -1
- data/lib/autoconfig.rb +12 -0
- metadata +3 -3
data/README.markdown
CHANGED
@@ -36,5 +36,5 @@ ApplicationConfig.web.hostname call will return "the.production.com".
|
|
36
36
|
## Configuration
|
37
37
|
|
38
38
|
By default, it will look at config directory of your project and transfer most of your .yml files (it ignores database ones). However,
|
39
|
-
you have full control over where it
|
39
|
+
you have full control over where it needs to look and what it needs to convert.
|
40
40
|
|
data/lib/autoconfig.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'yaml'
|
3
3
|
|
4
|
+
module StringCamelize
|
5
|
+
# Taken straight from active support inflector.rb, line 161
|
6
|
+
def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
|
7
|
+
if first_letter_in_uppercase
|
8
|
+
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
9
|
+
else
|
10
|
+
lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
String.send(:include, StringCamelize) unless String.instance_methods.include?("camelize")
|
15
|
+
|
4
16
|
module AutoConfig
|
5
17
|
def self.root
|
6
18
|
ENV['AUTOCONFIG_ROOT'] || ENV['APP_ROOT'] || Rails.root
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoconfig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- tjbladez
|