fastlane-plugin-waldo 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/waldo/helper/waldo_helper.rb +101 -2
- data/lib/fastlane/plugin/waldo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ed8c04c2045ecc72f5bae2886d924aa267dbf01
|
4
|
+
data.tar.gz: 56f47c14e035e955ca002a891648d4a96cfc1596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9507565edfe335c48757bc2283057b7a5235e0cf712c94fd5e70d4fd26ad3ba3f9ee8c13fcbad1126cc8c29ca178e6a188ce27d5ea85ce0fe569fba7cc6efb07
|
7
|
+
data.tar.gz: 5a07ca19ae171dddb902bfb96677c40fa0b00ab5a42b201529d89c3708d6328689105db90a081e033daf0b1fe19ddbd466a78409169cbd54eb377a66459a4f9c
|
@@ -1,8 +1,26 @@
|
|
1
|
+
require 'base64'
|
1
2
|
require 'net/http'
|
2
3
|
|
3
4
|
module Fastlane
|
4
5
|
module Helper
|
5
6
|
class WaldoHelper
|
7
|
+
def self.convert_commit(sha)
|
8
|
+
puts "Entering convert_commit(#{sha})"
|
9
|
+
|
10
|
+
prefix = 'remotes/origin/'
|
11
|
+
pfxlen = prefix.length
|
12
|
+
|
13
|
+
full_name = get_git_commit_name(sha)
|
14
|
+
|
15
|
+
if full_name.start_with?(prefix)
|
16
|
+
abbr_name = full_name[pfxlen..-1]
|
17
|
+
else
|
18
|
+
abbr_name = "local:#{full_name}"
|
19
|
+
end
|
20
|
+
|
21
|
+
%("#{sha[0..7]}-#{abbr_name}")
|
22
|
+
end
|
23
|
+
|
6
24
|
def self.dump_request(request)
|
7
25
|
len = request.body ? request.body.length : 0
|
8
26
|
|
@@ -76,6 +94,38 @@ module Fastlane
|
|
76
94
|
end
|
77
95
|
end
|
78
96
|
|
97
|
+
def self.get_git_commit_name(sha)
|
98
|
+
cmd = %(git name-rev --exclude='tags/*' --name-only "#{sha}")
|
99
|
+
|
100
|
+
puts "Calling: #{cmd}" if FastlaneCore::Globals.verbose?
|
101
|
+
|
102
|
+
result = Actions.sh(cmd, log: false).chomp
|
103
|
+
|
104
|
+
puts "#{cmd} => #{result}" if FastlaneCore::Globals.verbose?
|
105
|
+
|
106
|
+
result
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.get_git_commits
|
110
|
+
cmd = %(git log --format=%H -50)
|
111
|
+
|
112
|
+
result = Actions.sh(cmd, log: false).chomp
|
113
|
+
|
114
|
+
puts "#{cmd} => #{result}" if FastlaneCore::Globals.verbose?
|
115
|
+
|
116
|
+
result.split(' ')
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.get_history
|
120
|
+
history = get_git_commits
|
121
|
+
|
122
|
+
return '' unless !history.empty?
|
123
|
+
|
124
|
+
history = history.map { |sha| convert_commit(sha) }
|
125
|
+
|
126
|
+
Base64.strict_encode64("[#{history.join(',')}]")
|
127
|
+
end
|
128
|
+
|
79
129
|
def self.get_platform
|
80
130
|
Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] || :ios
|
81
131
|
end
|
@@ -92,6 +142,31 @@ module Fastlane
|
|
92
142
|
upload_error(message) if @upload_token
|
93
143
|
end
|
94
144
|
|
145
|
+
def self.has_git_command?
|
146
|
+
cmd = %(which git)
|
147
|
+
|
148
|
+
result = Actions.sh(cmd, log: false).chomp
|
149
|
+
|
150
|
+
puts "#{cmd} => #{result}" if FastlaneCore::Globals.verbose?
|
151
|
+
|
152
|
+
!result.empty?
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.is_git_repository?
|
156
|
+
cmd = %(git rev-parse)
|
157
|
+
|
158
|
+
result = true
|
159
|
+
|
160
|
+
Actions.sh(cmd,
|
161
|
+
log: false,
|
162
|
+
error_callback: ->(ignore) { result = false }
|
163
|
+
).chomp
|
164
|
+
|
165
|
+
puts "#{cmd} => #{result}" if FastlaneCore::Globals.verbose?
|
166
|
+
|
167
|
+
result
|
168
|
+
end
|
169
|
+
|
95
170
|
def self.make_build_request(uri)
|
96
171
|
if @apk_path
|
97
172
|
body_path = @apk_path
|
@@ -128,9 +203,27 @@ module Fastlane
|
|
128
203
|
end
|
129
204
|
|
130
205
|
def self.make_build_uri
|
206
|
+
if !has_git_command?
|
207
|
+
history_error = "noGitCommandFound"
|
208
|
+
elsif !is_git_repository?
|
209
|
+
history_error = "notGitRepository"
|
210
|
+
else
|
211
|
+
history = get_history
|
212
|
+
end
|
213
|
+
|
214
|
+
query = ''
|
215
|
+
|
216
|
+
if history
|
217
|
+
query += "&history=#{history}"
|
218
|
+
elsif history_error
|
219
|
+
query += "&historyError=#{history_error}"
|
220
|
+
end
|
221
|
+
|
222
|
+
query += "&variantName=#{@variant_name}" if @variant_name
|
223
|
+
|
131
224
|
uri_string = 'https://api.waldo.io/versions'
|
132
225
|
|
133
|
-
uri_string += "
|
226
|
+
uri_string += "?#{query[1..-1]}" if !query.empty?
|
134
227
|
|
135
228
|
URI(uri_string)
|
136
229
|
end
|
@@ -316,7 +409,13 @@ module Fastlane
|
|
316
409
|
end
|
317
410
|
|
318
411
|
FileUtils.cd(cd_path) do
|
319
|
-
|
412
|
+
cmd = %(zip -qry "#{zip_path}" "#{src_path}")
|
413
|
+
|
414
|
+
result = Actions.sh(cmd, log: false)
|
415
|
+
|
416
|
+
puts "#{cmd} => #{result}" if FastlaneCore::Globals.verbose?
|
417
|
+
|
418
|
+
unless result.empty?
|
320
419
|
handle_error("Unable to zip app at path '#{src_path.to_s}' into '#{zip_path.to_s}'")
|
321
420
|
|
322
421
|
return false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-waldo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J. G. Pusey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|