app_constants 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +13 -3
- data/VERSION +1 -1
- data/app_constants.gemspec +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@ Master is Rails 3 compatible only.
|
|
5
5
|
|
6
6
|
= AppConstants
|
7
7
|
|
8
|
-
It's funny how every Rails application I work on ends up needing some sort of per-environment global constants.
|
8
|
+
It's funny how every (non)Rails application I work on ends up needing some sort of per-environment global constants.
|
9
9
|
|
10
10
|
Examples may include the application url - It might be used in account activation emails and thus should be different between the development and production environments.
|
11
11
|
|
@@ -26,8 +26,9 @@ But in my experience constants end up being scattered all around, people don't k
|
|
26
26
|
|
27
27
|
AppConstants can be used as a gem or as a plugin. It provides a clean way to handle this need.
|
28
28
|
|
29
|
+
== Usage
|
29
30
|
|
30
|
-
|
31
|
+
=== Installing AppConstants as a gem
|
31
32
|
|
32
33
|
Add it to your Gemfile:
|
33
34
|
|
@@ -43,7 +44,7 @@ Then bundle install and run the generator:
|
|
43
44
|
exists config/initializers
|
44
45
|
create config/initializers/load_app_constants.rb
|
45
46
|
|
46
|
-
|
47
|
+
=== Installing AppConstants as a plugin
|
47
48
|
|
48
49
|
Just install the plugin as you normally would and run the generator
|
49
50
|
|
@@ -57,6 +58,15 @@ Just install the plugin as you normally would and run the generator
|
|
57
58
|
|
58
59
|
Now use the constants.yml file to define your own constants and the load_app_constants.rb initializer to customize the plugin. e.g: Change the default location for the constants.yml file.
|
59
60
|
|
61
|
+
=== Using AppConstants without Rails
|
62
|
+
|
63
|
+
After installing the gem - either using bundler or otherwise - you'll be responsible for initializing it, like so:
|
64
|
+
|
65
|
+
#somewhere in your non-Rails app
|
66
|
+
AppConstants.config_path = "#{File.dirname(__FILE__)}/config/constants.yml"
|
67
|
+
AppConstants.environment = "development"
|
68
|
+
AppConstants.load!
|
69
|
+
|
60
70
|
== Example
|
61
71
|
|
62
72
|
If you have a constants.yml file that looks like this:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/app_constants.gemspec
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Leonardo Borges
|
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
hash: -
|
116
|
+
hash: -781544183204636773
|
117
117
|
segments:
|
118
118
|
- 0
|
119
119
|
version: "0"
|