Ruby_AppThwack 0.0.6 → 0.0.7

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: 74226e7cbde20cc815ba3574af2b0794483ef4cc
4
- data.tar.gz: 4d2cc2df2194d02bb53747537cf11d5f9cb3eb47
3
+ metadata.gz: f4d6843491f891db582898645deac12b71c4611b
4
+ data.tar.gz: fcaefdbe293a1599e90cabf467ee91329265a1ef
5
5
  SHA512:
6
- metadata.gz: cb91484c4466f0487c391eb51b5a0237f73895d88b186917af12cdfee2be2e86365d717e743be510f391ac2e62e28826c98b1245acd89fac6231dd6db45c502a
7
- data.tar.gz: cbbd39341ec3575dd517c4347f51088d0eefaee3db305b0155c4d0176168d8dc51caa370686353bc6f591e08ec3c1869de6d69ddcc5a146f6c0fc1b46a81ff5d
6
+ metadata.gz: af269d823117ac3a7583a53accb9f37e02fb1a9d249e02bdec689c5ea61a426b40b2cdfba7084729a91e3d71faf0bd1b3b7e32e243ec3fc39aa9997d1c221aff
7
+ data.tar.gz: b9b2447321fb9b2d695824590661d0a1fee4e269e3047eb40e22a04949b592cfbf83f5e3a029cc1dafb5ae73fecef545d35d3b42435921bb20e4c827f2ce3487
data/bin/appthwack CHANGED
@@ -1,10 +1,13 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'dotenv'
4
4
  Dotenv.load
5
5
 
6
6
  require 'commander/import'
7
7
 
8
+ # testing only!
9
+ ENV['APPTHWACK_API_KEY'] = 'sam'
10
+
8
11
  say_error 'Must set environment variable APPTHWACK_API_KEY' if ENV['APPTHWACK_API_KEY'].nil?
9
12
 
10
13
  $:.push File.expand_path("../../lib", __FILE__)
@@ -1,5 +1,5 @@
1
1
  module AppThwack
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
4
4
 
5
5
  require_relative 'ruby_appthwack/reports.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Ruby_AppThwack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-23 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.4.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: typhoeus
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.6.7
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.6.7
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -129,19 +143,7 @@ executables:
129
143
  extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
132
- - ./features.zip
133
- - ./lib/ruby_appthwack/appthwack_api.rb
134
- - ./lib/ruby_appthwack/commands/report.rb
135
- - ./lib/ruby_appthwack/commands/run.rb
136
- - ./lib/ruby_appthwack/commands/status.rb
137
- - ./lib/ruby_appthwack/commands.rb
138
- - ./lib/ruby_appthwack/packaging.rb
139
- - ./lib/ruby_appthwack/reports.rb
140
- - ./lib/ruby_appthwack.rb
141
- - ./LICENSE
142
- - ./README.md
143
- - ./Ruby_AppThwack-0.0.5.gem
144
- - ./ruby_appthwack.gemspec
146
+ - lib/ruby_appthwack.rb
145
147
  - bin/appthwack
146
148
  homepage: https://github.com/samstewart/ruby_appthwack
147
149
  licenses: []
@@ -162,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
164
  version: '0'
163
165
  requirements: []
164
166
  rubyforge_project:
165
- rubygems_version: 2.0.0
167
+ rubygems_version: 2.0.3
166
168
  signing_key:
167
169
  specification_version: 4
168
170
  summary: Ruby AppThwack
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2013 Sam Stewart
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,6 +0,0 @@
1
- ## Ruby AppThwack
2
- Simple CLI for AppThwack.com's wonderful service.
3
-
4
-
5
- ## To Do
6
- 1. Cleanup options interface and move into configuration file
Binary file
data/features.zip DELETED
Binary file
@@ -1,103 +0,0 @@
1
-
2
- require 'ostruct'
3
- require "json"
4
- require "typhoeus"
5
- require "ostruct"
6
-
7
- module AppThwack::API
8
-
9
- class << self
10
- def get_project_id(name)
11
- res =
12
- JSON.parse(
13
- Typhoeus.get(
14
- "https://appthwack.com/api/project/",
15
- userpwd: "#{ENV['APPTHWACK_API_KEY']}:"
16
- ).body
17
- )
18
-
19
- return (res.select { |project| project['name'].eql? name }).first['id']
20
- end
21
-
22
- def get_device_pool(proj_id, name)
23
-
24
- res =
25
- JSON.parse(
26
- Typhoeus.get(
27
- "https://appthwack.com/api/devicepool/#{proj_id}",
28
- userpwd: "#{ENV['APPTHWACK_API_KEY']}:"
29
- ).body
30
- )
31
-
32
- return (res.select { |pool| pool['name'].eql? name }).first['id']
33
- end
34
-
35
-
36
- def download_file(src, dst)
37
- # We use curl to download the file to avoid running out of RAM
38
- return dst if system "curl -X GET '#{src}' -o '#{dst}' --silent"
39
- end
40
-
41
- def upload_file(src)
42
- f = Dir.glob( src ).first
43
-
44
- res = JSON.parse(
45
- Typhoeus.post(
46
- "https://appthwack.com/api/file",
47
- userpwd: "#{ENV['APPTHWACK_API_KEY']}:",
48
- params: {
49
- name: File.basename(f)
50
- },
51
- body: {
52
- file: File.open(f,"r")
53
- }
54
- ).body
55
- )
56
-
57
- return { :file_id => res["file_id"], :succeeded? => res['message'].nil?, :message => res['message'] }
58
- end
59
-
60
- def start_test(name, proj_id, app_id, pool_id, params = {})
61
-
62
- params.merge! project: proj_id, name: name, app: app_id, pool: pool_id
63
-
64
- res = JSON.parse(
65
- Typhoeus.post(
66
- "https://appthwack.com/api/run",
67
- userpwd: "#{ENV['APPTHWACK_API_KEY']}:",
68
- params: params
69
- ).body
70
- )
71
-
72
- return { :run_id => res['run_id'], :succeeded? => res['message'].nil?, :message => res['message'] }
73
- end
74
-
75
- def test_status?(proj_id, run_id)
76
- res = JSON.parse(
77
- Typhoeus.get(
78
- "https://appthwack.com/api/run/#{proj_id}/#{run_id}/status",
79
- userpwd: "#{ENV['APPTHWACK_API_KEY']}:",
80
- ).body
81
- )
82
-
83
- return res['status']
84
- end
85
-
86
- def test_running?(proj_id, run_id)
87
- return test_status?( proj_id, run_id ) != 'completed'
88
- end
89
-
90
- def download_results(proj_id, run_id)
91
-
92
- resp = Typhoeus.get(
93
- "https://appthwack.com/api/run/#{proj_id}/#{run_id}",
94
- userpwd: "#{ENV['APPTHWACK_API_KEY']}:",
95
- params: {
96
- format: "archive"
97
- }
98
- )
99
-
100
- return ( download_file resp.headers_hash['Location'], "#{proj_id}_#{run_id}.zip" ) if resp.code == 303
101
- end
102
- end
103
- end
@@ -1,5 +0,0 @@
1
- $:.push File.expand_path('../', __FILE__)
2
-
3
- require 'commands/status'
4
- require 'commands/run'
5
- require 'commands/report'
@@ -1,31 +0,0 @@
1
- command :reports do |c|
2
- c.syntax = 'appthwack reports [arguments]'
3
- c.summary = 'Downloads reports and tidies reports'
4
- c.description = ''
5
-
6
- c.option '--project PROJECT', 'The project name of the running tests'
7
- c.option '--runid INT', 'The run ID of the test'
8
- c.option '--platform PLATFORM', 'The mobile platform of the app under test'
9
-
10
- c.action do |args, options|
11
- say_error 'Need project name and run ID' if options.runid.nil? or options.project.nil?
12
-
13
- options.proj_id = AppThwack::API.get_project_id(options.project)
14
-
15
- say_ok "Project ID: #{options.proj_id}"
16
-
17
- status = AppThwack::API.test_status? options.proj_id, options.runid
18
-
19
- say_error 'Project is not finished' unless status.eql? 'completed'
20
-
21
- say_ok 'Downloading reports...'
22
-
23
- reports = AppThwack::API.download_results options.proj_id, options.runid
24
-
25
- say_ok "Downloaded raw reports: #{reports}"
26
-
27
- AppThwack::Reports.convert_reports reports, options.platform
28
-
29
- say_ok 'Converted reports'
30
- end
31
- end
@@ -1,96 +0,0 @@
1
-
2
- command :run do |c|
3
- c.syntax = 'appthwack run [options]'
4
- c.summary = 'Packages tests and pushes them to AppThwack for Running'
5
- c.description = ''
6
-
7
- c.option '--platform PLATFORM', 'The platform of the application under test'
8
- c.option '--project PROJECT', 'Name of AppThwack project'
9
- c.option '--devices DEVICES', 'Name of device pool to use'
10
- c.option '--testtype TYPE', 'Scheme used to build iOS app'
11
- c.option '--app TEST', 'Path of the application (can be Glob syntax)'
12
- c.option '--test TEST', 'Path of the test package'
13
- c.option '--wait', 'Wait for the tests to complete'
14
- c.option '--scheme SCHEME', 'XCode scheme for packaging the IPA'
15
- c.option '--downloadresults', 'Decide whether or not to wait and download results'
16
-
17
- c.action do |args, options|
18
-
19
- options.proj_id = AppThwack::API.get_project_id options.project
20
- options.pool_id = AppThwack::API.get_device_pool options.proj_id, options.devices
21
-
22
- say_ok "Project ID: #{options.proj_id}"
23
- say_ok "Pool ID: #{options.pool_id}"
24
-
25
- # Feature: list of tests to include via command line?
26
- if options.testtype.eql? 'calabash'
27
- options.test = AppThwack::Packaging.create_calabash_package options.proj_id, options.test
28
- end
29
-
30
- # if the platform is iOS, make an IPA before building
31
- if options.platform.eql? 'ios'
32
- options.app = AppThwack::Packaging.create_ipa(options.scheme)
33
- end
34
-
35
- # start by uploading the app
36
- options.app_id = (AppThwack::API.upload_file options.app)[:file_id]
37
- say_ok "App package ID: #{options.app_id}"
38
-
39
- exit 3 if options.app_id.nil?
40
-
41
- # now upload the test package
42
- options.test_id = (AppThwack::API.upload_file options.test)[:file_id]
43
-
44
- say_ok "Test packagae ID: #{options.test_id}"
45
-
46
- exit 4 if options.test_id.nil?
47
-
48
- params = {}
49
-
50
- params['calabash'] = { calabash: options.test_id }
51
-
52
- params['junit'] = { junit: options.test_id }
53
-
54
- result = AppThwack::API.start_test(
55
- File.basename(Dir.glob(options.app).first) + ' -- CLI',
56
- options.proj_id,
57
- options.app_id,
58
- options.pool_id,
59
- params[options.testtype]
60
- )
61
-
62
- options.run_id = result[:run_id]
63
-
64
- say_ok "Run ID: #{options.run_id} with message: #{result[:message]}"
65
-
66
- exit 5 if options.run_id.nil?
67
-
68
- sleep 5
69
-
70
- print "\n"
71
-
72
- # wait for test to terminate
73
- until not AppThwack::API.test_running? options.proj_id, options.run_id or not options.wait
74
- print "."
75
- sleep 30
76
- end
77
-
78
- print "\n"
79
-
80
- # download the results and we should have waited
81
- if options.downloadresults and options.wait
82
- say_ok 'Downloading results...'
83
-
84
- zip = AppThwack::API.download_results options.proj_id, options.run_id
85
-
86
- say_ok "Results zip #{zip}"
87
-
88
- dst = AppThwack::Reports.convert_reports zip, options.platform
89
-
90
- say_ok "Converted reports to #{dst}"
91
- end
92
-
93
- say_ok "Tests started successfully"
94
-
95
- end
96
- end
@@ -1,15 +0,0 @@
1
- command :status do |c|
2
- c.syntax = 'appthwack status [arguments]'
3
- c.summary = 'Check on the status of a running test'
4
- c.description = ''
5
-
6
- c.option '--project PROJECT', 'The project name of the running tests'
7
- c.option '--runid INT', 'The run ID of the test'
8
-
9
-
10
- c.action do |args, options|
11
- say_error 'Need project and run ID' if options.runid.nil? or options.project.nil?
12
-
13
- puts AppThwack::API.test_status? AppThwack::API.get_project_id(options.project), options.runid
14
- end
15
- end
@@ -1,31 +0,0 @@
1
-
2
- module AppThwack::Packaging
3
-
4
- class << self
5
- def create_ipa(scheme)
6
- #uses Shenzhen gem
7
- abort unless system "ipa build --scheme #{scheme} --configuration Release --no-archive"
8
-
9
- return Dir.glob('*.ipa').first
10
- end
11
-
12
- def create_calabash_package proj_id, src, opts = {}
13
- o = { :include_tests=> ["*.feature"], :exclude_tests=> nil}.merge opts
14
-
15
- # create the archive if it doesn't already exist
16
- unless File.extname(src) == '.zip'
17
- # delete any old archives we have laying about
18
- File.delete(src + '.zip') if File.exists?(src + '.zip')
19
-
20
- included = (o[:include_tests].map { |t| "'#{src}/#{t}'"}).join(' ')
21
- excluded = if o[:exclude_tests]; "-x #{ (o[:exclude_tests].map { |t| "'#{calabash}/#{t}'"}).join(' ') }" else "" end
22
-
23
- `zip #{src}.zip #{src} . -r #{excluded} -i '#{src}/support/*' '#{src}/step_definitions/*' #{included}`
24
- end
25
-
26
- src << '.zip'
27
-
28
- return src
29
- end
30
- end
31
- end
@@ -1,71 +0,0 @@
1
- require 'json'
2
- require 'pp'
3
-
4
- module AppThwack::Reports
5
- class << self
6
-
7
- def extract_reports(reports)
8
-
9
- 'unzipped_reports' if system "rm -rf unzipped_reports && unzip -qq #{reports} -d unzipped_reports"
10
- end
11
-
12
- # Converts Android reports into results readable by Cucumber plugin
13
- def convert_reports(reports, platform='android')
14
- # default to android folder
15
- intermediate_folders = 'calabash_tests_from_features.zip'
16
-
17
- dst = 'cucumber-html-reports'
18
-
19
- # unless platform is explicitly ios
20
- if platform.eql? 'ios'
21
- intermediate_folders = 'calabash'
22
- end
23
-
24
- reports = extract_reports(reports)
25
- folders = Dir.entries(reports).select {|f| not f.eql? '.' and not f.eql? '..' }
26
-
27
- # extract for each of the devices
28
- folders.each do |f|
29
-
30
- # capitalize every word
31
- device = f.gsub('_', ' ').split.map(&:capitalize).join(' ')
32
-
33
- # original folder name
34
- folder_name = f
35
-
36
- puts device
37
-
38
- f = File.join(reports, f, intermediate_folders, 'raw_calabash_json_output.instrtxt')
39
-
40
- if File.exists? f
41
- features = []
42
-
43
- # now we just add the device prefix to each feature name to make it unique
44
- File.open(f, 'r') do |io|
45
-
46
- features = JSON.load(io)
47
-
48
- if not features.nil?
49
-
50
- features.each_index do |i|
51
- # append the device name to the feature name
52
- features[i]['name'] = "#{features[i]['name']} on #{device}"
53
- end
54
- end
55
-
56
- Dir.mkdir dst if not Dir.exists? dst
57
-
58
- # now write out the new file
59
- File.open(File.join(dst, "#{Time.now.to_i}_#{folder_name}.json"), 'w') do |io|
60
- JSON.dump(features, io) unless features.nil?
61
- end
62
- end
63
- end
64
- end
65
-
66
- dst
67
- end
68
-
69
-
70
- end
71
- end
@@ -1,29 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "ruby_appthwack"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "Ruby_AppThwack"
7
- s.authors = ["Sam Stewart"]
8
- s.email = "sam@playhaven.com"
9
- s.homepage = "https://github.com/samstewart/ruby_appthwack"
10
- s.version = AppThwack::VERSION
11
- s.platform = Gem::Platform::RUBY
12
- s.summary = "Ruby AppThwack"
13
- s.description = "CLI for running UI tests on AppThwack.com"
14
-
15
- s.add_dependency "commander", "~> 4.1"
16
- s.add_dependency "json", "~> 1.8"
17
- s.add_dependency "faraday", "~> 0.8"
18
- s.add_dependency "faraday_middleware", "~> 0.9"
19
- s.add_dependency "dotenv", "~> 0.7"
20
- s.add_dependency "shenzhen", "~> 0.4.0"
21
-
22
- s.add_development_dependency "rspec"
23
- s.add_development_dependency "rake"
24
-
25
- s.files = Dir["./**/*"].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
26
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
28
- s.require_paths = ["lib"]
29
- end