class Capistrano::Measure::Adapter

Attributes

config[R]
logger[R]

Public Class Methods

capistrano_version() click to toggle source
# File lib/capistrano/measure/adapter.rb, line 5
def self.capistrano_version
  return ::Capistrano::Version::MAJOR.to_i if defined?(::Capistrano::Version::MAJOR)
  return ::Capistrano::VERSION[0].to_i if defined?(::Capistrano::VERSION)
  nil
end
new(logger, config) click to toggle source
# File lib/capistrano/measure/adapter.rb, line 11
def initialize(logger, config)
  @logger = logger
  @config = config
  @valid = true
end

Public Instance Methods

after_task(task_name) click to toggle source
# File lib/capistrano/measure/adapter.rb, line 21
def after_task(task_name)
  with_error_handling { timer.stop(task_name) }
end
before_task(task_name) click to toggle source
# File lib/capistrano/measure/adapter.rb, line 17
def before_task(task_name)
  with_error_handling { timer.start(task_name) }
end
print_report() click to toggle source

Private Instance Methods

debug?() click to toggle source
# File lib/capistrano/measure/adapter.rb, line 45
def debug?
  config.fetch(:measure_error_handling, :silent) == :raise
end
log_reporter() click to toggle source
# File lib/capistrano/measure/adapter.rb, line 37
def log_reporter
  @log_reporter ||= Capistrano::Measure::LogReporter.new(logger, config)
end
timer() click to toggle source
# File lib/capistrano/measure/adapter.rb, line 41
def timer
  @timer ||= Capistrano::Measure::Timer.new
end
valid?() click to toggle source
# File lib/capistrano/measure/adapter.rb, line 49
def valid?
  @valid
end
with_error_handling() { || ... } click to toggle source
# File lib/capistrano/measure/adapter.rb, line 53
def with_error_handling
  yield
rescue StandardError => e
  @valid = false
  raise e if debug?
end