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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710d4988cc9725cea1e1f5a4a06f3d85cd5ce191
4
- data.tar.gz: 3298f35909aaec64242696bc0b9f54f2b424bdef
3
+ metadata.gz: c8e53f2560018d6ec78997faecd5ade7715a8432
4
+ data.tar.gz: 6c1e23e1bd55b1e674fac39bd15c46986f0983a3
5
5
  SHA512:
6
- metadata.gz: 256e9c2ee640b9f6afeec37191757e11ea7f59478c668736005c8601a604ddd7ebb056dbd9dedba33e0651a07c29af0780e018239945ffaa4b87aa2a63549357
7
- data.tar.gz: 7ae6ecf19603392bc0a229dfe85f0dc37eff12a02b3d1695b306babc29d2e3304448661bbc59e9e3aa4f320704d93d6b6f59a8a4641743f485e706b358b080f0
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
- %x[curl -T #{file_path} "#{upload.url}"]
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(project_name:,
4
- device_pool_name:,
5
- apk_path:,
6
- calabash_test_package_path:)
7
- devicefarmapi = DeviceFarm::DeviceFarmApi.new()
8
- project = devicefarmapi.get_project_by_name(project_name:project_name)
9
- device_pool = devicefarmapi.get_device_pool_by_name(
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.1
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: nick@quaran.to
28
+ email: viniciusoliveiravmo@gmail.com
15
29
  executables: []
16
30
  extensions: []
17
31
  extra_rdoc_files: []