Sha256: 7c78900e088ebc706cfeab7434182e26cfe5f2273f5ab62f70fd93c6c7b74c94

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

module BeforeHook
  # The `before` hook for rake tasks. 
  # The code was taken from https://github.com/guillermo/rake-hooks/blob/master/lib/rake/hooks.rb#L2
  def before(*task_names, &new_task)
    task_names.each do |task_name|
      old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)
      return unless old_task

      desc old_task.full_comment
      task task_name => old_task.prerequisites do
        new_task.call
        old_task.invoke
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bower-rails-0.7.3 lib/tasks/helpers/before_hook.rb