xamarin-test-cloud 2.0.0.pre5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ module XamarinTestCloud
2
+
3
+ # TODO validate dsym against the current application.
4
+ # 1. put the dSYM.zip and .ipa in a directory
5
+ # 2. $ unzip <the>.ipa
6
+ # 3. $ unzip <the>.dSYM.zip
7
+ # 4. $ xcrun dwarfdump --uuid Payload/My.app/My
8
+ # 5. $ xcrun dwarfdump --uuid My.app.dSYM
9
+ # 6. confirm that they match.
10
+ class Dsym
11
+
12
+ attr_reader :path
13
+
14
+ # Caller should rescue RuntimeError and re-raise.
15
+ # @raise RuntimeError If the dSYM at path is invalid.
16
+ def initialize(path)
17
+ @path = path
18
+ validate!
19
+ end
20
+
21
+ def to_s
22
+ "#<DSYM #{@path}>"
23
+ end
24
+
25
+ def inspect
26
+ to_s
27
+ end
28
+
29
+ def validate!
30
+ extension = File.extname(path)
31
+
32
+ if extension != ".dSYM"
33
+ raise RuntimeError, %Q[Invalid dSYM directory.
34
+
35
+ The --dsym-file must have a dSYM extension. Found:
36
+
37
+ #{path}
38
+ ]
39
+ end
40
+
41
+ if !File.exist?(path)
42
+ raise RuntimeError, %Q[Invalid dSYM directory.
43
+
44
+ The --dsym-file does not exist:
45
+
46
+ #{path}
47
+ ]
48
+ end
49
+
50
+ if !File.directory?(path)
51
+ raise RuntimeError, %Q[Invalid dSYM directory.
52
+
53
+ The --dsym-file is not a directory:
54
+
55
+ #{path}
56
+ ]
57
+ end
58
+
59
+ if dwarf_symbol_files.count > 1
60
+ raise RuntimeError, %Q[Invalid dSYM directory.
61
+
62
+ The --dsym-file contains more than one symbol file.
63
+
64
+ Check the contents of #{File.join("Contents", "Resources", "DWARF")} in:
65
+
66
+ #{path}
67
+ ]
68
+ end
69
+
70
+ if dwarf_symbol_files.count < 1
71
+ raise RuntimeError, %Q[Invalid dSYM directory.
72
+
73
+ The --dsym-file contains no symbol file.
74
+
75
+ Check the contents of #{File.join("Contents", "Resources", "DWARF")} in:
76
+
77
+ #{path}
78
+
79
+ #{Dir.glob(File.join(path, "Contents", "Resources", "DWARF", "*" ))}
80
+ ]
81
+ end
82
+
83
+ true
84
+ end
85
+
86
+ def remote_path(path_to_app)
87
+ "#{File.basename(path_to_app)}_dSym"
88
+ end
89
+
90
+ def symbol_file
91
+ File.expand_path(dwarf_symbol_files[0])
92
+ end
93
+
94
+ # Cannot use Dir.glob
95
+ # https://github.com/xamarinhq/test-cloud-command-line/issues/52
96
+ def dwarf_symbol_files
97
+ @dwarf_symbol_files ||= begin
98
+ base = File.join(path, "Contents", "Resources", "DWARF")
99
+ Dir.entries(base).select do |entry|
100
+ !(entry.end_with?('..') || entry.end_with?('.'))
101
+ end.map { |entry| File.join(base, entry) }
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,80 @@
1
+
2
+ module XamarinTestCloud
3
+ module Environment
4
+
5
+ # Returns true if Windows environment
6
+ def self.windows_env?
7
+ if @@windows_env.nil?
8
+ @@windows_env = Environment.host_os_is_win?
9
+ end
10
+ @@windows_env
11
+ end
12
+
13
+ # Returns true if MacOS environment
14
+ def self.macos_env?
15
+ if @@macos_env.nil?
16
+ @@macos_env = Environment.host_os_is_darwin?
17
+ end
18
+ @@macos_env
19
+ end
20
+
21
+ # Returns true if debugging is enabled.
22
+ def self.debug?
23
+ ENV["DEBUG"] == "1"
24
+ end
25
+
26
+ # Returns the XTC_ENDPOINT
27
+ def self.xtc_endpoint
28
+ Environment.value_of_env("XTC_ENDPOINT")
29
+ end
30
+
31
+ # Returns the XTC_USERNAME
32
+ def self.xtc_username
33
+ Environment.value_of_env("XTC_USERNAME")
34
+ end
35
+
36
+ # Returns the XTC_PASSWORD
37
+ def self.xtc_password
38
+ Environment.value_of_env("XTC_PASSWORD")
39
+ end
40
+
41
+ private
42
+
43
+ # @visibility private
44
+ WIN_PATTERNS = [
45
+ /bccwin/i,
46
+ /cygwin/i,
47
+ /djgpp/i,
48
+ /mingw/i,
49
+ /mswin/i,
50
+ /wince/i,
51
+ ]
52
+
53
+ # @!visibility private
54
+ @@windows_env = nil
55
+
56
+ # @!visibility private
57
+ @@macos_env = nil
58
+
59
+ # @!visibility private
60
+ def self.host_os_is_win?
61
+ ruby_platform = RbConfig::CONFIG["host_os"]
62
+ !!WIN_PATTERNS.find { |r| ruby_platform =~ r }
63
+ end
64
+
65
+ #@!visibility private
66
+ def self.host_os_is_darwin?
67
+ (RbConfig::CONFIG['host_os'] =~ /darwin/)
68
+ end
69
+
70
+ # @!visibility private
71
+ def self.value_of_env(name)
72
+ value = ENV[name]
73
+ if value && value != ""
74
+ value
75
+ else
76
+ nil
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,94 @@
1
+
2
+ module XamarinTestCloud
3
+
4
+ # Appropriate for files under features/, <tmpdir>/ and test_servers/
5
+ #
6
+ # Not appropriate for app and dysm files.
7
+ #
8
+ # To create a Cucumber configuration instance, use `TestFile.cucumber_config`.
9
+ class TestFile
10
+
11
+ def self.file_digest(file, digest=:SHA256)
12
+ case digest
13
+ when :SHA256
14
+ require "digest"
15
+ Digest::SHA256.file(file).hexdigest
16
+ when :MD5
17
+ require "digest/md5"
18
+ Digest::MD5.file(file).hexdigest
19
+ else
20
+ raise ArgumentError, %Q[Invalid digest type: #{digest}.
21
+ Only :SHA256 or :MD5 are supported
22
+ ]
23
+ end
24
+ end
25
+
26
+ # Special handling for Cucumber configuration files.
27
+ #
28
+ # The server expects the remote file name to be _exactly_ config/cucumber.yml
29
+ def self.cucumber_config(file)
30
+ test_file = TestFile.new(file, File.dirname(file))
31
+ test_file.instance_variable_set(:@remote_path, "config/cucumber.yml")
32
+ test_file
33
+ end
34
+
35
+ attr_reader :path, :file_instance, :digest, :remote_path
36
+
37
+ # @param [String] path Needs to be expanded
38
+ # @param [String] basedir Needs to be the beginning of the path
39
+ def initialize(path, basedir)
40
+ @path = path
41
+ @basedir = basedir
42
+
43
+ expanded = File.expand_path(path)
44
+ if path != File.expand_path(expanded)
45
+ raise ArgumentError, %Q[Path must be expanded:
46
+
47
+ path: #{path}
48
+ expanded: #{expanded}
49
+ ]
50
+ end
51
+
52
+ if !path.start_with?(basedir)
53
+ raise ArgumentError, %Q[Path must start with basedir:
54
+
55
+ path: #{path}
56
+ basedir: #{basedir}
57
+
58
+ ]
59
+ end
60
+ end
61
+
62
+ def to_s
63
+ %Q[#<TestFile: #{@path} #{@digest} #{@remote_path}>]
64
+ end
65
+
66
+ def inspect
67
+ to_s
68
+ end
69
+
70
+ def file_instance
71
+ @file_instance ||= File.new(path)
72
+ end
73
+
74
+ def digest
75
+ @digest ||= TestFile.file_digest(path)
76
+ end
77
+
78
+ def remote_path
79
+ @remote_path ||= lambda do
80
+ require "pathname"
81
+ absolute = Pathname.new(path)
82
+ root = Pathname.new(basedir)
83
+ relative = absolute.relative_path_from(root)
84
+ relative.to_s
85
+ end.call
86
+ end
87
+
88
+ private
89
+
90
+ def basedir
91
+ @basedir
92
+ end
93
+ end
94
+ end
@@ -1,3 +1,3 @@
1
1
  module XamarinTestCloud
2
- VERSION = "2.0.0.pre5"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xamarin-test-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-04 00:00:00.000000000 Z
12
+ date: 2016-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -127,6 +127,20 @@ dependencies:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
129
  version: '2.99'
130
+ - !ruby/object:Gem::Dependency
131
+ name: rspec_junit_formatter
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '0.2'
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '0.2'
130
144
  - !ruby/object:Gem::Dependency
131
145
  name: rake
132
146
  requirement: !ruby/object:Gem::Requirement
@@ -273,6 +287,20 @@ dependencies:
273
287
  - - ">="
274
288
  - !ruby/object:Gem::Version
275
289
  version: '0'
290
+ - !ruby/object:Gem::Dependency
291
+ name: awesome_print
292
+ requirement: !ruby/object:Gem::Requirement
293
+ requirements:
294
+ - - ">="
295
+ - !ruby/object:Gem::Version
296
+ version: '0'
297
+ type: :development
298
+ prerelease: false
299
+ version_requirements: !ruby/object:Gem::Requirement
300
+ requirements:
301
+ - - ">="
302
+ - !ruby/object:Gem::Version
303
+ version: '0'
276
304
  description: Xamarin Test Cloud lets you automatically test your app on hundreds of
277
305
  mobile devices
278
306
  email:
@@ -286,11 +314,15 @@ files:
286
314
  - CHANGELOG.md
287
315
  - README.md
288
316
  - bin/test-cloud
317
+ - lib/xamarin-test-cloud/calabash_version_detector.rb
289
318
  - lib/xamarin-test-cloud/cli.rb
319
+ - lib/xamarin-test-cloud/dsym.rb
320
+ - lib/xamarin-test-cloud/environment.rb
290
321
  - lib/xamarin-test-cloud/http/payload.rb
291
322
  - lib/xamarin-test-cloud/http/request.rb
292
323
  - lib/xamarin-test-cloud/http/retriable_client.rb
293
324
  - lib/xamarin-test-cloud/retriable_options.rb
325
+ - lib/xamarin-test-cloud/test_file.rb
294
326
  - lib/xamarin-test-cloud/version.rb
295
327
  homepage: http://xamarin.com/test-cloud
296
328
  licenses: []
@@ -306,9 +338,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
338
  version: '2.0'
307
339
  required_rubygems_version: !ruby/object:Gem::Requirement
308
340
  requirements:
309
- - - ">"
341
+ - - ">="
310
342
  - !ruby/object:Gem::Version
311
- version: 1.3.1
343
+ version: '0'
312
344
  requirements: []
313
345
  rubyforge_project:
314
346
  rubygems_version: 2.5.1