autoconfig 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/autoconfig.rb +11 -3
  2. metadata +6 -6
data/lib/autoconfig.rb CHANGED
@@ -15,7 +15,7 @@ String.send(:include, StringCamelize) unless String.instance_methods.include?("c
15
15
 
16
16
  module AutoConfig
17
17
  def self.root
18
- ENV['AUTOCONFIG_ROOT'] || ENV['APP_ROOT'] || Rails.root
18
+ ENV['AUTOCONFIG_ROOT'] || ENV['APP_ROOT'] || (rails? && Rails.root) || base_dir
19
19
  end
20
20
 
21
21
  def self.pattern
@@ -27,7 +27,15 @@ module AutoConfig
27
27
  end
28
28
 
29
29
  def self.environment
30
- ENV['AUTOCONFIG_ENV'] || ENV['APP_ENV'] || Rails.env
30
+ ENV['AUTOCONFIG_ENV'] || ENV['APP_ENV'] || (rails? && Rails.env) || base_dir
31
+ end
32
+
33
+ def self.rails?
34
+ Object::const_defined? "Rails"
35
+ end
36
+
37
+ def self.base_dir
38
+ File.dirname(File.expand_path(__FILE__))
31
39
  end
32
40
 
33
41
  files = Dir.glob(path)
@@ -49,4 +57,4 @@ module AutoConfig
49
57
  ensure
50
58
  $VERBOSE = old_verbose
51
59
  end
52
- end
60
+ end
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: 19
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 6
10
- version: 0.0.6
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - tjbladez
@@ -30,7 +30,7 @@ extra_rdoc_files: []
30
30
  files:
31
31
  - lib/autoconfig.rb
32
32
  - README.markdown
33
- has_rdoc: true
33
+ has_rdoc: false
34
34
  homepage: http://github.com/tjbladez/autoconfig
35
35
  licenses: []
36
36
 
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements: []
61
61
 
62
62
  rubyforge_project:
63
- rubygems_version: 1.3.7
63
+ rubygems_version: 1.6.2
64
64
  signing_key:
65
65
  specification_version: 3
66
66
  summary: Automagically creates Config structures from your config/*.yml files