sauce-connect 3.5.0 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/sauce/connect.rb +100 -38
- metadata +9 -12
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
N2JjMTg1YmM5YzQzNmUyNDNhZTI4M2U2NGM4MTg5OTBiMWJhNWVkMg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ac85a3af79d626f0f58d6deed1db7ebe445ffdbe
|
4
|
+
data.tar.gz: d4fb55c8c1ec84446d79acd73ccebb66029d72aa
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NjVjZGMxNjY2OTYxZWFmN2YwMmFmZDY4MzcxNzQyMGFlNzBhOWM5Yzg1NzQ0
|
11
|
-
OTIxMjhjZDcyYThkYmYwNDEwOGJjNzgxYjMxNWE0YjJmMDhkNTQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzMyN2I5YzIxMDg3ZjRkZGRhNTcwZTNiMTE3N2M5OWEwMzM1NzZhNjYzNTZm
|
14
|
-
M2M2NTBhNTYyZjNhYWY1MDlmMWJlZjdjZTExZjFkYzI0YTljM2MyN2VmNDQ4
|
15
|
-
ZjMxMTYzZTc1YzIyNjMyNTg0Y2MxMjFhOTE1NWJhNGIwZjk0MDE=
|
6
|
+
metadata.gz: c9c703b675f134b84bdcda37d9831fc6628da02b9a77afab434b6ce874adbc752b2263a8ebbcd373f30d683ac5d6a3e2bf362b613232e2628e22b4c82b1595e6
|
7
|
+
data.tar.gz: 5398c70e1ee67fbbde0483a268399548c649427f78178bf3cac58d6ed7c81f68e50a2f0bcbab64f78ab5670971f673c7f8a7278fae057f5a799c456294c7e756
|
data/lib/sauce/connect.rb
CHANGED
@@ -19,6 +19,8 @@ module Sauce
|
|
19
19
|
@timeout = options.fetch(:timeout) { TIMEOUT }
|
20
20
|
@config = Sauce::Config.new(options)
|
21
21
|
@skip_connection_test = @config[:skip_connection_test]
|
22
|
+
@cli_options = @config[:connect_options]
|
23
|
+
@sc4_executable = @config[:sauce_connect_4_executable]
|
22
24
|
|
23
25
|
if @config.username.nil?
|
24
26
|
raise ArgumentError, "Username required to launch Sauce Connect. Please set the environment variable $SAUCE_USERNAME"
|
@@ -60,48 +62,68 @@ module Sauce
|
|
60
62
|
ensure_connection_is_possible
|
61
63
|
end
|
62
64
|
|
63
|
-
|
65
|
+
if java_is_present?
|
66
|
+
puts "[Connecting to Sauce Labs...]"
|
64
67
|
|
65
|
-
|
66
|
-
command_args = [@config.username, @config.access_key] + formatted_cli_options
|
67
|
-
command = "exec #{Sauce::Connect.connect_command} #{command_args.join(' ')} 2>&1"
|
68
|
-
@pipe = IO.popen(command)
|
68
|
+
formatted_cli_options = array_of_formatted_cli_options_from_hash(cli_options)
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
command_args = []
|
71
|
+
if @sc4_executable
|
72
|
+
command_args = ['-u', @config.username, '-k', @config.access_key]
|
73
|
+
else
|
74
|
+
command_args = [@config.username, @config.access_key]
|
75
75
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
if line =~/Invalid API_KEY provided/
|
93
|
-
@error = "Invalid API_KEY provided"
|
94
|
-
@quiet = false
|
76
|
+
|
77
|
+
command_args << formatted_cli_options
|
78
|
+
command = "exec #{connect_command} #{command_args.join(' ')} 2>&1"
|
79
|
+
|
80
|
+
unless @quiet
|
81
|
+
string_arguments = formatted_cli_options.join(' ')
|
82
|
+
puts "[Sauce Connect arguments: '#{string_arguments}' ]"
|
83
|
+
end
|
84
|
+
|
85
|
+
@pipe = IO.popen(command)
|
86
|
+
|
87
|
+
@process_status = $?
|
88
|
+
at_exit do
|
89
|
+
Process.kill("INT", @pipe.pid)
|
90
|
+
while @ready
|
91
|
+
sleep 1
|
95
92
|
end
|
96
|
-
$stderr.puts line unless @quiet
|
97
93
|
end
|
98
|
-
|
99
|
-
|
94
|
+
|
95
|
+
Thread.new {
|
96
|
+
while( (line = @pipe.gets) )
|
97
|
+
if line =~ /Tunnel remote VM is (.*) (\.\.|at)/
|
98
|
+
@status = $1
|
99
|
+
end
|
100
|
+
if line =~/You may start your tests\./
|
101
|
+
@ready = true
|
102
|
+
end
|
103
|
+
if line =~ /- (Problem.*)$/
|
104
|
+
@error = $1
|
105
|
+
@quiet = false
|
106
|
+
end
|
107
|
+
if line =~ /== Missing requirements ==/
|
108
|
+
@error = "Missing requirements"
|
109
|
+
@quiet = false
|
110
|
+
end
|
111
|
+
if line =~/Invalid API_KEY provided/
|
112
|
+
@error = "Invalid API_KEY provided"
|
113
|
+
@quiet = false
|
114
|
+
end
|
115
|
+
$stderr.puts line unless @quiet
|
116
|
+
end
|
117
|
+
@ready = false
|
118
|
+
}
|
119
|
+
else
|
120
|
+
raise "Java doesn't seem to be installed. Sauce Connect requires a working install of Java to proceed."
|
121
|
+
end
|
100
122
|
end
|
101
123
|
|
102
124
|
def cli_options
|
103
125
|
cli_options = { readyfile: "sauce_connect.ready" }
|
104
|
-
cli_options.merge!(@
|
126
|
+
cli_options.merge!(@cli_options) if @cli_options
|
105
127
|
cli_options
|
106
128
|
end
|
107
129
|
|
@@ -129,12 +151,42 @@ module Sauce
|
|
129
151
|
end
|
130
152
|
end
|
131
153
|
|
132
|
-
|
133
|
-
|
154
|
+
# Check the absolute version of the provided path.
|
155
|
+
# Returns true only if the path exists and is executable by the
|
156
|
+
# effective current user.
|
157
|
+
def find_sauce_connect
|
158
|
+
if @sc4_executable and path_is_connect_executable? @sc4_executable
|
159
|
+
File.absolute_path @sc4_executable
|
160
|
+
else
|
161
|
+
File.expand_path(File.dirname(__FILE__) + '/../../support/Sauce-Connect.jar')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def connect_command
|
166
|
+
command = "#{command_prefix}#{find_sauce_connect}"
|
167
|
+
return command
|
168
|
+
end
|
169
|
+
|
170
|
+
# SC4 doesn't require a prefix
|
171
|
+
def command_prefix
|
172
|
+
unless @sc4_executable
|
173
|
+
"java -jar "
|
174
|
+
end
|
175
|
+
|
176
|
+
""
|
134
177
|
end
|
135
178
|
|
136
|
-
def
|
137
|
-
|
179
|
+
def path_is_connect_executable? path
|
180
|
+
absolute_path = File.absolute_path path
|
181
|
+
if File.exist? absolute_path
|
182
|
+
if File.executable? absolute_path
|
183
|
+
true
|
184
|
+
else
|
185
|
+
raise TunnelNotPossibleException "#{absolute_path} is not executable by #{Process.euid}"
|
186
|
+
end
|
187
|
+
else
|
188
|
+
raise TunnelNotPossibleException "#{absolute_path} does not exist"
|
189
|
+
end
|
138
190
|
end
|
139
191
|
|
140
192
|
# Global Sauce Connect-ness
|
@@ -162,10 +214,20 @@ module Sauce
|
|
162
214
|
def array_of_formatted_cli_options_from_hash(hash)
|
163
215
|
hash.collect do |key, value|
|
164
216
|
opt_name = key.to_s.gsub("_", "-")
|
165
|
-
|
217
|
+
|
218
|
+
if !@sc4_executable
|
219
|
+
"--#{opt_name}=#{value}"
|
220
|
+
else
|
221
|
+
"--#{opt_name} #{value}"
|
222
|
+
end
|
166
223
|
end
|
167
224
|
end
|
168
225
|
|
226
|
+
def java_is_present?
|
227
|
+
# This is nieve; Can we be better?
|
228
|
+
system 'java -version'
|
229
|
+
end
|
230
|
+
|
169
231
|
def self.port_not_open_message
|
170
232
|
<<-ENDLINE
|
171
233
|
Unable to connect to port 443 on saucelabs.com, which may interfere with
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
My41LjA=
|
4
|
+
version: 3.5.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- R. Tyler Croy
|
@@ -12,24 +11,22 @@ authors:
|
|
12
11
|
autorequire:
|
13
12
|
bindir: bin
|
14
13
|
cert_chain: []
|
15
|
-
date:
|
14
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
16
15
|
dependencies:
|
17
16
|
- !ruby/object:Gem::Dependency
|
18
17
|
name: sauce
|
19
18
|
requirement: !ruby/object:Gem::Requirement
|
20
19
|
requirements:
|
21
|
-
- - ~>
|
20
|
+
- - "~>"
|
22
21
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
My41
|
22
|
+
version: '3.5'
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
26
|
requirements:
|
29
|
-
- - ~>
|
27
|
+
- - "~>"
|
30
28
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
32
|
-
My41
|
29
|
+
version: '3.5'
|
33
30
|
description: ''
|
34
31
|
email:
|
35
32
|
- tyler@monkeypox.org
|
@@ -49,17 +46,17 @@ require_paths:
|
|
49
46
|
- lib
|
50
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
48
|
requirements:
|
52
|
-
- -
|
49
|
+
- - ">="
|
53
50
|
- !ruby/object:Gem::Version
|
54
51
|
version: '0'
|
55
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
53
|
requirements:
|
57
|
-
- -
|
54
|
+
- - ">="
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: '0'
|
60
57
|
requirements: []
|
61
58
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.2.
|
59
|
+
rubygems_version: 2.2.2
|
63
60
|
signing_key:
|
64
61
|
specification_version: 4
|
65
62
|
summary: ''
|