fastlane-plugin-google_drive 0.4.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff3d3aa116c71368f5af60be0dc72657c6e4fdb26d78fbc1a9f271912dd55b52
4
- data.tar.gz: b29d5c43399aac7e73cc0781dc7b23c50fe164397459b8ea77259433f69367c9
3
+ metadata.gz: cbca024b341c811412e22d2b275bf3fccb75557aacee681df62f808a17ae011f
4
+ data.tar.gz: 2d55aeeb8afb05861e733974e09d9a2376d3f69a1dcb1d56b9543f0565dc2930
5
5
  SHA512:
6
- metadata.gz: 8cb8683819d407453d06260467319f86f81989d144464a97e5fcea93dd51bcd08ac7e8a147829d0bfd3110525a027f31c762b241c79c4cbe8aa2e9c830954092
7
- data.tar.gz: a71c29d80c84271aec2a2e3315cfff48f2387ba6e289315f0b19d93b3f870b226805bbc998f5b80bc008097ae08d018459319f22b96e5d49815ea2fb9674d380
6
+ metadata.gz: ae3dc9110b9f974d4b35d48b7f45c072683ba0ef3004e08fe63a0ac0ac0d7d9fed4feb5c31b7dc9319097846c85d150c0a30bdebb9d8b25df12851267b9d504d
7
+ data.tar.gz: fbeec3d0f8cd9e7593ef48e693a16c2a8e97cefafb26aa4e5134c182b961587eac8e3b48a05fb54c287dffd0446458b9d78a479bef57e9d55be7636c9d74a3c8
data/README.md CHANGED
@@ -19,7 +19,7 @@ fastlane add_plugin google_drive
19
19
  > Please refer to [this guide](https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md) to create an Google Drive credential.
20
20
 
21
21
  Upload files to Google Drive folder.
22
- > Aliases for this action - `google_drive_upload` and `upload_google_drive` will be deprecated in next version.
22
+ > Aliases for this action - `google_drive_upload` and `upload_google_drive` will be removed in next version.
23
23
 
24
24
  ```ruby
25
25
  upload_to_google_drive(
@@ -30,7 +30,7 @@ upload_to_google_drive(
30
30
  )
31
31
  ```
32
32
 
33
- Create new Google Drive folder
33
+ Create new Google Drive folder:
34
34
 
35
35
  ```ruby
36
36
  create_google_drive_folder(
@@ -40,6 +40,16 @@ create_google_drive_folder(
40
40
  )
41
41
  ```
42
42
 
43
+ Update the content of existing Google Drive file:
44
+
45
+ ```ruby
46
+ update_google_drive_file(
47
+ drive_keyfile: 'drive_key.json',
48
+ file_id: 'file_id',
49
+ upload_file: 'path/to/file.txt'
50
+ )
51
+ ```
52
+
43
53
  Download feature is not implemented yet. PR is always welcome.
44
54
 
45
55
  ## Example
@@ -67,7 +67,7 @@ module Fastlane
67
67
  optional: false,
68
68
  type: String,
69
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?
70
+ UI.user_error!("No target folder_id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
71
71
  end),
72
72
  FastlaneCore::ConfigItem.new(key: :folder_title,
73
73
  env_name: "GDRIVE_FOLDER_NAME",
@@ -0,0 +1,103 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/google_drive_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::GoogleDriveHelper.setup(
15
+ keyfile: params[:drive_keyfile],
16
+ service_account: params[:service_account]
17
+ )
18
+
19
+ file = Helper::GoogleDriveHelper.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::GoogleDriveHelper.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
+ ['Bumsoo Kim (@bskim45)']
96
+ end
97
+
98
+ def self.is_supported?(platform)
99
+ true
100
+ end
101
+ end
102
+ end
103
+ end
@@ -42,6 +42,18 @@ module Fastlane
42
42
  UI.error(e.message)
43
43
  UI.user_error!("Create '#{title}' failed")
44
44
  end
45
+
46
+ def self.update_file(file: nil, file_name: nil)
47
+ raise "Not a Google Drive file" unless file.kind_of?(::GoogleDrive::File)
48
+
49
+ begin
50
+ file = file.update_from_file(file_name)
51
+ file
52
+ rescue Exception => e
53
+ UI.error(e.message)
54
+ UI.user_error!("Upload '#{file_name}' failed")
55
+ end
56
+ end
45
57
  end
46
58
  end
47
59
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleDrive
3
- VERSION = "0.4.1"
3
+ VERSION = "0.5.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.4.1
4
+ version: 0.5.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: 2019-10-24 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.5
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,23 @@ dependencies:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.5
33
+ - !ruby/object:Gem::Dependency
34
+ name: google-api-client
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 0.37.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.37.0
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: pry
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +162,14 @@ dependencies:
142
162
  requirements:
143
163
  - - ">="
144
164
  - !ruby/object:Gem::Version
145
- version: 2.80.0
165
+ version: 2.140.0
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
149
169
  requirements:
150
170
  - - ">="
151
171
  - !ruby/object:Gem::Version
152
- version: 2.80.0
172
+ version: 2.140.0
153
173
  description:
154
174
  email: bskim45@gmail.com
155
175
  executables: []
@@ -161,6 +181,7 @@ files:
161
181
  - lib/fastlane/plugin/google_drive.rb
162
182
  - lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb
163
183
  - lib/fastlane/plugin/google_drive/actions/google_drive_upload_action.rb
184
+ - lib/fastlane/plugin/google_drive/actions/update_google_drive_file_action.rb
164
185
  - lib/fastlane/plugin/google_drive/actions/upload_google_drive_action.rb
165
186
  - lib/fastlane/plugin/google_drive/actions/upload_to_google_drive_action.rb
166
187
  - lib/fastlane/plugin/google_drive/helper/google_drive_helper.rb
@@ -184,8 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
205
  - !ruby/object:Gem::Version
185
206
  version: '0'
186
207
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.7.7
208
+ rubygems_version: 3.0.8
189
209
  signing_key:
190
210
  specification_version: 4
191
211
  summary: Upload files to Google Drive