env_json 0.2.1 → 0.2.2
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 +4 -4
- data/LICENSE.md +20 -0
- data/README.md +3 -1
- data/env_json.gemspec +1 -0
- data/lib/env_json/rails_tasks.rb +3 -1
- data/lib/env_json/railtie.rb +5 -2
- data/lib/env_json/version.rb +1 -1
- 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: 85559db959c60fd0ff307344a79c27d66770c657
|
4
|
+
data.tar.gz: b044f5ba3948635c8511530afc795f3e1d131c90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0580dbdb48f388217042b560af57afba67dd9edd3e95c48805c8cbb27c9bb10aa919083b5ebc5edb5a9d778ab3620c311e1ac3c2b3386080a7ab5319f79db31
|
7
|
+
data.tar.gz: 927d853dcb0c7aef14d7984d44ea2124e36a2a33d1c140d8e3d31ddc2e17029ea11f849aae43f96061e883c29d2eef5107184a203a781c08a97427fc9fbfbfab
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 hellvinz
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -47,9 +47,11 @@ About the JSON format:
|
|
47
47
|
export env variables defined in config/env.json to Amazon ElasticBeanstalk environment
|
48
48
|
|
49
49
|
```
|
50
|
-
bundle exec rake env_json:eb
|
50
|
+
RAILS_ENV=production bundle exec rake env_json:eb
|
51
51
|
```
|
52
52
|
|
53
|
+
You should pass RAILS_ENV. EnvJson can't figure out which environment you're targeting alone.
|
54
|
+
|
53
55
|
## Development
|
54
56
|
|
55
57
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/env_json.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = EnvJson::VERSION
|
9
9
|
spec.authors = ["Vincent Hellot"]
|
10
10
|
spec.email = ["hellvinz@gmail.com"]
|
11
|
+
spec.license = "MIT"
|
11
12
|
|
12
13
|
spec.summary = %q{Load ENV variables from a JSON file}
|
13
14
|
spec.description = %q{Load ENV variables from a JSON file. Usefull with ejson https://github.com/Shopify/ejson}
|
data/lib/env_json/rails_tasks.rb
CHANGED
@@ -8,7 +8,9 @@ namespace :env_json do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
desc 'load env into ElasticBeanstalk'
|
11
|
-
task eb
|
11
|
+
task :eb do
|
12
|
+
EnvJson.load_env_from_source_with_overrides(Rails.root.join('config/env.json'), ENV.fetch('RAILS_ENV'))
|
13
|
+
|
12
14
|
eb_formated_env = EnvJson.env.map{|key,value| "#{Shellwords.escape key}=#{Shellwords.escape value}" }.join(' ')
|
13
15
|
begin
|
14
16
|
PTY.spawn("eb setenv -v #{eb_formated_env}") do |stdin, stdout, pid|
|
data/lib/env_json/railtie.rb
CHANGED
@@ -4,8 +4,11 @@ module EnvJson
|
|
4
4
|
config.before_configuration { load_env }
|
5
5
|
|
6
6
|
# railtie hook to load env with Rails.env as environment name and config/env.json files as source
|
7
|
-
def load_env
|
8
|
-
|
7
|
+
def load_env()
|
8
|
+
env_json_file = Rails.root.join('config/env.json')
|
9
|
+
environment_name = Rails.env
|
10
|
+
puts "EnvJson: file #{env_json_file} does not exists" && return unless File.exists? env_json_file
|
11
|
+
EnvJson.load_env_from_source_with_overrides(env_json_file, environment_name)
|
9
12
|
end
|
10
13
|
|
11
14
|
rake_tasks do
|
data/lib/env_json/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: env_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Hellot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- ".travis.yml"
|
106
106
|
- CODE_OF_CONDUCT.md
|
107
107
|
- Gemfile
|
108
|
+
- LICENSE.md
|
108
109
|
- README.md
|
109
110
|
- Rakefile
|
110
111
|
- bin/console
|
@@ -116,7 +117,8 @@ files:
|
|
116
117
|
- lib/env_json/railtie.rb
|
117
118
|
- lib/env_json/version.rb
|
118
119
|
homepage: http://github.com/hellvinz/env_json
|
119
|
-
licenses:
|
120
|
+
licenses:
|
121
|
+
- MIT
|
120
122
|
metadata:
|
121
123
|
allowed_push_host: https://rubygems.org
|
122
124
|
post_install_message:
|