Module: RakeBubbler::RakeBubbler
Instance Method Summary collapse
- #capture_output ⇒ Object
- #capture_task?(name) ⇒ Boolean
- #config {|@config| ... } ⇒ Object
- #executed(name, duration, output, started, error) ⇒ Object
Instance Method Details
#capture_output ⇒ Object
19 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 |
# File 'lib/rake_bubbler/rake_bubbler.rb', line 19 def capture_output file = Tempfile.new(Digest::MD5.hexdigest((Time.now.to_i + rand(2**16)).to_s)) read, write = IO.pipe save_stdout = $stdout.dup $stdout.reopen(write) if fork read.close yield write.close $stdout.reopen(save_stdout) save_stdout.close Process.wait file.unlink file.read else write.close $stdout.close Shell.new.tee(file.path) < read > save_stdout read.close save_stdout.close exit! end # fork end |
#capture_task?(name) ⇒ Boolean
15 16 17 |
# File 'lib/rake_bubbler/rake_bubbler.rb', line 15 def capture_task?(name) @config.tasks_include?(name) && @config.call_conditions end |
#config {|@config| ... } ⇒ Object
7 8 9 |
# File 'lib/rake_bubbler/rake_bubbler.rb', line 7 def config yield @config end |
#executed(name, duration, output, started, error) ⇒ Object
11 12 13 |
# File 'lib/rake_bubbler/rake_bubbler.rb', line 11 def executed(name, duration, output, started, error) @config.call_executed(name, duration, output, started, error) end |