Sha256: dcd9cb7afe6b1dda804581373c0fe43202fa5d85d9af08e0273dd392b33e0407

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

class String #:nodoc:
  def uncapitalize #:nodoc:
    "#{self[0..0].downcase}#{self[1..-1]}"
  end
end

class ::Rake::SshDirPublisher # :nodoc:
  attr_reader :host, :remote_dir, :local_dir
end

class Echoe

  # http://pastie.caboo.se/127840
  
  def self.silence
    stdout, stderr = $stdout.clone, $stderr.clone
    $stdout.reopen(File.new('/tmp/stdout.echoe', 'w'))
    $stderr.reopen(File.new('/tmp/stderr.echoe', 'w'))
    yield
    $stdout.reopen(stdout)
    $stderr.reopen(stderr)
  end
end

# Redefine instead of chain a Rake task
# http://www.bigbold.com/snippets/posts/show/2032

module Rake
  module TaskManager
    def redefine_task(task_class, args, &block)
      task_name, deps = resolve_args(args)
      task_name = task_class.scope_name(@scope, task_name)
      deps = [deps] unless deps.respond_to?(:to_ary)
      deps = deps.collect {|d| d.to_s }
      task = @tasks[task_name.to_s] = task_class.new(task_name, self)
      task.application = self
      task.add_comment(@last_comment)
      @last_comment = nil
      task.enhance(deps, &block)
      task
    end
  end
  class Task
    class << self
      def redefine_task(args, &block)
        Rake.application.redefine_task(self, args, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
echoe-2.7.3 lib/echoe/extensions.rb