ufo 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +29 -72
- data/README.md +10 -7
- data/lib/ufo/dsl/outputter.rb +2 -2
- data/lib/ufo/dsl/task_definition.rb +32 -2
- data/lib/ufo/version.rb +1 -1
- data/spec/spec_helper.rb +3 -2
- data/ufo.gemspec +1 -3
- metadata +4 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a28bfa86e91d3ea36a942ebd7685507a9463b1
|
4
|
+
data.tar.gz: fe27b4aedda9f25ba87f919a78cd9d2f793c6c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0de91d904e57382fd4efbf827b4902803c5c79ec21824666c4a84b3c22b4d46cc89e942f21bf24142c61ae557b9fda8f8048c3d3cc5669cc4198319f90e70be0
|
7
|
+
data.tar.gz: c442de506a8cf9700049a74314498ea8a715138ec397185c95292d8a2ebf99853c0830bec440ab83932f3467ccae6ef4b54201055174c489e18f97869234dc64
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.1.0]
|
7
|
+
|
8
|
+
* print out useful error for ERB template errors
|
9
|
+
|
6
10
|
## [1.0.1]
|
7
11
|
|
8
12
|
* simplify `ufo task` command option
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ufo (
|
4
|
+
ufo (1.1.0)
|
5
5
|
aws-sdk
|
6
6
|
colorize
|
7
7
|
deep_merge
|
@@ -20,94 +20,53 @@ GEM
|
|
20
20
|
minitest (~> 5.1)
|
21
21
|
thread_safe (~> 0.3, >= 0.3.4)
|
22
22
|
tzinfo (~> 1.1)
|
23
|
-
aws-sdk (2.9.
|
24
|
-
aws-sdk-resources (= 2.9.
|
25
|
-
aws-sdk-core (2.9.
|
23
|
+
aws-sdk (2.9.25)
|
24
|
+
aws-sdk-resources (= 2.9.25)
|
25
|
+
aws-sdk-core (2.9.25)
|
26
26
|
aws-sigv4 (~> 1.0)
|
27
27
|
jmespath (~> 1.0)
|
28
|
-
aws-sdk-resources (2.9.
|
29
|
-
aws-sdk-core (= 2.9.
|
28
|
+
aws-sdk-resources (2.9.25)
|
29
|
+
aws-sdk-core (= 2.9.25)
|
30
30
|
aws-sigv4 (1.0.0)
|
31
31
|
builder (3.2.3)
|
32
32
|
byebug (9.0.6)
|
33
|
-
codeclimate-test-reporter (0.
|
34
|
-
simplecov (
|
35
|
-
coderay (1.1.1)
|
33
|
+
codeclimate-test-reporter (1.0.8)
|
34
|
+
simplecov (<= 0.13)
|
36
35
|
colorize (0.8.1)
|
37
36
|
deep_merge (1.1.1)
|
38
|
-
diff-lcs (1.
|
37
|
+
diff-lcs (1.3)
|
39
38
|
docile (1.1.5)
|
40
|
-
ffi (1.9.14)
|
41
|
-
formatador (0.2.5)
|
42
|
-
guard (2.14.0)
|
43
|
-
formatador (>= 0.2.4)
|
44
|
-
listen (>= 2.7, < 4.0)
|
45
|
-
lumberjack (~> 1.0)
|
46
|
-
nenv (~> 0.1)
|
47
|
-
notiffany (~> 0.0)
|
48
|
-
pry (>= 0.9.12)
|
49
|
-
shellany (~> 0.0)
|
50
|
-
thor (>= 0.18.1)
|
51
|
-
guard-bundler (2.1.0)
|
52
|
-
bundler (~> 1.0)
|
53
|
-
guard (~> 2.2)
|
54
|
-
guard-compat (~> 1.1)
|
55
|
-
guard-compat (1.2.1)
|
56
|
-
guard-rspec (4.7.3)
|
57
|
-
guard (~> 2.1)
|
58
|
-
guard-compat (~> 1.1)
|
59
|
-
rspec (>= 2.99.0, < 4.0)
|
60
39
|
hashie (3.5.5)
|
61
|
-
i18n (0.8.
|
40
|
+
i18n (0.8.3)
|
62
41
|
jmespath (1.3.1)
|
63
|
-
json (2.0
|
64
|
-
|
65
|
-
rb-fsevent (~> 0.9, >= 0.9.4)
|
66
|
-
rb-inotify (~> 0.9, >= 0.9.7)
|
67
|
-
ruby_dep (~> 1.2)
|
68
|
-
lumberjack (1.0.10)
|
69
|
-
method_source (0.8.2)
|
70
|
-
minitest (5.10.1)
|
71
|
-
nenv (0.3.0)
|
72
|
-
notiffany (0.1.1)
|
73
|
-
nenv (~> 0.1)
|
74
|
-
shellany (~> 0.0)
|
42
|
+
json (2.1.0)
|
43
|
+
minitest (5.10.2)
|
75
44
|
plissken (0.3.0)
|
76
45
|
symbolize (~> 4.2)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
rspec (3.5.0)
|
86
|
-
rspec-core (~> 3.5.0)
|
87
|
-
rspec-expectations (~> 3.5.0)
|
88
|
-
rspec-mocks (~> 3.5.0)
|
89
|
-
rspec-core (3.5.3)
|
90
|
-
rspec-support (~> 3.5.0)
|
91
|
-
rspec-expectations (3.5.0)
|
46
|
+
rake (12.0.0)
|
47
|
+
rspec (3.6.0)
|
48
|
+
rspec-core (~> 3.6.0)
|
49
|
+
rspec-expectations (~> 3.6.0)
|
50
|
+
rspec-mocks (~> 3.6.0)
|
51
|
+
rspec-core (3.6.0)
|
52
|
+
rspec-support (~> 3.6.0)
|
53
|
+
rspec-expectations (3.6.0)
|
92
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
93
|
-
rspec-support (~> 3.
|
94
|
-
rspec-mocks (3.
|
55
|
+
rspec-support (~> 3.6.0)
|
56
|
+
rspec-mocks (3.6.0)
|
95
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
-
rspec-support (~> 3.
|
97
|
-
rspec-support (3.
|
98
|
-
|
99
|
-
shellany (0.0.1)
|
100
|
-
simplecov (0.12.0)
|
58
|
+
rspec-support (~> 3.6.0)
|
59
|
+
rspec-support (3.6.0)
|
60
|
+
simplecov (0.13.0)
|
101
61
|
docile (~> 1.1.0)
|
102
62
|
json (>= 1.8, < 3)
|
103
63
|
simplecov-html (~> 0.10.0)
|
104
|
-
simplecov-html (0.10.
|
105
|
-
slop (3.6.0)
|
64
|
+
simplecov-html (0.10.1)
|
106
65
|
symbolize (4.5.2)
|
107
66
|
activemodel (>= 3.2, < 5)
|
108
67
|
activesupport (>= 3.2, < 5)
|
109
68
|
i18n
|
110
|
-
thor (0.19.
|
69
|
+
thor (0.19.4)
|
111
70
|
thread_safe (0.3.6)
|
112
71
|
tzinfo (1.2.3)
|
113
72
|
thread_safe (~> 0.1)
|
@@ -119,11 +78,9 @@ DEPENDENCIES
|
|
119
78
|
bundler (~> 1.3)
|
120
79
|
byebug
|
121
80
|
codeclimate-test-reporter
|
122
|
-
guard
|
123
|
-
guard-bundler
|
124
|
-
guard-rspec
|
125
81
|
rake
|
82
|
+
rspec
|
126
83
|
ufo!
|
127
84
|
|
128
85
|
BUNDLED WITH
|
129
|
-
1.
|
86
|
+
1.15.0
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ufo - A Easy Way to Build and Ship Docker Images AWS ECS
|
1
|
+
# Ufo - A Easy Way to Build and Ship Docker Images to AWS ECS
|
2
2
|
|
3
3
|
[![CircleCI](https://circleci.com/gh/tongueroo/ufo.svg?style=svg)](https://circleci.com/gh/tongueroo/ufo)
|
4
4
|
|
@@ -22,7 +22,10 @@ Ufo deploys a task definition that is created via a template generator which is
|
|
22
22
|
|
23
23
|
$ gem install ufo
|
24
24
|
|
25
|
-
Dependencies
|
25
|
+
### Dependencies
|
26
|
+
|
27
|
+
* Docker: You will need a working version of [Docker](https://docs.docker.com/engine/installation/) installed as ufo shells out and calls the `docker` command.
|
28
|
+
* AWS: Set up your AWS credentials at `~/.aws/credentials` and `~/.aws/config`. This is the [AWS standard way of setting up credentials](https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/).
|
26
29
|
|
27
30
|
## Quick Usage
|
28
31
|
|
@@ -31,7 +34,7 @@ Dependencies: You will need a working version of docker installed as ufo shells
|
|
31
34
|
To execute the ship process run:
|
32
35
|
|
33
36
|
```bash
|
34
|
-
ufo ship hi-web-prod--cluster mycluster
|
37
|
+
ufo ship hi-web-prod --cluster mycluster
|
35
38
|
```
|
36
39
|
|
37
40
|
Note, if you have configured `ufo/settings.yml` to map hi-web-prod to the `mycluster` cluster using the service_cluster option the command becomes simply:
|
@@ -181,12 +184,12 @@ This is easily accomplished with the `bin/deploy` wrapper script that the `ufo i
|
|
181
184
|
```bash
|
182
185
|
#!/bin/bash -xe
|
183
186
|
|
184
|
-
ufo ship hi-worker --cluster stag --no-wait
|
185
|
-
ufo ship hi-clock --cluster stag --no-wait --no-docker
|
186
|
-
ufo ship hi-web-prod--cluster stag --no-docker
|
187
|
+
ufo ship hi-worker-prod --cluster stag --no-wait
|
188
|
+
ufo ship hi-clock-prod --cluster stag --no-wait --no-docker
|
189
|
+
ufo ship hi-web-prod --cluster stag --no-docker
|
187
190
|
```
|
188
191
|
|
189
|
-
The first `ufo ship hi-worker` command build and ships docker image to ECS, but the following two `ufo ship` commands use the `--no-docker` flag to skip the `docker build` step. `ufo ship` will use the last built docker image as the image to be shipped. For those curious, this is stored in `ufo/docker_image_name_ufo.txt`.
|
192
|
+
The first `ufo ship hi-worker-prod` command build and ships docker image to ECS, but the following two `ufo ship` commands use the `--no-docker` flag to skip the `docker build` step. `ufo ship` will use the last built docker image as the image to be shipped. For those curious, this is stored in `ufo/docker_image_name_ufo.txt`.
|
190
193
|
|
191
194
|
### Service and Task Names Convention
|
192
195
|
|
data/lib/ufo/dsl/outputter.rb
CHANGED
@@ -13,8 +13,8 @@ module Ufo
|
|
13
13
|
FileUtils.rm_rf(output_path) if @options[:clean]
|
14
14
|
FileUtils.mkdir(output_path) unless File.exist?(output_path)
|
15
15
|
|
16
|
-
path = "#{output_path}/#{@name}.json"
|
17
|
-
puts "
|
16
|
+
path = "#{output_path}/#{@name}.json".sub(/^\.\//,'')
|
17
|
+
puts " #{path}" unless @options[:quiet]
|
18
18
|
validate(@erb_result, path)
|
19
19
|
json = @pretty ?
|
20
20
|
JSON.pretty_generate(JSON.parse(@erb_result)) :
|
@@ -20,10 +20,40 @@ module Ufo
|
|
20
20
|
|
21
21
|
def build
|
22
22
|
instance_eval(&@block)
|
23
|
-
|
24
|
-
ERB.new(erb_template).result(binding)
|
23
|
+
erb_result(source_path)
|
25
24
|
end
|
26
25
|
|
26
|
+
def erb_result(path)
|
27
|
+
template = IO.read(path)
|
28
|
+
begin
|
29
|
+
ERB.new(template, nil, "-").result(binding)
|
30
|
+
rescue Exception => e
|
31
|
+
puts e
|
32
|
+
|
33
|
+
# how to know where ERB stopped? - https://www.ruby-forum.com/topic/182051
|
34
|
+
# syntax errors have the (erb):xxx info in e.message
|
35
|
+
# undefined variables have (erb):xxx info in e.backtrac
|
36
|
+
error_info = e.message.split("\n").grep(/\(erb\)/)[0]
|
37
|
+
error_info ||= e.backtrace.grep(/\(erb\)/)[0]
|
38
|
+
raise unless error_info # unable to find the (erb):xxx: error line
|
39
|
+
line = error_info.split(':')[1].to_i
|
40
|
+
puts "Error evaluating ERB template on line #{line.to_s.colorize(:red)} of: #{path.sub(/^\.\//, '')}"
|
41
|
+
|
42
|
+
template_lines = template.split("\n")
|
43
|
+
context = 5 # lines of context
|
44
|
+
top, bottom = [line-context-1, 0].max, line+context-1
|
45
|
+
spacing = template_lines.size.to_s.size
|
46
|
+
template_lines[top..bottom].each_with_index do |line_content, index|
|
47
|
+
line_number = top+index+1
|
48
|
+
if line_number == line
|
49
|
+
printf("%#{spacing}d %s\n".colorize(:red), line_number, line_content)
|
50
|
+
else
|
51
|
+
printf("%#{spacing}d %s\n", line_number, line_content)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
exit 1 unless ENV['TEST']
|
55
|
+
end
|
56
|
+
end
|
27
57
|
# at this point instance_eval has been called and source has possibly been called
|
28
58
|
def source(name)
|
29
59
|
@source = name
|
data/lib/ufo/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,9 @@ ENV['TEST'] = '1'
|
|
3
3
|
require "codeclimate-test-reporter"
|
4
4
|
CodeClimate::TestReporter.start
|
5
5
|
|
6
|
+
# Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
|
7
|
+
ENV['HOME'] = "spec/fixtures/home"
|
8
|
+
|
6
9
|
require "pp"
|
7
10
|
require "byebug"
|
8
11
|
|
@@ -27,7 +30,5 @@ RSpec.configure do |c|
|
|
27
30
|
c.include Helpers
|
28
31
|
|
29
32
|
c.before(:each) do
|
30
|
-
# ensures we never called real aws api since the fixture home folder does not have ~/.aws/credentails setup
|
31
|
-
ENV['HOME'] = "spec/fixtures/home"
|
32
33
|
end
|
33
34
|
end
|
data/ufo.gemspec
CHANGED
@@ -28,7 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
29
|
spec.add_development_dependency "byebug"
|
30
30
|
spec.add_development_dependency "rake"
|
31
|
-
spec.add_development_dependency "
|
32
|
-
spec.add_development_dependency "guard-bundler"
|
33
|
-
spec.add_development_dependency "guard-rspec"
|
31
|
+
spec.add_development_dependency "rspec"
|
34
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -137,35 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: guard-bundler
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: guard-rspec
|
140
|
+
name: rspec
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
170
142
|
requirements:
|
171
143
|
- - ">="
|
@@ -256,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
228
|
version: '0'
|
257
229
|
requirements: []
|
258
230
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.
|
231
|
+
rubygems_version: 2.6.11
|
260
232
|
signing_key:
|
261
233
|
specification_version: 4
|
262
234
|
summary: Build Docker Containers and Ship Them to AWS ECS
|