calabash-android 0.9.8 → 0.9.9

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
  SHA256:
3
- metadata.gz: 4d51222924ed9594aea36dcdd0af70b87301e16bd87d276d9c00ae62b5b69504
4
- data.tar.gz: 1c717c5e6eac99ccbce3a386ae328485c2d06494f4d92e36d67c6dbab0ba3c76
3
+ metadata.gz: ffee0c3a564354c2caec0ab6a8d6a313b2166b2f04c381c52708eb98e4d9d3cc
4
+ data.tar.gz: 0b4d4c9b52e6380a9f5990e69a61fa1e9c9b8514079d34a2387a48ffcd763c84
5
5
  SHA512:
6
- metadata.gz: eca1050f8c43739908292fc20c01c3d75949a8229bc9f578ad49f9944524d1d484076db04e4bb084a2fc250194852f131cdf86df13b7948e0943dbdfa78eef83
7
- data.tar.gz: 0a164ec8a21e932c416170c29da181483a573d9430417aa799a44ad43bcafac89cc8053c8775fa7b2f1fa90a18ca53f8cee3e9533e37c8757b09804b53148c22
6
+ metadata.gz: 0d9e35881dac6ca416cb357572ba337e6276412210e32bb2fe8e4e58e94f0e14b0b91c27a7f3111c8dc1c0d3077a9c9637329590ba03ec37bb562f591f98acf8
7
+ data.tar.gz: 0029141008ce6f26a324e316b4b60b46b0103b56ba1b0cc94fd461c660383a71a9d846b5f7c5df926eadee1b0b7da6998c580f1fe919d826906ee9df7fe878ab
@@ -1,5 +1,4 @@
1
1
  require 'rexml/document'
2
- require 'luffa'
3
2
  require 'timeout'
4
3
 
5
4
  if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
@@ -193,13 +192,13 @@ module Calabash
193
192
  build_tools_directories =
194
193
  build_tools_files.select do |dir|
195
194
  begin
196
- Luffa::Version.new(File.basename(dir))
195
+ Calabash::Android::Version.new(File.basename(dir))
197
196
  true
198
197
  rescue ArgumentError
199
198
  false
200
199
  end
201
200
  end.sort do |a, b|
202
- Luffa::Version.compare(Luffa::Version.new(File.basename(a)), Luffa::Version.new(File.basename(b)))
201
+ Calabash::Android::Version.compare(Calabash::Android::Version.new(File.basename(a)), Calabash::Android::Version.new(File.basename(b)))
203
202
  end.reverse.map{|dir| File.join('build-tools', File.basename(dir))}
204
203
 
205
204
  if build_tools_directories.empty?
@@ -173,7 +173,7 @@ def fingerprint_from_apk(app_path)
173
173
 
174
174
  Calabash::Utils.with_silent_zip do
175
175
  Zip::File.foreach("app.apk") do |z|
176
- z.extract if /^META-INF\/\w+.(rsa|dsa)/i =~ z.name
176
+ z.extract if /^META-INF\/\w+\.(rsa|dsa)$/i =~ z.name
177
177
  end
178
178
  end
179
179
 
@@ -362,9 +362,9 @@ module Calabash module Android
362
362
 
363
363
  def install_app(app_path)
364
364
  if _sdk_version >= 23
365
- cmd = "#{adb_command} install -g \"#{app_path}\""
365
+ cmd = "#{adb_command} install -g -t \"#{app_path}\""
366
366
  else
367
- cmd = "#{adb_command} install \"#{app_path}\""
367
+ cmd = "#{adb_command} install -t \"#{app_path}\""
368
368
  end
369
369
 
370
370
  log "Installing: #{app_path}"
@@ -1,5 +1,213 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.9.8"
3
+ VERSION = "0.9.9"
4
+
5
+ # A model of a software release version that can be used to compare two versions.
6
+ #
7
+ # Calabash and RunLoop try very hard to comply with Semantic Versioning rules.
8
+ # However, the semantic versioning spec is incompatible with RubyGem's patterns
9
+ # for pre-release gems.
10
+ #
11
+ # > "But returning to the practical: No release version of SemVer is compatible
12
+ # > with Rubygems." - _David Kellum_
13
+ #
14
+ # Calabash and RunLoop version numbers will be in the form `<major>.<minor>.<patch>[.pre<N>]`.
15
+ #
16
+ # @see http://semver.org/
17
+ # @see http://gravitext.com/2012/07/22/versioning.html
18
+ #
19
+ # TODO Expand to handle versions with more than 1 "." and no "."
20
+ # ^ Needs to handle arbitrary versions from Info.plists. In particular it
21
+ # needs to handle a unix timestamp - found the DeviceAgent-Runner.app.
22
+ class Version
23
+
24
+ # @!attribute [rw] major
25
+ # @return [Integer] the major version
26
+ attr_accessor :major
27
+
28
+ # @!attribute [rw] minor
29
+ # @return [Integer] the minor version
30
+ attr_accessor :minor
31
+
32
+ # @!attribute [rw] patch
33
+ # @return [Integer] the patch version
34
+ attr_accessor :patch
35
+
36
+ # @!attribute [rw] pre
37
+ # @return [Boolean] true if this is a pre-release version
38
+ attr_accessor :pre
39
+
40
+ # @!attribute [rw] pre_version
41
+ # @return [Integer] if this is a pre-release version, returns the
42
+ # pre-release version; otherwise this is nil
43
+ attr_accessor :pre_version
44
+
45
+ # Creates a new Version instance with all the attributes set.
46
+ #
47
+ # @example
48
+ # version = Version.new(0.10.1)
49
+ # version.major => 0
50
+ # version.minor => 10
51
+ # version.patch => 1
52
+ # version.pre => false
53
+ # version.pre_version => nil
54
+ #
55
+ # @example
56
+ # version = Version.new(1.6.3.pre5)
57
+ # version.major => 1
58
+ # version.minor => 6
59
+ # version.patch => 3
60
+ # version.pre => true
61
+ # version.pre_version => 5
62
+ #
63
+ # @param [String] version the version string to parse.
64
+ # @raise [ArgumentError] if version is not in the form 5, 6.1, 7.1.2, 8.2.3.pre1
65
+ def initialize(version)
66
+ tokens = version.strip.split('.')
67
+ count = tokens.count
68
+ if tokens.empty?
69
+ raise ArgumentError, "expected '#{version}' to be like 5, 6.1, 7.1.2, 8.2.3.pre1"
70
+ end
71
+
72
+ if count < 4 and tokens.any? { |elm| elm =~ /\D/ }
73
+ raise ArgumentError, "expected '#{version}' to be like 5, 6.1, 7.1.2, 8.2.3.pre1"
74
+ end
75
+
76
+ if count == 4
77
+ @pre = tokens[3]
78
+ pre_tokens = @pre.scan(/\D+|\d+/)
79
+ @pre_version = pre_tokens[1].to_i if pre_tokens.count == 2
80
+ end
81
+
82
+ @major, @minor, @patch = version.split('.').map(&:to_i)
83
+ end
84
+
85
+ # Returns an string representation of this version.
86
+ # @return [String] a string in the form `<major>.<minor>.<patch>[.pre<N>]`
87
+ def to_s
88
+ str = [major, minor, patch].compact.join('.')
89
+ str = "#{str}.#{pre}" if pre
90
+ str
91
+ end
92
+
93
+ def inspect
94
+ "#<Version #{to_s}>"
95
+ end
96
+
97
+ # Compare this version to another for _object_ equality. This allows
98
+ # Version instances to be used as Hash keys.
99
+ # @param [Version] other the version to compare against.
100
+ def eql?(other)
101
+ hash == other.hash
102
+ end
103
+
104
+ # The hash method for this instance.
105
+ def hash
106
+ str = [major, minor, patch].map do |str|
107
+ str ? str : "0"
108
+ end.join(".")
109
+
110
+ if pre
111
+ str = "#{str}.#{pre}"
112
+ end
113
+
114
+ str.hash
115
+ end
116
+
117
+ # Compare this version to another for equality.
118
+ # @param [Version] other the version to compare against
119
+ # @return [Boolean] true if this Version is the same as `other`
120
+ def == (other)
121
+ Version.compare(self, other) == 0
122
+ end
123
+
124
+ # Compare this version to another for inequality.
125
+ # @param [Version] other the version to compare against
126
+ # @return [Boolean] true if this Version is not the same as `other`
127
+ def != (other)
128
+ Version.compare(self, other) != 0
129
+ end
130
+
131
+ # Is this version less-than another version?
132
+ # @param [Version] other the version to compare against
133
+ # @return [Boolean] true if this Version is less-than `other`
134
+ def < (other)
135
+ Version.compare(self, other) < 0
136
+ end
137
+
138
+ # Is this version greater-than another version?
139
+ # @param [Version] other the version to compare against
140
+ # @return [Boolean] true if this Version is greater-than `other`
141
+ def > (other)
142
+ Version.compare(self, other) > 0
143
+ end
144
+
145
+ # Is this version less-than or equal to another version?
146
+ # @param [Version] other the version to compare against
147
+ # @return [Boolean] true if this Version is less-than or equal `other`
148
+ def <= (other)
149
+ Version.compare(self, other) <= 0
150
+ end
151
+
152
+ # Is this version greater-than or equal to another version?
153
+ # @param [Version] other the version to compare against
154
+ # @return [Boolean] true if this Version is greater-than or equal `other`
155
+ def >= (other)
156
+ Version.compare(self, other) >= 0
157
+ end
158
+
159
+ # Compare version `a` to version `b`.
160
+ #
161
+ # @example
162
+ # compare Version.new(0.10.0), Version.new(0.9.0) => 1
163
+ # compare Version.new(0.9.0), Version.new(0.10.0) => -1
164
+ # compare Version.new(0.9.0), Version.new(0.9.0) => 0
165
+ #
166
+ # @return [Integer] an integer `(-1, 1)`
167
+ def <=> (other)
168
+ Version.compare(self, other)
169
+ end
170
+
171
+ # Compare version `a` to version `b`.
172
+ #
173
+ # @example
174
+ # compare Version.new(0.10.0), Version.new(0.9.0) => 1
175
+ # compare Version.new(0.9.0), Version.new(0.10.0) => -1
176
+ # compare Version.new(0.9.0), Version.new(0.9.0) => 0
177
+ #
178
+ # @return [Integer] an integer `(-1, 1)`
179
+ def self.compare(a, b)
180
+
181
+ if a.major != b.major
182
+ return a.major.to_i > b.major.to_i ? 1 : -1
183
+ end
184
+
185
+ a_minor = a.minor ? a.minor.to_i : 0
186
+ b_minor = b.minor ? b.minor.to_i : 0
187
+ if a_minor != b_minor
188
+ return a_minor > b_minor.to_i ? 1 : -1
189
+ end
190
+
191
+ a_patch = a.patch ? a.patch.to_i : 0
192
+ b_patch = b.patch ? b.patch.to_i : 0
193
+ if a_patch != b_patch
194
+ return a_patch.to_i > b_patch.to_i ? 1 : -1
195
+ end
196
+
197
+ return -1 if a.pre && (!a.pre_version) && b.pre_version
198
+ return 1 if a.pre_version && b.pre && (!b.pre_version)
199
+
200
+ return -1 if a.pre && (!b.pre)
201
+ return 1 if (!a.pre) && b.pre
202
+
203
+ return -1 if a.pre_version && (!b.pre_version)
204
+ return 1 if (!a.pre_version) && b.pre_version
205
+
206
+ if a.pre_version != b.pre_version
207
+ return a.pre_version.to_i > b.pre_version.to_i ? 1 : -1
208
+ end
209
+ 0
210
+ end
211
+ end
4
212
  end
5
213
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2019-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -56,16 +56,22 @@ dependencies:
56
56
  name: rubyzip
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.2'
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: '1.3'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - "~>"
69
+ - - ">="
67
70
  - !ruby/object:Gem::Version
68
71
  version: '1.2'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.3'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: awesome_print
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -114,20 +120,6 @@ dependencies:
114
120
  - - "~>"
115
121
  - !ruby/object:Gem::Version
116
122
  version: 0.0.4
117
- - !ruby/object:Gem::Dependency
118
- name: luffa
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- type: :runtime
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
123
  - !ruby/object:Gem::Dependency
132
124
  name: rake
133
125
  requirement: !ruby/object:Gem::Requirement
@@ -395,8 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
395
387
  - !ruby/object:Gem::Version
396
388
  version: '0'
397
389
  requirements: []
398
- rubyforge_project:
399
- rubygems_version: 2.7.7
390
+ rubygems_version: 3.0.3
400
391
  signing_key:
401
392
  specification_version: 4
402
393
  summary: Client for calabash-android for automated functional testing on Android