fastlane-plugin-google_drive 0.2.0 → 0.3.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: 25c7b2e3b658ca2ab433146073bfd0da8f5acdc865b1d8ab5a7981927e087c13
4
- data.tar.gz: 42cce7a465a1955e902c9522c754694733309f9aaff5d5797e76a4a142c3d03a
3
+ metadata.gz: 98e80910c3c134ed316765f0a4bdcf2a4915010afdcf52eab33f6a84b6243731
4
+ data.tar.gz: 51e457c7f9188d4609920a4cab910085b8447fc02577075222b6b129bca680b3
5
5
  SHA512:
6
- metadata.gz: 4f694a5b1e75ca345133e4759598ec7b93f8cab3bef73f60ca2c2cfa76451ade3404ae845535d5240dd46f7927a16b17bd94cfd2e907875cdd58d89c146c4594
7
- data.tar.gz: 036e78a81ee5d63dc0cacc106be9c6e472befb71addfd45564993b5d9c3d04258735155edbd8d6c1691c378c9680ab426ae9fb6a1b03a0795ba012808c427347
6
+ metadata.gz: 1eefa32898e4441139bcd4ee703cad60deb0563af1dea62cff04405636082511eccba7c9d8ede7e09e32343841d24be0da4534aa3eeff6344ed6dd6c4144dd75
7
+ data.tar.gz: 7bcf83c2ed587f7333aa54f2a14af39c9d41ccf057cc7dee39f8ac8129ddb73372a4d497346f1f86cb9f0fa65e35d05c0947860f14fa4bf67cfd1d258cc50304
data/README.md CHANGED
@@ -15,7 +15,7 @@ fastlane add_plugin google_drive
15
15
  ## About google_drive
16
16
 
17
17
  ```ruby
18
- upload_google_drive(
18
+ upload_to_google_drive(
19
19
  drive_keyfile: 'drive_key.json',
20
20
  service_account: true,
21
21
  folder_id: 'folder_id',
@@ -24,6 +24,7 @@ upload_google_drive(
24
24
  ```
25
25
 
26
26
  Upload files to Google Drive folder.
27
+ You can also use `google_drive_upload` or `upload_google_drive` as aliases.
27
28
 
28
29
  ```ruby
29
30
  create_google_drive_folder(
@@ -1,118 +1,13 @@
1
- require 'fastlane/action'
2
- require_relative '../helper/google_drive_helper'
3
-
4
1
  module Fastlane
5
2
  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 GoogleDriveUploadAction < 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
- folder = Helper::GoogleDriveHelper.file_by_id(
20
- session: session, fid: params[:folder_id]
21
- )
22
-
23
- uploaded_files = []
24
- assets = params[:upload_files]
25
-
26
- UI.abort_with_message!("No files to upload") if assets.nil? or assets.empty?
27
-
28
- assets.each do |asset|
29
- UI.message('------------------')
30
- UI.important("Uploading #{asset}")
31
- uploaded_files.push(Helper::GoogleDriveHelper.upload_file(file: folder, file_name: asset))
32
- UI.success('Success')
33
- UI.message('------------------')
34
- end
35
-
36
- 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
- end
3
+ require 'fastlane/plugin/google_drive/actions/upload_to_google_drive_action'
4
+ class GoogleDriveUploadAction < UploadToGoogleDriveAction
5
+ #####################################################
6
+ # @!group Documentation
7
+ #####################################################
39
8
 
40
9
  def self.description
41
- 'Upload files to Google Drive'
42
- end
43
-
44
- def self.details
45
- [
46
- 'Upload files to Google Drive',
47
- 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
48
- ].join("\n")
49
- end
50
-
51
- def self.available_options
52
- [
53
- FastlaneCore::ConfigItem.new(key: :drive_keyfile,
54
- env_name: 'GDRIVE_KEY_FILE',
55
- description: 'Json config file',
56
- type: String,
57
- default_value: 'drive_key.json',
58
- verify_block: proc do |value|
59
- UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
60
- end),
61
- FastlaneCore::ConfigItem.new(key: :service_account,
62
- env_name: 'GDRIVE_SERVICE_ACCOUNT',
63
- description: 'Credential is service account',
64
- optional: true,
65
- is_string: false,
66
- default_value: false),
67
- FastlaneCore::ConfigItem.new(key: :folder_id,
68
- env_name: "GDRIVE_UPLOAD_FOLDER_ID",
69
- description: "Upload target folder id",
70
- optional: false,
71
- type: String,
72
- verify_block: proc do |value|
73
- UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
74
- end),
75
- FastlaneCore::ConfigItem.new(key: :upload_files,
76
- env_name: "GDRIVE_UPLOAD_FILES",
77
- description: "Path to files to be uploaded",
78
- optional: false,
79
- is_string: false,
80
- verify_block: proc do |value|
81
- UI.user_error!("upload_files must be an Array of paths to files") unless value.kind_of?(Array)
82
- UI.user_error!("No upload file is given, pass using `upload_files: ['a', 'b']`") unless value and !value.empty?
83
- value.each do |path|
84
- UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
85
- end
86
- end)
87
- ]
88
- end
89
-
90
- def self.output
91
- [
92
- ['GDRIVE_UPLOADED_FILE_NAMES', 'The array of names of uploaded files'],
93
- ['GDRIVE_UPLOADED_FILE_URLS', 'The array of links to uploaded files']
94
- ]
95
- end
96
-
97
- def self.return_value
98
- # nothing
99
- end
100
-
101
- def self.authors
102
- ['Bumsoo Kim (@bskim45)']
103
- end
104
-
105
- def self.is_supported?(platform)
106
- true
107
- end
108
-
109
- def self.category
110
- :deprecated
111
- end
112
-
113
- def self.deprecated_notes
114
- "`google_drive_upload(...)` is renamed to `upload_google_drive(...)`\n" \
115
- "It will be removed in next release."
10
+ "Alias for the `upload_to_google_drive` action"
116
11
  end
117
12
  end
118
13
  end
@@ -1,109 +1,13 @@
1
- require 'fastlane/action'
2
- require_relative '../helper/google_drive_helper'
3
-
4
1
  module Fastlane
5
2
  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 UploadGoogleDriveAction < 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
- folder = Helper::GoogleDriveHelper.file_by_id(
20
- session: session, fid: params[:folder_id]
21
- )
22
-
23
- uploaded_files = []
24
- assets = params[:upload_files]
25
-
26
- UI.abort_with_message!("No files to upload") if assets.nil? or assets.empty?
27
-
28
- assets.each do |asset|
29
- UI.message('------------------')
30
- UI.important("Uploading #{asset}")
31
- uploaded_files.push(Helper::GoogleDriveHelper.upload_file(file: folder, file_name: asset))
32
- UI.success('Success')
33
- UI.message('------------------')
34
- end
35
-
36
- 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
- end
3
+ require 'fastlane/plugin/google_drive/actions/upload_to_google_drive_action'
4
+ class UploadGoogleDriveAction < UploadToGoogleDriveAction
5
+ #####################################################
6
+ # @!group Documentation
7
+ #####################################################
39
8
 
40
9
  def self.description
41
- 'Upload files to Google Drive'
42
- end
43
-
44
- def self.details
45
- [
46
- 'Upload files to Google Drive',
47
- 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
48
- ].join("\n")
49
- end
50
-
51
- def self.available_options
52
- [
53
- FastlaneCore::ConfigItem.new(key: :drive_keyfile,
54
- env_name: 'GDRIVE_KEY_FILE',
55
- description: 'Json config file',
56
- type: String,
57
- default_value: 'drive_key.json',
58
- verify_block: proc do |value|
59
- UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
60
- end),
61
- FastlaneCore::ConfigItem.new(key: :service_account,
62
- env_name: 'GDRIVE_SERVICE_ACCOUNT',
63
- description: 'Credential is service account',
64
- optional: true,
65
- is_string: false,
66
- default_value: false),
67
- FastlaneCore::ConfigItem.new(key: :folder_id,
68
- env_name: "GDRIVE_UPLOAD_FOLDER_ID",
69
- description: "Upload target folder id",
70
- optional: false,
71
- type: String,
72
- verify_block: proc do |value|
73
- UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
74
- end),
75
- FastlaneCore::ConfigItem.new(key: :upload_files,
76
- env_name: "GDRIVE_UPLOAD_FILES",
77
- description: "Path to files to be uploaded",
78
- optional: false,
79
- is_string: false,
80
- verify_block: proc do |value|
81
- UI.user_error!("upload_files must be an Array of paths to files") unless value.kind_of?(Array)
82
- UI.user_error!("No upload file is given, pass using `upload_files: ['a', 'b']`") unless value and !value.empty?
83
- value.each do |path|
84
- UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
85
- end
86
- end)
87
- ]
88
- end
89
-
90
- def self.output
91
- [
92
- ['GDRIVE_UPLOADED_FILE_NAMES', 'The array of names of uploaded files'],
93
- ['GDRIVE_UPLOADED_FILE_URLS', 'The array of links to uploaded files']
94
- ]
95
- end
96
-
97
- def self.return_value
98
- # nothing
99
- end
100
-
101
- def self.authors
102
- ['Bumsoo Kim (@bskim45)']
103
- end
104
-
105
- def self.is_supported?(platform)
106
- true
10
+ "Alias for the `upload_to_google_drive` action"
107
11
  end
108
12
  end
109
13
  end
@@ -0,0 +1,110 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/google_drive_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
+
14
+ session = Helper::GoogleDriveHelper.setup(
15
+ keyfile: params[:drive_keyfile],
16
+ service_account: params[:service_account]
17
+ )
18
+
19
+ folder = Helper::GoogleDriveHelper.file_by_id(
20
+ session: session, fid: params[:folder_id]
21
+ )
22
+
23
+ uploaded_files = []
24
+ assets = params[:upload_files]
25
+
26
+ UI.abort_with_message!("No files to upload") if assets.nil? or assets.empty?
27
+
28
+ assets.each do |asset|
29
+ UI.message('------------------')
30
+ UI.important("Uploading #{asset}")
31
+ uploaded_files.push(Helper::GoogleDriveHelper.upload_file(file: folder, file_name: asset))
32
+ UI.success('Success')
33
+ UI.message('------------------')
34
+ end
35
+
36
+ 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
+ end
39
+
40
+ def self.description
41
+ 'Upload files to Google Drive'
42
+ end
43
+
44
+ def self.details
45
+ [
46
+ 'Upload files to Google Drive',
47
+ 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile'
48
+ ].join("\n")
49
+ end
50
+
51
+ def self.available_options
52
+ [
53
+ FastlaneCore::ConfigItem.new(key: :drive_keyfile,
54
+ env_name: 'GDRIVE_KEY_FILE',
55
+ description: 'Json config file',
56
+ type: String,
57
+ default_value: 'drive_key.json',
58
+ verify_block: proc do |value|
59
+ UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value)
60
+ end),
61
+ FastlaneCore::ConfigItem.new(key: :service_account,
62
+ env_name: 'GDRIVE_SERVICE_ACCOUNT',
63
+ description: 'Credential is service account',
64
+ optional: true,
65
+ is_string: false,
66
+ default_value: false),
67
+ FastlaneCore::ConfigItem.new(key: :folder_id,
68
+ env_name: "GDRIVE_UPLOAD_FOLDER_ID",
69
+ description: "Upload target folder id",
70
+ optional: false,
71
+ type: String,
72
+ verify_block: proc do |value|
73
+ UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty?
74
+ end),
75
+ FastlaneCore::ConfigItem.new(key: :upload_files,
76
+ env_name: "GDRIVE_UPLOAD_FILES",
77
+ description: "Path to files to be uploaded",
78
+ optional: false,
79
+ is_string: false,
80
+ verify_block: proc do |value|
81
+ UI.user_error!("upload_files must be an Array of paths to files") unless value.kind_of?(Array)
82
+ UI.user_error!("No upload file is given, pass using `upload_files: ['a', 'b']`") unless value and !value.empty?
83
+ value.each do |path|
84
+ UI.user_error!("Couldn't find upload file at path '#{path}'") unless File.exist?(path)
85
+ end
86
+ end)
87
+ ]
88
+ end
89
+
90
+ def self.output
91
+ [
92
+ ['GDRIVE_UPLOADED_FILE_NAMES', 'The array of names of uploaded files'],
93
+ ['GDRIVE_UPLOADED_FILE_URLS', 'The array of links to uploaded files']
94
+ ]
95
+ end
96
+
97
+ def self.return_value
98
+ # nothing
99
+ end
100
+
101
+ def self.authors
102
+ ['Bumsoo Kim (@bskim45)']
103
+ end
104
+
105
+ def self.is_supported?(platform)
106
+ true
107
+ end
108
+ end
109
+ end
110
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GoogleDrive
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.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.2.0
4
+ version: 0.3.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: 2018-04-20 00:00:00.000000000 Z
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google_drive
@@ -162,6 +162,7 @@ files:
162
162
  - lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb
163
163
  - lib/fastlane/plugin/google_drive/actions/google_drive_upload_action.rb
164
164
  - lib/fastlane/plugin/google_drive/actions/upload_google_drive_action.rb
165
+ - lib/fastlane/plugin/google_drive/actions/upload_to_google_drive_action.rb
165
166
  - lib/fastlane/plugin/google_drive/helper/google_drive_helper.rb
166
167
  - lib/fastlane/plugin/google_drive/version.rb
167
168
  homepage: https://github.com/bskim45/fastlane-plugin-google_drive