app_constants 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app_constants.gemspec +9 -8
- data/lib/app_constants.rb +7 -1
- data/root +0 -0
- data/test/app_constants_spec.rb +11 -1
- data/test/fixtures/template_constants.yml +10 -0
- metadata +53 -59
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/app_constants.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.0.
|
7
|
+
s.name = "app_constants"
|
8
|
+
s.version = "1.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Leonardo Borges"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-02-13"
|
13
|
+
s.description = "A clean and simple way to manage your application's per-environment constants"
|
14
|
+
s.email = "leonardoborges.rj@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/generators/templates/README",
|
32
32
|
"lib/generators/templates/constants.yml",
|
33
33
|
"lib/generators/templates/load_app_constants.rb",
|
34
|
+
"root",
|
34
35
|
"test/app_constants_spec.rb",
|
35
36
|
"test/fixtures/constants.yml",
|
36
37
|
"test/fixtures/nested_constants.yml",
|
@@ -38,11 +39,11 @@ Gem::Specification.new do |s|
|
|
38
39
|
"test/test_helper.rb",
|
39
40
|
"uninstall.rb"
|
40
41
|
]
|
41
|
-
s.homepage =
|
42
|
+
s.homepage = "http://github.com/leonardoborges/app_constants"
|
42
43
|
s.licenses = ["MIT"]
|
43
44
|
s.require_paths = ["lib"]
|
44
|
-
s.rubygems_version =
|
45
|
-
s.summary =
|
45
|
+
s.rubygems_version = "1.8.10"
|
46
|
+
s.summary = "A clean and simple way to manage your application's per-environment constants"
|
46
47
|
s.test_files = [
|
47
48
|
"test/app_constants_spec.rb",
|
48
49
|
"test/test_helper.rb"
|
data/lib/app_constants.rb
CHANGED
@@ -24,7 +24,13 @@ class AppConstants
|
|
24
24
|
|
25
25
|
def method_missing(method, *args)
|
26
26
|
fail_if_constant_missing(method.to_s)
|
27
|
-
constants_hash[method.to_s].nil?
|
27
|
+
if constants_hash[method.to_s].nil?
|
28
|
+
""
|
29
|
+
elsif constants_hash[method.to_s].is_a?(Hash)
|
30
|
+
AppConstants.new(constants_hash[method.to_s])
|
31
|
+
else
|
32
|
+
constants_hash[method.to_s].freeze
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|
30
36
|
def fail_if_constant_missing(constant)
|
data/root
ADDED
File without changes
|
data/test/app_constants_spec.rb
CHANGED
@@ -54,6 +54,16 @@ describe "AppConstants" do
|
|
54
54
|
AppConstants.environment = "playpen"
|
55
55
|
expect { AppConstants.load! }.to raise_error(RuntimeError)
|
56
56
|
end
|
57
|
+
|
58
|
+
it "should allow nested constants" do
|
59
|
+
AppConstants.config_path = "#{File.dirname(__FILE__)}/fixtures/template_constants.yml"
|
60
|
+
AppConstants.environment = "development"
|
61
|
+
AppConstants.load!
|
62
|
+
|
63
|
+
AppConstants.email.default_sender.should == "do-not-reply@test.com"
|
64
|
+
AppConstants.delayed_jobs.timeouts.default.should == 300
|
65
|
+
AppConstants.very.deep.nesting.level == true
|
66
|
+
end
|
57
67
|
|
58
68
|
describe "#load!" do
|
59
69
|
|
@@ -64,4 +74,4 @@ describe "AppConstants" do
|
|
64
74
|
expect { AppConstants.load! }.to raise_error(ArgumentError)
|
65
75
|
end
|
66
76
|
end
|
67
|
-
end
|
77
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_constants
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Leonardo Borges
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rspec
|
18
|
-
requirement: &
|
16
|
+
requirement: &70108009980120 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :development
|
25
23
|
prerelease: false
|
26
|
-
version_requirements: *
|
27
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *70108009980120
|
25
|
+
- !ruby/object:Gem::Dependency
|
28
26
|
name: rspec
|
29
|
-
requirement: &
|
27
|
+
requirement: &70108009979500 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :development
|
36
34
|
prerelease: false
|
37
|
-
version_requirements: *
|
38
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *70108009979500
|
36
|
+
- !ruby/object:Gem::Dependency
|
39
37
|
name: jeweler
|
40
|
-
requirement: &
|
38
|
+
requirement: &70108009977780 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
46
44
|
type: :development
|
47
45
|
prerelease: false
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *70108009977780
|
47
|
+
- !ruby/object:Gem::Dependency
|
50
48
|
name: rspec
|
51
|
-
requirement: &
|
49
|
+
requirement: &70108009993640 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
57
55
|
type: :development
|
58
56
|
prerelease: false
|
59
|
-
version_requirements: *
|
57
|
+
version_requirements: *70108009993640
|
60
58
|
description: A clean and simple way to manage your application's per-environment constants
|
61
59
|
email: leonardoborges.rj@gmail.com
|
62
60
|
executables: []
|
63
|
-
|
64
61
|
extensions: []
|
65
|
-
|
66
|
-
extra_rdoc_files:
|
62
|
+
extra_rdoc_files:
|
67
63
|
- README.rdoc
|
68
|
-
files:
|
64
|
+
files:
|
69
65
|
- Gemfile
|
70
66
|
- Gemfile.lock
|
71
67
|
- MIT-LICENSE
|
@@ -81,43 +77,41 @@ files:
|
|
81
77
|
- lib/generators/templates/README
|
82
78
|
- lib/generators/templates/constants.yml
|
83
79
|
- lib/generators/templates/load_app_constants.rb
|
80
|
+
- root
|
84
81
|
- test/app_constants_spec.rb
|
85
82
|
- test/fixtures/constants.yml
|
86
83
|
- test/fixtures/nested_constants.yml
|
87
84
|
- test/fixtures/template_constants.yml
|
88
85
|
- test/test_helper.rb
|
89
86
|
- uninstall.rb
|
90
|
-
has_rdoc: true
|
91
87
|
homepage: http://github.com/leonardoborges/app_constants
|
92
|
-
licenses:
|
88
|
+
licenses:
|
93
89
|
- MIT
|
94
90
|
post_install_message:
|
95
91
|
rdoc_options: []
|
96
|
-
|
97
|
-
require_paths:
|
92
|
+
require_paths:
|
98
93
|
- lib
|
99
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
95
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
segments:
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
segments:
|
106
101
|
- 0
|
107
|
-
|
108
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
hash: 4169077398743622493
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
104
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version:
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
114
109
|
requirements: []
|
115
|
-
|
116
110
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.8.10
|
118
112
|
signing_key:
|
119
113
|
specification_version: 3
|
120
114
|
summary: A clean and simple way to manage your application's per-environment constants
|
121
|
-
test_files:
|
115
|
+
test_files:
|
122
116
|
- test/app_constants_spec.rb
|
123
117
|
- test/test_helper.rb
|