simple-settings 0.0.5 → 0.0.6
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.
- checksums.yaml +15 -0
- data/README.rdoc +14 -4
- data/lib/simple-settings.rb +7 -2
- data/lib/simple-settings/version.rb +1 -1
- metadata +5 -12
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Y2NlNTA4ODRjYTJkM2IzMDQ0ZThhN2QyODM3NTY1OGIzZDBiZDJjMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjkzMzI0NjM5NThjMDgyNDI1ZTQyMTVjYTNiNzYxZTIyZDZlNWQ1OA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2U5MzE2OTEyOGY4MjJiYTg4Y2QzNTBhNmMyYTkzNDAwZDhiYzdjMWM0MGYz
|
10
|
+
ZDMxY2NkZDVhZTA5MmU2ZDExNjM1NmVmOTZjYmMwMGIxYzE2MTk0ZDlmZDcx
|
11
|
+
ZDJmNzgzNThhZDFjMTdiYWZjNzk3NTlkZjRiYWNmOTliYjY2YTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzExZjQzZGY1YmI5NTBkOGQyNWU3NGUxNjc2YmNiZDczYzY1NGEwMjY2MjMx
|
14
|
+
ZmQyMTA2YjAzYWYwYzg2ZTRlZDlhODdiM2NmZDc4ZTBmZmNiZmFjYTY0ZjEz
|
15
|
+
ODg0NGQ1YWI0OTY1MjFhMWJmY2Y5YzZkMTEwYTYwYmI3N2Q3MTc=
|
data/README.rdoc
CHANGED
@@ -10,15 +10,25 @@ http://fury-badge.herokuapp.com/rb/simple-settings.png
|
|
10
10
|
|
11
11
|
At some point you'll need to load settings. In a rails project I'd do this in config/initializers/01_settings.rb:
|
12
12
|
|
13
|
+
```
|
13
14
|
SimpleSettings.load
|
15
|
+
```
|
14
16
|
|
15
17
|
If you're not using a rails project you'll need to set the location of the settings.yml and your current environment via:
|
16
|
-
|
18
|
+
|
19
|
+
```
|
17
20
|
SimpleSettings.file_path = "~/path_to/settings.yml"
|
18
21
|
SimpleSettings.env = "development"
|
22
|
+
```
|
19
23
|
|
20
|
-
|
24
|
+
These values will default to ./config/settings.yml and development.
|
21
25
|
|
22
|
-
|
23
|
-
|
26
|
+
Env is read from:
|
27
|
+
1- Rails
|
28
|
+
2- ENV['RAILS_ENV']
|
24
29
|
|
30
|
+
Your yaml file will be available via:
|
31
|
+
```
|
32
|
+
SimpleSettings.config[:setting_name]
|
33
|
+
SimpleSettings.config[:nested_attributes][:work_too]
|
34
|
+
```
|
data/lib/simple-settings.rb
CHANGED
@@ -33,13 +33,18 @@ module SimpleSettings
|
|
33
33
|
|
34
34
|
def file_path
|
35
35
|
return @file_path if @file_path
|
36
|
-
|
36
|
+
if defined?(Rails)
|
37
|
+
return @file_path = Rails.root.join('config','settings.yml') if Rails.root
|
38
|
+
else
|
39
|
+
return './config/settings.yml'
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def env
|
40
44
|
return @env if @env
|
41
45
|
return @env = Rails.env if defined?(Rails)
|
42
|
-
return @env =
|
46
|
+
return @env = ENV['RAILS_ENV'] unless ENV['RAILS_ENV'].nil?
|
47
|
+
return @env = 'development'
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Alex Smith
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -57,27 +52,25 @@ files:
|
|
57
52
|
- README.rdoc
|
58
53
|
homepage: http://alexsmith.io
|
59
54
|
licenses: []
|
55
|
+
metadata: {}
|
60
56
|
post_install_message:
|
61
57
|
rdoc_options: []
|
62
58
|
require_paths:
|
63
59
|
- lib
|
64
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
61
|
requirements:
|
67
62
|
- - ! '>='
|
68
63
|
- !ruby/object:Gem::Version
|
69
64
|
version: '0'
|
70
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
66
|
requirements:
|
73
67
|
- - ! '>='
|
74
68
|
- !ruby/object:Gem::Version
|
75
69
|
version: '0'
|
76
70
|
requirements: []
|
77
71
|
rubyforge_project:
|
78
|
-
rubygems_version:
|
72
|
+
rubygems_version: 2.0.5
|
79
73
|
signing_key:
|
80
|
-
specification_version:
|
74
|
+
specification_version: 4
|
81
75
|
summary: A gem to easily handle environment specific settings
|
82
76
|
test_files: []
|
83
|
-
has_rdoc:
|