rails_config 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -4
- data/Rakefile +1 -1
- data/TODO +3 -9
- data/VERSION +1 -1
- data/lib/generators/rails_config/install_generator.rb +20 -0
- data/lib/generators/{templates → rails_config/templates}/rails_config.rb +0 -0
- data/lib/generators/rails_config/templates/settings.yml +0 -0
- data/lib/generators/rails_config/templates/settings/development.yml +0 -0
- data/lib/generators/rails_config/templates/settings/production.yml +0 -0
- data/lib/generators/rails_config/templates/settings/test.yml +0 -0
- metadata +13 -11
- data/lib/generators/rails_config_generator.rb +0 -11
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# RailsConfig
|
2
|
+
|
1
3
|
## Summary
|
2
4
|
|
3
5
|
RailsConfig helps you easily manage environment specific Rails settings in an easy and usable manner
|
@@ -25,9 +27,14 @@ Add this to your `Gemfile`:
|
|
25
27
|
|
26
28
|
You may customize the behavior of RailsConfig by generating an initializer file:
|
27
29
|
|
28
|
-
rails g rails_config
|
30
|
+
rails g rails_config:install
|
31
|
+
|
32
|
+
This will generate `config/initializers/rails_config.rb` with a set of default settings as well as to generate a set of default settings files:
|
29
33
|
|
30
|
-
|
34
|
+
config/settings.yml
|
35
|
+
config/settings/development.yml
|
36
|
+
config/settings/production.yml
|
37
|
+
config/settings/test.yml
|
31
38
|
|
32
39
|
## Accessing the Settings object
|
33
40
|
|
@@ -75,11 +82,13 @@ Embedded Ruby is allowed in the configuration files. See examples below.
|
|
75
82
|
|
76
83
|
Consider the two following config files.
|
77
84
|
|
78
|
-
|
85
|
+
#{Rails.root}/config/settings.yml:
|
86
|
+
|
79
87
|
size: 1
|
80
88
|
server: google.com
|
81
89
|
|
82
|
-
|
90
|
+
#{Rails.root}/config/environments/development.yml:
|
91
|
+
|
83
92
|
size: 2
|
84
93
|
computed: <%= 1 + 2 + 3 %>
|
85
94
|
section:
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
s.email = ["railsjedi@gmail.com", "ifredwu@gmail.com"]
|
12
12
|
s.files = FileList["[A-Z]*", "{bin,generators,lib,spec}/**/*"]
|
13
13
|
|
14
|
-
s.add_dependency 'activesupport', "
|
14
|
+
s.add_dependency 'activesupport', "~>3.0"
|
15
15
|
s.add_development_dependency 'rspec', ">=2.0.0.beta.19"
|
16
16
|
|
17
17
|
end
|
data/TODO
CHANGED
@@ -1,14 +1,8 @@
|
|
1
|
-
-
|
2
|
-
- config/settings.yml
|
3
|
-
- config/settings/development.yml
|
4
|
-
- config/settings/test.yml
|
5
|
-
- config/settings/production.yml
|
6
|
-
|
7
|
-
- Add generator `rails_config:override` that creates an config/rails_config.rb initializer and disables the default initialzer
|
1
|
+
- Change part of the install generator to `rails_config:override` that creates an config/rails_config.rb initializer and disables the default initialzer
|
8
2
|
|
9
3
|
DONE:
|
10
4
|
- Add a Rails before_filter that triggers Settings.reload! for each development request
|
5
|
+
- Add generator `rails_config:install` to create the default setting files
|
11
6
|
- Allow user to customize the name of the global setting object (Settings)
|
12
7
|
- Abstract OpenStruct to RailsConfig::Options
|
13
|
-
- Add ability to define multiple sources (Start with YAMLSource)
|
14
|
-
|
8
|
+
- Add ability to define multiple sources (Start with YAMLSource)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RailsConfig
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc "Generates a custom Rails Config initializer file."
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
@_rails_config_source_root ||= File.expand_path("../templates", __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
def copy_initializer
|
11
|
+
template "rails_config.rb", "config/initializers/rails_config.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_settings
|
15
|
+
template "settings.yml", "config/settings.yml"
|
16
|
+
directory "settings", "config/settings"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jacques Crocker
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-09-07 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -25,15 +25,13 @@ dependencies:
|
|
25
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 7
|
31
31
|
segments:
|
32
32
|
- 3
|
33
33
|
- 0
|
34
|
-
|
35
|
-
- rc
|
36
|
-
version: 3.0.0.rc
|
34
|
+
version: "3.0"
|
37
35
|
type: :runtime
|
38
36
|
version_requirements: *id001
|
39
37
|
- !ruby/object:Gem::Dependency
|
@@ -74,8 +72,12 @@ files:
|
|
74
72
|
- Rakefile
|
75
73
|
- TODO
|
76
74
|
- VERSION
|
77
|
-
- lib/generators/
|
78
|
-
- lib/generators/templates/rails_config.rb
|
75
|
+
- lib/generators/rails_config/install_generator.rb
|
76
|
+
- lib/generators/rails_config/templates/rails_config.rb
|
77
|
+
- lib/generators/rails_config/templates/settings.yml
|
78
|
+
- lib/generators/rails_config/templates/settings/development.yml
|
79
|
+
- lib/generators/rails_config/templates/settings/production.yml
|
80
|
+
- lib/generators/rails_config/templates/settings/test.yml
|
79
81
|
- lib/rails_config.rb
|
80
82
|
- lib/rails_config/options.rb
|
81
83
|
- lib/rails_config/railtie.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class RailsConfigGenerator < Rails::Generators::Base
|
2
|
-
desc "Generates a custom Rails Config initializer file."
|
3
|
-
|
4
|
-
def self.source_root
|
5
|
-
@_rails_config_source_root ||= File.expand_path("../templates", __FILE__)
|
6
|
-
end
|
7
|
-
|
8
|
-
def copy_initializer
|
9
|
-
template "rails_config.rb", "config/initializers/rails_config.rb"
|
10
|
-
end
|
11
|
-
end
|