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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6071b0648184b61f8274200200d176117984fcb
4
- data.tar.gz: 2cc5922b50900e2cfe03031162b4ed15d47801d8
3
+ metadata.gz: 8fb7422eca16f693aadb6e4fcd14a9af46413883
4
+ data.tar.gz: f48e9ffb013fac627fab22bb53e7abc8f627b5af
5
5
  SHA512:
6
- metadata.gz: e704eef2f064b28e3132d6dc9dc4fe2e28c76710d6896b87249a527947182f548619e99a00e3752b76d624a1fb7c7af64f9023c3a5e9200ecdae6de2c10e8d4f
7
- data.tar.gz: 175a85948fe41961c971275e80da1f7b1b41fc8d5f0e6a2daf0531533647b217073d517cc27f489cfcdb7a7f92892c20a1e4f3c8cc9520d490dbdcf28a70912b
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/envvar`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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
@@ -4,5 +4,3 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,3 +1,3 @@
1
1
  module Envvar
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'
3
3
  end
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.1.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-21 00:00:00.000000000 Z
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
- - ".gitignore"
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
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.4
5
- before_install: gem install bundler -v 1.12.5
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in envvar.gemspec
4
- gemspec
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
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
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