env-dependencies 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/env-dependencies.gemspec +19 -0
- data/lib/env-dependencies/railtie.rb +11 -0
- data/lib/env-dependencies/version.rb +3 -0
- data/lib/env-dependencies.rb +2 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 68f5fa9343117db1989282a195e68f1073e8e7ab
|
4
|
+
data.tar.gz: bf3a74d67f2325352acfa290517f760f9e34b6b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 798ddb625256a4d75509447a9c5d6b9c245424e45a7e898da64a43dc4b4f9e6e4de8e65c8365f1660135c0bca1612ab7c0183adf7a6373a2ceeeaddd0fce13b2
|
7
|
+
data.tar.gz: ca24ac68cf4ebd45d21a35075e5d4a8b5d81cc04e177ddb496f64f4b3fa999fa06e5843032babfb2177533b79a402ac52b420cbb0268f5243d46dc2ecb2c4ee4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Luke Horvat
|
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/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# env-dependencies [![Gem version](http://img.shields.io/gem/v/env-dependencies.svg?style=flat-square)](http://rubygems.org/gems/env-dependencies)
|
2
|
+
|
3
|
+
Ruby gem for defining which environment variables must be set in order for your Rails application to function properly.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'env-dependencies'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Define an `env_dependencies` array in `config/application.rb` like so:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
class Application < Rails::Application
|
25
|
+
config.env_dependencies = [
|
26
|
+
"CDN_URL",
|
27
|
+
"JAVA_HOME",
|
28
|
+
"ROLLBAR_ACCESS_TOKEN",
|
29
|
+
"UI_DIR"
|
30
|
+
]
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
When your Rails application starts, an error will be raised immediately if any environment variables are not set. A nice precautionary measure!
|
35
|
+
|
36
|
+
## Related
|
37
|
+
|
38
|
+
If you find this gem useful, you may also like [path-dependencies](https://github.com/lukehorvat/path-dependencies).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'env-dependencies/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "env-dependencies"
|
8
|
+
spec.version = EnvDependencies::VERSION
|
9
|
+
spec.authors = ["Luke Horvat"]
|
10
|
+
spec.email = ["lukehorvat@gmail.com"]
|
11
|
+
spec.summary = %q{Ruby gem for defining which environment variables must be set in order for your Rails application to function properly.}
|
12
|
+
spec.description = %q{Ruby gem for defining which environment variables must be set in order for your Rails application to function properly.}
|
13
|
+
spec.homepage = "https://github.com/lukehorvat/env-dependencies"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
18
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module EnvDependencies
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
config.before_initialize do
|
4
|
+
config.env_dependencies.select do |dependency|
|
5
|
+
!ENV.key?(dependency)
|
6
|
+
end.each do |dependency|
|
7
|
+
raise "Required environment variable '#{dependency}' is not set."
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: env-dependencies
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luke Horvat
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Ruby gem for defining which environment variables must be set in order
|
42
|
+
for your Rails application to function properly.
|
43
|
+
email:
|
44
|
+
- lukehorvat@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- env-dependencies.gemspec
|
55
|
+
- lib/env-dependencies.rb
|
56
|
+
- lib/env-dependencies/railtie.rb
|
57
|
+
- lib/env-dependencies/version.rb
|
58
|
+
homepage: https://github.com/lukehorvat/env-dependencies
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.2.5
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Ruby gem for defining which environment variables must be set in order for
|
82
|
+
your Rails application to function properly.
|
83
|
+
test_files: []
|