cloudster 2.19.7 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 714fdfb934ab6e43b39832bcb3b280415f208562
4
- data.tar.gz: a8b009d410769dcbff93ffda190ad2851bcf7622
3
+ metadata.gz: 65213c19f49cad89f8f96711b46476ba6d216f5b
4
+ data.tar.gz: 02f3da6e9866c8198a68df710b3180c4fd0705d3
5
5
  SHA512:
6
- metadata.gz: d441d0b8cee377c24ab15f4aff6ad048b123820a6e7e7be49f81387007f4aecb812dc29ff2f51aa7f8e61d2967cae8edd6fc34f315a77aa2bd7cfbc08c1fdc76
7
- data.tar.gz: c1c4f004ff2c2606fbd9b08b73f0944e1bea0288ba6dc79a3d8336e2a889cd22486b8e24debae9d7dec3131609b3bc400bd27df29539fef0e4548169d23789e8
6
+ metadata.gz: 04f46afbccb3fdd8e061f39094cf0c0fe65918a83632e0962252f5bb850c57b9c55f53684f0fbbfe5a167c296ab1f06c7686958253ecbdbe2ea8742312cecf80
7
+ data.tar.gz: 0d97b0b5128705db2d4a947fd479d075fc1cfe75ee895a2aae96a4adbe0cf2e29112c9da20575e845b03647f28f22090b91cdcfea545e40e91b4bf5b6ec29f6a
@@ -1,6 +1,4 @@
1
1
  language: ruby
2
- before_install:
3
- - gem install nokogiri -- --with-cflags='--std=gnu99'
4
2
  rvm:
5
3
  - 1.9.3
6
4
  - 1.9.2
data/Gemfile CHANGED
@@ -1,16 +1,11 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
2
 
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- gem "fog", "1.10.0"
9
- gem "json", "~>1.7.7"
3
+ gem "fog", "1.15.0"
4
+
10
5
  group :development do
11
6
  gem "rdoc"
12
7
  gem "bundler"
13
- gem "jeweler", "~> 1.8.7"
8
+ gem "jeweler", "~> 1.8.8"
14
9
  end
15
10
 
16
11
  group :test do
@@ -3,26 +3,25 @@ GEM
3
3
  specs:
4
4
  addressable (2.3.5)
5
5
  builder (3.2.2)
6
- colorize (0.5.8)
7
- coveralls (0.6.7)
8
- colorize
6
+ coveralls (0.7.0)
9
7
  multi_json (~> 1.3)
10
8
  rest-client
11
9
  simplecov (>= 0.7)
10
+ term-ansicolor
12
11
  thor
13
12
  diff-lcs (1.2.4)
14
13
  excon (0.25.3)
15
14
  faraday (0.8.8)
16
15
  multipart-post (~> 1.2.0)
17
- fog (1.10.0)
16
+ fog (1.15.0)
18
17
  builder
19
- excon (~> 0.14)
18
+ excon (~> 0.25.0)
20
19
  formatador (~> 0.2.0)
21
20
  mime-types
22
21
  multi_json (~> 1.0)
23
22
  net-scp (~> 1.1)
24
23
  net-ssh (>= 2.1.3)
25
- nokogiri (~> 1.5.0)
24
+ nokogiri (~> 1.5)
26
25
  ruby-hmac
27
26
  formatador (0.2.4)
28
27
  git (1.2.6)
@@ -36,7 +35,7 @@ GEM
36
35
  hashie (2.0.5)
37
36
  highline (1.6.19)
38
37
  httpauth (0.2.0)
39
- jeweler (1.8.7)
38
+ jeweler (1.8.8)
40
39
  builder
41
40
  bundler (~> 1.0)
42
41
  git (>= 1.2.5)
@@ -45,16 +44,16 @@ GEM
45
44
  nokogiri (= 1.5.10)
46
45
  rake
47
46
  rdoc
48
- json (1.7.7)
47
+ json (1.8.0)
49
48
  jwt (0.1.8)
50
49
  multi_json (>= 1.5)
51
50
  mime-types (1.25)
52
- multi_json (1.7.9)
51
+ multi_json (1.8.2)
53
52
  multi_xml (0.5.5)
54
53
  multipart-post (1.2.0)
55
54
  net-scp (1.1.2)
56
55
  net-ssh (>= 2.6.5)
57
- net-ssh (2.6.8)
56
+ net-ssh (2.7.0)
58
57
  nokogiri (1.5.10)
59
58
  oauth2 (0.9.2)
60
59
  faraday (~> 0.8)
@@ -74,7 +73,7 @@ GEM
74
73
  rspec-expectations (~> 2.14.0)
75
74
  rspec-mocks (~> 2.14.0)
76
75
  rspec-core (2.14.5)
77
- rspec-expectations (2.14.2)
76
+ rspec-expectations (2.14.3)
78
77
  diff-lcs (>= 1.1.3, < 2.0)
79
78
  rspec-mocks (2.14.3)
80
79
  ruby-hmac (0.4.0)
@@ -82,7 +81,10 @@ GEM
82
81
  multi_json (~> 1.0)
83
82
  simplecov-html (~> 0.7.1)
84
83
  simplecov-html (0.7.1)
84
+ term-ansicolor (1.2.2)
85
+ tins (~> 0.8)
85
86
  thor (0.18.1)
87
+ tins (0.12.0)
86
88
 
87
89
  PLATFORMS
88
90
  ruby
@@ -90,8 +92,7 @@ PLATFORMS
90
92
  DEPENDENCIES
91
93
  bundler
92
94
  coveralls (>= 0.5.7)
93
- fog (= 1.10.0)
94
- jeweler (~> 1.8.7)
95
- json (~> 1.7.7)
95
+ fog (= 1.15.0)
96
+ jeweler (~> 1.8.8)
96
97
  rdoc
97
98
  rspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.19.7
1
+ 2.20.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cloudster"
8
- s.version = "2.19.7"
8
+ s.version = "2.20.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Emil Soman"]
12
- s.date = "2013-09-05"
12
+ s.date = "2013-10-17"
13
13
  s.description = "Cloudster is a Ruby gem that was born to cut the learning curve involved \n in writing your own CloudFormation templates. If you don't know what a CloudFormation template is, \n but know about the AWS Cloud offerings, you can still use cloudster to provision your stack. \n Still in infancy , cloudster can create a very basic stack like a breeze. All kinds of contribution welcome !"
14
14
  s.email = "emil.soman@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  "lib/cloudster/elastic_ip.rb",
37
37
  "lib/cloudster/elasticache.rb",
38
38
  "lib/cloudster/elb.rb",
39
- "lib/cloudster/inner_merge.rb",
39
+ "lib/cloudster/hash_additions.rb",
40
40
  "lib/cloudster/options_manager.rb",
41
41
  "lib/cloudster/output.rb",
42
42
  "lib/cloudster/rds.rb",
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
48
48
  "spec/elastic_ip_spec.rb",
49
49
  "spec/elasticache_spec.rb",
50
50
  "spec/elb_spec.rb",
51
- "spec/inner_merge_spec.rb",
51
+ "spec/hash_additions.rb",
52
52
  "spec/output_spec.rb",
53
53
  "spec/rds_spec.rb",
54
54
  "spec/s3_spec.rb",
@@ -64,24 +64,21 @@ Gem::Specification.new do |s|
64
64
  s.specification_version = 4
65
65
 
66
66
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
67
- s.add_runtime_dependency(%q<fog>, ["= 1.10.0"])
68
- s.add_runtime_dependency(%q<json>, ["~> 1.7.7"])
67
+ s.add_runtime_dependency(%q<fog>, ["= 1.15.0"])
69
68
  s.add_development_dependency(%q<rdoc>, [">= 0"])
70
69
  s.add_development_dependency(%q<bundler>, [">= 0"])
71
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
70
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.8"])
72
71
  else
73
- s.add_dependency(%q<fog>, ["= 1.10.0"])
74
- s.add_dependency(%q<json>, ["~> 1.7.7"])
72
+ s.add_dependency(%q<fog>, ["= 1.15.0"])
75
73
  s.add_dependency(%q<rdoc>, [">= 0"])
76
74
  s.add_dependency(%q<bundler>, [">= 0"])
77
- s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
75
+ s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
78
76
  end
79
77
  else
80
- s.add_dependency(%q<fog>, ["= 1.10.0"])
81
- s.add_dependency(%q<json>, ["~> 1.7.7"])
78
+ s.add_dependency(%q<fog>, ["= 1.15.0"])
82
79
  s.add_dependency(%q<rdoc>, [">= 0"])
83
80
  s.add_dependency(%q<bundler>, [">= 0"])
84
- s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
81
+ s.add_dependency(%q<jeweler>, ["~> 1.8.8"])
85
82
  end
86
83
  end
87
84
 
@@ -4,7 +4,7 @@ require 'json'
4
4
  require 'fog'
5
5
  require 'cloudster/output'
6
6
  require 'cloudster/options_manager'
7
- require 'cloudster/inner_merge'
7
+ require 'cloudster/hash_additions'
8
8
  include OptionsManager
9
9
  require 'cloudster/ec2'
10
10
  require 'cloudster/elb'
@@ -71,7 +71,7 @@ module Cloudster
71
71
  }
72
72
  cloud_template['Resources'] = resource_template if !resource_template.empty?
73
73
  cloud_template['Outputs'] = output_template if !output_template.empty?
74
- return cloud_template.to_json
74
+ return cloud_template.delete_nil.to_json
75
75
  end
76
76
 
77
77
  # Triggers the stack creation
@@ -18,6 +18,9 @@ module Cloudster
18
18
  def initialize(options = {})
19
19
  require_options(options, [:name])
20
20
  @name = options[:name]
21
+ @enabled = options[:enabled] || true
22
+ @default_root_object = options[:default_root_object] || 'index.html'
23
+ @aliases = options[:aliases] || []
21
24
  end
22
25
 
23
26
  # Merges the required CloudFormation template for adding an CloudFront to an s3 instance
@@ -47,11 +50,22 @@ module Cloudster
47
50
  @name => {
48
51
  "Type" => "AWS::CloudFront::Distribution",
49
52
  "Properties" => {
50
- "DistributionConfig" => {
51
- "S3Origin" => {
52
- "DNSName"=> {"Fn::GetAtt" => [@instance_name, "DomainName"]},
53
+ "DistributionConfig"=> {
54
+ "Origins"=>[{
55
+ "DomainName"=> {"Fn::GetAtt" => [@instance_name, "DomainName"]},
56
+ "Id"=>@instance_name,
57
+ "S3OriginConfig"=> {}
58
+ }],
59
+ "DefaultRootObject" => @default_root_object,
60
+ "DefaultCacheBehavior" => {
61
+ "TargetOriginId" => @instance_name,
62
+ "ForwardedValues" => {
63
+ "QueryString" => "false"
64
+ },
65
+ "ViewerProtocolPolicy" => "allow-all"
53
66
  },
54
- "Enabled" => "true"
67
+ "Aliases"=> @aliases,
68
+ "Enabled"=> @enabled.to_s
55
69
  }
56
70
  }
57
71
  }
@@ -59,7 +73,8 @@ module Cloudster
59
73
  }
60
74
  outputs = {
61
75
  @name => {
62
- 'domain_name' => {'Fn::GetAtt' => [@name, 'DomainName']}
76
+ 'domain_name' => {'Fn::GetAtt' => [@name, 'DomainName']},
77
+ 'distribution_id' => { "Ref" => @name }
63
78
  }
64
79
  }
65
80
  template['Outputs'] = output_template(outputs)
@@ -7,4 +7,7 @@ class Hash
7
7
  end
8
8
  self
9
9
  end
10
+ def delete_nil
11
+ delete_if{|k, v| v.nil? or v.instance_of?(Hash) && v.delete_nil.nil? }
12
+ end
10
13
  end
@@ -14,7 +14,7 @@ module Cloudster
14
14
  # * options<~Hash>
15
15
  # * :name : String representing the resource name (Required)
16
16
  # * :access_control : String consisting of one of the predefined permission values: Private | PublicRead | PublicReadWrite | AuthenticatedRead | BucketOwnerRead | BucketOwnerFullControl
17
- # * :website_configuration : A hash containing the name of the index document and name of the error document. ( Example: {"index_document" => "index.html", "error_document" => "error.html"} )
17
+ # * :website_configuration : A hash containing the name of the index document and name of the error document. ( Example: {:index_document => "index.html", :error_document => "error.html"} )
18
18
  #
19
19
  # ==== Examples
20
20
  # bucket = Cloudster::S3.new(
@@ -58,7 +58,7 @@ module Cloudster
58
58
  # * options<~Hash>
59
59
  # * :name : String representing the resource name (Required)
60
60
  # * :access_control : String consisting of one of the predefined permission value. ( Example: PublicRead )
61
- # * :website_configuration : A hash containing the name of the index document and name of the error document. ( Example: {"index_document" => "index.html", "error_document" => "error.html"} )
61
+ # * :website_configuration : A hash containing the name of the index document and name of the error document. ( Example: {:index_document => "index.html", :error_document => "error.html"} )
62
62
  #
63
63
  # ==== Returns
64
64
  # * Ruby hash version of the Cloud Formation template for S3
@@ -67,7 +67,7 @@ module Cloudster
67
67
  properties = {}
68
68
  properties.merge!({"AccessControl" => options[:access_control]}) unless options[:access_control].nil?
69
69
  unless options[:website_configuration].nil?
70
- properties.merge!({"WebsiteConfiguration" => {"IndexDocument" => options[:website_configuration]["index_document"], "ErrorDocument" => options[:website_configuration]["error_document"]}})
70
+ properties.merge!({"WebsiteConfiguration" => {"IndexDocument" => options[:website_configuration][:index_document], "ErrorDocument" => options[:website_configuration][:error_document]}})
71
71
  end
72
72
  template = {
73
73
  'Resources' => {
@@ -11,8 +11,11 @@ describe Cloudster::ChefClient do
11
11
  end
12
12
  describe '#add_to' do
13
13
  it "should add elastic ip configuration to ec2 template" do
14
- bucket = bucket = Cloudster::S3.new(:name => 'S3ResourceName',:access_control => 'PublicRead')
15
- cloud_front = Cloudster::CloudFront.new(:name => 'CloudFront')
14
+ bucket = Cloudster::S3.new(:name => 'S3ResourceName',:access_control => 'PublicRead')
15
+ cloud_front = Cloudster::CloudFront.new(:name => 'CloudFront',
16
+ :default_root_object => 'index.html',
17
+ :aliases => ['mysite.example.com', 'yoursite.example.com'],
18
+ :enabled => true)
16
19
  cloud_front.add_to bucket
17
20
  bucket.template.should ==
18
21
  {
@@ -27,9 +30,20 @@ describe Cloudster::ChefClient do
27
30
  "Type"=>"AWS::CloudFront::Distribution",
28
31
  "Properties"=>{
29
32
  "DistributionConfig"=> {
30
- "S3Origin" => {
31
- "DNSName"=>{"Fn::GetAtt"=>["S3ResourceName", "DomainName"]}
33
+ "Origins"=>[{
34
+ "DomainName"=> {"Fn::GetAtt" => ["S3ResourceName", "DomainName"]},
35
+ "Id"=>"S3ResourceName",
36
+ "S3OriginConfig"=> {}
37
+ }],
38
+ "DefaultRootObject"=>"index.html",
39
+ "DefaultCacheBehavior" => {
40
+ "TargetOriginId" => "S3ResourceName",
41
+ "ForwardedValues" => {
42
+ "QueryString" => "false"
43
+ },
44
+ "ViewerProtocolPolicy" => "allow-all"
32
45
  },
46
+ "Aliases"=>["mysite.example.com", "yoursite.example.com"],
33
47
  "Enabled"=>"true"
34
48
  }
35
49
  }
@@ -51,7 +65,8 @@ describe Cloudster::ChefClient do
51
65
  "Value"=>{
52
66
  "Fn::Join"=>[",",
53
67
  [
54
- {"Fn::Join"=>["|", ["domain_name", {"Fn::GetAtt"=>["CloudFront", "DomainName"]}]]}
68
+ {"Fn::Join"=>["|", ["domain_name", {"Fn::GetAtt"=>["CloudFront", "DomainName"]}]]},
69
+ {"Fn::Join"=>["|", ["distribution_id", {"Ref"=>"CloudFront"}]]}
55
70
  ]
56
71
  ]
57
72
  }
@@ -28,4 +28,26 @@ describe "Hash" do
28
28
  }
29
29
  end
30
30
  end
31
+ describe "#delete_nil" do
32
+ it "should delete keys which have nil values recursively" do
33
+ hash = {
34
+ 'key1' => 'value1',
35
+ 'key2' => {
36
+ 'inner_key1' =>'inner_value1',
37
+ 'inner_key2' =>nil
38
+ },
39
+ 'key3' => nil,
40
+ 'key4' => {
41
+ 'key5' => nil
42
+ }
43
+ }
44
+ hash.delete_nil.should == {
45
+ 'key1' => 'value1',
46
+ 'key2' => {
47
+ 'inner_key1' =>'inner_value1'
48
+ },
49
+ 'key4' => {}
50
+ }
51
+ end
52
+ end
31
53
  end
@@ -19,7 +19,7 @@ describe Cloudster::S3 do
19
19
  }
20
20
  end
21
21
  it "should return a ruby hash for the resource cloudformation template" do
22
- s3 = Cloudster::S3.new(:name => 'bucket_name', :access_control => "PublicRead", :website_configuration => {"index_document" => "index.html", "error_document" => "error.html"} )
22
+ s3 = Cloudster::S3.new(:name => 'bucket_name', :access_control => "PublicRead", :website_configuration => {:index_document => "index.html", :error_document => "error.html"} )
23
23
  s3.template.should == {
24
24
  'Resources' => {'bucket_name' => {'Type' => 'AWS::S3::Bucket', 'Properties' => {"AccessControl" => "PublicRead", "WebsiteConfiguration" => { "IndexDocument" => "index.html", "ErrorDocument" => "error.html" } }}},
25
25
  "Outputs" => {"bucket_name"=>{"Value"=>{"Fn::Join"=>[",", [{"Fn::Join"=>["|", ["bucket_name", {"Ref"=>"bucket_name"}]]}, {"Fn::Join"=>["|", ["dns_name", {"Fn::GetAtt"=>["bucket_name", "DomainName"]}]]}, {"Fn::Join"=>["|", ["website_url", {"Fn::GetAtt"=>["bucket_name", "WebsiteURL"]}]]}]]}}}
@@ -32,7 +32,7 @@ describe Cloudster::S3 do
32
32
  expect { Cloudster::S3.template() }.to raise_error(ArgumentError, 'Missing required argument: name')
33
33
  end
34
34
  it "should return a ruby hash for the resource cloudformation template" do
35
- hash = Cloudster::S3.template(:name => 'bucket_name', :access_control => "PublicRead", :website_configuration => {"index_document" => "index.html", "error_document" => "error.html"} )
35
+ hash = Cloudster::S3.template(:name => 'bucket_name', :access_control => "PublicRead", :website_configuration => {:index_document => "index.html", :error_document => "error.html"} )
36
36
  hash.should == {
37
37
  'Resources' => {'bucket_name' => {'Type' => 'AWS::S3::Bucket', 'Properties' => {"AccessControl" => "PublicRead", "WebsiteConfiguration" => { "IndexDocument" => "index.html", "ErrorDocument" => "error.html" } }}},
38
38
  "Outputs" => {"bucket_name"=>{"Value"=>{"Fn::Join"=>[",", [{"Fn::Join"=>["|", ["bucket_name", {"Ref"=>"bucket_name"}]]}, {"Fn::Join"=>["|", ["dns_name", {"Fn::GetAtt"=>["bucket_name", "DomainName"]}]]}, {"Fn::Join"=>["|", ["website_url", {"Fn::GetAtt"=>["bucket_name", "WebsiteURL"]}]]}]]}}}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.7
4
+ version: 2.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Soman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-05 00:00:00.000000000 Z
11
+ date: 2013-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.10.0
19
+ version: 1.15.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.10.0
27
- - !ruby/object:Gem::Dependency
28
- name: json
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 1.7.7
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 1.7.7
26
+ version: 1.15.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rdoc
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +58,14 @@ dependencies:
72
58
  requirements:
73
59
  - - ~>
74
60
  - !ruby/object:Gem::Version
75
- version: 1.8.7
61
+ version: 1.8.8
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - ~>
81
67
  - !ruby/object:Gem::Version
82
- version: 1.8.7
68
+ version: 1.8.8
83
69
  description: "Cloudster is a Ruby gem that was born to cut the learning curve involved
84
70
  \n in writing your own CloudFormation templates. If you don't know what a CloudFormation
85
71
  template is, \n but know about the AWS Cloud offerings, you can still use cloudster
@@ -111,7 +97,7 @@ files:
111
97
  - lib/cloudster/elastic_ip.rb
112
98
  - lib/cloudster/elasticache.rb
113
99
  - lib/cloudster/elb.rb
114
- - lib/cloudster/inner_merge.rb
100
+ - lib/cloudster/hash_additions.rb
115
101
  - lib/cloudster/options_manager.rb
116
102
  - lib/cloudster/output.rb
117
103
  - lib/cloudster/rds.rb
@@ -123,7 +109,7 @@ files:
123
109
  - spec/elastic_ip_spec.rb
124
110
  - spec/elasticache_spec.rb
125
111
  - spec/elb_spec.rb
126
- - spec/inner_merge_spec.rb
112
+ - spec/hash_additions.rb
127
113
  - spec/output_spec.rb
128
114
  - spec/rds_spec.rb
129
115
  - spec/s3_spec.rb