class Pipely::Deploy::BootstrapContext
Context passed to the erb templates, providers helpers for common bootstraping activities for emr and ec2 instances.
bootstrap.ec2.install_gems_script bootstrap.emr.install_gems_script
Attributes
ec2[R]
emr[R]
gem_files[RW]
s3_steps_path[RW]
Public Class Methods
new()
click to toggle source
# File lib/pipely/deploy/bootstrap_context.rb, line 71 def initialize @emr = EmrContext.new(self) @ec2 = Ec2Context.new(self) end
Public Instance Methods
fetch_command(transport)
click to toggle source
# File lib/pipely/deploy/bootstrap_context.rb, line 76 def fetch_command(transport) case transport.to_sym when :hadoop_fs 'hadoop fs -copyToLocal' when :awscli 'aws s3 cp' end end
install_gems_script(transport) { |*params| ... }
click to toggle source
# File lib/pipely/deploy/bootstrap_context.rb, line 85 def install_gems_script(transport, &blk) transport_cmd = fetch_command(transport) if transport_cmd.nil? raise "Unsupported transport: #{transport}" unless blk end script = "" @gem_files.each do |gem_file| filename = File.basename(gem_file) params = [transport_cmd, gem_file, filename] if blk command = yield(*params) else command = params.join(" ") end script << %Q[ # #{filename} #{command} gem install --force --local #{filename} --no-ri --no-rdoc ] end script end