fastlane-plugin-dropbox 0.2.1 → 0.3.0

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: 9fb75b24901139d6abc08c1ff3d6ea563f17084ce23bd308dbe96f24c856c1c5
4
- data.tar.gz: 86d25e5494a6043a63bb322aec67f930da9737145f057a6a2a16f54ebf0c9c41
3
+ metadata.gz: e65e3a99db618fd4d50bf04788b28295ce94a5a02a2cb6e86dc590bf5c749cc4
4
+ data.tar.gz: e1c5c12d9ae53366fcfd9743a910ab153bce84afe3decdaef966eea9718e9675
5
5
  SHA512:
6
- metadata.gz: 7ce42363dac0fb171e17286a15bee1fa3b57102c6303224461c1577c3426a2a37aa0a55344f327e5ddc39e762463773499be3322f9b8f5dd35d1b345a00a06ad
7
- data.tar.gz: c49d606532c5a64a6e27a3183fdb82f85a10ccb81bb517ac7a9ceefae6b0344333b989b68d5dca5283417090c5791c96aa6c8bbd52fea309ca0184c73371b53d
6
+ metadata.gz: df8ded885066405e344f956b9ee83af2067ecef9aae4ffe21729c0b7b1e52525cda4dab2f6493bc3a3aafda71e6226127fa77dd6b2abad42b27c70e730175d63
7
+ data.tar.gz: 93f173625125689f8d35fa119db0a110aaa7b5a5f64cba7ffcabdde344eb6231d8d66721969db757845c8581149a3ab2ff5735c6c3755dfe7832a6d9aff65a39
data/README.md CHANGED
@@ -25,7 +25,9 @@ This plugin relies on MacOS keychain (for storing your Dropbox access token), he
25
25
 
26
26
  In order to register a Dropbox app you need to go to [Dropbox Developers](https://www.dropbox.com/developers/apps) site and create your own app.
27
27
 
28
- 1. For Fastlane you only need the app key and app secret. You'll also have to come up with some name for the app, but this is not used by Fastlane in any way.
28
+ ### Using access token
29
+
30
+ 1. For Fastlane you only need the access token (or the app key and app secret). You'll also have to come up with some name for the app, but this is not used by Fastlane in any way.
29
31
  1. You also don't need to apply for production state of your app, and keep it in development phase unless you make heavy use of it. Even Dropbox themselves encourage staying in development state when the app is used as an internal tool. Read more [here](https://www.dropbox.com/developers/reference/developer-guide#production-approval).
30
32
  1. You start with access for one user only, but in development state you can request access for up to 500 users, which should cover most of the use cases for Fastlane integration.
31
33
 
@@ -33,6 +35,16 @@ In order to register a Dropbox app you need to go to [Dropbox Developers](https:
33
35
 
34
36
  ### Basic usage
35
37
 
38
+ Using access token:
39
+
40
+ dropbox(
41
+ file_path: '/some/local-path/to/file.txt',
42
+ dropbox_path: '/path/to/Dropbox/destination/folder',
43
+ access_token: 'your-dropbox-access-token'
44
+ )
45
+
46
+ Using app key and app secret:
47
+
36
48
  dropbox(
37
49
  file_path: '/some/local-path/to/file.txt',
38
50
  dropbox_path: '/path/to/Dropbox/destination/folder',
@@ -50,8 +62,7 @@ The default `write_mode` is `add`, which means that plugin will raise an error i
50
62
  file_path: '/some/local-path/to/file.txt',
51
63
  dropbox_path: '/path/to/Dropbox/destination/folder',
52
64
  write_mode: 'overwrite',
53
- app_key: 'your-dropbox-app-key',
54
- app_secret: 'your-dropbox-app-secret'
65
+ access_token: 'your-dropbox-access-token'
55
66
  )
56
67
 
57
68
  For the more fine-grained overwriting you can set the `update` write mode, and pass the current file revision to update:
@@ -61,8 +72,7 @@ For the more fine-grained overwriting you can set the `update` write mode, and p
61
72
  dropbox_path: '/path/to/Dropbox/destination/folder',
62
73
  write_mode: 'update',
63
74
  update_rev: 'filerevisiontoupdate',
64
- app_key: 'your-dropbox-app-key',
65
- app_secret: 'your-dropbox-app-secret'
75
+ access_token: 'your-dropbox-access-token'
66
76
  )
67
77
 
68
78
  The `update_rev` parameter is required for `update` write mode and ignored in other cases. Currently, if the current file revision on Dropbox doesn't match the provided revision, the plugin will fail (Dropbox API won't allow for the update).
@@ -7,12 +7,12 @@ module Fastlane
7
7
  KEYCHAIN_SERVICE_NAME = 'fastlane-plugin-dropbox'.freeze
8
8
 
9
9
  def self.run(params)
10
+ validate_params(params)
11
+
10
12
  UI.message ''
11
13
  UI.message "Starting upload of #{params[:file_path]} to Dropbox"
12
14
  UI.message ''
13
15
 
14
- params[:keychain] ||= default_keychain
15
-
16
16
  write_mode =
17
17
  if params[:write_mode].nil?
18
18
  'add'
@@ -29,7 +29,7 @@ module Fastlane
29
29
  params[:write_mode]
30
30
  end
31
31
 
32
- access_token = get_token_from_keychain(params[:keychain], params[:keychain_password])
32
+ access_token = params[:access_token] || get_token_from_keychain(params[:keychain] ||= default_keychain, params[:keychain_password])
33
33
  unless access_token
34
34
  access_token = request_token(params[:app_key], params[:app_secret])
35
35
  unless save_token_to_keychain(params[:keychain], access_token)
@@ -152,6 +152,13 @@ module Fastlane
152
152
  end
153
153
  end
154
154
 
155
+ def self.validate_params(params)
156
+ return if params[:access_token] && !params[:access_token].empty?
157
+
158
+ UI.user_error!("App Key not specified for Dropbox app. Provide your app's App Key or create a new app at https://www.dropbox.com/developers if you don't have an app yet.") unless params[:app_key] && !params[:app_key].empty?
159
+ UI.user_error!("App Secret not specified for Dropbox app. Provide your app's App Secret or create a new app at https://www.dropbox.com/developers if you don't have an app yet.") unless params[:app_secret] && !params[:app_secret].empty?
160
+ end
161
+
155
162
  #####################################################
156
163
  # @!group Documentation
157
164
  #####################################################
@@ -161,7 +168,7 @@ module Fastlane
161
168
  end
162
169
 
163
170
  def self.details
164
- 'You have to authorize the action before using it. The access token is stored in your default keychain'
171
+ 'You have to authorize the action before using it. The access token is stored in your default keychain or passed in'
165
172
  end
166
173
 
167
174
  def self.available_options
@@ -200,18 +207,12 @@ module Fastlane
200
207
  env_name: 'DROPBOX_APP_KEY',
201
208
  description: 'App Key of your Dropbox app',
202
209
  type: String,
203
- optional: false,
204
- verify_block: proc do |value|
205
- UI.user_error!("App Key not specified for Dropbox app. Provide your app's App Key or create a new app at https://www.dropbox.com/developers if you don't have an app yet.") unless value && !value.empty?
206
- end),
210
+ optional: true),
207
211
  FastlaneCore::ConfigItem.new(key: :app_secret,
208
212
  env_name: 'DROPBOX_APP_SECRET',
209
213
  description: 'App Secret of your Dropbox app',
210
214
  type: String,
211
- optional: false,
212
- verify_block: proc do |value|
213
- UI.user_error!("App Secret not specified for Dropbox app. Provide your app's App Secret or create a new app at https://www.dropbox.com/developers if you don't have an app yet.") unless value && !value.empty?
214
- end),
215
+ optional: true),
215
216
  FastlaneCore::ConfigItem.new(key: :keychain,
216
217
  env_name: 'DROPBOX_KEYCHAIN',
217
218
  description: 'Path to keychain where the access token would be stored. Will use default keychain if no value is provided',
@@ -222,7 +223,12 @@ module Fastlane
222
223
  end),
223
224
  FastlaneCore::ConfigItem.new(key: :keychain_password,
224
225
  env_name: 'DROPBOX_KEYCHAIN_PASSWORD',
225
- description: 'Password to unlock keychain. If not provided, the plugin would ask for password',
226
+ description: 'Password to unlock keychain. If not provided, the plugin will ask for password',
227
+ type: String,
228
+ optional: true),
229
+ FastlaneCore::ConfigItem.new(key: :access_token,
230
+ env_name: 'DROPBOX_ACCESS_TOKEN',
231
+ description: 'Access Token to authenticate with the Dropbox API',
226
232
  type: String,
227
233
  optional: true)
228
234
  ]
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Dropbox
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-dropbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Kapusta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-11 00:00:00.000000000 Z
11
+ date: 2020-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dropbox_api