gauge-ruby 0.0.4.1 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e2188a5e620b9ea6f96412402b3da4ea7dd152a
4
- data.tar.gz: eda8692a31244882c0a50a8395124270ae689216
3
+ metadata.gz: ca1c1ef4c0bc30a15af7176cf126f85c2bb7ea28
4
+ data.tar.gz: 0533e8641e36c79b6b4a01cf80cf3f682c19e668
5
5
  SHA512:
6
- metadata.gz: dcca9d23502d72a8a98071255853ac8ee9b213bfdd58506351c1df3cca4d47eb064b058e5c053cf40ea66cd2aa89ba231523f9d4c545b295a125c1ace3dcf558
7
- data.tar.gz: cc7dcd0093d0c10357839a5a16d68591659ba3a8e0ad0d5720e1dbf1b55d89f43f3efbcfae62ff1cdae00646b10c75058fb07641dec5158967a2ffdd5ee6b38d
6
+ metadata.gz: c35043657b58688950fbb2034cdf1a0637644c7ec7a113e76000638f8abac2a318d9aa4e97bc9d00c2d3de12f3335c951ece1dac34195b0c45bf55b0a4b09b09
7
+ data.tar.gz: 32e28492115359abec73578c54389a8b7d7d46d8b5d423537587604a1cb1bb4564f2819810d0004a15affa16efff12753a0624a20e07da75bfee373e621574bb
@@ -1,5 +1,5 @@
1
1
  # Copyright 2015 ThoughtWorks, Inc.
2
-
2
+ #
3
3
  # This file is part of Gauge-Ruby.
4
4
  #
5
5
  # Gauge-Ruby is free software: you can redistribute it and/or modify
@@ -15,29 +15,28 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with Gauge-Ruby. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
+ # Gauge runtime for Ruby language. Read more about Gauge: http://getgauge.io
19
+
18
20
  # @api public
19
21
  module Gauge
20
- # @api public
21
22
  class << self
22
- # @!macro [attach] self.configure
23
- # @method configure(&block)
24
- # @api public
25
- # Custom configuration for Gauge
26
- # Lets you configure modules that need to be included at runtime.
23
+ # @api public
24
+ # Custom configuration for Gauge
25
+ # Lets you configure modules that need to be included at runtime.
27
26
  #
28
- # @example
29
- # # Given there are two modules defined
30
- # module Foo
31
- # end
27
+ # @example
28
+ # # Given there are two modules defined
29
+ # module Foo
30
+ # end
32
31
  #
33
- # module Bar
34
- # end
32
+ # module Bar
33
+ # end
35
34
  #
36
- # # Gauge can be configured to include these modules at runtime.
35
+ # # Gauge can be configured to include these modules at runtime.
37
36
  #
38
- # Gauge.configure do |config|
39
- # config.include Foo, Bar
40
- # end
37
+ # Gauge.configure do |config|
38
+ # config.include Foo, Bar
39
+ # end
41
40
  def configure(&block)
42
41
  Configuration.instance.instance_eval &block
43
42
  end
@@ -19,7 +19,7 @@ require_relative 'configuration'
19
19
  module Gauge
20
20
  # @api private
21
21
  class MethodCache
22
- HOOKS.each { |hook|
22
+ ["before_step", "after_step", "before_spec", "after_spec", "before_scenario", "after_scenario", "before_suite", "after_suite"].each { |hook|
23
23
  define_singleton_method "add_#{hook}_hook" do |&block|
24
24
  self.class_variable_get("@@#{hook}_hooks").push block
25
25
  end
@@ -27,7 +27,7 @@ module Gauge
27
27
  self.class_variable_get("@@#{hook}_hooks")
28
28
  end
29
29
  }
30
-
30
+
31
31
  def self.add_step(parameterized_step_text, &block)
32
32
  @@steps_map[parameterized_step_text] = block
33
33
  end
@@ -61,7 +61,6 @@ module Gauge
61
61
  end
62
62
 
63
63
  private
64
- HOOKS = ["before_step", "after_step", "before_spec", "after_spec", "before_scenario", "after_scenario", "before_suite", "after_suite"]
65
64
  @@steps_map = Hash.new
66
65
  @@steps_text_map = Hash.new
67
66
  @@steps_with_aliases = []
@@ -50,16 +50,12 @@ module Gauge
50
50
  end
51
51
 
52
52
  def screenshot_bytes
53
- return nil if (ENV['screenshot_enabled'] || "").downcase == "false"
54
- # todo: make it platform independent
55
- if (OS.mac?)
56
- file = File.open("#{Dir.tmpdir}/screenshot.png", "w+")
57
- `screencapture #{file.path}`
58
- file_content = File.binread(file.path)
59
- File.delete file
60
- return file_content
61
- end
62
- return nil
53
+ return nil if (ENV['screenshot_enabled'] || "").downcase == "false" || which("gauge_screenshot").nil?
54
+ file = File.open("#{Dir.tmpdir}/screenshot.png", "w+")
55
+ `gauge_screenshot #{file.path}`
56
+ file_content = File.binread(file.path)
57
+ File.delete file
58
+ return file_content
63
59
  end
64
60
 
65
61
  def time_elapsed_since(start_time)
@@ -77,7 +73,19 @@ module Gauge
77
73
  end
78
74
  end
79
75
  return params
80
- end
76
+ end
77
+
78
+ private
79
+ def which(cmd)
80
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
81
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
82
+ exts.each { |ext|
83
+ exe = File.join(path, "#{cmd}#{ext}")
84
+ return exe if File.executable?(exe) && !File.directory?(exe)
85
+ }
86
+ end
87
+ return nil
88
+ end
81
89
  end
82
90
  end
83
91
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gauge-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.1
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gauge Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-protocol-buffers