envvar 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +32 -4
- data/bin/setup +0 -2
- data/lib/envvar/version.rb +1 -1
- metadata +3 -9
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -6
- data/envvar.gemspec +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb7422eca16f693aadb6e4fcd14a9af46413883
|
4
|
+
data.tar.gz: f48e9ffb013fac627fab22bb53e7abc8f627b5af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c89a10e5e0de9fd591b47ebf5be7bff70633849a94c7ba7565e0c7c0d71bf6f55addcfc58c80e0708ae707add261dd182646899b9b5b14622d582b1cd577d21c
|
7
|
+
data.tar.gz: 5143aa203d1594acbc4767d8466f554add6fe2f7db10d5f949cb59fb5937bac1c01d2a5fb0e0d56292f3528261ac48f3cc7bf59f6e07d2c6a8cf519d929852d3
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Brendan Stennett
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Envvar
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Manages defining optional (and default) values, environment specific values and required values.
|
4
|
+
There is a focus on 12 Factor principle and definining most variables outside of the environment
|
5
|
+
in production but making it easy for developers to get started with development environment
|
6
|
+
specific variables and sensible defaults.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -22,7 +23,34 @@ Or install it yourself as:
|
|
22
23
|
|
23
24
|
## Usage
|
24
25
|
|
25
|
-
|
26
|
+
Place the following lines as soon as possible in the application boot process:
|
27
|
+
```ruby
|
28
|
+
require 'envvar'
|
29
|
+
Envvar.load(File.expand_path('../application.yml', __FILE__))
|
30
|
+
```
|
31
|
+
|
32
|
+
The application.yml file contains a few different sections:
|
33
|
+
- required
|
34
|
+
- defaults
|
35
|
+
- development, test, etc.
|
36
|
+
|
37
|
+
A sample of this file is show below:
|
38
|
+
```yaml
|
39
|
+
required:
|
40
|
+
- FOO
|
41
|
+
- BAR
|
42
|
+
defaults:
|
43
|
+
BAM: thud
|
44
|
+
development:
|
45
|
+
FOO: bat
|
46
|
+
BAR: qux
|
47
|
+
```
|
48
|
+
|
49
|
+
This gives a nice place to set application defaults and development/test variables in one place. It would be best
|
50
|
+
practise to not include the production environment variables in this file and instead set them as ENV variables in the
|
51
|
+
outside environment. Any variables listed in the `required` section that are not present in the ENV hash after the
|
52
|
+
Envvar.load call with raise `Envvar::EnvironmentError`. This allows for a fast-fail setup which is useful in more
|
53
|
+
complex applications with quite a few necessary environment variables.
|
26
54
|
|
27
55
|
## Development
|
28
56
|
|
data/bin/setup
CHANGED
data/lib/envvar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envvar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan Stennett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -62,16 +62,10 @@ executables: []
|
|
62
62
|
extensions: []
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
-
-
|
66
|
-
- ".rspec"
|
67
|
-
- ".travis.yml"
|
68
|
-
- Gemfile
|
69
|
-
- LICENSE.txt
|
65
|
+
- LICENSE
|
70
66
|
- README.md
|
71
|
-
- Rakefile
|
72
67
|
- bin/console
|
73
68
|
- bin/setup
|
74
|
-
- envvar.gemspec
|
75
69
|
- lib/envvar.rb
|
76
70
|
- lib/envvar/version.rb
|
77
71
|
homepage: http://github.com/HuffMoody/envvar
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2017 Brendan Stennett
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/envvar.gemspec
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'envvar/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "envvar"
|
8
|
-
spec.version = Envvar::VERSION
|
9
|
-
spec.authors = ["Brendan Stennett"]
|
10
|
-
spec.email = ["brendan@thinkdataworks.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Very simple library for managing configuration through ENV hash.}
|
13
|
-
spec.description = %q{Manages defining optional (and default) values, environment specific values and required values. There is a focus on 12 Factor principle and definining most variables outside of the environment in production but making it easy for developers to get started with development environment specific variables and sensible defaults.}
|
14
|
-
spec.homepage = "http://github.com/HuffMoody/envvar"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
-
else
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.12"
|
31
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
-
end
|