figaro2eb 0.0.1 → 0.0.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/README.md +15 -2
- data/bin/figaro2eb +16 -0
- data/figaro2eb-0.0.1.gem +0 -0
- data/lib/figaro2eb/version.rb +1 -1
- data/lib/figaro2eb.rb +24 -11
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 63332cd31587acf635ecf0606de1715570c87272
|
|
4
|
+
data.tar.gz: a0ae94554b829a7b56035cf36c7d00be80995041
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ced6089da9d5e857fb6f9a16188b4e9c1ca691c3f532cf768fd85b99f2361b1f388d7f25ea459c6bc4a79d6aa6793b02eb76f7ca3fecbdd5ef699544a7bb0776
|
|
7
|
+
data.tar.gz: 9ae80a36f86b991a6795416fc11065263842b4fa0a122f2a500667f67135e5410f6eac916ee10850baf9e8d26339a1ebeb108ffb0af1c1806d3b8f8c604a4cbb
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Figaro2eb
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generates a shell script from Figaro's application.yml to set environment variables on an Elastic Beanstalk instance.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -20,7 +20,20 @@ Or install it yourself as:
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
1. Install the gem
|
|
24
|
+
```
|
|
25
|
+
gem install figaro2eb
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. Go to your Rails app's root directory
|
|
29
|
+
```
|
|
30
|
+
cd /path/to/application
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. Run it!
|
|
34
|
+
```
|
|
35
|
+
figaro2eb target_rails_env target_eb_env
|
|
36
|
+
```
|
|
24
37
|
|
|
25
38
|
## Contributing
|
|
26
39
|
|
data/bin/figaro2eb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
begin
|
|
3
|
+
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
4
|
+
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
|
5
|
+
require 'figaro2eb'
|
|
6
|
+
rescue LoadError
|
|
7
|
+
require 'rubygems'
|
|
8
|
+
require 'figaro2eb'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
begin
|
|
12
|
+
Figaro2eb::Application.new.run
|
|
13
|
+
rescue Errno::ENOENT => err
|
|
14
|
+
$stderr.puts "figaro2eb: #{err.message}"
|
|
15
|
+
exit(1)
|
|
16
|
+
end
|
data/figaro2eb-0.0.1.gem
ADDED
|
Binary file
|
data/lib/figaro2eb/version.rb
CHANGED
data/lib/figaro2eb.rb
CHANGED
|
@@ -5,6 +5,9 @@ module Figaro2eb
|
|
|
5
5
|
class Application
|
|
6
6
|
|
|
7
7
|
def initialize
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def run
|
|
8
11
|
self.check_args
|
|
9
12
|
self.load_application_yml
|
|
10
13
|
self.create_script
|
|
@@ -13,7 +16,7 @@ module Figaro2eb
|
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
def check_args
|
|
16
|
-
if
|
|
19
|
+
if ARGV.length != 2
|
|
17
20
|
puts "USAGE: figaro2eb target_rails_env target_eb_env"
|
|
18
21
|
exit
|
|
19
22
|
end
|
|
@@ -21,19 +24,29 @@ module Figaro2eb
|
|
|
21
24
|
|
|
22
25
|
# Load in YAML file
|
|
23
26
|
def load_application_yml
|
|
24
|
-
|
|
27
|
+
begin
|
|
28
|
+
@keys = YAML.load_file('config/application.yml')
|
|
29
|
+
rescue
|
|
30
|
+
puts "Cannot find config/application.yml. Are you in your Rails root directory?"
|
|
31
|
+
exit
|
|
32
|
+
end
|
|
25
33
|
end
|
|
26
34
|
|
|
27
35
|
# Create bash script
|
|
28
36
|
def create_script
|
|
29
|
-
|
|
37
|
+
begin
|
|
38
|
+
@script = File.open('create-env-vars.sh', 'w')
|
|
39
|
+
rescue
|
|
40
|
+
puts "Cannot open create-env-vars.sh. Please try again."
|
|
41
|
+
exit
|
|
42
|
+
end
|
|
30
43
|
end
|
|
31
44
|
|
|
32
45
|
# Add the script to your .gitignore
|
|
33
46
|
def add_script_to_gitignore
|
|
34
47
|
if File.readlines(".gitignore").grep(/create-env-vars.sh/).size == 0
|
|
35
48
|
open('.gitignore', 'a') do |file|
|
|
36
|
-
|
|
49
|
+
file << "create-env-vars.sh\n"
|
|
37
50
|
end
|
|
38
51
|
end
|
|
39
52
|
end
|
|
@@ -41,20 +54,20 @@ module Figaro2eb
|
|
|
41
54
|
# Generate script
|
|
42
55
|
def generate_script
|
|
43
56
|
# Make sure it's bash!
|
|
44
|
-
@
|
|
57
|
+
@script.write("#!/bin/bash\n")
|
|
45
58
|
|
|
46
59
|
# Write out the command...
|
|
47
|
-
@
|
|
60
|
+
@script.write("eb setenv ")
|
|
48
61
|
|
|
49
62
|
self.push_keys
|
|
50
|
-
self.
|
|
63
|
+
self.push_eb_environment
|
|
51
64
|
end
|
|
52
65
|
|
|
53
66
|
# Push the keys that are at the top level
|
|
54
67
|
def push_keys
|
|
55
68
|
@keys.each do |key, value|
|
|
56
69
|
if value.is_a? String
|
|
57
|
-
@
|
|
70
|
+
@script.write("#{key}='#{value}' ")
|
|
58
71
|
else
|
|
59
72
|
self.rails_environment_check key
|
|
60
73
|
end
|
|
@@ -69,19 +82,19 @@ module Figaro2eb
|
|
|
69
82
|
|
|
70
83
|
def push_environment_keys key
|
|
71
84
|
@keys[key].each do |key, value|
|
|
72
|
-
@
|
|
85
|
+
@script.write("#{key}='#{value}' ")
|
|
73
86
|
self.check_if_value_empty key, value
|
|
74
87
|
end
|
|
75
88
|
end
|
|
76
89
|
|
|
77
90
|
def check_if_value_empty key, value
|
|
78
91
|
if value.empty?
|
|
79
|
-
puts "The value of #{key} is empty. You
|
|
92
|
+
puts "The value of #{key} is empty. You will have to manually add this to the EB configuration."
|
|
80
93
|
end
|
|
81
94
|
end
|
|
82
95
|
|
|
83
96
|
def push_eb_environment
|
|
84
|
-
@
|
|
97
|
+
@script.write("-e #{ARGV[1]}")
|
|
85
98
|
end
|
|
86
99
|
end
|
|
87
100
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: figaro2eb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kerr
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-01-
|
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -42,7 +42,8 @@ description: Generates a shell script from Figaro's application.yml to set envir
|
|
|
42
42
|
variables on an Elastic Beanstalk instance.
|
|
43
43
|
email:
|
|
44
44
|
- andrewjkerr47@gmail.com
|
|
45
|
-
executables:
|
|
45
|
+
executables:
|
|
46
|
+
- figaro2eb
|
|
46
47
|
extensions: []
|
|
47
48
|
extra_rdoc_files: []
|
|
48
49
|
files:
|
|
@@ -51,6 +52,8 @@ files:
|
|
|
51
52
|
- LICENSE.txt
|
|
52
53
|
- README.md
|
|
53
54
|
- Rakefile
|
|
55
|
+
- bin/figaro2eb
|
|
56
|
+
- figaro2eb-0.0.1.gem
|
|
54
57
|
- figaro2eb.gemspec
|
|
55
58
|
- lib/figaro2eb.rb
|
|
56
59
|
- lib/figaro2eb/version.rb
|