sumomo 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 081f53d1cf887c37ccd6634d470674276a600694
4
- data.tar.gz: d7b8b5d4e40b8b0a283af3dc6dd898a937ee14d8
3
+ metadata.gz: 19a7b13c51abbddeff61c5b0b23eb1163dd70bd8
4
+ data.tar.gz: fbe8f61d32f2d6acd41b6437fa8f8ac84773f4c3
5
5
  SHA512:
6
- metadata.gz: 401a6213e3e06dab6ca9e27481bec2f914cf3643f6f0b38d1a817f566104f897cfa174135f8fcfd284901788e51862c67ffbc1bf5db51c192f6132f8a183d625
7
- data.tar.gz: 0a3e46d8623b2e536bdde1451b1d8db85b735aa90c554073e339e327f8bc425a70f573db980c167172f6c6f60601976673c55db4ca3d4d814a8a8c907a23b074
6
+ metadata.gz: a12275c78d5ee20bcd911f678607003f6c1681570243d1a8772d702dc1950b8180474cfdfbd10440813d05d8d370b260c6c235c476d15de96c16dbf1dc225b2e
7
+ data.tar.gz: a13a1e7840147f9e70948256b81ecd8f0baf25b7bc58bc53e938e641663a8040e5ca00d949dae36de3333a0f3fc54b99da0c592bb95f33323a03d78940194265
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Sumomo
2
2
 
3
+ Making cloudformation suck less.
4
+
3
5
  Because plums are also peaches
4
6
 
5
7
  ## Installation
@@ -18,22 +20,55 @@ Or install it yourself as:
18
20
 
19
21
  $ gem install sumomo
20
22
 
21
- ## Usage
23
+ ## Commandline Tool Usage
22
24
 
23
25
  This gem lets you use all of the syntax in the [momo](https://github.com/davidsiaw/momo) and more!
24
26
 
25
27
  You need to setup your AWS credentials using `aws configure`.
26
28
 
29
+ This is the simplest way to use sumomo:
30
+
31
+ First, create a file called Sumomofile in your directory
32
+
33
+ ```ruby
34
+ # Sumomofile
35
+ x = hidden_value "meow"
36
+ eip = make "AWS::EC2::EIP"
37
+ output "IPAddress", eip
38
+ output "Haha", x
27
39
  ```
40
+
41
+ To create a stack that acquires an IP Address and outputs it
42
+
43
+ $ sumomo create mystack
44
+
45
+ To view a stack's outputs
46
+
47
+ $ sumomo outputs mystack
48
+
49
+ To update a stack
50
+
51
+ $ sumomo update mystack
52
+
53
+ To delete a stack
54
+
55
+ $ sumomo delete mystack
56
+
57
+ ## Library Usage
58
+
59
+ The commandline tool actions can also be performed programmatically
60
+
61
+ ```ruby
28
62
  require "sumomo"
29
63
 
30
64
  Sumomo::update_stack(name: "mystack", region: "ap-northeast-1") do
31
65
  x = hidden_value "meow"
32
-
66
+ eip = make "AWS::EC2::EIP"
67
+ output "IPAddress", eip
33
68
  output "Haha", x
34
69
  end
35
70
 
36
- Sumomo::wait_for_stack(name: "kurosawa", region: "ap-northeast-1")
71
+ Sumomo::wait_for_stack(name: "mystack", region: "ap-northeast-1")
37
72
  ```
38
73
 
39
74
  ## Development
data/exe/sumomo CHANGED
@@ -25,10 +25,11 @@ when "delete"
25
25
 
26
26
  when "create", "update"
27
27
  local_opts = Trollop::options do
28
- opt :filename, "File that describes the stack", type: :string, required: true
28
+ opt :filename, "File that describes the stack", type: :string, default: "Sumomofile"
29
29
  end
30
30
  Sumomo::create_stack(name: ARGV[0], region: global_opts[:region]) do
31
- eval File.read(local_opts[:filename]), local_opts[:filename]
31
+ proc = Proc.new {}
32
+ eval File.read(local_opts[:filename]), proc.binding, local_opts[:filename]
32
33
  end
33
34
 
34
35
  when "outputs"
data/lib/sumomo/ecs.rb CHANGED
@@ -44,30 +44,52 @@ module Sumomo
44
44
  }
45
45
  }
46
46
 
47
- definition["MountPoints"] = container[:files].map do |file, destination|
47
+ if container[:files]
48
+ definition["MountPoints"] = container[:files].map do |file, destination|
48
49
 
49
- s3_location = "container_files/#{sluggify(service_name)}/#{definition["Name"]}/#{file}"
50
- volume_name = sluggify("#{definition["Name"].underscore}_#{destination}").camelize
50
+ s3_location = "container_files/#{sluggify(service_name)}/#{definition["Name"]}/#{file}"
51
+ volume_name = sluggify("#{definition["Name"].underscore}_#{destination}").camelize
51
52
 
52
- upload_file s3_location, File.read(file)
53
+ upload_file s3_location, File.read(file)
53
54
 
54
- machine_volume_locations[s3_location] = "/opt/s3/#{s3_location}"
55
+ machine_volume_locations[s3_location] = "/opt/s3/#{s3_location}"
55
56
 
56
- volumes << {
57
- "Name" => volume_name,
58
- "Host" => { "SourcePath" => machine_volume_locations[s3_location] }
59
- }
57
+ volumes << {
58
+ "Name" => volume_name,
59
+ "Host" => { "SourcePath" => machine_volume_locations[s3_location] }
60
+ }
60
61
 
61
- {
62
- "ContainerPath" => destination,
63
- "SourceVolume" => volume_name
64
- }
62
+ {
63
+ "ContainerPath" => destination,
64
+ "SourceVolume" => volume_name
65
+ }
66
+ end
67
+ container.delete(:files)
65
68
  end
66
69
 
67
- container.each do |key, value|
68
- if key != :files
69
- definition["#{key}".camelize] = value
70
+ if container[:ports]
71
+ definition["PortMappings"] = container[:ports].map do |from_port, to_port|
72
+ {
73
+ "ContainerPort" => from_port,
74
+ "HostPort" => to_port
75
+ }
70
76
  end
77
+ container.delete(:ports)
78
+ end
79
+
80
+ if container[:envvars]
81
+ definition["Environment"] = container[:envvars].map do |var_name, var_value|
82
+ {
83
+ "Name" => var_name,
84
+ "Value" => var_value
85
+ }
86
+ end
87
+ container.delete(:envvars)
88
+ end
89
+
90
+
91
+ container.each do |key, value|
92
+ definition["#{key}".camelize] = value
71
93
  end
72
94
 
73
95
  definition
@@ -1,3 +1,3 @@
1
1
  module Sumomo
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-17 00:00:00.000000000 Z
11
+ date: 2017-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler