Sha256: d812034e13a4335ffa4c5f3dcd53987412734aea3993cb8ab58b9bc1e1f4682a

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

module Capistrano
  module Measure
    module Integration
      module Capistrano3
        def measure_adapter
          @measure_adapter ||= Capistrano::Measure::Adapter.new
        end

        def insert_measure_tasks
          Rake.application.tasks.each do |current_task|
            before(current_task, :"bm_#{current_task}_before_hook") do
              measure_adapter.before_task(current_task)
            end

            after(current_task, :"bm_#{current_task}_after_hook") do
              measure_adapter.after_task(current_task)
            end
          end
        end

        def invoke_task(task_string)
          name, _ = parse_task_string(task_string)

          insert_measure_tasks if top_level_tasks.first == name
          super(task_string)
          measure_adapter.print_report if top_level_tasks.last == name
        end
      end
    end
  end
end

module Capistrano
  class Application
    include Capistrano::Measure::Integration::Capistrano3
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-measure-0.8.1 lib/capistrano/measure/integration/capistrano_3.rb