lono 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.md +1 -0
- data/lib/lono/bashify.rb +3 -9
- data/lib/lono/version.rb +1 -1
- metadata +1 -1
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
gemspec
|
data/README.md
CHANGED
@@ -84,6 +84,7 @@ You can convert UserData scripts in existing Cloud Formation Templates to a star
|
|
84
84
|
<pre>
|
85
85
|
$ lono bashify cloud_formation_template.json
|
86
86
|
$ lono bash cloud_formation_template.json # shorthand
|
87
|
+
$ lono b https://s3.amazonaws.com/cloudformation-templates-us-east-1/LAMP_Single_Instance.template # shorthand and url
|
87
88
|
</pre>
|
88
89
|
|
89
90
|
This is useful if you want to take an existing [Cloud Formation Template example](http://aws.amazon.com/cloudformation/aws-cloudformation-templates/) and quicklly change the UserData section into a bash script. The bashify command will generate a snippet that is meant to be copied and pasted into a bash script and used with user_data helper method. The bash script should work right off the bat as lono will transform the generated Cloud Formation object references to json objects, there's no need to manually change what is generated to the helper methods, though you can if you prefer the look of the helper methods.
|
data/lib/lono/bashify.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
1
3
|
module Lono
|
2
4
|
class Bashify
|
3
5
|
def initialize(options={})
|
@@ -18,16 +20,8 @@ module Lono
|
|
18
20
|
paths.select {|p| p =~ /UserData/ && p =~ /Fn::Join/ }
|
19
21
|
end
|
20
22
|
|
21
|
-
def find_user_data
|
22
|
-
raw = IO.read(@path)
|
23
|
-
json = JSON.load(raw)
|
24
|
-
|
25
|
-
user_data = json['Resources']['server']['Properties']['UserData']['Fn::Base64']['Fn::Join']
|
26
|
-
@delimiter, @data = user_data
|
27
|
-
end
|
28
|
-
|
29
23
|
def run
|
30
|
-
raw =
|
24
|
+
raw = open(@path).read
|
31
25
|
json = JSON.load(raw)
|
32
26
|
paths = user_data_paths(json)
|
33
27
|
paths.each do |path|
|
data/lib/lono/version.rb
CHANGED