jack-eb 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/jack/config/download.rb +10 -0
- data/lib/jack/config/transmit.rb +1 -5
- data/lib/jack/version.rb +1 -1
- data/spec/fixtures/project/jack/cfg/{stag-rails-app.cfg.yml → stag-rails-app-s9.cfg.yml} +0 -0
- data/spec/lib/config/download_spec.rb +6 -0
- data/spec/lib/config/transmit_spec.rb +1 -6
- data/spec/spec_helper.rb +6 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b42806f99aa21018cdc2ba15165568982ea5e33
|
4
|
+
data.tar.gz: 45ce60cf95cfc8beea67a41dd604ec90e8121e96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81a1908e5f2fd064c6908f90f23c4d80220ce37f8f85ce696202b878b9bbf6b4f59d6abc70d48b09a92cad715998fe96056950712795280cc1e32854d6747f0
|
7
|
+
data.tar.gz: e5245a9d74159e6c4d28c879b2c8bd5a7d95f0630d767b269bf2dea68a4a0dc10e72531ee2d967200517b568490e9190a22a2f69305cff40108a90dc7b15c1fd
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ In your project folder create a folder call jack/cfg. It might be useful for yo
|
|
49
49
|
$ jack config download [ENVIRONMENT_NAME]
|
50
50
|
</pre>
|
51
51
|
|
52
|
-
The path of config that is saved is based on
|
52
|
+
The path of config that is saved is based on the environment name.
|
53
53
|
|
54
54
|
<pre>
|
55
55
|
$ jack config download stag-rails-app-s1
|
@@ -57,13 +57,13 @@ Downloading config file...
|
|
57
57
|
Running: eb config save --cfg current-2015-03-03_18-40-34 stag-rails-app-s1
|
58
58
|
|
59
59
|
Configuration saved at: /Users/tung/src/rails/.elasticbeanstalk/saved_configs/current-2015-03-03_18-40-34.cfg.yml
|
60
|
-
Writing to local config file: jack/cfg/stag-rails-app.cfg.yml
|
60
|
+
Writing to local config file: jack/cfg/stag-rails-app-s1.cfg.yml
|
61
61
|
Cleaning up eb remote config and local files
|
62
62
|
Config downloaded to jack/cfg/stag-rails-app.cfg.yml
|
63
63
|
$
|
64
64
|
</pre>
|
65
65
|
|
66
|
-
Results in a saved jack/cfg/stag-rails-app.cfg.yml template configuration file.
|
66
|
+
Results in a saved jack/cfg/stag-rails-app-s1.cfg.yml template configuration file. This is overridable.
|
67
67
|
|
68
68
|
<pre>
|
69
69
|
$ jack config download -c myconfig stag-rails-app-s1
|
@@ -83,9 +83,9 @@ Configuration templates hold all the options and settings that we can set for an
|
|
83
83
|
The purpose of the jack/cfg configs is allow us to be able to create environments with a codified configuration file that can be versioned controlled.
|
84
84
|
|
85
85
|
<pre>
|
86
|
-
$ jack create stag-rails-app-s1 # uses the jack/cfg/stag-rails-app.cfg.yml template
|
87
|
-
$ jack create stag-rails-app-s2 #
|
88
|
-
$ jack create -c myconfig stag-rails-app-s3 # creates environment using a config not based on naming convention
|
86
|
+
$ jack create stag-rails-app-s1 # uses the jack/cfg/stag-rails-app-s1.cfg.yml template
|
87
|
+
$ jack create stag-rails-app-s2 # uses the jack/cfg/stag-rails-app-s1.cfg.yml template
|
88
|
+
$ jack create -c myconfig stag-rails-app-s3 # creates environment using a config not based on environment naming convention
|
89
89
|
</pre>
|
90
90
|
|
91
91
|
If the project is brand new and has never had `eb init` ran on it before. For example, a project that has just been git cloned. Then calling any of the jack commands will automatically call `eb init` in the project. `eb init` requires the platform flag in order to avoid prompting. By default, the latest Docker solution stack is used for the platform option. But you can override that by creating an ~/.jack/create.yml or jack/create.yml within the project folder. Here's an [example](https://gist.github.com/tongueroo/086e3c11c4d00d5c39b6). The options from each file is merged using the following precedence: project folder, user home, default that is packaged with this gem. Most of the settings that `jack create` should used should be in the template configuration file though.
|
@@ -100,7 +100,7 @@ To download a template configuration.
|
|
100
100
|
$ jack config download stag-rails-app-s1
|
101
101
|
```
|
102
102
|
|
103
|
-
This will save the config to jack/cfg/stag-rails-app.cfg.yml.
|
103
|
+
This will save the config to jack/cfg/stag-rails-app-s1.cfg.yml.
|
104
104
|
|
105
105
|
#### Upload
|
106
106
|
|
@@ -110,7 +110,7 @@ To upload a template configuration.
|
|
110
110
|
$ jack config upload stag-rails-app-s1
|
111
111
|
```
|
112
112
|
|
113
|
-
This will save the config to jack/cfg/stag-rails-app.cfg.yml. Here's an example of the [output](http://d.pr/i/14Sfh).
|
113
|
+
This will save the config to jack/cfg/stag-rails-app-s1.cfg.yml. Here's an example of the [output](http://d.pr/i/14Sfh).
|
114
114
|
|
115
115
|
Notice that the `eb config upload` command also prompts you with the diff before uploading and ask for confirmation. You can bypass the prompt with the force option.
|
116
116
|
|
data/lib/jack/config/download.rb
CHANGED
@@ -21,12 +21,22 @@ module Jack
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def download
|
24
|
+
add_gitignore
|
24
25
|
get_current_cfg
|
25
26
|
copy_to_local_cfg
|
26
27
|
clean
|
27
28
|
UI.say "Config downloaded to #{@local_config_path}".colorize(:green)
|
28
29
|
end
|
29
30
|
|
31
|
+
def add_gitignore
|
32
|
+
path = "#{@root}/.gitignore"
|
33
|
+
if File.exist?(path)
|
34
|
+
ignores = IO.read(path)
|
35
|
+
has_ignore = ignores.include?("jack/cfg")
|
36
|
+
end
|
37
|
+
do_cmd("echo 'jack/cfg/*.yml' >> #{path}") unless has_ignore
|
38
|
+
end
|
39
|
+
|
30
40
|
def get_current_cfg
|
31
41
|
UI.say "Downloading config file..."
|
32
42
|
eb_config_save
|
data/lib/jack/config/transmit.rb
CHANGED
@@ -15,14 +15,10 @@ module Jack
|
|
15
15
|
|
16
16
|
@saved_configs = "#{@root}/.elasticbeanstalk/saved_configs"
|
17
17
|
|
18
|
-
local_config_name = options[:cfg] ||
|
18
|
+
local_config_name = options[:cfg] || @env_name
|
19
19
|
@local_config_path = "jack/cfg/#{local_config_name}.cfg.yml"
|
20
20
|
end
|
21
21
|
|
22
|
-
def config_name_convention(env_name)
|
23
|
-
env_name.split('-')[0..-2].join('-')
|
24
|
-
end
|
25
|
-
|
26
22
|
def timestamp
|
27
23
|
Time.now.strftime "%Y-%m-%d_%H-%M-%S"
|
28
24
|
end
|
data/lib/jack/version.rb
CHANGED
File without changes
|
@@ -8,18 +8,13 @@ describe Jack::Config do
|
|
8
8
|
let(:transmit) { Jack::Config::Transmit.new(test_options) }
|
9
9
|
|
10
10
|
describe "transmit" do
|
11
|
-
it "config_name_convention" do
|
12
|
-
name = transmit.config_name_convention("stag-rails-app-s9")
|
13
|
-
expect(name).to eq "stag-rails-app"
|
14
|
-
end
|
15
|
-
|
16
11
|
it "timestamp" do
|
17
12
|
timestamp = transmit.timestamp
|
18
13
|
expect(timestamp).to be_a(String)
|
19
14
|
end
|
20
15
|
|
21
16
|
it "extract_name" do
|
22
|
-
name = transmit.extract_name("/app/.elasticbeanstalk/
|
17
|
+
name = transmit.extract_name("/app/.elasticbeanstalk/saved_configs/stag-rails-app.cfg.yml")
|
23
18
|
expect(name).to eq "stag-rails-app"
|
24
19
|
end
|
25
20
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -35,6 +35,8 @@ global:
|
|
35
35
|
default_platform: 64bit Amazon Linux 2014.09 v1.2.0 running Docker 1.3.3
|
36
36
|
EOL
|
37
37
|
path = "#{@root}/.elasticbeanstalk/config.yml"
|
38
|
+
dir = File.dirname(path)
|
39
|
+
FileUtils.mkdir_p(dir) unless File.exist?(path)
|
38
40
|
File.write(path, data) unless File.exist?(path)
|
39
41
|
end
|
40
42
|
|
@@ -44,5 +46,9 @@ RSpec.configure do |c|
|
|
44
46
|
c.include Helpers
|
45
47
|
c.before :all do
|
46
48
|
@root = "spec/fixtures/project"
|
49
|
+
fake_eb_config
|
50
|
+
end
|
51
|
+
c.after :all do
|
52
|
+
FileUtils.rm_f("#{@root}/.gitignore")
|
47
53
|
end
|
48
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jack-eb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -162,7 +162,7 @@ files:
|
|
162
162
|
- lib/jack/util.rb
|
163
163
|
- lib/jack/version.rb
|
164
164
|
- lib/jack/version_checker.rb
|
165
|
-
- spec/fixtures/project/jack/cfg/stag-rails-app.cfg.yml
|
165
|
+
- spec/fixtures/project/jack/cfg/stag-rails-app-s9.cfg.yml
|
166
166
|
- spec/lib/cli_spec.rb
|
167
167
|
- spec/lib/config/diff_spec.rb
|
168
168
|
- spec/lib/config/download_spec.rb
|
@@ -202,7 +202,7 @@ signing_key:
|
|
202
202
|
specification_version: 4
|
203
203
|
summary: Wrapper tool to manage AWS Elastic Beanstalk environments
|
204
204
|
test_files:
|
205
|
-
- spec/fixtures/project/jack/cfg/stag-rails-app.cfg.yml
|
205
|
+
- spec/fixtures/project/jack/cfg/stag-rails-app-s9.cfg.yml
|
206
206
|
- spec/lib/cli_spec.rb
|
207
207
|
- spec/lib/config/diff_spec.rb
|
208
208
|
- spec/lib/config/download_spec.rb
|