Class: Microstatic::Rake::S3DeployTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/microstatic/rake/s3_deployer_task.rb

Instance Method Summary collapse

Constructor Details

#initialize(task_env) ⇒ S3DeployTask

Returns a new instance of S3DeployTask.



6
7
8
# File 'lib/microstatic/rake/s3_deployer_task.rb', line 6

def initialize(task_env)
  @task_env = task_env
end

Instance Method Details

#defineObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/microstatic/rake/s3_deployer_task.rb', line 10

def define
  require 'microstatic'

  te = @task_env
  te.check_for_mandatory_opts!

  desc "deploy to the '#{te.bucket_name}' S3 bucket" unless ::Rake.application.last_comment
  task te.task_name_or('s3deploy') do

    te.check_for_aws_creds!
    deployer = Microstatic::S3Deployer.build( te.source_dir, te.bucket_name, te.aws_creds )
    deployer.exclude_files(te.exclude) if te.exclude
    deployer.upload
  end
end