Module: Eaco::Rake::Utils
Overview
Assorted utilities.
Instance Method Summary collapse
-
#capture_stdout(&block) ⇒ String
Captures the stdout emitted by the given
block. -
#gemfile ⇒ String
The current gemfile name.
Instance Method Details
#capture_stdout(&block) ⇒ String
Captures the stdout emitted by the given block
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eaco/rake/utils.rb', line 16 def capture_stdout(&block) stdout, string = $stdout, StringIO.new $stdout = string yield string.tap(&:rewind).read ensure $stdout = stdout end |
#gemfile ⇒ String
Returns the current gemfile name.
30 31 32 33 34 |
# File 'lib/eaco/rake/utils.rb', line 30 def gemfile gemfile = ENV['BUNDLE_GEMFILE'] File.basename(gemfile, '.*') if gemfile end |