fastlane-plugin-googledrive_spquyt 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3cbd8ab899865cdb43df6b2092da2609f2bcc94ac370db7e059cea4942185f1e
4
+ data.tar.gz: fd4039fd3061a85070ec348e8e9df0f650e3551ac40386bb05acf3e2cc7a09f8
5
+ SHA512:
6
+ metadata.gz: 2f0bdfa4f6ce85a9c081c84e4b07b0622c9f5cf7eadec6fb46f00151a14ae9b82a4a3171dc68939c2bc4babffdc7217f70a06b6019526cc45727ed091d63d22b
7
+ data.tar.gz: 3463baf6d9bba45281db20cdaec7816629acc7adbfff3fda12845c3d87591e36c6a89b01ec754de31fbfb22e3196d9ca81021449ef8f0d180c591fc8a9781722
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 QuocTA-Amela <101373375+QuocTA-Amela@users.noreply.github.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # googledrive_spquyt plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-googledrive_spquyt)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-googledrive_spquyt`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin googledrive_spquyt
11
+ ```
12
+
13
+ ## About googledrive_spquyt
14
+
15
+ CRUD files and folders on Google Drive
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
+
23
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,103 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/googledrive_spquyt_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ GDRIVE_CREATED_FOLDER_ID = :GDRIVE_CREATED_FOLDER_ID
8
+ GDRIVE_CREATED_FOLDER_URL = :GDRIVE_CREATED_FOLDER_URL
9
+ end
10
+ class CreateGoogleDriveFolderAction < Action
11
+ def self.run(params)
12
+ UI.message("Using config file: #{params[:drive_keyfile]}")
13
+
14
+ session = Helper::GoogledriveSpquytHelper.setup(
15
+ keyfile: params[:drive_keyfile],
16
+ service_account: params[:service_account]
17
+ )
18
+
19
+ folder = Helper::GoogledriveSpquytHelper.file_by_id(
20
+ session: session, fid: params[:folder_id]
21
+ )
22
+
23
+ title = params[:folder_title]
24
+ UI.message('------------------')
25
+ UI.important("Creating #{title}")
26
+ new_folder = Helper::GoogledriveSpquytHelper.create_subcollection(root_folder: folder, title: title)
27
+ UI.success('Success')
28
+ UI.message('------------------')
29
+
30
+ folder_id = new_folder.resource_id.split(':').last
31
+ Actions.lane_context[SharedValues::GDRIVE_CREATED_FOLDER_ID] = folder_id
32
+ Actions.lane_context[SharedValues::GDRIVE_CREATED_FOLDER_URL] = new_folder.human_url
33
+
34
+ new_folder
35
+ end
36
+
37
+ def self.description
38
+ 'Create new folder on Google Drive'
39
+ end
40
+
41
+ def self.details
42
+ [
43
+ 'Create new folder on Google Drive',
44
+ 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
45
+ ].join("\n")
46
+ end
47
+
48
+ def self.available_options
49
+ [
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)
80
+ ]
81
+ end
82
+
83
+ def self.output
84
+ [
85
+ ['GDRIVE_CREATED_FOLDER_ID', 'ID of the created folder'],
86
+ ['GDRIVE_CREATED_FOLDER_URL', 'Link to the created folder']
87
+ ]
88
+ end
89
+
90
+ def self.return_value
91
+ '`GoogleDrive::Collection` object which indicates the created folder.'
92
+ end
93
+
94
+ def self.authors
95
+ ['SpQuyt (@spquyt)']
96
+ end
97
+
98
+ def self.is_supported?(platform)
99
+ true
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,92 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/googledrive_spquyt_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ GDRIVE_FOLDER_FILES = :GDRIVE_FOLDER_FILES
8
+ GDRIVE_FOLDER_FILES_TITLE = :GDRIVE_FOLDER_FILES_TITLE
9
+ end
10
+ class ListFilesGoogleDriveAction < Action
11
+ def self.run(params)
12
+
13
+ session = Helper::GoogledriveSpquytHelper.setup(
14
+ keyfile: params[:drive_keyfile],
15
+ service_account: params[:service_account]
16
+ )
17
+
18
+ folder = Helper::GoogledriveSpquytHelper.file_by_id(
19
+ session: session, fid: params[:folder_id]
20
+ )
21
+
22
+ folder_files = params[:keyword] ? folder.files.select{|file| file.title.include? params[:keyword]} : folder.files
23
+ folder_files_title = params[:keyword] ? folder.files.select{|file| file.title.include? params[:keyword]}.map{|file| file.title} : folder.files.map{|file| file.title}
24
+ Actions.lane_context[SharedValues::GDRIVE_FOLDER_FILES] = folder_files
25
+ Actions.lane_context[SharedValues::GDRIVE_FOLDER_FILES_TITLE] = folder_files_title
26
+ UI.important("List files: #{folder_files_title}")
27
+ end
28
+
29
+ def self.description
30
+ 'List files on Google Drive'
31
+ end
32
+
33
+ def self.details
34
+ [
35
+ 'List files on Google Drive',
36
+ 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
37
+ ].join("\n")
38
+ end
39
+
40
+ def self.available_options
41
+ [
42
+ FastlaneCore::ConfigItem.new(key: :drive_keyfile,
43
+ env_name: 'GDRIVE_KEY_FILE',
44
+ description: 'Json config file',
45
+ type: String,
46
+ default_value: 'drive_key.json',
47
+ verify_block: proc do |value|
48
+ UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
49
+ end),
50
+ FastlaneCore::ConfigItem.new(key: :service_account,
51
+ env_name: 'GDRIVE_SERVICE_ACCOUNT',
52
+ description: 'Credential is service account',
53
+ optional: true,
54
+ is_string: false,
55
+ default_value: false),
56
+ FastlaneCore::ConfigItem.new(key: :folder_id,
57
+ env_name: "GDRIVE_UPLOAD_FOLDER_ID",
58
+ description: "Upload target folder id",
59
+ optional: false,
60
+ type: String,
61
+ verify_block: proc do |value|
62
+ UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
63
+ end),
64
+ FastlaneCore::ConfigItem.new(key: :keyword,
65
+ env_name: "GDRIVE_KEYWORD_LIST_FILES",
66
+ description: "Keyword for filter list files",
67
+ optional: false,
68
+ type: String),
69
+ ]
70
+ end
71
+
72
+ def self.output
73
+ [
74
+ ['GDRIVE_FOLDER_FILES', 'Full collection of files in folder'],
75
+ ['GDRIVE_FOLDER_FILES_TITLE', 'Title of files in folder']
76
+ ]
77
+ end
78
+
79
+ def self.return_value
80
+ # nothing
81
+ end
82
+
83
+ def self.authors
84
+ ['SpQuyt (@spquyt)']
85
+ end
86
+
87
+ def self.is_supported?(platform)
88
+ true
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,103 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/googledrive_spquyt_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ GDRIVE_UPDATED_FILE_NAME = :GDRIVE_UPDATED_FILE_NAME
8
+ GDRIVE_UPDATED_FILE_URL = :GDRIVE_UPDATED_FILE_URL
9
+ end
10
+ class UpdateGoogleDriveFileAction < Action
11
+ def self.run(params)
12
+ UI.message("Using config file: #{params[:drive_keyfile]}")
13
+
14
+ session = Helper::GoogledriveSpquytHelper.setup(
15
+ keyfile: params[:drive_keyfile],
16
+ service_account: params[:service_account]
17
+ )
18
+
19
+ file = Helper::GoogledriveSpquytHelper.file_by_id(
20
+ session: session, fid: params[:file_id]
21
+ )
22
+
23
+ upload_file = params[:upload_file]
24
+ UI.abort_with_message!("No file to upload") if upload_file.nil? or upload_file.empty?
25
+
26
+ UI.message('------------------')
27
+ UI.important("Uploading #{upload_file}")
28
+ Helper::GoogledriveSpquytHelper.update_file(file: file, file_name: upload_file)
29
+ UI.success('Success')
30
+ UI.message('------------------')
31
+
32
+ Actions.lane_context[SharedValues::GDRIVE_UPDATED_FILE_NAME] = file.title
33
+ Actions.lane_context[SharedValues::GDRIVE_UPDATED_FILE_URL] = file.human_url
34
+ end
35
+
36
+ def self.description
37
+ 'Update a Google Drive file'
38
+ end
39
+
40
+ def self.details
41
+ [
42
+ 'Update a Google Drive file',
43
+ 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
44
+ ].join("\n")
45
+ end
46
+
47
+ def self.available_options
48
+ [
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)
80
+ ]
81
+ end
82
+
83
+ def self.output
84
+ [
85
+ ['GDRIVE_UPDATED_FILE_NAME', 'The name of the uploaded file'],
86
+ ['GDRIVE_UPDATED_FILE_URL', 'The link to the uploaded file']
87
+ ]
88
+ end
89
+
90
+ def self.return_value
91
+ # nothing
92
+ end
93
+
94
+ def self.authors
95
+ ['SpQuyt (@spquyt)']
96
+ end
97
+
98
+ def self.is_supported?(platform)
99
+ true
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,142 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/googledrive_spquyt_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ GDRIVE_UPLOADED_FILE_NAMES = :GDRIVE_UPLOADED_FILE_NAMES
8
+ GDRIVE_UPLOADED_FILE_URLS = :GDRIVE_UPLOADED_FILE_URLS
9
+ end
10
+ class UploadToGoogleDriveAction < Action
11
+ def self.run(params)
12
+ UI.message("Using config file: #{params[:drive_keyfile]}")
13
+ session = Helper::GoogledriveSpquytHelper.setup(
14
+ keyfile: params[:drive_keyfile],
15
+ service_account: params[:service_account]
16
+ )
17
+ folder = Helper::GoogledriveSpquytHelper.file_by_id(
18
+ session: session, fid: params[:folder_id]
19
+ )
20
+
21
+ # Begin of Delete alias function
22
+ if params[:delete_alias_keyword]
23
+ params[:keyword] = params[:delete_alias_keyword]
24
+ end
25
+ Actions::ListFilesGoogleDriveAction.run(params)
26
+ files_alias_to_delete = Actions.lane_context[SharedValues::GDRIVE_FOLDER_FILES]
27
+ files_alias_to_delete.each do |file_to_delete_item|
28
+ UI.message("Deleting file #{file_to_delete_item.title}...")
29
+ file_to_delete_item.delete(true)
30
+ end
31
+ # End of Delete alias function
32
+
33
+ uploaded_files = []
34
+ assets = params[:upload_files]
35
+ generate_public_links = params[:public_links]
36
+
37
+ UI.abort_with_message!("No files to upload") if assets.nil? or assets.empty?
38
+
39
+ assets.each do |asset|
40
+ UI.message('------------------')
41
+ UI.important("Uploading #{asset}")
42
+ uploaded_files.push(Helper::GoogledriveSpquytHelper.upload_file(file: folder, file_name: asset))
43
+ UI.success('Success')
44
+ UI.message('------------------')
45
+ end
46
+
47
+ Actions.lane_context[SharedValues::GDRIVE_UPLOADED_FILE_NAMES] = uploaded_files.map(&:title)
48
+ Actions.lane_context[SharedValues::GDRIVE_UPLOADED_FILE_URLS] =
49
+ if generate_public_links
50
+ uploaded_files.map(&Helper::GoogledriveSpquytHelper.method(:create_public_url))
51
+ else
52
+ uploaded_files.map(&:human_url)
53
+ end
54
+ end
55
+
56
+ def self.description
57
+ 'Upload files to Google Drive'
58
+ end
59
+
60
+ def self.details
61
+ [
62
+ 'Upload files to Google Drive',
63
+ 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
64
+ ].join("\n")
65
+ end
66
+
67
+ def self.available_options
68
+ [
69
+ FastlaneCore::ConfigItem.new(key: :drive_keyfile,
70
+ env_name: 'GDRIVE_KEY_FILE',
71
+ description: 'Json config file',
72
+ type: String,
73
+ default_value: 'drive_key.json',
74
+ verify_block: proc do |value|
75
+ UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
76
+ end),
77
+ FastlaneCore::ConfigItem.new(key: :service_account,
78
+ env_name: 'GDRIVE_SERVICE_ACCOUNT',
79
+ description: 'Credential is service account',
80
+ optional: true,
81
+ is_string: false,
82
+ default_value: false),
83
+ FastlaneCore::ConfigItem.new(key: :folder_id,
84
+ env_name: "GDRIVE_UPLOAD_FOLDER_ID",
85
+ description: "Upload target folder id",
86
+ optional: false,
87
+ type: String,
88
+ verify_block: proc do |value|
89
+ UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
90
+ end),
91
+ FastlaneCore::ConfigItem.new(key: :upload_files,
92
+ env_name: "GDRIVE_UPLOAD_FILES",
93
+ description: "Path to files to be uploaded",
94
+ optional: false,
95
+ is_string: false,
96
+ verify_block: proc do |value|
97
+ UI.user_error!("upload_files must be an Array of paths to files") unless value.kind_of?(Array)
98
+ UI.user_error!("No upload file is given, pass using `upload_files: ['a', 'b']`") unless value and !value.empty?
99
+ value.each do |path|
100
+ UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
101
+ end
102
+ end),
103
+ FastlaneCore::ConfigItem.new(key: :public_links,
104
+ env_name: 'GDRIVE_PUBLIC_LINKS',
105
+ description: 'Uploaded file links should be public',
106
+ optional: true,
107
+ default_value: false,
108
+ is_string: false),
109
+ FastlaneCore::ConfigItem.new(key: :keyword,
110
+ env_name: "GDRIVE_KEYWORD_LIST_FILES",
111
+ description: "A keyword to filter list files",
112
+ optional: true,
113
+ default_value: ""),
114
+ FastlaneCore::ConfigItem.new(key: :delete_alias_keyword,
115
+ env_name: "GDRIVE_DELETE_ALIAS_WHEN_UPLOADING_KEYWORD",
116
+ description: "A keyword to delete alias files when uploading a new file",
117
+ optional: true,
118
+ default_value: ""),
119
+ ]
120
+ end
121
+
122
+ def self.output
123
+ [
124
+ ['GDRIVE_UPLOADED_FILE_NAMES', 'The array of names of uploaded files'],
125
+ ['GDRIVE_UPLOADED_FILE_URLS', 'The array of links to uploaded files']
126
+ ]
127
+ end
128
+
129
+ def self.return_value
130
+ # nothing
131
+ end
132
+
133
+ def self.authors
134
+ ['SpQuyt (@spquyt)']
135
+ end
136
+
137
+ def self.is_supported?(platform)
138
+ true
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,73 @@
1
+ require 'fastlane_core/ui/ui'
2
+ require 'google_drive'
3
+
4
+ module Fastlane
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
+
7
+ module Helper
8
+ class GoogledriveSpquytHelper
9
+ def self.setup(keyfile: nil, service_account: false)
10
+ if service_account
11
+ ::GoogleDrive::Session.from_service_account_key(keyfile)
12
+ else
13
+ ::GoogleDrive::Session.from_config(keyfile)
14
+ end
15
+ rescue Exception => e
16
+ UI.error(e.message)
17
+ UI.user_error!('Invalid Google Drive credentials')
18
+ end
19
+
20
+ def self.file_by_id(session: nil, fid: nil)
21
+ file = session.file_by_id(fid)
22
+ file
23
+ rescue Exception => e
24
+ UI.error(e.message)
25
+ UI.user_error!("File with id '#{fid}' not found in Google Drive")
26
+ end
27
+
28
+ def self.upload_file(file: nil, file_name: nil, title: nil)
29
+ raise "Not Google Drive file" unless file.kind_of?(::GoogleDrive::File)
30
+
31
+ begin
32
+ file = file.upload_from_file(file_name, title, convert: false)
33
+ file
34
+ rescue Exception => e
35
+ UI.error(e.message)
36
+ UI.user_error!("Upload '#{file_name}' failed")
37
+ end
38
+ end
39
+
40
+ def self.create_public_url(file)
41
+ raise "Not Google Drive file" unless file.kind_of?(::GoogleDrive::File)
42
+
43
+ begin
44
+ file.acl.push(type: "anyone", role: "reader")
45
+ file.reload_metadata
46
+ file.human_url
47
+ rescue Exception => e
48
+ UI.error(e.message)
49
+ UI.user_error!("Create public link for '#{file.resource_id}' failed")
50
+ end
51
+ end
52
+
53
+ def self.create_subcollection(root_folder:, title:)
54
+ root_folder.create_subcollection(title)
55
+ rescue Exception => e
56
+ UI.error(e.message)
57
+ UI.user_error!("Create '#{title}' failed")
58
+ end
59
+
60
+ def self.update_file(file: nil, file_name: nil)
61
+ raise "Not a Google Drive file" unless file.kind_of?(::GoogleDrive::File)
62
+
63
+ begin
64
+ file = file.update_from_file(file_name)
65
+ file
66
+ rescue Exception => e
67
+ UI.error(e.message)
68
+ UI.user_error!("Upload '#{file_name}' failed")
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module GoogledriveSpquyt
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/googledrive_spquyt/version'
2
+
3
+ module Fastlane
4
+ module GoogledriveSpquyt
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::GoogledriveSpquyt.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-googledrive_spquyt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - QuocTA-Amela
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google_drive2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.9
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.9
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: fastlane
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.210.1
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.210.1
61
+ - !ruby/object:Gem::Dependency
62
+ name: pry
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec_junit_formatter
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rubocop
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '='
122
+ - !ruby/object:Gem::Version
123
+ version: 1.12.1
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '='
129
+ - !ruby/object:Gem::Version
130
+ version: 1.12.1
131
+ - !ruby/object:Gem::Dependency
132
+ name: rubocop-performance
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: rubocop-require_tools
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ - !ruby/object:Gem::Dependency
160
+ name: simplecov
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ description:
174
+ email: 101373375+QuocTA-Amela@users.noreply.github.com
175
+ executables: []
176
+ extensions: []
177
+ extra_rdoc_files: []
178
+ files:
179
+ - LICENSE
180
+ - README.md
181
+ - lib/fastlane/plugin/googledrive_spquyt.rb
182
+ - lib/fastlane/plugin/googledrive_spquyt/actions/create_google_drive_folder_action.rb
183
+ - lib/fastlane/plugin/googledrive_spquyt/actions/list_files_google_drive_action.rb
184
+ - lib/fastlane/plugin/googledrive_spquyt/actions/update_google_drive_file_action.rb
185
+ - lib/fastlane/plugin/googledrive_spquyt/actions/upload_to_google_drive_action.rb
186
+ - lib/fastlane/plugin/googledrive_spquyt/helper/googledrive_spquyt_helper.rb
187
+ - lib/fastlane/plugin/googledrive_spquyt/version.rb
188
+ homepage:
189
+ licenses:
190
+ - MIT
191
+ metadata: {}
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '2.6'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubygems_version: 3.0.3.1
208
+ signing_key:
209
+ specification_version: 4
210
+ summary: CRUD files and folders on Google Drive
211
+ test_files: []