rails_simple_config 0.0.3 → 0.0.4

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.md CHANGED
@@ -14,7 +14,7 @@ Run the generator to create the default configuration file:
14
14
 
15
15
  rails generate rails_simple_config:install
16
16
 
17
- The generator will create 3 files in your Rails root directory; namely `secrets.yml`, `secrets.example.yml` and `config.yml`.
17
+ The generator will create 3 files in your Rails `config` directory; namely `secrets.yml`, `secrets.example.yml` and `config.yml`.
18
18
 
19
19
  The `secrets.yml` should _not_ be committed to source control, and it should be used to keep settings which are
20
20
  considered a secret; such as your Amazon credentials. These settings will be loaded first. The `secrets.example.yml` filename
@@ -26,7 +26,7 @@ The `config.yml` file should contain all other configuration settings.
26
26
 
27
27
  ### Define configuration settings
28
28
 
29
- Define your settings in the generated `secrets.yml` and `config.yml` file, found in your Rails root directory.
29
+ Define your settings in the generated `secrets.yml` and `config.yml` file, found in your Rails `config` directory.
30
30
 
31
31
  The file contains sections for the development, test and production Rails environments, and a shared section.
32
32
  It can also contain ERB code so that more advanced configuration scenarios can be supported.
@@ -1,5 +1,5 @@
1
1
  Description:
2
- Creates the default configuration file (config.yml) in the project root directory.
2
+ Creates the default configuration file (config.yml) in the project config directory.
3
3
 
4
4
  Example:
5
5
  `rails generate rails_simple_config:install`
@@ -3,9 +3,9 @@ module RailsSimpleConfig
3
3
  source_root File.expand_path('../templates', __FILE__)
4
4
 
5
5
  def copy_files
6
- template "config.yml", "./config.yml"
7
- template "secrets.yml", "./secrets.yml"
8
- template "secrets.yml", "./secrets.example.yml"
6
+ template "config.yml", File.join("config", "config.yml")
7
+ template "secrets.yml", File.join("config", "secrets.yml")
8
+ template "secrets.yml", File.join("config", "secrets.example.yml")
9
9
  end
10
10
 
11
11
  end
@@ -10,8 +10,8 @@ module SimpleConfig
10
10
 
11
11
  def load!
12
12
  puts "Loading configuration for '#{Rails.env}'."
13
- load_file(Rails.root + 'secrets.yml')
14
- load_file(Rails.root + 'config.yml')
13
+ load_file File.join(Rails.root, 'config', 'secrets.yml')
14
+ load_file File.join(Rails.root, 'config', 'config.yml')
15
15
  end
16
16
 
17
17
  def reload!
@@ -23,7 +23,7 @@ module SimpleConfig
23
23
 
24
24
  def load_file(filename)
25
25
  if File.exist?(filename)
26
- configuration = YAML.load(ERB.new(File.read(filename)).result)[Rails.env]
26
+ configuration = YAML.load(ERB.new(File.read(filename)).result(binding))[Rails.env]
27
27
  configuration.each do |key, value|
28
28
  self.__send__("#{key}=", value)
29
29
  end if configuration
@@ -48,3 +48,5 @@ module SimpleConfig
48
48
 
49
49
  end
50
50
 
51
+ # alias to support using AppConfig global
52
+ AppConfig = SimpleConfig
@@ -1,3 +1,3 @@
1
1
  module RailsSimpleConfig
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_simple_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-09 00:00:00.000000000Z
12
+ date: 2011-10-20 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: A simple YAML based configuration for Ruby on Rails 3+, which supports
15
15
  shared settings, ERB and more.