fastlane-plugin-google_drive 0.9.0 → 0.10.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: 538f68214b71146ef64f4a99e01bc75ccc2fd8b146837d966aa354bf932b4c9a
4
- data.tar.gz: a93cc09b8149798b1cc0f8f5457aec6add54b3cb408f523c426d13cc1e26838f
3
+ metadata.gz: 95915a684767c4d65c40e26820aad4d29579adca45710cab0a5ff555cf1c7624
4
+ data.tar.gz: 2dd1a39283b55295292112371d91f1c9a4e8e0450226e15f9492f8af4a4078a6
5
5
  SHA512:
6
- metadata.gz: 902b3d02aabd9ef980767370367d906405acf6ceadfd01fc75035624810dce42434746e0a339e63e32257acf0d43521c0c55f709562b09d857fb5e91c01b5b51
7
- data.tar.gz: 0162a8cc7f27baf481d49c0beaad418a518b9d02b7213ce8774b41756c6aad1d84912cb2d1615eed9f1212e6ee01d3c41dfa60fe922c5fdfe783f4c8be6a5c2d
6
+ metadata.gz: a285dd2f1557c1e847c190e546b2ebdacb91ff725829d66c074299b205fadea6b419ecc2762a9307731367823256e1d4d5c122cce2be314611fae37b61916851
7
+ data.tar.gz: ff88fbe7ea37e1561f383c15385b00ced9f956b11b590a72aa66768dc2675e7460497bc9f255db168453e9cca1354a05264288520b95963297974f86a33451ee
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # google_drive `fastlane` plugin
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-google_drive)
4
- [![Gem Version Badge](https://badge.fury.io/rb/fastlane-plugin-google_drive.svg)](https://badge.fury.io/rb/fastlane-plugin-google_drive)
5
- [![Build Status](https://travis-ci.com/bskim45/fastlane-plugin-google_drive.svg?branch=master)](https://travis-ci.com/bskim45/fastlane-plugin-google_drive)
4
+ [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-google_drive.svg)](https://badge.fury.io/rb/fastlane-plugin-google_drive)
5
+ ![Build Status](https://github.com/bskim45/fastlane-plugin-google_drive/actions/workflows/rubygems.yml/badge.svg)
6
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/681ab1f5c19ca029dff4/test_coverage)](https://codeclimate.com/github/bskim45/fastlane-plugin-google_drive/test_coverage)
7
- [![security](https://hakiri.io/github/bskim45/fastlane-plugin-google_drive/master.svg)](https://hakiri.io/github/bskim45/fastlane-plugin-google_drive/master)
8
7
 
9
8
  ## Getting Started
10
9
 
@@ -16,14 +15,15 @@ fastlane add_plugin google_drive
16
15
 
17
16
  ## About google_drive
18
17
 
19
- > Please refer to [this guide](https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md) to create an Google Drive credential.
18
+ > Please refer to [this guide](https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md) to create a Google Drive credential.
20
19
 
21
20
  Upload files to Google Drive folder.
22
- > Aliases for this action - `google_drive_upload` and `upload_google_drive` are both removed in `v0.6.0`.
23
21
 
24
22
  ```ruby
25
23
  upload_to_google_drive(
26
24
  drive_keyfile: 'drive_key.json',
25
+ # or you can provide the content of JSON keyfile directly as an argument
26
+ # drive_key_json: __KEYFILE_CONTENT__,
27
27
  service_account: true,
28
28
  folder_id: 'folder_id',
29
29
  upload_files: ['file_to_upload', 'another_file_to_upload']
@@ -107,4 +107,4 @@ _fastlane_ is the easiest way to automate beta deployments and releases for your
107
107
 
108
108
  The MIT License (MIT)
109
109
 
110
- Copyright (c) 2019 Bumsoo Kim (<https://bsk.im>)
110
+ Copyright (c) 2022 Bumsoo Kim (<https://bsk.im>)
@@ -7,12 +7,16 @@ module Fastlane
7
7
  GDRIVE_CREATED_FOLDER_ID = :GDRIVE_CREATED_FOLDER_ID
8
8
  GDRIVE_CREATED_FOLDER_URL = :GDRIVE_CREATED_FOLDER_URL
9
9
  end
10
+
10
11
  class CreateGoogleDriveFolderAction < Action
11
12
  def self.run(params)
12
- UI.message("Using credential file: #{params[:drive_keyfile]}")
13
+ unless params[:drive_keyfile].nil?
14
+ UI.message("Using credential file: #{params[:drive_keyfile]}")
15
+ end
13
16
 
14
17
  session = Helper::GoogleDriveHelper.setup(
15
18
  keyfile: params[:drive_keyfile],
19
+ key_json: params[:drive_key_json],
16
20
  service_account: params[:service_account]
17
21
  )
18
22
 
@@ -47,36 +51,62 @@ module Fastlane
47
51
 
48
52
  def self.available_options
49
53
  [
50
- FastlaneCore::ConfigItem.new(key: :drive_keyfile,
51
- env_name: 'GDRIVE_KEY_FILE',
52
- description: 'Json config file',
53
- type: String,
54
- default_value: 'drive_key.json',
55
- verify_block: proc do |value|
56
- UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
57
- end),
58
- FastlaneCore::ConfigItem.new(key: :service_account,
59
- env_name: 'GDRIVE_SERVICE_ACCOUNT',
60
- description: 'Credential is service account',
61
- optional: true,
62
- is_string: false,
63
- default_value: false),
64
- FastlaneCore::ConfigItem.new(key: :folder_id,
65
- env_name: "GDRIVE_UPLOAD_FOLDER_ID",
66
- description: "Upload target folder id",
67
- optional: false,
68
- type: String,
69
- verify_block: proc do |value|
70
- UI.user_error!("No target folder_id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
71
- end),
72
- FastlaneCore::ConfigItem.new(key: :folder_title,
73
- env_name: "GDRIVE_FOLDER_NAME",
74
- description: "Folder title of new one",
75
- optional: false,
76
- type: String,
77
- verify_block: proc do |value|
78
- UI.user_error!("No folder title given") if value.nil? || value.empty?
79
- end)
54
+ FastlaneCore::ConfigItem.new(
55
+ key: :drive_keyfile,
56
+ env_names: ['GDRIVE_KEY_FILE', 'GOOGLE_APPLICATION_CREDENTIALS'],
57
+ description: 'Path to the JSON keyfile',
58
+ conflicting_options: [:drive_key_json],
59
+ type: String,
60
+ optional: true,
61
+ verify_block: proc do |value|
62
+ UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
63
+ UI.user_error!("'#{value}' doesn't seem to be a valid JSON keyfile") unless FastlaneCore::Helper.json_file?(value)
64
+ end
65
+ ),
66
+ FastlaneCore::ConfigItem.new(
67
+ key: :drive_key_json,
68
+ env_name: 'GDRIVE_KEY_JSON',
69
+ description: 'Credential key in stringified JSON format',
70
+ optional: true,
71
+ conflicting_options: [:drive_keyfile],
72
+ type: String,
73
+ sensitive: true,
74
+ verify_block: proc do |value|
75
+ begin
76
+ JSON.parse(value)
77
+ rescue JSON::ParserError
78
+ UI.user_error!("Provided credential key is not a valid JSON")
79
+ end
80
+ end
81
+ ),
82
+ FastlaneCore::ConfigItem.new(
83
+ key: :service_account,
84
+ env_name: 'GDRIVE_SERVICE_ACCOUNT',
85
+ description: 'true if the credential is for a service account, false otherwise',
86
+ optional: true,
87
+ is_string: false,
88
+ default_value: false
89
+ ),
90
+ FastlaneCore::ConfigItem.new(
91
+ key: :folder_id,
92
+ env_name: "GDRIVE_UPLOAD_FOLDER_ID",
93
+ description: "Upload target folder id",
94
+ optional: false,
95
+ type: String,
96
+ verify_block: proc do |value|
97
+ UI.user_error!("No target `folder_id` was provided. Pass it using `folder_id: 'some_id'`") unless value and !value.empty?
98
+ end
99
+ ),
100
+ FastlaneCore::ConfigItem.new(
101
+ key: :folder_title,
102
+ env_name: "GDRIVE_FOLDER_NAME",
103
+ description: "Folder title of new one",
104
+ optional: false,
105
+ type: String,
106
+ verify_block: proc do |value|
107
+ UI.user_error!("No folder title given") if value.nil? || value.empty?
108
+ end
109
+ )
80
110
  ]
81
111
  end
82
112
 
@@ -92,7 +122,7 @@ module Fastlane
92
122
  end
93
123
 
94
124
  def self.authors
95
- ['Kohki Miki (@giginet)']
125
+ ['Bumsoo Kim (@bskim45)', 'Kohki Miki (@giginet)']
96
126
  end
97
127
 
98
128
  def self.is_supported?(platform)
@@ -11,10 +11,13 @@ module Fastlane
11
11
 
12
12
  class FindGoogleDriveFileByIdAction < Action
13
13
  def self.run(params)
14
- UI.message("Using credential file: #{params[:drive_keyfile]}")
14
+ unless params[:drive_keyfile].nil?
15
+ UI.message("Using credential file: #{params[:drive_keyfile]}")
16
+ end
15
17
 
16
18
  session = Helper::GoogleDriveHelper.setup(
17
19
  keyfile: params[:drive_keyfile],
20
+ key_json: params[:drive_key_json],
18
21
  service_account: params[:service_account]
19
22
  )
20
23
 
@@ -53,18 +56,36 @@ module Fastlane
53
56
  [
54
57
  FastlaneCore::ConfigItem.new(
55
58
  key: :drive_keyfile,
56
- env_name: 'GDRIVE_KEY_FILE',
57
- description: 'The path to the json keyfile',
59
+ env_names: ['GDRIVE_KEY_FILE', 'GOOGLE_APPLICATION_CREDENTIALS'],
60
+ description: 'Path to the JSON keyfile',
61
+ conflicting_options: [:drive_key_json],
58
62
  type: String,
59
- default_value: 'drive_key.json',
63
+ optional: true,
60
64
  verify_block: proc do |value|
61
65
  UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
66
+ UI.user_error!("'#{value}' doesn't seem to be a valid JSON keyfile") unless FastlaneCore::Helper.json_file?(value)
67
+ end
68
+ ),
69
+ FastlaneCore::ConfigItem.new(
70
+ key: :drive_key_json,
71
+ env_name: 'GDRIVE_KEY_JSON',
72
+ description: 'Credential key in stringified JSON format',
73
+ optional: true,
74
+ conflicting_options: [:drive_keyfile],
75
+ type: String,
76
+ sensitive: true,
77
+ verify_block: proc do |value|
78
+ begin
79
+ JSON.parse(value)
80
+ rescue JSON::ParserError
81
+ UI.user_error!("Provided credential key is not a valid JSON")
82
+ end
62
83
  end
63
84
  ),
64
85
  FastlaneCore::ConfigItem.new(
65
86
  key: :service_account,
66
87
  env_name: 'GDRIVE_SERVICE_ACCOUNT',
67
- description: 'Whether the credential file is for the google service account',
88
+ description: 'true if the credential is for a service account, false otherwise',
68
89
  optional: true,
69
90
  is_string: false,
70
91
  default_value: false
@@ -8,10 +8,13 @@ module Fastlane
8
8
 
9
9
  class FindGoogleDriveFileByTitleAction < Action
10
10
  def self.run(params)
11
- UI.message("Using credential file: #{params[:drive_keyfile]}")
11
+ unless params[:drive_keyfile].nil?
12
+ UI.message("Using credential file: #{params[:drive_keyfile]}")
13
+ end
12
14
 
13
15
  session = Helper::GoogleDriveHelper.setup(
14
16
  keyfile: params[:drive_keyfile],
17
+ key_json: params[:drive_key_json],
15
18
  service_account: params[:service_account]
16
19
  )
17
20
 
@@ -57,18 +60,36 @@ module Fastlane
57
60
  [
58
61
  FastlaneCore::ConfigItem.new(
59
62
  key: :drive_keyfile,
60
- env_name: 'GDRIVE_KEY_FILE',
61
- description: 'The path to the json keyfile',
63
+ env_names: ['GDRIVE_KEY_FILE', 'GOOGLE_APPLICATION_CREDENTIALS'],
64
+ description: 'Path to the JSON keyfile',
65
+ conflicting_options: [:drive_key_json],
62
66
  type: String,
63
- default_value: 'drive_key.json',
67
+ optional: true,
64
68
  verify_block: proc do |value|
65
69
  UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
70
+ UI.user_error!("'#{value}' doesn't seem to be a valid JSON keyfile") unless FastlaneCore::Helper.json_file?(value)
71
+ end
72
+ ),
73
+ FastlaneCore::ConfigItem.new(
74
+ key: :drive_key_json,
75
+ env_name: 'GDRIVE_KEY_JSON',
76
+ description: 'Credential key in stringified JSON format',
77
+ optional: true,
78
+ conflicting_options: [:drive_keyfile],
79
+ type: String,
80
+ sensitive: true,
81
+ verify_block: proc do |value|
82
+ begin
83
+ JSON.parse(value)
84
+ rescue JSON::ParserError
85
+ UI.user_error!("Provided credential key is not a valid JSON")
86
+ end
66
87
  end
67
88
  ),
68
89
  FastlaneCore::ConfigItem.new(
69
90
  key: :service_account,
70
91
  env_name: 'GDRIVE_SERVICE_ACCOUNT',
71
- description: 'Whether the credential file is for the google service account',
92
+ description: 'true if the credential is for a service account, false otherwise',
72
93
  optional: true,
73
94
  is_string: false,
74
95
  default_value: false
@@ -7,12 +7,16 @@ module Fastlane
7
7
  GDRIVE_UPDATED_FILE_NAME = :GDRIVE_UPDATED_FILE_NAME
8
8
  GDRIVE_UPDATED_FILE_URL = :GDRIVE_UPDATED_FILE_URL
9
9
  end
10
+
10
11
  class UpdateGoogleDriveFileAction < Action
11
12
  def self.run(params)
12
- UI.message("Using credential file: #{params[:drive_keyfile]}")
13
+ unless params[:drive_keyfile].nil?
14
+ UI.message("Using credential file: #{params[:drive_keyfile]}")
15
+ end
13
16
 
14
17
  session = Helper::GoogleDriveHelper.setup(
15
18
  keyfile: params[:drive_keyfile],
19
+ key_json: params[:drive_key_json],
16
20
  service_account: params[:service_account]
17
21
  )
18
22
 
@@ -46,37 +50,63 @@ module Fastlane
46
50
 
47
51
  def self.available_options
48
52
  [
49
- FastlaneCore::ConfigItem.new(key: :drive_keyfile,
50
- env_name: 'GDRIVE_KEY_FILE',
51
- description: 'Json config file',
52
- type: String,
53
- default_value: 'drive_key.json',
54
- verify_block: proc do |value|
55
- UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
56
- end),
57
- FastlaneCore::ConfigItem.new(key: :service_account,
58
- env_name: 'GDRIVE_SERVICE_ACCOUNT',
59
- description: 'Credential is service account',
60
- optional: true,
61
- is_string: false,
62
- default_value: false),
63
- FastlaneCore::ConfigItem.new(key: :file_id,
64
- env_name: "GDRIVE_UPDATE_FILE_ID",
65
- description: "Target file id to update the content",
66
- optional: false,
67
- type: String,
68
- verify_block: proc do |value|
69
- UI.user_error!("No target file id given, pass using `file_id: 'some_id'`") unless value and !value.empty?
70
- end),
71
- FastlaneCore::ConfigItem.new(key: :upload_file,
72
- env_name: "GDRIVE_UPLOAD_FILE",
73
- description: "Path to a file to be uploaded",
74
- optional: false,
75
- is_string: false,
76
- verify_block: proc do |value|
77
- UI.user_error!("No upload file is given, pass using `upload_file: 'some/path/a.txt'`") unless value and !value.empty?
78
- UI.user_error!("Couldn't find upload file at path '#{value}'") unless File.exist?(value)
79
- end)
53
+ FastlaneCore::ConfigItem.new(
54
+ key: :drive_keyfile,
55
+ env_names: ['GDRIVE_KEY_FILE', 'GOOGLE_APPLICATION_CREDENTIALS'],
56
+ description: 'Path to the JSON keyfile',
57
+ conflicting_options: [:drive_key_json],
58
+ type: String,
59
+ optional: true,
60
+ verify_block: proc do |value|
61
+ UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
62
+ UI.user_error!("'#{value}' doesn't seem to be a valid JSON keyfile") unless FastlaneCore::Helper.json_file?(value)
63
+ end
64
+ ),
65
+ FastlaneCore::ConfigItem.new(
66
+ key: :drive_key_json,
67
+ env_name: 'GDRIVE_KEY_JSON',
68
+ description: 'Credential key in stringified JSON format',
69
+ optional: true,
70
+ conflicting_options: [:drive_keyfile],
71
+ type: String,
72
+ sensitive: true,
73
+ verify_block: proc do |value|
74
+ begin
75
+ JSON.parse(value)
76
+ rescue JSON::ParserError
77
+ UI.user_error!("Provided credential key is not a valid JSON")
78
+ end
79
+ end
80
+ ),
81
+ FastlaneCore::ConfigItem.new(
82
+ key: :service_account,
83
+ env_name: 'GDRIVE_SERVICE_ACCOUNT',
84
+ description: 'true if the credential is for a service account, false otherwise',
85
+ optional: true,
86
+ is_string: false,
87
+ default_value: false
88
+ ),
89
+ FastlaneCore::ConfigItem.new(
90
+ key: :file_id,
91
+ env_name: "GDRIVE_UPDATE_FILE_ID",
92
+ description: "Target file id to update the content",
93
+ optional: false,
94
+ type: String,
95
+ verify_block: proc do |value|
96
+ UI.user_error!("No target `file_id` is provided. Pass it using `file_id: 'some_id'`") unless value and !value.empty?
97
+ end
98
+ ),
99
+ FastlaneCore::ConfigItem.new(
100
+ key: :upload_file,
101
+ env_name: "GDRIVE_UPLOAD_FILE",
102
+ description: "Path to a file to be uploaded",
103
+ optional: false,
104
+ is_string: false,
105
+ verify_block: proc do |value|
106
+ UI.user_error!("No upload file is given, pass using `upload_file: 'some/path/a.txt'`") unless value and !value.empty?
107
+ UI.user_error!("Couldn't find upload file at path '#{value}'") unless File.exist?(value)
108
+ end
109
+ )
80
110
  ]
81
111
  end
82
112
 
@@ -7,12 +7,16 @@ module Fastlane
7
7
  GDRIVE_UPLOADED_FILE_NAMES = :GDRIVE_UPLOADED_FILE_NAMES
8
8
  GDRIVE_UPLOADED_FILE_URLS = :GDRIVE_UPLOADED_FILE_URLS
9
9
  end
10
+
10
11
  class UploadToGoogleDriveAction < Action
11
12
  def self.run(params)
12
- UI.message("Using credential file: #{params[:drive_keyfile]}")
13
+ unless params[:drive_keyfile].nil?
14
+ UI.message("Using credential file: #{params[:drive_keyfile]}")
15
+ end
13
16
 
14
17
  session = Helper::GoogleDriveHelper.setup(
15
18
  keyfile: params[:drive_keyfile],
19
+ key_json: params[:drive_key_json],
16
20
  service_account: params[:service_account]
17
21
  )
18
22
 
@@ -56,46 +60,74 @@ module Fastlane
56
60
 
57
61
  def self.available_options
58
62
  [
59
- FastlaneCore::ConfigItem.new(key: :drive_keyfile,
60
- env_name: 'GDRIVE_KEY_FILE',
61
- description: 'Json config file',
62
- type: String,
63
- default_value: 'drive_key.json',
64
- verify_block: proc do |value|
65
- UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
66
- end),
67
- FastlaneCore::ConfigItem.new(key: :service_account,
68
- env_name: 'GDRIVE_SERVICE_ACCOUNT',
69
- description: 'Credential is service account',
70
- optional: true,
71
- is_string: false,
72
- default_value: false),
73
- FastlaneCore::ConfigItem.new(key: :folder_id,
74
- env_name: "GDRIVE_UPLOAD_FOLDER_ID",
75
- description: "Upload target folder id",
76
- optional: false,
77
- type: String,
78
- verify_block: proc do |value|
79
- UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
80
- end),
81
- FastlaneCore::ConfigItem.new(key: :upload_files,
82
- env_name: "GDRIVE_UPLOAD_FILES",
83
- description: "Path to files to be uploaded",
84
- optional: false,
85
- is_string: false,
86
- verify_block: proc do |value|
87
- UI.user_error!("upload_files must be an Array of paths to files") unless value.kind_of?(Array)
88
- UI.user_error!("No upload file is given, pass using `upload_files: ['a', 'b']`") unless value and !value.empty?
89
- value.each do |path|
90
- UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
91
- end
92
- end),
93
- FastlaneCore::ConfigItem.new(key: :public_links,
94
- env_name: 'GDRIVE_PUBLIC_LINKS',
95
- description: 'Uploaded file links should be public',
96
- optional: true,
97
- default_value: false,
98
- is_string: false)
63
+ FastlaneCore::ConfigItem.new(
64
+ key: :drive_keyfile,
65
+ env_names: ['GDRIVE_KEY_FILE', 'GOOGLE_APPLICATION_CREDENTIALS'],
66
+ description: 'Path to the JSON keyfile',
67
+ conflicting_options: [:drive_key_json],
68
+ type: String,
69
+ optional: true,
70
+ verify_block: proc do |value|
71
+ UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
72
+ UI.user_error!("'#{value}' doesn't seem to be a valid JSON keyfile") unless FastlaneCore::Helper.json_file?(value)
73
+ end
74
+ ),
75
+ FastlaneCore::ConfigItem.new(
76
+ key: :drive_key_json,
77
+ env_name: 'GDRIVE_KEY_JSON',
78
+ description: 'Credential key in stringified JSON format',
79
+ optional: true,
80
+ conflicting_options: [:drive_keyfile],
81
+ type: String,
82
+ sensitive: true,
83
+ verify_block: proc do |value|
84
+ begin
85
+ JSON.parse(value)
86
+ rescue JSON::ParserError
87
+ UI.user_error!("Provided credential key is not a valid JSON")
88
+ end
89
+ end
90
+ ),
91
+ FastlaneCore::ConfigItem.new(
92
+ key: :service_account,
93
+ env_name: 'GDRIVE_SERVICE_ACCOUNT',
94
+ description: 'true if the credential is for a service account, false otherwise',
95
+ optional: true,
96
+ is_string: false,
97
+ default_value: false
98
+ ),
99
+ FastlaneCore::ConfigItem.new(
100
+ key: :folder_id,
101
+ env_name: "GDRIVE_UPLOAD_FOLDER_ID",
102
+ description: "Upload target folder id",
103
+ optional: false,
104
+ type: String,
105
+ verify_block: proc do |value|
106
+ UI.user_error!("No target `folder_id` was provided. Pass it using `folder_id: 'some_id'`") unless value and !value.empty?
107
+ end
108
+ ),
109
+ FastlaneCore::ConfigItem.new(
110
+ key: :upload_files,
111
+ env_name: "GDRIVE_UPLOAD_FILES",
112
+ description: "Path to files to be uploaded",
113
+ optional: false,
114
+ is_string: false,
115
+ verify_block: proc do |value|
116
+ UI.user_error!("upload_files must be an Array of paths to files") unless value.kind_of?(Array)
117
+ UI.user_error!("No upload file is given, pass using `upload_files: ['a', 'b']`") unless value and !value.empty?
118
+ value.each do |path|
119
+ UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
120
+ end
121
+ end
122
+ ),
123
+ FastlaneCore::ConfigItem.new(
124
+ key: :public_links,
125
+ env_name: 'GDRIVE_PUBLIC_LINKS',
126
+ description: 'Uploaded file links should be public',
127
+ optional: true,
128
+ default_value: false,
129
+ is_string: false
130
+ )
99
131
  ]
100
132
  end
101
133
 
@@ -1,15 +1,18 @@
1
1
  require 'fastlane_core/ui/ui'
2
2
  require 'google_drive'
3
+
3
4
  module Fastlane
4
5
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
6
 
6
7
  module Helper
7
8
  class GoogleDriveHelper
8
- def self.setup(keyfile: nil, service_account: false)
9
+ def self.setup(keyfile: nil, key_json: nil, service_account: false)
10
+ keyfile_or_io = keyfile || StringIO.new(key_json || '')
11
+
9
12
  if service_account
10
- ::GoogleDrive::Session.from_service_account_key(keyfile)
13
+ ::GoogleDrive::Session.from_service_account_key(keyfile_or_io)
11
14
  else
12
- ::GoogleDrive::Session.from_config(keyfile)
15
+ ::GoogleDrive::Session.from_config(keyfile_or_io)
13
16
  end
14
17
  rescue Exception => e
15
18
  UI.error(e.message)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleDrive
3
- VERSION = "0.9.0"
3
+ VERSION = "0.10.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-google_drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bumsoo Kim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-03 00:00:00.000000000 Z
11
+ date: 2024-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive2
@@ -196,6 +196,20 @@ dependencies:
196
196
  - - ">="
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
+ - !ruby/object:Gem::Dependency
200
+ name: simplecov_json_formatter
201
+ requirement: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ type: :development
207
+ prerelease: false
208
+ version_requirements: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
199
213
  - !ruby/object:Gem::Dependency
200
214
  name: fastlane
201
215
  requirement: !ruby/object:Gem::Requirement
@@ -245,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
259
  - !ruby/object:Gem::Version
246
260
  version: '0'
247
261
  requirements: []
248
- rubygems_version: 3.0.8
262
+ rubygems_version: 3.1.6
249
263
  signing_key:
250
264
  specification_version: 4
251
265
  summary: Upload files to Google Drive