ecs_compose 0.1.0.pre20 → 0.1.0.pre21
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 +10 -2
- data/lib/ecs_compose/manifest.rb +29 -14
- 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: 55d8fcc5850ff69d5a1e58e11aa5a8f2833fd88a
|
4
|
+
data.tar.gz: 60e180a4221b945ef1e5751c77c5c17b8a8b9482
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e15686e4f614e94e2016b2eb2575f44801b7440ad1bca95b77293270eef9009ca88aec87a5c0d55787e1af6b0f08d1e1954605350143bc19b95a77a46829673e
|
7
|
+
data.tar.gz: 2de5e884c78d17fedadea416f98debad47e17ee05ed8c25432a80f6693646fb84a68d5aef0d13c9ef79f8126ceabdd793c95173f4121de7c27248a93701d615a
|
data/exe/ecs-compose
CHANGED
@@ -26,6 +26,12 @@ Options:
|
|
26
26
|
-i, --file-info (task:<name> | service:<name>)
|
27
27
|
Specify the task type and task name for a
|
28
28
|
docker-compose.yml file
|
29
|
+
-p, --project-name <project-name>
|
30
|
+
Will be prepended to the names of task definitions
|
31
|
+
and services, to permit running multiple versions of
|
32
|
+
an app on a single cluster. If your task name is
|
33
|
+
"foo", and your project name is "staging", then it
|
34
|
+
will be registered and run as "staging-foo".
|
29
35
|
--cluster <cluster> ECS cluster to use [default: default]
|
30
36
|
-e <name>=<value> Set an environment variable
|
31
37
|
--entrypoint <entrypoint>
|
@@ -195,9 +201,11 @@ class App
|
|
195
201
|
# Create a manifest, either by reading it in, or synthesizing it from a
|
196
202
|
# `docker-compose.yml` file and some extra arguments.
|
197
203
|
def load_manifest
|
204
|
+
project_name = options.fetch("--project-name") || nil
|
198
205
|
case mode
|
199
206
|
when :manifest
|
200
|
-
Manifest.read_from_manifest(options.fetch('--manifest') || DEFAULT_MANIFEST
|
207
|
+
Manifest.read_from_manifest(options.fetch('--manifest') || DEFAULT_MANIFEST,
|
208
|
+
project_name)
|
201
209
|
when :file
|
202
210
|
info = options.fetch('--file-info')
|
203
211
|
if info.nil?
|
@@ -208,7 +216,7 @@ class App
|
|
208
216
|
end
|
209
217
|
type, name = $1, $2
|
210
218
|
Manifest.read_from_file(options.fetch('--file') || DEFAULT_FILE,
|
211
|
-
type.to_sym, name)
|
219
|
+
project_name, type.to_sym, name)
|
212
220
|
else raise "Unknown mode: #{mode}"
|
213
221
|
end
|
214
222
|
end
|
data/lib/ecs_compose/manifest.rb
CHANGED
@@ -4,22 +4,37 @@ module EcsCompose
|
|
4
4
|
|
5
5
|
# A collection of multiple task definitions, including names and types.
|
6
6
|
class Manifest
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
class << self
|
8
|
+
# Build a manifest from a single `docker-compose.yml` file, using the
|
9
|
+
# supplied type and name.
|
10
|
+
def read_from_file(path, project_name, type, name)
|
11
|
+
new([TaskDefinition.new(type,
|
12
|
+
compound_name(project_name, name),
|
13
|
+
File.read(path))])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Read in a complete manifest.
|
17
|
+
def read_from_manifest(path, project_name)
|
18
|
+
dir = File.dirname(path)
|
19
|
+
yaml = Psych.load_file(path)
|
20
|
+
defs = yaml.fetch('task_definitions').map do |name, info|
|
21
|
+
TaskDefinition.new(info.fetch('type').to_sym,
|
22
|
+
compound_name(project_name, name),
|
23
|
+
File.read(File.join(dir, info.fetch('path'))))
|
24
|
+
end
|
25
|
+
new(defs)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
12
29
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
File.read(File.join(dir, info.fetch('path'))))
|
30
|
+
# If we've been supplied with a `project_name`, build a compound name.
|
31
|
+
def compound_name(project_name, name)
|
32
|
+
if project_name.nil?
|
33
|
+
name
|
34
|
+
else
|
35
|
+
"#{project_name}-#{name}"
|
36
|
+
end
|
21
37
|
end
|
22
|
-
new(defs)
|
23
38
|
end
|
24
39
|
|
25
40
|
attr_reader :task_definitions
|
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.pre21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kidd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|