gem_configurator 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gem_configurator/version.rb +1 -1
- data/lib/gem_configurator.rb +5 -4
- metadata +4 -4
data/lib/gem_configurator.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "gem_configurator/version"
|
2
2
|
require 'active_support/inflector'
|
3
|
+
require 'erb'
|
3
4
|
|
4
5
|
module GemConfigurator
|
5
6
|
|
@@ -8,7 +9,7 @@ module GemConfigurator
|
|
8
9
|
private
|
9
10
|
|
10
11
|
def config_path
|
11
|
-
config_file_name = "#{self.class.to_s.underscore}.yml"
|
12
|
+
config_file_name = "#{self.class.to_s.demodulize.underscore}.yml"
|
12
13
|
if using_rails? && File.exists?(Rails.root.join("config",config_file_name))
|
13
14
|
Rails.root.join("config",config_file_name)
|
14
15
|
elsif File.exists?("config/#{config_file_name}")
|
@@ -21,13 +22,13 @@ module GemConfigurator
|
|
21
22
|
def configure
|
22
23
|
raw_settings = parse_yaml(config_path())
|
23
24
|
environment = using_rails? ? Rails.env : 'development'
|
24
|
-
|
25
|
+
|
25
26
|
if raw_settings
|
26
27
|
@settings = raw_settings[environment]
|
27
28
|
else
|
28
29
|
@settings = {}
|
29
30
|
end
|
30
|
-
|
31
|
+
|
31
32
|
if self.respond_to?(:default_settings,true)
|
32
33
|
@settings = default_settings.merge(@settings)
|
33
34
|
else
|
@@ -36,7 +37,7 @@ module GemConfigurator
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def parse_yaml(path)
|
39
|
-
path ? YAML.
|
40
|
+
path ? YAML.load(ERB.new(File.read(path)).result) : nil
|
40
41
|
end
|
41
42
|
|
42
43
|
def using_rails?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_configurator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-06 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153034280 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153034280
|
26
26
|
description: Implements a standard way of using yml files to configure gems.
|
27
27
|
email:
|
28
28
|
- iwhitney@ssa-i.org
|