Method: Octopress::Deploy::S3#initialize

Defined in:
lib/octopress-deploy/s3.rb

#initialize(options) ⇒ S3

Returns a new instance of S3.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/octopress-deploy/s3.rb', line 8

def initialize(options)
  begin
    require 'aws-sdk-v1'
  rescue LoadError
    abort "Deploying to S3 requires the aws-sdk-v1 gem. Install with `gem install aws-sdk-v1`."
  end
  @options     = options
  @local       = options[:site_dir]          || '_site'
  @bucket_name = options[:bucket_name]
  @access_key  = options[:access_key_id]     || ENV['AWS_ACCESS_KEY_ID']
  @secret_key  = options[:secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
  @region      = options[:region]            || ENV['AWS_DEFAULT_REGION'] || 'us-east-1'
  @distro_id   = options[:distribution_id]   || ENV['AWS_DISTRIBUTION_ID']
  @remote_path = (options[:remote_path]      || '/').sub(/^\//,'')
  @verbose     = options[:verbose]
  @incremental = options[:incremental]
  @delete      = options[:delete]
  @headers     = options[:headers]           || []
  @remote_path = @remote_path.sub(/^\//,'')  # remove leading slash
  @pull_dir    = options[:dir]
  connect
end