Class: Pipely::Tasks::UploadSteps

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/pipely/tasks/upload_steps.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &task_block) ⇒ UploadSteps

Returns a new instance of UploadSteps.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/pipely/tasks/upload_steps.rb', line 34

def initialize(*args, &task_block)
  setup_ivars(args)

  unless ::Rake.application.last_comment
    desc "Upload Data Pipeline steps to S3"
  end

  task name, *args do |_, task_args|
    RakeFileUtils.send(:verbose, verbose) do
      if task_block
        task_block.call(*[self, task_args].slice(0, task_block.arity))
      end

      run_task verbose
    end
  end
end

Instance Attribute Details

#local_pathObject

Local path to where the step files are.

default:

"steps"


19
20
21
# File 'lib/pipely/tasks/upload_steps.rb', line 19

def local_path
  @local_path
end

#nameObject

Name of task.

default:

:upload_steps


13
14
15
# File 'lib/pipely/tasks/upload_steps.rb', line 13

def name
  @name
end

#s3_bucket_nameObject

Name of S3 bucket to upload steps to.



22
23
24
# File 'lib/pipely/tasks/upload_steps.rb', line 22

def s3_bucket_name
  @s3_bucket_name
end

#s3_pathObject

Path within S3 bucket to upload steps to.



25
26
27
# File 'lib/pipely/tasks/upload_steps.rb', line 25

def s3_path
  @s3_path
end

#verboseObject

Use verbose output. If this is set to true, the task will print the local and remote paths of each step file it uploads to S3.

default:

true


32
33
34
# File 'lib/pipely/tasks/upload_steps.rb', line 32

def verbose
  @verbose
end

Instance Method Details

#run_task(verbose) ⇒ Object



58
59
60
61
62
63
# File 'lib/pipely/tasks/upload_steps.rb', line 58

def run_task(verbose)
  with_bucket do |bucket|
    s3_uploader = Pipely::Deploy::S3Uploader.new(bucket, s3_path)
    s3_uploader.upload(step_files)
  end
end

#setup_ivars(args) ⇒ Object



52
53
54
55
56
# File 'lib/pipely/tasks/upload_steps.rb', line 52

def setup_ivars(args)
  @name = args.shift || :upload_steps
  @verbose = true
  @local_path = "steps"
end