Class: Stevenson::Deployer::S3

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/stevenson/deployers/s3.rb

Instance Attribute Summary collapse

Attributes included from Base

#options

Instance Method Summary collapse

Methods included from Base

included

Constructor Details

#initialize(options) ⇒ S3

Returns a new instance of S3.



10
11
12
13
# File 'lib/stevenson/deployers/s3.rb', line 10

def initialize(options)
  @deployment_bucket_name, @deployment_key, @deployment_access_key, @deployment_access_secret = options["s3"]
  super
end

Instance Attribute Details

#deployment_bucket_nameObject (readonly)

Returns the value of attribute deployment_bucket_name.



8
9
10
# File 'lib/stevenson/deployers/s3.rb', line 8

def deployment_bucket_name
  @deployment_bucket_name
end

#deployment_keyObject (readonly)

Returns the value of attribute deployment_key.



8
9
10
# File 'lib/stevenson/deployers/s3.rb', line 8

def deployment_key
  @deployment_key
end

Instance Method Details

#deploy!(directory) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/stevenson/deployers/s3.rb', line 15

def deploy!(directory)
  Dir.glob("#{directory}/**/*").each do |file|
    s3_bucket.files.create(
      key:    File.join(deployment_key, file.partition(directory).last),
      body:   File.read(file),
      public: true,
    ) if File.file?(file)
  end
end