env_json 0.2.2 → 0.3.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: 85559db959c60fd0ff307344a79c27d66770c657
4
- data.tar.gz: b044f5ba3948635c8511530afc795f3e1d131c90
3
+ metadata.gz: 8c8ae56d36f3c3369dbc62ea9da4c1c9a4928e20
4
+ data.tar.gz: cd6644b61fb246c79c995506c398a301a6dd966c
5
5
  SHA512:
6
- metadata.gz: a0580dbdb48f388217042b560af57afba67dd9edd3e95c48805c8cbb27c9bb10aa919083b5ebc5edb5a9d778ab3620c311e1ac3c2b3386080a7ab5319f79db31
7
- data.tar.gz: 927d853dcb0c7aef14d7984d44ea2124e36a2a33d1c140d8e3d31ddc2e17029ea11f849aae43f96061e883c29d2eef5107184a203a781c08a97427fc9fbfbfab
6
+ metadata.gz: 44ca45e0312db4d12c4a1655b3348e4601499bd1647640f69575e9a6475ccc03c9d9f25129a1fe644e60e781b7e8649232f3a06e78e4a5a7358117f35900f1bb
7
+ data.tar.gz: c11546087ee1ee4b1ecd47f0e0ef0af490b73ad4f63bda17dfc987b535632aa953dea2c9bd86dec372ac64ab885d4ad6a27852059bb2c77540f08667e412c8e9
data/README.md CHANGED
@@ -52,6 +52,12 @@ RAILS_ENV=production bundle exec rake env_json:eb
52
52
 
53
53
  You should pass RAILS_ENV. EnvJson can't figure out which environment you're targeting alone.
54
54
 
55
+ You can pass ENVIRONMENT_NAME to give AWS ElasticBeanstalk environment name
56
+
57
+ ```
58
+ RAILS_ENV=production ENVIRONMENT_NAME=my-staging-env bundle exec rake env_json:eb
59
+ ```
60
+
55
61
  ## Development
56
62
 
57
63
  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.
@@ -9,11 +9,16 @@ namespace :env_json do
9
9
 
10
10
  desc 'load env into ElasticBeanstalk'
11
11
  task :eb do
12
+ eb_environment_name = ENV['ENVIRONMENT_NAME']
13
+
12
14
  EnvJson.load_env_from_source_with_overrides(Rails.root.join('config/env.json'), ENV.fetch('RAILS_ENV'))
13
15
 
14
16
  eb_formated_env = EnvJson.env.map{|key,value| "#{Shellwords.escape key}=#{Shellwords.escape value}" }.join(' ')
17
+ eb_environment_name_switch = eb_environment_name ? "-e #{eb_environment_name}" : nil
18
+ eb_command = "eb setenv #{eb_environment_name_switch} -v #{eb_formated_env}"
19
+
15
20
  begin
16
- PTY.spawn("eb setenv -v #{eb_formated_env}") do |stdin, stdout, pid|
21
+ PTY.spawn(eb_command) do |stdin, stdout, pid|
17
22
  begin
18
23
  stdin.each { |line| print line }
19
24
  rescue Errno::EIO
@@ -1,4 +1,4 @@
1
1
  module EnvJson
2
2
  # EnvJson version
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
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.2
4
+ version: 0.3.0
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-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler