devicefarm 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devicefarm/devicefarmapi.rb +27 -1
- data/lib/devicefarm.rb +9 -7
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8e53f2560018d6ec78997faecd5ade7715a8432
|
4
|
+
data.tar.gz: 6c1e23e1bd55b1e674fac39bd15c46986f0983a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90b049ac49ef92674e435426c49a7f504d5f523f1c9e61622dc9b9b3390dbf45dfbdb8f7232cf46988912463197971b069273473d3bfebedef58ca21bf492953
|
7
|
+
data.tar.gz: ac647a22e88c53d52a05e4a18058009dc12f5fbd59dfeb9660fc11436ad9f826c6bc0dee6ebc80e4cb5153e7265da517dbb9e59ac8b284e2c2c78b7fd5869aad
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require "aws-sdk-devicefarm"
|
2
2
|
|
3
|
+
POLLING_INTERVAL = 1
|
4
|
+
|
3
5
|
class DeviceFarm::DeviceFarmApi
|
4
6
|
|
5
7
|
def initialize
|
@@ -16,13 +18,37 @@ class DeviceFarm::DeviceFarmApi
|
|
16
18
|
device_pool
|
17
19
|
end
|
18
20
|
|
21
|
+
|
22
|
+
def upload_file(url, path)
|
23
|
+
url = URI.parse(upload.url)
|
24
|
+
contents = File.open(path, 'rb').read
|
25
|
+
Net::HTTP.new(url.host).start do |http|
|
26
|
+
http.send_request("PUT", url.request_uri, contents, { 'content-type' => 'application/octet-stream' })
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_upload_result(upload)
|
31
|
+
uploadResult = @client.get_upload({
|
32
|
+
arn: "#{upload.arn}",
|
33
|
+
}).upload
|
34
|
+
end
|
35
|
+
|
36
|
+
def wait_for_upload_finish(upload)
|
37
|
+
upload_result = get_upload_result(upload)
|
38
|
+
while(!upload_result.status == "SUCCEEDED")
|
39
|
+
upload_result = get_upload_result(upload)
|
40
|
+
sleep(POLLING_INTERVAL)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
19
44
|
def upload_artifact(file_path:,type:,project:)
|
20
45
|
file = File.new(file_path)
|
21
46
|
upload = @client.create_upload({
|
22
47
|
project_arn: project.arn,
|
23
48
|
name: File.basename(file),
|
24
49
|
type: type}).upload
|
25
|
-
|
50
|
+
upload_file.(upload.url,file_path)
|
51
|
+
wait_for_upload_finish(upload)
|
26
52
|
upload
|
27
53
|
end
|
28
54
|
|
data/lib/devicefarm.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
class DeviceFarm
|
2
2
|
|
3
|
-
def self.test_with_calabash(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
def self.test_with_calabash(
|
4
|
+
project_name:,
|
5
|
+
device_pool_name:,
|
6
|
+
apk_path:,
|
7
|
+
calabash_test_package_path:)
|
8
|
+
|
9
|
+
devicefarmapi = DeviceFarm::DeviceFarmApi.new()
|
10
|
+
project = devicefarmapi.get_project_by_name(project_name:project_name)
|
11
|
+
device_pool = devicefarmapi.get_device_pool_by_name(
|
10
12
|
pool_name:device_pool_name,
|
11
13
|
project:project)
|
12
14
|
upload_apk = devicefarmapi.upload_artifact(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devicefarm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- viniciusmo
|
@@ -9,9 +9,23 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-04-19 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-devicefarm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.5.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.0
|
13
27
|
description: A simple way to upload your artifacts to test your app ;)
|
14
|
-
email:
|
28
|
+
email: viniciusoliveiravmo@gmail.com
|
15
29
|
executables: []
|
16
30
|
extensions: []
|
17
31
|
extra_rdoc_files: []
|