scirocco 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -6
- data/examples/search_devices.rb +8 -0
- data/jenkins.png +0 -0
- data/lib/scirocco/cli.rb +63 -18
- data/lib/scirocco/client.rb +20 -5
- data/lib/scirocco/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac916cebd9a0b2dba447ecc7528dae8ad4030a3
|
4
|
+
data.tar.gz: 8240b153e6dda045aff848468f8aec009c24c44f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a6b034d27053cf54c108a6d9913a5af95d6a10ca7a5bb5c18cbcea47ba0e0eeff425966292e3568709c6607d12b0d1e8006705a8de281142b862c1bf467dd0b
|
7
|
+
data.tar.gz: 8c192aff712a4038f9b6da6ea3d652ad3e6df54db102cb74702d7d51bef10a4195ff1ebd8e7576dc621be9fcc759d36db62064b0baf0053009d66304cf178f89
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ The official Ruby client for the [SciroccoCloud](http://www.scirocco-cloud.com/)
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'scirocco'
|
14
|
+
gem 'scirocco', '0.1.3'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -20,17 +20,60 @@ And then execute:
|
|
20
20
|
|
21
21
|
Or install it yourself as:
|
22
22
|
|
23
|
-
$ gem install scirocco
|
23
|
+
$ gem install scirocco -v 0.1.3
|
24
24
|
|
25
|
-
##
|
25
|
+
## Upload app
|
26
26
|
|
27
|
-
$ scirocco
|
27
|
+
$ scirocco upload_app --project-id=$PROJECT_ID --app-path=$APP_PATH --api-key=$API_KEY
|
28
|
+
|
29
|
+
|
30
|
+
## Search device
|
31
|
+
|
32
|
+
$ scirocco devices --project-id=$PROJECT_ID --status=available --api-key=$API_KEY
|
33
|
+
|
34
|
+
## Running tests
|
35
|
+
|
36
|
+
$ scirocco run_test --test-class-id=$TEST_CLASS_ID --device-id=$DEVICE_ID --api-key=$API_KEY --poll
|
37
|
+
|
38
|
+
## Abort the all booked test jobs
|
39
|
+
|
40
|
+
$ scirocco abort_all --api-key=$API_KEY --poll
|
28
41
|
|
29
42
|
## Jenkins Integration
|
30
43
|
|
31
|
-
In Jenkins
|
44
|
+
* In Jenkins, set up a new task.
|
45
|
+
* In the "Execute shell" section, add the following:
|
46
|
+
|
47
|
+
~~~
|
48
|
+
# Configuration
|
49
|
+
API_KEY=XXXXX
|
50
|
+
PROJECT_ID=XXX
|
51
|
+
APP_PATH=./MainActivity.apk
|
52
|
+
TEST_CLASS_ID=XXX
|
53
|
+
|
54
|
+
# Set available device id
|
55
|
+
DEVICE_ID=`scirocco get_device_id --project-id=$PROJECT_ID --status=available --api-key=$API_KEY`
|
56
|
+
if [ -n "$DEVICE_ID" ]; then
|
57
|
+
# When available device is not found, set not available device id
|
58
|
+
DEVICE_ID=`scirocco get_device_id --project-id=$PROJECT_ID --api-key=$API_KEY`
|
59
|
+
fi
|
60
|
+
|
61
|
+
# Upload apk
|
62
|
+
scirocco upload_app --project-id=$PROJECT_ID --app-path=$APP_PATH --api-key=$API_KEY
|
63
|
+
|
64
|
+
# Get device_id
|
65
|
+
scirocco get_device_id --project-id=$PROJECT_ID --status=available --api-key=$API_KEY
|
66
|
+
|
67
|
+
# Do the test
|
68
|
+
scirocco run_test --test-class-id=$TEST_CLASS_ID --device-id=$DEVICE_ID --poll --api-key=$API_KEY
|
69
|
+
~~~
|
70
|
+
|
71
|
+
Here's what that code looks like in Jenkins:
|
72
|
+
|
73
|
+
![Jenkins Integration](https://raw.githubusercontent.com/sonixlabs/scirocco-rb/master/jenkins.png)
|
32
74
|
|
33
|
-
|
75
|
+
* Save the task.
|
76
|
+
* Execute the task and check for the console output.
|
34
77
|
|
35
78
|
## Development
|
36
79
|
|
data/jenkins.png
ADDED
Binary file
|
data/lib/scirocco/cli.rb
CHANGED
@@ -14,17 +14,20 @@ module Scirocco
|
|
14
14
|
pp client.projects()
|
15
15
|
end
|
16
16
|
|
17
|
-
desc "tests
|
18
|
-
|
17
|
+
desc "tests", "Print list of tests associated with the given project_id"
|
18
|
+
option :project_id, :required => true
|
19
|
+
def tests
|
19
20
|
client = Scirocco::Client.new(options[:api_key], options)
|
20
|
-
pp client.tests(project_id)
|
21
|
+
pp client.tests(options[:project_id])
|
21
22
|
end
|
22
23
|
|
24
|
+
desc "run_test", "Runs the test on the device"
|
25
|
+
option :test_class_id, :required => true
|
26
|
+
option :device_id, :required => true
|
23
27
|
option :poll, :type => :boolean
|
24
|
-
|
25
|
-
def run_test(test_class_id, device_id)
|
28
|
+
def run_test
|
26
29
|
client = Scirocco::Client.new(options[:api_key], options)
|
27
|
-
test_job = client.run_test(test_class_id, device_id)["test_job"]
|
30
|
+
test_job = client.run_test(options[:test_class_id], options[:device_id])["test_job"]
|
28
31
|
puts "* test_job:"
|
29
32
|
pp test_job
|
30
33
|
if options[:poll]
|
@@ -40,28 +43,70 @@ module Scirocco
|
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
43
|
-
desc "check_test
|
44
|
-
|
46
|
+
desc "check_test", "Check the test result"
|
47
|
+
option :test_job_id, :required => true
|
48
|
+
def check_test
|
45
49
|
client = Scirocco::Client.new(options[:api_key], options)
|
46
|
-
pp client.check_test(test_job_id)
|
50
|
+
pp client.check_test(options[:test_job_id])
|
47
51
|
end
|
48
52
|
|
49
|
-
desc "
|
50
|
-
|
53
|
+
desc "abort_test", "Abort the booked test job"
|
54
|
+
option :test_job_id, :required => true
|
55
|
+
def abort_test
|
51
56
|
client = Scirocco::Client.new(options[:api_key], options)
|
52
|
-
pp client.
|
57
|
+
pp client.abort_test(options[:test_job_id])
|
53
58
|
end
|
54
59
|
|
55
|
-
desc "
|
56
|
-
def
|
60
|
+
desc "abort_all", "Abort the all booked test jobs"
|
61
|
+
def abort_all
|
57
62
|
client = Scirocco::Client.new(options[:api_key], options)
|
58
|
-
pp client.
|
63
|
+
pp client.abort_all
|
59
64
|
end
|
60
65
|
|
61
|
-
desc "
|
62
|
-
|
66
|
+
desc "devices", "Print list of devices"
|
67
|
+
option :project_id, :required => true
|
68
|
+
option :os
|
69
|
+
option :os_version
|
70
|
+
option :carrier
|
71
|
+
option :model
|
72
|
+
option :country
|
73
|
+
option :status
|
74
|
+
def devices
|
63
75
|
client = Scirocco::Client.new(options[:api_key], options)
|
64
|
-
pp client.
|
76
|
+
pp client.devices(options[:project_id], options)
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "get_device_id", "Get device id"
|
80
|
+
option :project_id, :required => true
|
81
|
+
option :os
|
82
|
+
option :os_version
|
83
|
+
option :carrier
|
84
|
+
option :model
|
85
|
+
option :country
|
86
|
+
option :status
|
87
|
+
def get_device_id
|
88
|
+
client = Scirocco::Client.new(options[:api_key], options)
|
89
|
+
devices = client.devices(options[:project_id], options)["devices"]
|
90
|
+
if devices.length > 0
|
91
|
+
p devices[0]["device_id"]
|
92
|
+
else
|
93
|
+
p ""
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "apps", "Print list of apps"
|
98
|
+
option :project_id, :required => true
|
99
|
+
def apps
|
100
|
+
client = Scirocco::Client.new(options[:api_key], options)
|
101
|
+
pp client.apps(options[:project_id])
|
102
|
+
end
|
103
|
+
|
104
|
+
desc "upload_app", "Upload app"
|
105
|
+
option :project_id, :required => true
|
106
|
+
option :app_path, :required => true
|
107
|
+
def upload_app
|
108
|
+
client = Scirocco::Client.new(options[:api_key], options)
|
109
|
+
pp client.upload_app(options[:project_id], options[:app_path])
|
65
110
|
end
|
66
111
|
|
67
112
|
end
|
data/lib/scirocco/client.rb
CHANGED
@@ -28,9 +28,9 @@ module Scirocco
|
|
28
28
|
## Device API
|
29
29
|
##############
|
30
30
|
|
31
|
-
def devices(project_id)
|
31
|
+
def devices(project_id, params={})
|
32
32
|
url = build_url("devices")
|
33
|
-
get(url, {:project_id => project_id})
|
33
|
+
get(url, {:project_id => project_id}.merge(params))
|
34
34
|
end
|
35
35
|
|
36
36
|
|
@@ -57,7 +57,6 @@ module Scirocco
|
|
57
57
|
# Checks for when test completes
|
58
58
|
def poll_test_result(test_job_id)
|
59
59
|
status = nil
|
60
|
-
runtime = 0
|
61
60
|
while !['passed', 'failed'].include?(status)
|
62
61
|
sleep(API_POLL_SEC)
|
63
62
|
test_status = check_test(test_job_id)["test_status"]
|
@@ -77,6 +76,24 @@ module Scirocco
|
|
77
76
|
get(url, params)
|
78
77
|
end
|
79
78
|
|
79
|
+
def abort_test(test_job_id)
|
80
|
+
url = build_url("tests", "abort")
|
81
|
+
data = {
|
82
|
+
:api_key => @api_key,
|
83
|
+
:test_job_id => test_job_id
|
84
|
+
}
|
85
|
+
post(url, data)
|
86
|
+
end
|
87
|
+
|
88
|
+
def abort_all
|
89
|
+
url = build_url("tests", "abort_all")
|
90
|
+
data = {
|
91
|
+
:api_key => @api_key,
|
92
|
+
}
|
93
|
+
post(url, data)
|
94
|
+
end
|
95
|
+
|
96
|
+
|
80
97
|
############
|
81
98
|
## App API
|
82
99
|
############
|
@@ -97,8 +114,6 @@ module Scirocco
|
|
97
114
|
post(url, data)
|
98
115
|
end
|
99
116
|
|
100
|
-
private
|
101
|
-
|
102
117
|
def build_url(type, resource=nil)
|
103
118
|
@scheme + "://" + [@host + ":" + @port.to_s, "api", @version, type, resource].compact.join("/") + "/"
|
104
119
|
end
|
data/lib/scirocco/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scirocco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k-yamada
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -126,7 +126,9 @@ files:
|
|
126
126
|
- assets/jenkins.png
|
127
127
|
- bin/console
|
128
128
|
- bin/setup
|
129
|
+
- examples/search_devices.rb
|
129
130
|
- exe/scirocco
|
131
|
+
- jenkins.png
|
130
132
|
- lib/scirocco.rb
|
131
133
|
- lib/scirocco/cli.rb
|
132
134
|
- lib/scirocco/client.rb
|
@@ -154,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
158
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.4.8
|
158
160
|
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: API client for SciroccoCloud
|