fastlane-plugin-google_drive 0.5.0 → 0.6.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: cbca024b341c811412e22d2b275bf3fccb75557aacee681df62f808a17ae011f
4
- data.tar.gz: 2d55aeeb8afb05861e733974e09d9a2376d3f69a1dcb1d56b9543f0565dc2930
3
+ metadata.gz: b34d7897969c1e344ea4b8d9a6c6e00f04ea31c168f269c42235dfe05e5efad8
4
+ data.tar.gz: 19bfe0fb1bbe86dc31bba4925f7e1810c1969bdfeb8c544cec4eb0d09800070d
5
5
  SHA512:
6
- metadata.gz: ae3dc9110b9f974d4b35d48b7f45c072683ba0ef3004e08fe63a0ac0ac0d7d9fed4feb5c31b7dc9319097846c85d150c0a30bdebb9d8b25df12851267b9d504d
7
- data.tar.gz: fbeec3d0f8cd9e7593ef48e693a16c2a8e97cefafb26aa4e5134c182b961587eac8e3b48a05fb54c287dffd0446458b9d78a479bef57e9d55be7636c9d74a3c8
6
+ metadata.gz: d2c24ec4756413f9213ae79c132b09b0b60560e25b6ecfd2a86d47af06b50c1f6b7a06caeb7fcf3021ef0cb47c835c3b43451b0a5509e01753692499e82d1d61
7
+ data.tar.gz: dfa063b0605a717e4af7ee7bc483550e0650f3b028463a2390f02485979af978dbb3cbb33c14956694811b3a3ecf8a14fbfbb8d5efbf8c1291d21f5a6534439a
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 removed in next version.
22
+ > Aliases for this action - `google_drive_upload` and `upload_google_drive` are both removed in `v0.6.0`.
23
23
 
24
24
  ```ruby
25
25
  upload_to_google_drive(
@@ -22,6 +22,7 @@ module Fastlane
22
22
 
23
23
  uploaded_files = []
24
24
  assets = params[:upload_files]
25
+ generate_public_links = params[:public_links]
25
26
 
26
27
  UI.abort_with_message!("No files to upload") if assets.nil? or assets.empty?
27
28
 
@@ -34,7 +35,12 @@ module Fastlane
34
35
  end
35
36
 
36
37
  Actions.lane_context[SharedValues::GDRIVE_UPLOADED_FILE_NAMES] = uploaded_files.map(&:title)
37
- Actions.lane_context[SharedValues::GDRIVE_UPLOADED_FILE_URLS] = uploaded_files.map(&:human_url)
38
+ Actions.lane_context[SharedValues::GDRIVE_UPLOADED_FILE_URLS] =
39
+ if generate_public_links
40
+ uploaded_files.map(&Helper::GoogleDriveHelper.method(:create_public_url))
41
+ else
42
+ uploaded_files.map(&:human_url)
43
+ end
38
44
  end
39
45
 
40
46
  def self.description
@@ -83,7 +89,13 @@ module Fastlane
83
89
  value.each do |path|
84
90
  UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
85
91
  end
86
- 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)
87
99
  ]
88
100
  end
89
101
 
@@ -36,6 +36,19 @@ module Fastlane
36
36
  end
37
37
  end
38
38
 
39
+ def self.create_public_url(file)
40
+ raise "Not Google Drive file" unless file.kind_of?(::GoogleDrive::File)
41
+
42
+ begin
43
+ file.acl.push(type: "anyone", role: "reader")
44
+ file.reload_metadata
45
+ file.human_url
46
+ rescue Exception => e
47
+ UI.error(e.message)
48
+ UI.user_error!("Create public link for '#{file.resource_id}' failed")
49
+ end
50
+ end
51
+
39
52
  def self.create_subcollection(root_folder:, title:)
40
53
  root_folder.create_subcollection(title)
41
54
  rescue Exception => e
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleDrive
3
- VERSION = "0.5.0"
3
+ VERSION = "0.6.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.5.0
4
+ version: 0.6.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: 2020-10-19 00:00:00.000000000 Z
11
+ date: 2021-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive
@@ -180,9 +180,7 @@ files:
180
180
  - README.md
181
181
  - lib/fastlane/plugin/google_drive.rb
182
182
  - lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb
183
- - lib/fastlane/plugin/google_drive/actions/google_drive_upload_action.rb
184
183
  - lib/fastlane/plugin/google_drive/actions/update_google_drive_file_action.rb
185
- - lib/fastlane/plugin/google_drive/actions/upload_google_drive_action.rb
186
184
  - lib/fastlane/plugin/google_drive/actions/upload_to_google_drive_action.rb
187
185
  - lib/fastlane/plugin/google_drive/helper/google_drive_helper.rb
188
186
  - lib/fastlane/plugin/google_drive/version.rb
@@ -1,24 +0,0 @@
1
- module Fastlane
2
- module Actions
3
- require 'fastlane/plugin/google_drive/actions/upload_to_google_drive_action'
4
- class GoogleDriveUploadAction < UploadToGoogleDriveAction
5
- #####################################################
6
- # @!group Documentation
7
- #####################################################
8
-
9
- def self.description
10
- "Alias for the `upload_to_google_drive` action"
11
- end
12
-
13
- def self.category
14
- :deprecated
15
- end
16
-
17
- def self.deprecated_notes
18
- [
19
- "Please use `upload_to_google_drive` instead."
20
- ].join("\n")
21
- end
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- module Fastlane
2
- module Actions
3
- require 'fastlane/plugin/google_drive/actions/upload_to_google_drive_action'
4
- class UploadGoogleDriveAction < UploadToGoogleDriveAction
5
- #####################################################
6
- # @!group Documentation
7
- #####################################################
8
-
9
- def self.description
10
- "Alias for the `upload_to_google_drive` action"
11
- end
12
-
13
- def self.category
14
- :deprecated
15
- end
16
-
17
- def self.deprecated_notes
18
- [
19
- "Please use `upload_to_google_drive` instead."
20
- ].join("\n")
21
- end
22
- end
23
- end
24
- end