blade-sauce_labs_plugin 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7019507ca64d76eb63254b7815ff95898f3898cf
|
4
|
+
data.tar.gz: ac458f0a4b05b834aa3385fb450a59ff00d863b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 895a2fd9fefc3e40e638a0c0628afe0fb6b9bea2fcd21d814c8fe49a9b5e85bf2fad86b81502c843313ea9893dec2ad58fc578f174e5bb54abcb87ad0cf779cc
|
7
|
+
data.tar.gz: 2955c25d211c78e40a430f340cc68db21a2f2ccf7496f0edc70ac9b6f14da68e0c48f76fea4448f84131a9699bb66c963147c67d594f0937a037545b6a256281
|
@@ -13,9 +13,10 @@ module Blade::SauceLabsPlugin
|
|
13
13
|
|
14
14
|
def start
|
15
15
|
if Blade.config.interface == :ci
|
16
|
-
Tunnel.start
|
17
|
-
|
18
|
-
|
16
|
+
Tunnel.start do
|
17
|
+
Blade.config.expected_sessions = Client.platforms.size
|
18
|
+
Client.request(:post, "rest/v1/#{username}/js-tests", test_params)
|
19
|
+
end
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -37,7 +38,7 @@ module Blade::SauceLabsPlugin
|
|
37
38
|
|
38
39
|
private
|
39
40
|
def test_params
|
40
|
-
{ url: Blade.url, platforms: Client.platforms, framework: Blade.config.framework }.merge(default_test_config).merge(test_config)
|
41
|
+
{ url: Blade.url, platforms: Client.platforms, framework: Blade.config.framework, tunnelIdentifier: Tunnel.identifier }.merge(default_test_config).merge(test_config)
|
41
42
|
end
|
42
43
|
|
43
44
|
def default_test_config
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require "
|
1
|
+
require "securerandom"
|
2
|
+
require "shellwords"
|
2
3
|
|
3
4
|
module Blade::SauceLabsPlugin::Tunnel
|
4
5
|
extend self
|
@@ -6,37 +7,51 @@ module Blade::SauceLabsPlugin::Tunnel
|
|
6
7
|
extend Forwardable
|
7
8
|
def_delegators Blade::SauceLabsPlugin, :username, :access_key
|
8
9
|
|
10
|
+
attr_reader :identifier, :pid
|
11
|
+
|
9
12
|
def start
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
output = ""
|
18
|
-
while line = reader.gets
|
19
|
-
output << line
|
20
|
-
case line
|
21
|
-
when /Sauce Connect is up, you may start your tests/
|
22
|
-
break
|
23
|
-
when /Goodbye/
|
24
|
-
STDERR.puts output
|
25
|
-
raise "Sauce Connect tunnel connection error"
|
13
|
+
@identifier = SecureRandom.hex(10)
|
14
|
+
@pid = EM::DeferrableChildProcess.open(command).get_pid
|
15
|
+
|
16
|
+
timer = EM::PeriodicTimer.new(1) do
|
17
|
+
if ready_file_exists?
|
18
|
+
timer.cancel
|
19
|
+
yield
|
26
20
|
end
|
27
21
|
end
|
28
|
-
|
29
|
-
ensure
|
30
|
-
writer.close if writer
|
31
|
-
reader.close if reader
|
32
22
|
end
|
33
23
|
|
34
24
|
def stop
|
35
|
-
|
36
|
-
|
25
|
+
signal = ready_file_exists? ? "INT" : "KILL"
|
26
|
+
remove_ready_file
|
27
|
+
Process.kill(signal, pid) rescue nil
|
37
28
|
end
|
38
29
|
|
39
30
|
private
|
31
|
+
def command
|
32
|
+
[tunnel_command, tunnel_args].join(" ")
|
33
|
+
end
|
34
|
+
|
35
|
+
def tunnel_command
|
36
|
+
Pathname.new(File.dirname(__FILE__)).join("../../../support/sc-#{os}/bin/sc").to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def tunnel_args
|
40
|
+
["--user", username, "--api-key", access_key, "--tunnel-identifier", identifier, "--readyfile", ready_file_path].shelljoin
|
41
|
+
end
|
42
|
+
|
43
|
+
def ready_file_path
|
44
|
+
Blade.tmp_path.join("sauce_tunnel_#{identifier}_ready").to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
def ready_file_exists?
|
48
|
+
File.exists?(ready_file_path)
|
49
|
+
end
|
50
|
+
|
51
|
+
def remove_ready_file
|
52
|
+
File.unlink(ready_file_path) if ready_file_exists?
|
53
|
+
end
|
54
|
+
|
40
55
|
def os
|
41
56
|
@os ||=
|
42
57
|
case RUBY_PLATFORM.downcase
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blade-sauce_labs_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javan Makhmali
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: childprocess
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
description:
|
98
84
|
email:
|
99
85
|
- javan@javan.us
|
@@ -147,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
133
|
version: '0'
|
148
134
|
requirements: []
|
149
135
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.5
|
151
137
|
signing_key:
|
152
138
|
specification_version: 4
|
153
139
|
summary: Blade Runner plugin for Sauce Labs (saucelabs.com)
|