Class: AmazonStaticSite::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/amazon_static_site/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Service

Returns a new instance of Service.



5
6
7
8
9
10
# File 'lib/amazon_static_site/service.rb', line 5

def initialize(config)
  @config     = config
  @s3         = Client::S3.new(self)
  @cloudflare = Client::Cloudflare.new(self)
  @uploader   = Client::Upload.new(self)
end

Instance Attribute Details

#cloudflareObject (readonly)

Returns the value of attribute cloudflare.



3
4
5
# File 'lib/amazon_static_site/service.rb', line 3

def cloudflare
  @cloudflare
end

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/amazon_static_site/service.rb', line 3

def config
  @config
end

#s3Object (readonly)

Returns the value of attribute s3.



3
4
5
# File 'lib/amazon_static_site/service.rb', line 3

def s3
  @s3
end

#uploaderObject (readonly)

Returns the value of attribute uploader.



3
4
5
# File 'lib/amazon_static_site/service.rb', line 3

def uploader
  @uploader
end

Instance Method Details

#run_cloudflareObject



21
22
23
# File 'lib/amazon_static_site/service.rb', line 21

def run_cloudflare
  cloudflare.configure_dns
end

#run_s3Object



12
13
14
15
# File 'lib/amazon_static_site/service.rb', line 12

def run_s3
  s3.create_buckets
  s3.publish_static_website_on_s3
end

#run_uploadObject



17
18
19
# File 'lib/amazon_static_site/service.rb', line 17

def run_upload
  uploader.upload_to(s3.primary)
end