Sha256: 98b02d752a51e525eff6fc5267a2a872ddcf97ea842c78498167d4d53574959a
Contents?: true
Size: 1.84 KB
Versions: 10
Compression:
Stored size: 1.84 KB
Contents
module Hexx module Suit module Metrics # Prepares and runs yardstick environment from '.hexx-suit.yml' class Yardstick < RSpec::Metrics::Base # Loads yardstick verifier # # @return [Hexx::Suit::Metrics::Yardstick] # # @api private def self.new require "yardstick/rake/measurement" super end # @!scope class # Prepares output for the yardstick and sets the YARDSTICK_OUTPUT env # # @return [self] def load prepare_output set_environment super end # @!scope class # Runs yardstick with options from '.hexx-suit.yml' # # @return [undefined] def run measurement.yardstick_measure end private # yardstic metric definitions def name "yardstick" end def default_options { "output" => "tmp/yardstick/output.log", "path" => "lib/**/*.rb" } end def metric ::Yardstick::Rake::Measurement end # operations def prepare_output SYSTEM.call %( mkdir #{ ::File.dirname(output) } -p touch #{ output } ) end def set_environment ENV["YARDSTICK_OUTPUT"] = output end # helpers def measurement metric.new(:yardstick_measure, options) do |config| config.output = output end end def options @options ||= begin list = default_options.merge settings.to_hash list["path"] = Array(list["path"]).join(" ") list end end def output @output ||= options["output"] end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems