configutron 0.3.0 → 0.3.1

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 CHANGED
@@ -71,21 +71,24 @@ try it out:
71
71
  >> App.variable
72
72
  => "value"
73
73
 
74
+ also
75
+ ----
76
+ * erb works
77
+
74
78
  inspiration
75
79
  -----------
76
- * [Christopher J. Bottaro](http://github.com/cjbottaro/app_config/)'s app_config
77
- * [Brian Smith](http://swig505.com)
80
+ * [Christopher J. Bottaro](http://github.com/cjbottaro/app_config/)'s app_config
81
+ * [Brian Smith](http://swig505.com)
78
82
 
79
83
  note on patches/pull requests
80
84
  -----------------------------
81
- * fork the project.
82
- * make your feature addition or bug fix.
83
- * add tests for it. this is important so i don't break it in a
84
- future version unintentionally.
85
- * commit, do not mess with rakefile, version, or history.
86
- (if you want to have your own version, that is fine but bump version in a commit by itself i can ignore when i pull)
87
- * send me a pull request. bonus points for topic branches.
88
-
85
+ * fork the project.
86
+ * make your feature addition or bug fix.
87
+ * add tests for it. this is important so i don't break it in a
88
+ future version unintentionally.
89
+ * commit, do not mess with rakefile, version, or history.
90
+ (if you want to have your own version, that is fine but bump version in a commit by itself i can ignore when i pull)
91
+ * send me a pull request. bonus points for topic branches.
89
92
 
90
93
  copyright
91
94
  ---------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/lib/configutron.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'ostruct'
3
+ require 'erb'
3
4
  require 'core_ext'
4
5
 
5
6
  module Configutron
@@ -23,9 +24,9 @@ module Configutron
23
24
  env_settings_path = File.expand_path("#{RAILS_ROOT}/config/settings/#{RAILS_ENV}.yml")
24
25
 
25
26
  if File.exist?(settings_path)
26
- @configutron = YAML.load_file(settings_path)[RAILS_ENV].symbolize_keys
27
+ @configutron = YAML.load(ERB.new(File.read(settings_path)).result)[RAILS_ENV].symbolize_keys
27
28
  elsif File.exists?(env_settings_path)
28
- @configutron = YAML.load_file(env_settings_path).symbolize_keys
29
+ @configutron = YAML.load(ERB.new(File.read(env_settings_path)).result).symbolize_keys
29
30
  else
30
31
  raise IOError, "Create either config/settings.yml or config/settings/RAILS_ENV.yml"
31
32
  end
@@ -59,6 +59,10 @@ describe Configutron do
59
59
  Configutron.my_hash.one.should == 1
60
60
  Configutron.my_hash.two.should == 2
61
61
  end
62
+
63
+ specify "erb values work" do
64
+ Configutron.my_erb_variable.should == 3
65
+ end
62
66
  end
63
67
 
64
68
  describe "nested settings" do
@@ -71,6 +75,6 @@ describe Configutron do
71
75
  Configutron.four.five.six.should == 6
72
76
  end
73
77
  end
74
- end
78
+ end
75
79
  end
76
80
  end
@@ -23,6 +23,8 @@ two:
23
23
  four:
24
24
  five:
25
25
  six: 6
26
+
27
+ my_erb_variable: <%= 1 + 2 %>
26
28
  END_SETTINGS
27
29
 
28
30
  SETTINGS_YML = <<-END_SETTINGS
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configutron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neal Clark