settei 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -8
- data/lib/settei/version.rb +1 -1
- data/settei.gemspec +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 420fd42e68113f4e584bd112c0fcf0614d5f9622
|
4
|
+
data.tar.gz: e3fb141eca64df590927a41d97ce581832ec697f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz: '
|
6
|
+
metadata.gz: '083334231d67b72fbfb8fada4b0212e58d709bf4b94ff8c679e09342d9a96fbc83fc38378edebcc7a61d928f6c632ac22df0b7e0d571c7f25c2846810629dc1b'
|
7
|
+
data.tar.gz: '058da9d1f4ef97479c449d9a6edcec8ac6a31c9e52f129da5601290a6b9e7861d0b2f0b59ab05c636c4fe12089ca9f9123d621fc2c2a5e61033c7431574e1c14'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
For Rails, a rake task is available for simple setup:
|
31
31
|
|
32
|
-
$ settei:install:rails
|
32
|
+
$ rake settei:install:rails
|
33
33
|
|
34
34
|
A `config/setting.rb` file is added for basic setup.
|
35
35
|
|
@@ -41,7 +41,7 @@ In your app, you can access the settings like this:
|
|
41
41
|
Setting.dig(:google, :api, :secret)
|
42
42
|
```
|
43
43
|
|
44
|
-
|
44
|
+
### Settei::Base
|
45
45
|
|
46
46
|
`Settei::Base` is the core class for accessing the configurations. It is initialized by a hash. It is a light wrapper intended for you to extend.
|
47
47
|
|
@@ -49,9 +49,11 @@ Setting.dig(:google, :api, :secret)
|
|
49
49
|
|
50
50
|
`#dig_and_wrap` will return a `Settei::Base` if it the return value is a hash.
|
51
51
|
|
52
|
+
For other methods, [check here](http://www.rubydoc.info/github/lulalala/settei/master/Settei/Base).
|
53
|
+
|
52
54
|
Install script maps `Setting` to an instance of `Settei::Base`, for convenience.
|
53
55
|
|
54
|
-
|
56
|
+
### Loader
|
55
57
|
|
56
58
|
`Settei::Loaders::SimpleLoader` is responsible for providing the hash to initialize `Settei::Base`. It loads from a source such as YAML or environment variable. It can also serialize the whole hash into one string, suitable for deploying via environment variables.
|
57
59
|
|
@@ -62,13 +64,15 @@ loader.load(:production).as_env_value # loads production.yml and returns "XYZ"
|
|
62
64
|
loader.load(:test).as_env_assignment # loads test.yml and returns "APP_CONG=XYZ"
|
63
65
|
```
|
64
66
|
|
65
|
-
We welcome PRs for different types of loaders, as `SimpleLoader`
|
67
|
+
We welcome PRs for different types of loaders, as `SimpleLoader` probably can't handle all situations.
|
68
|
+
|
69
|
+
For other methods, [check here](http://www.rubydoc.info/github/lulalala/settei/master/Settei/Loaders/SimpleLoader).
|
66
70
|
|
67
|
-
|
71
|
+
### Deployment
|
68
72
|
|
69
73
|
If `deploy.rb` is present, `rake settei:install:rails` will append code to it, allow serialized config to be passed as an environment variable.
|
70
74
|
|
71
|
-
|
75
|
+
### Frameworks other than Rails
|
72
76
|
|
73
77
|
Settei is designed to be simple so you can integrate it into any frameworks easily. The steps are mainly:
|
74
78
|
|
@@ -79,11 +83,11 @@ Settei is designed to be simple so you can integrate it into any frameworks easi
|
|
79
83
|
|
80
84
|
We also welcome PRs for generators of other frameworks too.
|
81
85
|
|
82
|
-
|
86
|
+
## Ruby < 2.3
|
83
87
|
|
84
88
|
`Settei::Base` uses `dig` to access the configuration, available since Ruby 2.3. If your Ruby is not new enough, don't be afraid. Write your own hash accessor literally takes minutes. You can even use `SettingsLogic.new(hash)` .
|
85
89
|
|
86
|
-
|
90
|
+
## FAQ
|
87
91
|
|
88
92
|
**Q:** Would serialized configuration be too big for environment variable?
|
89
93
|
**A:** [The upper limit is pretty big.](https://stackoverflow.com/a/1078125/474597)
|
data/lib/settei/version.rb
CHANGED
data/settei.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["lulalala"]
|
9
9
|
spec.email = ["mark@goodlife.tw"]
|
10
10
|
|
11
|
-
spec.summary = %q{
|
12
|
-
|
11
|
+
spec.summary = %q{Hash based configuration}
|
12
|
+
spec.description = %q{Hash based configuration with flexibility and 12-factor app deployment in mind. Settei allows use of nested hash, and can be serialized as environment variable, suitable for 12-factor app.}
|
13
13
|
spec.homepage = "https://github.com/lulalala/settei"
|
14
14
|
spec.licenses = ['MIT']
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: settei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lulalala
|
@@ -66,7 +66,9 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description: Hash based configuration with flexibility and 12-factor app deployment
|
70
|
+
in mind. Settei allows use of nested hash, and can be serialized as environment
|
71
|
+
variable, suitable for 12-factor app.
|
70
72
|
email:
|
71
73
|
- mark@goodlife.tw
|
72
74
|
executables: []
|
@@ -118,5 +120,5 @@ rubyforge_project:
|
|
118
120
|
rubygems_version: 2.6.13
|
119
121
|
signing_key:
|
120
122
|
specification_version: 4
|
121
|
-
summary:
|
123
|
+
summary: Hash based configuration
|
122
124
|
test_files: []
|