saucelabs-adapter 0.8.18 → 0.8.19

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.18
1
+ 0.8.19
@@ -0,0 +1,35 @@
1
+ # http://groups.google.com/group/capistrano/browse_thread/thread/455c0c8a6faa9cc8?pli=1
2
+ class Net::SSH::Gateway
3
+ # Opens a SSH tunnel from a port on a remote host to a given host and port
4
+ # on the local side
5
+ # (equivalent to openssh -R parameter)
6
+ def open_remote(port, host, remote_port, remote_host = "127.0.0.1")
7
+ ensure_open!
8
+
9
+ @session_mutex.synchronize do
10
+ @session.forward.remote(port, host, remote_port, remote_host)
11
+ end
12
+
13
+ if block_given?
14
+ begin
15
+ yield [remote_port, remote_host]
16
+ ensure
17
+ close_remote(remote_port, remote_host)
18
+ end
19
+ else
20
+ return [remote_port, remote_host]
21
+ end
22
+ rescue Errno::EADDRINUSE
23
+ retry
24
+ end
25
+
26
+ # Cancels port-forwarding over an open port that was previously opened via
27
+ # #open_remote.
28
+ def close_remote(port, host = "127.0.0.1")
29
+ ensure_open!
30
+
31
+ @session_mutex.synchronize do
32
+ @session.forward.cancel_remote(port, host)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rest_client'
3
+ require 'json'
4
+
5
+ module SauceREST
6
+
7
+ # A simple class for using the Sauce Labs REST API
8
+ class Client
9
+ @@roots = {
10
+ :script => 'scripts',
11
+ :job => 'jobs',
12
+ :result => 'results',
13
+ :tunnel => 'tunnels'
14
+ }
15
+
16
+ def initialize base_url
17
+ @base_url = base_url
18
+ @resource = RestClient::Resource.new @base_url
19
+ end
20
+
21
+ def create type, *args
22
+ doc = args[-1]
23
+ doc_json = doc.to_json
24
+ resp_json = @resource[@@roots[type]].post(doc_json,
25
+ :content_type =>
26
+ 'application/octet-stream')
27
+ resp = JSON.parse resp_json
28
+ return resp
29
+ end
30
+
31
+ def get type, docid
32
+ resp_json = @resource[@@roots[type] + '/' + docid].get
33
+ resp = JSON.parse resp_json
34
+ return resp
35
+ end
36
+
37
+ def attach docid, name, data
38
+ resp_json = @resource[@@roots[:script] + '/' + docid + '/' + name].put data
39
+ resp = JSON.parse resp_json
40
+ return resp
41
+ end
42
+
43
+ def delete type, docid
44
+ resp_json = @resource[@@roots[type] + '/' + docid].delete
45
+ resp = JSON.parse resp_json
46
+ return resp
47
+ end
48
+
49
+ def list type
50
+ resp_json = @resource[@@roots[type] + '/'].get
51
+ resp = JSON.parse resp_json
52
+ return resp
53
+ end
54
+ end
55
+
56
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucelabs-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 18
10
- version: 0.8.18
9
+ - 19
10
+ version: 0.8.19
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Felkins, Chad Woolley, Sam Pierson, Nate Clark
@@ -130,6 +130,8 @@ files:
130
130
  - lib/saucelabs_adapter/tunnels/sauce_tunnel.rb
131
131
  - lib/saucelabs_adapter/tunnels/ssh_tunnel.rb
132
132
  - lib/saucelabs_adapter/utilities.rb
133
+ - lib/saucerest-ruby/gateway.rb
134
+ - lib/saucerest-ruby/saucerest.rb
133
135
  - README.markdown
134
136
  - spec/selenium_config_spec.rb
135
137
  - spec/spec_helper.rb