kumogata 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +5 -9
- data/bin/kumogata +5 -1
- data/kumogata.gemspec +1 -1
- data/lib/kumogata/argument_parser.rb +2 -0
- data/lib/kumogata/client.rb +1 -1
- data/lib/kumogata/version.rb +1 -1
- data/spec/kumogata_convert_spec.rb +56 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05df0dd35de66dcfff11541b428ece4688d17f65
|
4
|
+
data.tar.gz: 2f6c5363c47f71d9b2a936fa340ad1f48ae601fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3de82eaf417eaf49fc4e724d1aaeb261751d0d4b4fddd8e874879804eaa84513cc040e448b222718eda69ee4aef14bc9daaaf8594f44d538d2cc9ac7d2e1de5
|
7
|
+
data.tar.gz: fba3eb7bcb2569b066f3eb9e474f8bbbe69c6a655beac8cf035d961ba1e575ef8595cd0b2e2a34c64a0a4396b23131effc4b14f1c48d876e4f16c791b46bfa2a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -93,6 +93,7 @@ Options:
|
|
93
93
|
-r, --region REGION
|
94
94
|
--profile CONFIG_PROFILE
|
95
95
|
--credentials-path PATH
|
96
|
+
--config-path PATH
|
96
97
|
--format TMPLATE_FORMAT
|
97
98
|
--output-format FORMAT
|
98
99
|
--skip-replace-underscore
|
@@ -199,7 +200,7 @@ end
|
|
199
200
|
|
200
201
|
```ruby
|
201
202
|
Resources do
|
202
|
-
_include 'template2.rb'
|
203
|
+
_include 'template2.rb', :ami_id => 'ami-XXXXXXXX'
|
203
204
|
end
|
204
205
|
```
|
205
206
|
|
@@ -209,7 +210,7 @@ end
|
|
209
210
|
myEC2Instance do
|
210
211
|
Type "AWS::EC2::Instance"
|
211
212
|
Properties do
|
212
|
-
ImageId
|
213
|
+
ImageId args[:ami_id]
|
213
214
|
InstanceType { Ref "InstanceType" }
|
214
215
|
KeyName "your_key_name"
|
215
216
|
end
|
@@ -623,10 +624,5 @@ aws_session_token=texample123324
|
|
623
624
|
* Create a stack and run post commands
|
624
625
|
* https://asciinema.org/a/8088
|
625
626
|
|
626
|
-
##
|
627
|
-
|
628
|
-
1. Fork it ( http://github.com/winebarrel/kumogata/fork )
|
629
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
630
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
631
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
632
|
-
5. Create new Pull Request
|
627
|
+
## Similar tools
|
628
|
+
* [Codenize.tools](http://codenize.tools/)
|
data/bin/kumogata
CHANGED
@@ -29,8 +29,12 @@ begin
|
|
29
29
|
|
30
30
|
provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(credentials_opts)
|
31
31
|
aws_opts[:credential_provider] = provider
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
+
if File.exist?(options.config_path) and File.readable?(options.config_path)
|
35
|
+
ini = AWS::Core::IniParser.parse(File.read(options.config_path))
|
36
|
+
profile = options.config_profile || 'default'
|
37
|
+
region = ini[profile]['region']
|
34
38
|
aws_opts[:region] = region if region
|
35
39
|
end
|
36
40
|
|
data/kumogata.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['sgwr_dts@yahoo.co.jp']
|
11
11
|
spec.summary = %q{A tool for AWS CloudFormation.}
|
12
12
|
spec.description = %q{A tool for AWS CloudFormation. It can define a template in Ruby DSL.}
|
13
|
-
spec.homepage = '
|
13
|
+
spec.homepage = 'http://kumogata.codenize.tools/'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -8,6 +8,7 @@ class Kumogata::ArgumentParser
|
|
8
8
|
:command_result_log => File.join(Dir.pwd, 'command_result.json'),
|
9
9
|
:color => $stdout.tty?,
|
10
10
|
:debug => false,
|
11
|
+
:config_path => File.expand_path('~/.aws/config'),
|
11
12
|
}
|
12
13
|
|
13
14
|
COMMANDS = {
|
@@ -86,6 +87,7 @@ class Kumogata::ArgumentParser
|
|
86
87
|
opt.on('-r', '--region REGION') {|v| options[:region] = v }
|
87
88
|
opt.on('' , '--profile CONFIG_PROFILE') {|v| options[:config_profile] = v }
|
88
89
|
opt.on('' , '--credentials-path PATH') {|v| options[:credentials_path] = v }
|
90
|
+
opt.on('' , '--config-path PATH') {|v| options[:config_path] = v }
|
89
91
|
opt.on('' , '--format TMPLATE_FORMAT', supported_formats) {|v| options[:format] = v }
|
90
92
|
opt.on('' , '--output-format FORMAT', supported_formats) {|v| options[:output_format] = v }
|
91
93
|
opt.on('' , '--skip-replace-underscore') { options[:skip_replace_underscore] = false }
|
data/lib/kumogata/client.rb
CHANGED
data/lib/kumogata/version.rb
CHANGED
@@ -940,6 +940,62 @@ Resources do
|
|
940
940
|
_include #{f.path.inspect}
|
941
941
|
end
|
942
942
|
|
943
|
+
Outputs do
|
944
|
+
AZ do
|
945
|
+
Value do
|
946
|
+
Fn__GetAtt "myEC2Instance", "AvailabilityZone"
|
947
|
+
end
|
948
|
+
end
|
949
|
+
end
|
950
|
+
EOS
|
951
|
+
|
952
|
+
json_template = run_client(:convert, :template => template)
|
953
|
+
end
|
954
|
+
|
955
|
+
expect(json_template).to eq((<<-EOS).chomp)
|
956
|
+
{
|
957
|
+
"Resources": {
|
958
|
+
"myEC2Instance": {
|
959
|
+
"Type": "AWS::EC2::Instance",
|
960
|
+
"Properties": {
|
961
|
+
"ImageId": "ami-XXXXXXXX",
|
962
|
+
"InstanceType": "t1.micro"
|
963
|
+
}
|
964
|
+
}
|
965
|
+
},
|
966
|
+
"Outputs": {
|
967
|
+
"AZ": {
|
968
|
+
"Value": {
|
969
|
+
"Fn::GetAtt": [
|
970
|
+
"myEC2Instance",
|
971
|
+
"AvailabilityZone"
|
972
|
+
]
|
973
|
+
}
|
974
|
+
}
|
975
|
+
}
|
976
|
+
}
|
977
|
+
EOS
|
978
|
+
end
|
979
|
+
|
980
|
+
it 'convert splitted Ruby template to JSON template with args' do
|
981
|
+
json_template = nil
|
982
|
+
|
983
|
+
part_of_template = <<-EOS
|
984
|
+
myEC2Instance do
|
985
|
+
Type "AWS::EC2::Instance"
|
986
|
+
Properties do
|
987
|
+
ImageId args[:ami_id]
|
988
|
+
InstanceType "t1.micro"
|
989
|
+
end
|
990
|
+
end
|
991
|
+
EOS
|
992
|
+
|
993
|
+
tempfile(part_of_template, '.rb') do |f|
|
994
|
+
template = <<-EOS
|
995
|
+
Resources do
|
996
|
+
_include #{f.path.inspect}, {:ami_id => "ami-XXXXXXXX"}
|
997
|
+
end
|
998
|
+
|
943
999
|
Outputs do
|
944
1000
|
AZ do
|
945
1001
|
Value do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumogata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -321,7 +321,7 @@ files:
|
|
321
321
|
- spec/spec_helper.rb
|
322
322
|
- spec/string_stream_spec.rb
|
323
323
|
- spec/vpc-knowhow-2014-04.template
|
324
|
-
homepage:
|
324
|
+
homepage: http://kumogata.codenize.tools/
|
325
325
|
licenses:
|
326
326
|
- MIT
|
327
327
|
metadata: {}
|