constfig 0.0.1 → 0.0.2
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/.gitignore +1 -0
- data/CHANGELOG +7 -0
- data/Gemfile +2 -0
- data/README.md +31 -1
- data/lib/constfig/version.rb +1 -1
- metadata +12 -5
data/.gitignore
CHANGED
data/CHANGELOG
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,9 @@ Simple configuration for Ruby.
|
|
4
4
|
|
5
5
|
Allows you to define configuration CONSTANTS that take values from ENV.
|
6
6
|
|
7
|
+
[](https://travis-ci.org/astrails/constfig)
|
8
|
+
[](https://codeclimate.com/github/astrails/constfig)
|
9
|
+
|
7
10
|
## Installation
|
8
11
|
|
9
12
|
Add this line to your application's Gemfile:
|
@@ -58,7 +61,34 @@ For boolean variables you can supply either `TrueClass`, or `FalseClass`.
|
|
58
61
|
|
59
62
|
### Existing constants
|
60
63
|
|
61
|
-
This gem will not re-define existing constants
|
64
|
+
This gem will not re-define existing constants, which can be used to define
|
65
|
+
defaults for non-production environments.
|
66
|
+
|
67
|
+
### Rails on Heroku
|
68
|
+
|
69
|
+
There is one caveat with Rails on Heroku. By default Heroku doesn't provide
|
70
|
+
environment variables to your application during the `rake assets:precompile`
|
71
|
+
stage of slug compilation. If you don't take care of it your application will
|
72
|
+
fail to compile its assets and might fail to work in produciton. To take care
|
73
|
+
of it you can either use Heroku Labs
|
74
|
+
[user-env-compile](https://devcenter.heroku.com/articles/labs-user-env-compile)
|
75
|
+
option, or (and this is what I'd recommend) you can use development defaults
|
76
|
+
during assets:precompile.
|
77
|
+
|
78
|
+
For example in Rails you con do this:
|
79
|
+
|
80
|
+
if Rails.env.development? || Rails.env.test? || ARGV.join =~ /assets:precompile/
|
81
|
+
DEFAULT_DOMAIN = 'myapp.dev'
|
82
|
+
end
|
83
|
+
|
84
|
+
define_config :DEFAULT_DOMAIN
|
85
|
+
|
86
|
+
In development and test environments it willuse 'myapp.dev' ad
|
87
|
+
`PRIMARY_DOMAIN`, but in production and staging environment it will fail unless
|
88
|
+
`PRIMARY_DOMAIN` is provided by environment.
|
89
|
+
|
90
|
+
> NOTE: make sure those configuration variables are not actually used for asset
|
91
|
+
> compilation. If they are, I'd go with `user-env-compile`.
|
62
92
|
|
63
93
|
### Managing environment
|
64
94
|
|
data/lib/constfig/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constfig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
5
4
|
prerelease:
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Vitaly Kushner
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Simple Constnt Configuration for Ruby. Creates CONSTANTS with values
|
15
15
|
from ENV
|
@@ -21,6 +21,7 @@ extra_rdoc_files: []
|
|
21
21
|
files:
|
22
22
|
- .gitignore
|
23
23
|
- .rspec
|
24
|
+
- CHANGELOG
|
24
25
|
- Gemfile
|
25
26
|
- Guardfile
|
26
27
|
- LICENSE.txt
|
@@ -39,20 +40,26 @@ rdoc_options: []
|
|
39
40
|
require_paths:
|
40
41
|
- lib
|
41
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
hash: 2038963096202275797
|
46
49
|
version: '0'
|
47
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
50
|
none: false
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
52
|
requirements:
|
50
53
|
- - ! '>='
|
51
54
|
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
hash: 2038963096202275797
|
52
58
|
version: '0'
|
59
|
+
none: false
|
53
60
|
requirements: []
|
54
61
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
62
|
+
rubygems_version: 1.8.25
|
56
63
|
signing_key:
|
57
64
|
specification_version: 3
|
58
65
|
summary: Simple Constnt configuration for Ruby.
|