Sha256: 4262849199e3e911db2a3b14b550064ca7f49347f894062b84e1eb9febdbe24b

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_measuer_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_measuer_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.0 lib/capistrano/measure/integration/capistrano_3.rb