fastlane-plugin-pcloudy 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5beb8f759d9c8483fbb1d9185edc83e0d09c6d22e900c4e848ff635adff4f1e7
4
- data.tar.gz: 4c21078f470ecbf008c417c60a6afac259b84750850b9c6d489048715d8311cd
3
+ metadata.gz: 2bdcb5d3d987b73719bbdd902e255606276709a57021db2062cec7fb12b950a9
4
+ data.tar.gz: 5c48a0006d40bc7292d71f0fad8b5a851f5e5c334086eaa892fd38e998d17871
5
5
  SHA512:
6
- metadata.gz: baa15536e27dc025e5e56845f256fc35d4c4d4f37b2781a7e8052f946b9649d817caccd2adfaebe233e718d172f812433c103b81419ba51251a5639c9f06e696
7
- data.tar.gz: 07a4aceb6833f999a52be92af8cd1aaf1b02c6f94ec2408768c70f18576c2b10014ad761c1caac714b55e4e66517f99e94526bf576ed8744fd669a1ae018f472
6
+ metadata.gz: 5fa3c933376720ba3a9aec4c35e52a57bca7b66fa7d96db8182fe7e04aded8fe0766bba70f4867077cba44c134ee469c1c5ae77624052906fba0af1ed8c9f945
7
+ data.tar.gz: e4da7919f1dfb7e5b4afb199d75ee67e10f902241905602b59880502e46ab893ccc4d0be64483e96cf53e5cab4d9d6a69fd405994b845d1bbed6a876f26ce94d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+
5
+ - Network failures such as timeouts, dropped connections during large uploads, and unreachable hosts
6
+ now fail the lane with a clear "Could not reach pCloudy" error instead of a Ruby stack trace.
7
+ - HTTP errors now include pCloudy's own error message (e.g. a wrong API key) when pCloudy sends one.
8
+ - Error messages no longer show "(code n/a)" when pCloudy returns no result code.
9
+ - `pcloudy_upload_app` has a new `poll_interval` option for `resign: true`, matching `pcloudy_resign_app`.
10
+ - The gem is now maintained and published by pCloudy.
11
+
3
12
  ## 0.2.0
4
13
 
5
14
  - New `pcloudy_upload_app`: uploads an `.ipa` or `.apk` to pCloudy My Apps. Picks up the output of
data/README.md CHANGED
@@ -66,6 +66,7 @@ name = pcloudy_upload_app(file: "./build/MyApp.apk")
66
66
  | `upload_timeout` | `PCLOUDY_UPLOAD_TIMEOUT` | `600` | Seconds allowed for the upload |
67
67
  | `processing_timeout` | `PCLOUDY_PROCESSING_TIMEOUT` | `120` | Seconds to wait for the file to appear in My Apps |
68
68
  | `resign_timeout` | `PCLOUDY_RESIGN_TIMEOUT` | `600` | Seconds to wait for re-signing (with `resign: true`) |
69
+ | `poll_interval` | — | `5` | Seconds between re-sign progress checks (with `resign: true`) |
69
70
 
70
71
  Plus `username`, `api_key` and `cloud_url`, as for every action.
71
72
 
@@ -90,7 +90,7 @@ module Fastlane
90
90
  end
91
91
 
92
92
  def self.authors
93
- ["bikee1235"]
93
+ ["pCloudy"]
94
94
  end
95
95
 
96
96
  def self.return_value
@@ -33,7 +33,7 @@ module Fastlane
33
33
  end
34
34
 
35
35
  def self.authors
36
- ["bikee1235"]
36
+ ["pCloudy"]
37
37
  end
38
38
 
39
39
  def self.return_value
@@ -37,7 +37,7 @@ module Fastlane
37
37
  Actions.lane_context[SharedValues::PCLOUDY_APP_FILE] = name
38
38
 
39
39
  if params[:resign]
40
- name = Helper::PcloudyOptions.resign(client, name, timeout: params[:resign_timeout], interval: 5)
40
+ name = Helper::PcloudyOptions.resign(client, name, timeout: params[:resign_timeout], interval: params[:poll_interval])
41
41
  Actions.lane_context[SharedValues::PCLOUDY_RESIGNED_FILE] = name
42
42
  Actions.lane_context[SharedValues::PCLOUDY_APP_FILE] = name
43
43
  end
@@ -72,7 +72,7 @@ module Fastlane
72
72
  end
73
73
 
74
74
  def self.authors
75
- ["bikee1235"]
75
+ ["pCloudy"]
76
76
  end
77
77
 
78
78
  def self.return_value
@@ -118,6 +118,10 @@ module Fastlane
118
118
  env_name: "PCLOUDY_RESIGN_TIMEOUT",
119
119
  description: "Seconds to wait for re-signing to finish (when resign: true)",
120
120
  default_value: 600,
121
+ type: Integer),
122
+ FastlaneCore::ConfigItem.new(key: :poll_interval,
123
+ description: "Seconds between re-sign progress checks (when resign: true)",
124
+ default_value: 5,
121
125
  type: Integer)
122
126
  ]
123
127
  end
@@ -1,5 +1,6 @@
1
1
  require "json"
2
2
  require "net/http"
3
+ require "openssl"
3
4
  require "uri"
4
5
 
5
6
  module Fastlane
@@ -11,6 +12,11 @@ module Fastlane
11
12
 
12
13
  DEFAULT_CLOUD_URL = "https://device.pcloudy.com".freeze
13
14
 
15
+ # Connection failures turned into Error. Net::OpenTimeout/ReadTimeout/WriteTimeout are Timeout::Errors.
16
+ NETWORK_ERRORS = [SocketError, Timeout::Error, EOFError, OpenSSL::SSL::SSLError,
17
+ Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE,
18
+ Errno::ETIMEDOUT, Errno::EHOSTUNREACH, Errno::ENETUNREACH].freeze
19
+
14
20
  def initialize(username:, api_key:, cloud_url: DEFAULT_CLOUD_URL, timeout: 60)
15
21
  @username = username
16
22
  @api_key = api_key
@@ -130,24 +136,42 @@ module Fastlane
130
136
  end
131
137
 
132
138
  path = request.path
133
- raise(Error, "pCloudy #{path} returned HTTP #{response.code}") unless response.is_a?(Net::HTTPSuccess)
139
+ unless response.is_a?(Net::HTTPSuccess)
140
+ message = error_message(parse_result(response.body))
141
+ raise(Error, "pCloudy #{path} returned HTTP #{response.code}#{message ? ": #{message}" : ''}")
142
+ end
134
143
 
135
144
  result = JSON.parse(response.body.to_s)["result"]
136
145
  raise(Error, "pCloudy #{path} returned an unexpected response") unless result.kind_of?(Hash)
137
146
 
138
147
  # Some endpoints (e.g. upload_file) omit "code"; treat an explicit error or a non-200 code as failure.
139
148
  if result["error"] || (result.key?("code") && result["code"].to_i != 200)
140
- message = result["error"] || result["msg"] || result["message"] || "unknown error"
141
- raise(Error, "pCloudy #{path} failed (code #{result['code'] || 'n/a'}): #{message}")
149
+ code = result.key?("code") ? " (code #{result['code']})" : ""
150
+ raise(Error, "pCloudy #{path} failed#{code}: #{error_message(result) || 'unknown error'}")
142
151
  end
143
152
 
144
153
  result
145
154
  rescue JSON::ParserError
146
155
  raise(Error, "pCloudy #{request.path} returned invalid JSON")
147
- rescue SocketError, Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET, OpenSSL::SSL::SSLError => e
156
+ rescue *NETWORK_ERRORS => e
148
157
  raise(Error, "Could not reach pCloudy at #{@base}: #{e.message}")
149
158
  end
150
159
 
160
+ # The "result" hash of an error response body, or nil when the body is not pCloudy JSON.
161
+ def parse_result(body)
162
+ result = JSON.parse(body.to_s)["result"]
163
+ result.kind_of?(Hash) ? result : nil
164
+ rescue JSON::ParserError, TypeError
165
+ nil
166
+ end
167
+
168
+ def error_message(result)
169
+ return nil unless result
170
+
171
+ message = result["error"] || result["msg"] || result["message"]
172
+ message.to_s.empty? ? nil : message.to_s
173
+ end
174
+
151
175
  def endpoint(path)
152
176
  URI.join(@base.to_s.end_with?("/") ? @base.to_s : "#{@base}/", path.sub(%r{^/}, ""))
153
177
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Pcloudy
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,34 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-pcloudy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - bikee1235
7
+ - pCloudy
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: bundler
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '1.17'
19
- - - "<"
20
- - !ruby/object:Gem::Version
21
- version: '3'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- version: '1.17'
29
- - - "<"
30
- - !ruby/object:Gem::Version
31
- version: '3'
32
12
  - !ruby/object:Gem::Dependency
33
13
  name: fastlane
34
14
  requirement: !ruby/object:Gem::Requirement
@@ -94,8 +74,6 @@ dependencies:
94
74
  description: 'Use pCloudy (device.pcloudy.com or a private cloud) from your fastlane
95
75
  lanes: list available real iOS and Android devices, upload the .ipa or .apk you
96
76
  just built, and re-sign iOS apps with pCloudy''s certificate.'
97
- email:
98
- - bikee.bihari@sstsinc.com
99
77
  executables: []
100
78
  extensions: []
101
79
  extra_rdoc_files: []
@@ -110,13 +88,11 @@ files:
110
88
  - lib/fastlane/plugin/pcloudy/helper/pcloudy_client.rb
111
89
  - lib/fastlane/plugin/pcloudy/helper/pcloudy_options.rb
112
90
  - lib/fastlane/plugin/pcloudy/version.rb
113
- homepage: https://github.com/Smart-Software-Testing-Solutions-Opkey/fastlane-plugin-pcloudy
91
+ homepage: https://www.pcloudy.com
114
92
  licenses:
115
93
  - MIT
116
94
  metadata:
117
- homepage_uri: https://github.com/Smart-Software-Testing-Solutions-Opkey/fastlane-plugin-pcloudy
118
- changelog_uri: https://github.com/Smart-Software-Testing-Solutions-Opkey/fastlane-plugin-pcloudy/blob/main/CHANGELOG.md
119
- bug_tracker_uri: https://github.com/Smart-Software-Testing-Solutions-Opkey/fastlane-plugin-pcloudy/issues
95
+ homepage_uri: https://www.pcloudy.com
120
96
  rubygems_mfa_required: 'true'
121
97
  rdoc_options: []
122
98
  require_paths: