module Eaco::Rake::Utils

Assorted utilities.

Public Instance Methods

capture_stdout() { || ... } click to toggle source

Captures the stdout emitted by the given block

@param block [Proc] @return [String] the captured output

# 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() click to toggle source

@return [String] the current gemfile name

# File lib/eaco/rake/utils.rb, line 30
def gemfile
  gemfile = ENV['BUNDLE_GEMFILE']

  File.basename(gemfile, '.*') if gemfile
end