Class: Frontman::Builder::AssetPipeline
- Inherits:
-
Object
- Object
- Frontman::Builder::AssetPipeline
- Extended by:
- T::Sig
- Defined in:
- lib/frontman/builder/asset_pipeline.rb
Instance Attribute Summary collapse
-
#pipelines ⇒ Object
readonly
Returns the value of attribute pipelines.
Instance Method Summary collapse
-
#initialize(external_pipelines) ⇒ AssetPipeline
constructor
A new instance of AssetPipeline.
- #run!(timing) ⇒ Object
- #run_in_background!(timing) ⇒ Object
Constructor Details
#initialize(external_pipelines) ⇒ AssetPipeline
Returns a new instance of AssetPipeline.
14 15 16 |
# File 'lib/frontman/builder/asset_pipeline.rb', line 14 def initialize(external_pipelines) @pipelines = external_pipelines end |
Instance Attribute Details
#pipelines ⇒ Object (readonly)
Returns the value of attribute pipelines.
11 12 13 |
# File 'lib/frontman/builder/asset_pipeline.rb', line 11 def pipelines @pipelines end |
Instance Method Details
#run!(timing) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/frontman/builder/asset_pipeline.rb', line 19 def run!(timing) pipelines = get_by_timing(timing) pipelines.each do |pipeline| p "Running external asset pipeline: #{pipeline[:name]}" `#{pipeline[:command]}` sleep(pipeline[:delay]) if pipeline[:delay] p "Finished: #{pipeline[:name]}" end pipelines end |
#run_in_background!(timing) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/frontman/builder/asset_pipeline.rb', line 35 def run_in_background!(timing) pipelines = get_by_timing(timing) pipelines.map do |pipeline| p "Running external asset pipeline: #{pipeline[:name]}" pid = fork { exec(pipeline[:command]) } sleep(pipeline[:delay]) if pipeline[:delay] pid end end |