Module: CukeStepBm
- Defined in:
- lib/cuke-step-bm/cli.rb,
lib/cuke-step-bm.rb,
lib/cuke-step-bm/version.rb
Overview
require ‘ostruct’
Defined Under Namespace
Classes: Cli
Constant Summary collapse
- BM_SUPPORTED_OUTPUT_MODES =
cuke_step_bm bm-cuke-step cuke-step-bm.rb :bm => BenchMark(only for display) :std => SimpleTimeDiff :std_with_log => SimpleTimeDiff log :off => Cucumber default do nothing
[:bm, :std, :std_with_log, :off]
- VERSION =
"1.0.1"
Class Attribute Summary collapse
-
.delimiter ⇒ Object
Returns the value of attribute delimiter.
-
.log_file ⇒ Object
Returns the value of attribute log_file.
-
.output_mode ⇒ Object
Returns the value of attribute output_mode.
-
.root ⇒ Object
Returns the value of attribute root.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
-
.remove_log! ⇒ Object
remove log file before cuke working with :std_with_log.
- .suite! ⇒ Object
- .use_defaults! ⇒ Object
- .write_to_log(msg) ⇒ Object
Class Attribute Details
.delimiter ⇒ Object
Returns the value of attribute delimiter.
14 15 16 |
# File 'lib/cuke-step-bm.rb', line 14 def delimiter @delimiter end |
.log_file ⇒ Object
Returns the value of attribute log_file.
14 15 16 |
# File 'lib/cuke-step-bm.rb', line 14 def log_file @log_file end |
.output_mode ⇒ Object
Returns the value of attribute output_mode.
14 15 16 |
# File 'lib/cuke-step-bm.rb', line 14 def output_mode @output_mode end |
.root ⇒ Object
Returns the value of attribute root.
14 15 16 |
# File 'lib/cuke-step-bm.rb', line 14 def root @root end |
Class Method Details
.configure {|_self| ... } ⇒ Object
16 17 18 |
# File 'lib/cuke-step-bm.rb', line 16 def configure yield self end |
.remove_log! ⇒ Object
remove log file before cuke working with :std_with_log
47 48 49 50 51 |
# File 'lib/cuke-step-bm.rb', line 47 def remove_log! File.delete log_file if File.exist?(log_file) && (output_mode == :std_with_log) rescue Exception => e warn e. end |
.suite! ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cuke-step-bm.rb', line 20 def suite! use_defaults! paths = [ File.("config/cuke_step_bm.rb", root), File.(".cuke_step_bm", root), "#{ENV["HOME"]}/.cuke_step_bm" ] paths.each { |path| load(path) if File.exist?(path) } self.output_mode = :std unless BM_SUPPORTED_OUTPUT_MODES.include? output_mode end |
.use_defaults! ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/cuke-step-bm.rb', line 31 def use_defaults! configure do |config| config.root = File.('.', Dir.pwd) config.output_mode = :std config.log_file = File.join(config.root, 'features', 'steps_consuming.bms') config.delimiter = "-#{[20879].pack("U*")}-" end end |
.write_to_log(msg) ⇒ Object
40 41 42 43 44 |
# File 'lib/cuke-step-bm.rb', line 40 def write_to_log(msg) File.open(log_file, "a+") { |f| f.write msg } rescue nil end |