ecs_compose 0.1.0.pre34 → 0.1.0.pre35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/ecs-compose +17 -4
- data/lib/ecs_compose/json_generator.rb +4 -0
- data/lib/ecs_compose/manifest.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bb09918be5f55c4f0a05e995f8cf86d68ff5b03
|
4
|
+
data.tar.gz: 2d83241f8d2554fee75f124d89c601fbceea1a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87c4afe23b5a89d5d876414247bafc9a86a20bdd49a25f77c0cf58aff445faddb58cc27a922e0b0d64ae8204cdad6942360787bc37a56bf70366af3191402e91
|
7
|
+
data.tar.gz: 953e9df937866505b1bd718e6fe376d3ca96f81923a72a3adc76af588c36ace2ce0813da2a0335b202cc7bbc8e663c80c85a4a270b4fe42627a656fd45e60491
|
data/exe/ecs-compose
CHANGED
@@ -18,6 +18,10 @@ Usage:
|
|
18
18
|
Options:
|
19
19
|
-h, --help Show this help message
|
20
20
|
--version Print the version of this program
|
21
|
+
-c, --cage-export <export>
|
22
|
+
A directory of `docker-compose.yml` files exported
|
23
|
+
from cage (defaults to export/, takes precedence over
|
24
|
+
--file)
|
21
25
|
-m, --manifest <manifest>
|
22
26
|
Path to an ecs-compose manifest (defaults to
|
23
27
|
deploy/DEPLOY-MANIFEST.yml, takes precedence over --file)
|
@@ -54,6 +58,7 @@ DOCOPT
|
|
54
58
|
class App
|
55
59
|
include EcsCompose
|
56
60
|
|
61
|
+
DEFAULT_CAGE_EXPORT = "export"
|
57
62
|
DEFAULT_FILE = "docker-compose.yml"
|
58
63
|
DEFAULT_MANIFEST = "deploy/DEPLOY-MANIFEST.yml"
|
59
64
|
|
@@ -110,7 +115,7 @@ class App
|
|
110
115
|
fatal_err("Cannot find task '#{task_name}'")
|
111
116
|
|
112
117
|
env = options.fetch('-e').flatten.inject({}) do |hsh, e_opt|
|
113
|
-
e_opt =~ /\A([^=]+)=(.*)/ or
|
118
|
+
e_opt =~ /\A([^=]+)=(.*)/ or
|
114
119
|
fatal_err "Can't parse '-e #{e_opt}'"
|
115
120
|
hsh[$1] = $2
|
116
121
|
hsh
|
@@ -166,7 +171,7 @@ class App
|
|
166
171
|
end
|
167
172
|
end
|
168
173
|
|
169
|
-
found = manifest.task_definitions.find {|td| td.name } or
|
174
|
+
found = manifest.task_definitions.find {|td| td.name == task_definition } or
|
170
175
|
fatal_err("Can't find task definition: #{task_definition}")
|
171
176
|
puts found.to_json
|
172
177
|
end
|
@@ -178,17 +183,21 @@ class App
|
|
178
183
|
available
|
179
184
|
else
|
180
185
|
available.select {|td| names.include?(td.name) }
|
181
|
-
end
|
186
|
+
end
|
182
187
|
end
|
183
188
|
|
184
189
|
# Figure out whether we have a manifest or a docker-compose.yml. We
|
185
190
|
# check supplied flags first, then defaults, and we prefer manifests
|
186
191
|
# when there's a tie.
|
187
192
|
def mode
|
188
|
-
if options.fetch('--
|
193
|
+
if options.fetch('--cage-export')
|
194
|
+
:cage_export
|
195
|
+
elsif options.fetch('--manifest')
|
189
196
|
:manifest
|
190
197
|
elsif options.fetch('--file')
|
191
198
|
:file
|
199
|
+
elsif Dir.exist?(DEFAULT_CAGE_EXPORT)
|
200
|
+
:cage_export
|
192
201
|
elsif File.exist?(DEFAULT_MANIFEST)
|
193
202
|
:manifest
|
194
203
|
elsif File.exist?(DEFAULT_FILE)
|
@@ -203,6 +212,10 @@ class App
|
|
203
212
|
def load_manifest
|
204
213
|
project_name = options.fetch("--project-name") || nil
|
205
214
|
case mode
|
215
|
+
when :cage_export
|
216
|
+
Manifest.read_from_cage_export(options.fetch('--cage-export') ||
|
217
|
+
DEFAULT_CAGE_EXPORT,
|
218
|
+
project_name)
|
206
219
|
when :manifest
|
207
220
|
Manifest.read_from_manifest(options.fetch('--manifest') || DEFAULT_MANIFEST,
|
208
221
|
project_name)
|
@@ -19,6 +19,10 @@ module EcsCompose
|
|
19
19
|
|
20
20
|
# Generate an ECS task definition as a raw Ruby hash.
|
21
21
|
def generate
|
22
|
+
if @yaml.has_key?("version")
|
23
|
+
@yaml = @yaml.fetch("services")
|
24
|
+
end
|
25
|
+
|
22
26
|
# Generate JSON for our containers.
|
23
27
|
containers = @yaml.map do |name, fields|
|
24
28
|
# Skip this service if we've been given a list to emit, and
|
data/lib/ecs_compose/manifest.rb
CHANGED
@@ -25,6 +25,23 @@ module EcsCompose
|
|
25
25
|
new(defs)
|
26
26
|
end
|
27
27
|
|
28
|
+
def read_from_cage_export(path, project_name)
|
29
|
+
defs = []
|
30
|
+
for file in Dir.glob(File.join(path, "*.yml"))
|
31
|
+
name = File.basename(file, ".yml")
|
32
|
+
defs << TaskDefinition.new(:service,
|
33
|
+
compound_name(project_name, name),
|
34
|
+
File.read(file))
|
35
|
+
end
|
36
|
+
for file in Dir.glob(File.join(path, "tasks/*.yml"))
|
37
|
+
name = File.basename(file, ".yml")
|
38
|
+
defs << TaskDefinition.new(:task,
|
39
|
+
compound_name(project_name, name),
|
40
|
+
File.read(file))
|
41
|
+
end
|
42
|
+
new(defs)
|
43
|
+
end
|
44
|
+
|
28
45
|
private
|
29
46
|
|
30
47
|
# If we've been supplied with a `project_name`, build a compound name.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecs_compose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kidd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|