cloudster 2.16.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -56,6 +56,9 @@ Create AWS resources :
56
56
  :name => 'MyBucket'
57
57
  )
58
58
 
59
+ cloud_front = Cloudster::CloudFront.new(:name => 'CloudFrontResource')
60
+ cloud_front.add_to storage
61
+
59
62
  elasticache = Cloudster::ElastiCache.new(
60
63
  :name => 'CacheResource',
61
64
  :node_type => 'cache.t1.micro',
@@ -76,7 +79,7 @@ Get the CloudFormation template for a resource as a Ruby Hash :
76
79
 
77
80
  app_server.template
78
81
 
79
- Cloudster can also do things on the AWS Cloud :
82
+ Cloudster can also interact with the provisioned AWS Cloud :
80
83
 
81
84
  - Provision the stack :
82
85
 
@@ -189,8 +192,8 @@ above and this can hold things up considerably.
189
192
 
190
193
  MIT
191
194
 
195
+ *Free Software, Forever . YEAH !*
196
+
192
197
  ## Thanks
193
198
 
194
199
  To Sinatra README for having a nice 'Contribute' section which I'm using(with minor changes) for Cloudster.
195
-
196
- *Free Software, Forever . YEAH !*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.16.0
1
+ 2.17.0
data/cloudster.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cloudster"
8
- s.version = "2.16.0"
8
+ s.version = "2.17.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 = "2012-12-31"
12
+ s.date = "2013-01-07"
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 = [
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "lib/cloudster.rb",
31
31
  "lib/cloudster/chef_client.rb",
32
32
  "lib/cloudster/cloud.rb",
33
+ "lib/cloudster/cloud_front.rb",
33
34
  "lib/cloudster/deep_merge.rb",
34
35
  "lib/cloudster/ec2.rb",
35
36
  "lib/cloudster/elastic_ip.rb",
@@ -39,6 +40,7 @@ Gem::Specification.new do |s|
39
40
  "lib/cloudster/rds.rb",
40
41
  "lib/cloudster/s3.rb",
41
42
  "spec/chef_client_spec.rb",
43
+ "spec/cloud_front_spec.rb",
42
44
  "spec/cloud_spec.rb",
43
45
  "spec/ec2_spec.rb",
44
46
  "spec/elastic_ip_spec.rb",
data/lib/cloudster.rb CHANGED
@@ -13,3 +13,4 @@ require 'cloudster/elasticache'
13
13
  require 'cloudster/cloud'
14
14
  require 'cloudster/chef_client'
15
15
  require 'cloudster/elastic_ip'
16
+ require 'cloudster/cloud_front'
@@ -0,0 +1,61 @@
1
+ module Cloudster
2
+ #==CloudFront resource
3
+ class CloudFront
4
+
5
+ # Initialize CloudFront
6
+ #
7
+ # ==== Notes
8
+ # options parameter must include values for :name
9
+ #
10
+ # ==== Examples
11
+ # cloud_front = Cloudster::CloudFront.new(:name => 'CloudFront')
12
+ #
13
+ # ==== Parameters
14
+ # * options<~Hash> -
15
+ # * :name: String containing the name of CloudFront resource
16
+ def initialize(options = {})
17
+ require_options(options, [:name])
18
+ @name = options[:name]
19
+ end
20
+
21
+ # Merges the required CloudFormation template for adding an CloudFront to an s3 instance
22
+ #
23
+ #
24
+ # ==== Examples
25
+ # cloud_front = Cloudster::CloudFront.new(:name => 'CloudFrontDistribution')
26
+ # s3 = Cloudster::S3.new(
27
+ # :name => 'S3Resource',
28
+ # :access_control => 'PublicRead'
29
+ # )
30
+ #
31
+ # cloud_front.add_to s3
32
+ #
33
+ # ==== Parameters
34
+ # * instance of s3
35
+ def add_to(s3)
36
+ s3_template = s3.template
37
+ @instance_name = s3.name
38
+ cloud_front_template = template
39
+ s3.template.deep_merge(cloud_front_template)
40
+ end
41
+
42
+ private
43
+ def template
44
+ return "Resources" => {
45
+ @name => {
46
+ "Type" => "AWS::CloudFront::Distribution",
47
+ "Properties" => {
48
+ "DistributionConfig" => {
49
+ "S3Origin" => {
50
+ "DNSName"=> {"Fn::GetAtt" => [@instance_name, "DomainName"]},
51
+ },
52
+ "Enabled" => "true"
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ end
59
+
60
+ end
61
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cloudster::ChefClient do
4
+ describe 'initialize' do
5
+ it "should raise argument error if no argument is not provided" do
6
+ expect { Cloudster::CloudFront.new() }.to raise_error(ArgumentError, 'Missing required argument: name')
7
+ end
8
+ it "should not raise argument error if all arguments are provided" do
9
+ expect { Cloudster::CloudFront.new(:name => 'CloudFront') }.to_not raise_error
10
+ end
11
+ end
12
+ describe '#add_to' do
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')
16
+ cloud_front.add_to bucket
17
+ bucket.template.should ==
18
+ {
19
+ "Resources"=>{
20
+ "S3ResourceName"=>{
21
+ "Type"=>"AWS::S3::Bucket",
22
+ "Properties"=>{
23
+ "AccessControl"=>"PublicRead"
24
+ }
25
+ },
26
+ "CloudFront"=>{
27
+ "Type"=>"AWS::CloudFront::Distribution",
28
+ "Properties"=>{
29
+ "DistributionConfig"=> {
30
+ "S3Origin" => {
31
+ "DNSName"=>{"Fn::GetAtt"=>["S3ResourceName", "DomainName"]}
32
+ },
33
+ "Enabled"=>"true"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ end
40
+ end
41
+ end
@@ -22,7 +22,7 @@ describe Cloudster::ChefClient do
22
22
  "Properties"=>{
23
23
  "KeyName"=>"testkey",
24
24
  "ImageId"=>"image_id",
25
- "InstanceType"=>"t1.micro",
25
+ "InstanceType"=>"t1.micro"
26
26
  }
27
27
  },
28
28
  "ElasticIp"=>{
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.0
4
+ version: 2.17.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-31 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -132,6 +132,7 @@ files:
132
132
  - lib/cloudster.rb
133
133
  - lib/cloudster/chef_client.rb
134
134
  - lib/cloudster/cloud.rb
135
+ - lib/cloudster/cloud_front.rb
135
136
  - lib/cloudster/deep_merge.rb
136
137
  - lib/cloudster/ec2.rb
137
138
  - lib/cloudster/elastic_ip.rb
@@ -141,6 +142,7 @@ files:
141
142
  - lib/cloudster/rds.rb
142
143
  - lib/cloudster/s3.rb
143
144
  - spec/chef_client_spec.rb
145
+ - spec/cloud_front_spec.rb
144
146
  - spec/cloud_spec.rb
145
147
  - spec/ec2_spec.rb
146
148
  - spec/elastic_ip_spec.rb
@@ -164,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
166
  version: '0'
165
167
  segments:
166
168
  - 0
167
- hash: 648278835
169
+ hash: 500109
168
170
  required_rubygems_version: !ruby/object:Gem::Requirement
169
171
  none: false
170
172
  requirements: