gem_configurator 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module GemConfigurator
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -9,8 +9,10 @@ module GemConfigurator
9
9
 
10
10
  def config_path
11
11
  config_file_name = "#{self.class.to_s.underscore}.yml"
12
- if defined?(Rails) && File.exists?(Rails.root.join("config",config_file_name))
12
+ if using_rails? && File.exists?(Rails.root.join("config",config_file_name))
13
13
  Rails.root.join("config",config_file_name)
14
+ elsif File.exists?("config/#{config_file_name}")
15
+ File.path("config/#{config_file_name}")
14
16
  else
15
17
  nil
16
18
  end
@@ -18,9 +20,10 @@ module GemConfigurator
18
20
 
19
21
  def configure
20
22
  raw_settings = parse_yaml(config_path())
23
+ environment = using_rails? ? Rails.env : 'development'
21
24
 
22
25
  if raw_settings
23
- @settings = raw_settings[Rails.env]
26
+ @settings = raw_settings[environment]
24
27
  else
25
28
  @settings = {}
26
29
  end
@@ -35,4 +38,8 @@ module GemConfigurator
35
38
  def parse_yaml(path)
36
39
  path ? YAML.load_file(path) : nil
37
40
  end
41
+
42
+ def using_rails?
43
+ defined?(Rails)
44
+ end
38
45
  end
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.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-09-05 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &2165130900 !ruby/object:Gem::Requirement
17
+ requirement: &2165645080 !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: *2165130900
25
+ version_requirements: *2165645080
26
26
  description: Implements a standard way of using yml files to configure gems.
27
27
  email:
28
28
  - iwhitney@ssa-i.org