Sha256: e6f86af8ff2e3df146419e5e5522cf8cc918b4fe2e9a4b1ab0dfe7b65397cb54

Contents?: true

Size: 576 Bytes

Versions: 4

Compression:

Stored size: 576 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
        begin
          new_task.call
        rescue LoadError
          #empty
        end
        old_task.invoke
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bower-rails-0.8.3 lib/tasks/helpers/before_hook.rb
bower-rails-0.8.2 lib/tasks/helpers/before_hook.rb
bower-rails-0.8.1 lib/tasks/helpers/before_hook.rb
bower-rails-0.8.0 lib/tasks/helpers/before_hook.rb