fastlane-plugin-execute_api 0.1.0 → 0.1.3

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: c0d2d79f45d0a9f8fa98186c201e24668428706a6229d3bfc6de73519affb4a0
4
- data.tar.gz: 5235b059fcdb396d48691a4f6e9a2652fa2689d71c4ea240b3723d6d1b5fdf36
3
+ metadata.gz: 005eddd0a22a8642024c5f64f313fe26a92348103914fee7d4168e4e460505d2
4
+ data.tar.gz: 21546ba9d34497d18339b51c2e935900ca624c84290e8362f0ae9a81c8177e2e
5
5
  SHA512:
6
- metadata.gz: e78b5190e23a7ffaeb341d6638bf76d56e0d8b844a4c7cc20ff8c0a598e91f3b56d696408e7cbb8f4661b381b71b5f1736450072c84f8e503a9450bf02d37798
7
- data.tar.gz: a38e692e15b902701d1cb7f4b06a2d10a1d6c6ab7a2e1fc8fac3de2503d7846b2088d9229d97d5a30c67f1072ebf636a740069b6c46a1c9261f151e427ae83a9
6
+ metadata.gz: 279622720e434c79392ceae1fd96c704695e2d09b77ba49ccbe7c99c36824f721b2b0a9cb2588fb4445aca594e4725fa302379fb992f8ae82615776bf6ca2d4f
7
+ data.tar.gz: ccd2fcd6aaf1f16f42e2c764fb1e5b62c7f69031878148bedc904b2ff0ac6ec79ca8f55f413b8020a605551d54e6993bd91cf50e2c50ce8feb2e4f746a89336e
@@ -8,7 +8,6 @@ module Fastlane
8
8
  def self.run(config)
9
9
  params = {}
10
10
  # extract parms from config received from fastlane
11
- params[:uploadArtifacts] = config[:uploadArtifacts]
12
11
  params[:endPoint] = config[:endPoint]
13
12
  params[:apk] = config[:apk]
14
13
  params[:ipa] = config[:ipa]
@@ -18,14 +17,17 @@ module Fastlane
18
17
  params[:multipartPayload] = config[:multipartPayload]
19
18
  params[:headers] = config[:headers]
20
19
 
21
- upload_artifacts = params[:uploadArtifacts]
22
20
  apk_file = params[:apk]
23
21
  ipa_file = params[:ipa]
24
22
  custom_file = params[:file]
25
-
23
+
26
24
  end_point = params[:endPoint]
27
25
 
28
- UI.user_error!("No endPoint given, pass using endPoint: 'endpoint'") if end_point.to_s.length == 0 && end_point.to_s.length == 0
26
+ upload_artifacts = ipa_file.to_s.length > 0 || apk_file.to_s.length > 0 || custom_file.to_s.length > 0
27
+
28
+ params[:uploadArtifacts] = upload_artifacts.to_s
29
+
30
+ UI.user_error!("No endPoint given, pass using endPoint: 'endpoint'") if end_point.to_s.length == 0
29
31
  UI.user_error!("No IPA or APK or a file path given, pass using `ipa: 'ipa path'` or `apk: 'apk path' or file:`") if upload_artifacts && ipa_file.to_s.length == 0 && apk_file.to_s.length == 0 && custom_file.to_s.length == 0
30
32
  UI.user_error!("Please only give IPA path or APK path (not both)") if upload_artifacts && ipa_file.to_s.length > 0 && apk_file.to_s.length > 0
31
33
 
@@ -45,13 +47,13 @@ module Fastlane
45
47
  multipart_payload[:multipart] = true
46
48
  if multipart_payload[:fileFormFieldName]
47
49
  key = multipart_payload[:fileFormFieldName]
48
- multipart_payload["#{key}"] = File.new(custom_file, 'rb')
50
+ multipart_payload[key.to_s] = File.new(custom_file, 'rb')
49
51
  else
50
52
  multipart_payload[:file] = File.new(custom_file, 'rb')
51
53
  end
52
54
 
53
- UI.message multipart_payload
54
- upload_request(params, multipart_payload)
55
+ UI.message(multipart_payload)
56
+ upload_request(params, multipart_payload)
55
57
  end
56
58
 
57
59
  def self.upload_request(params, multipart_payload)
@@ -60,15 +62,13 @@ module Fastlane
60
62
  url: params[:endPoint],
61
63
  payload: multipart_payload,
62
64
  headers: params[:headers],
63
- log: Logger.new(STDOUT)
65
+ log: Logger.new($stdout)
64
66
  )
65
67
 
66
68
  response = request.execute
67
69
  UI.message(response)
68
- if params[:uploadArtifacts]
69
- UI.success("Successfully finished uploading the fille") if response.code == 200 || response.code == 201
70
- else
71
- UI.success("Successfully finished executing the request") if response.code == 200 || response.code == 201
70
+ if response.code == 200 || response.code == 201
71
+ params[:uploadArtifacts]? UI.success("Successfully finished uploading the fille") : UI.success("Successfully finished executing the request")
72
72
  end
73
73
  end
74
74
 
@@ -95,8 +95,7 @@ module Fastlane
95
95
  env_name: "",
96
96
  description: "uploading any file or not",
97
97
  optional: true,
98
- default_value: false,
99
- type: Boolean),
98
+ default_value: false),
100
99
  FastlaneCore::ConfigItem.new(key: :apk,
101
100
  env_name: "",
102
101
  description: ".apk file for the build",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module ExecuteApi
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-execute_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pasan Eramusugoda