Module: Pipely::Build::TemplateHelpers
- Included in:
- Template
- Defined in:
- lib/pipely/build/template_helpers.rb
Overview
Helper methods used by ERB templates.
Instance Method Summary collapse
- #s3_asset_path(path) ⇒ Object
- #s3n_asset_path(path) ⇒ Object
- #s3n_step_path(path) ⇒ Object
- #streaming_hadoop_step(options) ⇒ Object
Instance Method Details
#s3_asset_path(path) ⇒ Object
8 9 10 |
# File 'lib/pipely/build/template_helpers.rb', line 8 def s3_asset_path(path) "#{s3_asset_prefix if '/' == path[0]}#{path}" end |
#s3n_asset_path(path) ⇒ Object
12 13 14 |
# File 'lib/pipely/build/template_helpers.rb', line 12 def s3n_asset_path(path) "#{s3n_asset_prefix if '/' == path[0]}#{path}" end |
#s3n_step_path(path) ⇒ Object
16 17 18 |
# File 'lib/pipely/build/template_helpers.rb', line 16 def s3n_step_path(path) "#{s3n_step_prefix if '/' == path[0]}#{path}" end |
#streaming_hadoop_step(options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pipely/build/template_helpers.rb', line 20 def streaming_hadoop_step() parts = [ '/home/hadoop/contrib/streaming/hadoop-streaming.jar' ] Array([:input]).each do |input| parts += [ '-input', s3n_asset_path(input) ] end Array([:output]).each do |output| parts += ['-output', s3_asset_path(output) ] end Array([:mapper]).each do |mapper| parts += ['-mapper', s3n_step_path(mapper) ] end Array([:reducer]).each do |reducer| parts += ['-reducer', s3n_step_path(reducer) ] end Array([:cache_file]).each do |cache_file| parts += ['-cacheFile', s3n_asset_path(cache_file)] end ([:env] || {}).each do |name, value| parts += ['-cmdenv', "#{name}=#{value}"] end parts.join(',') end |