fastlane-plugin-google_cloud_storage_update 0.2.1 → 0.2.3

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: 3f50a9e91b40690fdd34db9a164bc620990579d8570f17daf47a41cc00afcff7
4
- data.tar.gz: 686030eba2ad0060634b425be7e3b11a1dde86a717c9bedac78caa5a3951d6cb
3
+ metadata.gz: 3c8253e60dd6bb7480ff373ec5ccbfc0f648a6b2b7b8218976f901ba0a075269
4
+ data.tar.gz: 869e1b4f9c04bc1524d0887c53e9b093965c294260193c993a1095f1adf787fc
5
5
  SHA512:
6
- metadata.gz: 0b731dbf2e5b25020b4b71a30a98521a26708a8fb8b0d21f5dab577678ed4e22ba12e4364f44e370cef68bdc7c5fd1f8979b395d81840d32d02e52cca2255a94
7
- data.tar.gz: 532d8d32bb7eb6ad2f24797f054b6ac791aa109744e69c0ed7927fe3447254e5c609630fe4ec2023e64f7fd0e984241b23bd7bc59ff31b7e2b9a85611b2146ce
6
+ metadata.gz: 573714742574a36d6685117a8f39a5f0d865dd7e1faa3de17cf35d17b7dadfb13f8bf0436e962a9b8ec631c58abed543d4d7d4f8e03507e42ce2799da969e62b
7
+ data.tar.gz: fc50e9754656772757f0ce26da12a9867189e1e1f04116b198f00d59a2dcee39dc5f57f35f17d3723d14aea331dbe00d80e3dcb4447cb325accc46c084f2bf8d
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Fernando Saragoca <fsaragoca@me.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.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Fernando Saragoca <fsaragoca@me.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 CHANGED
@@ -1,54 +1,54 @@
1
- # google_cloud_storage plugin
2
-
3
- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-google_cloud_storage)
4
- [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
5
- [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
6
-
7
- [![Twitter: @fsaragoca](https://img.shields.io/badge/contact-@fsaragoca-blue.svg?style=flat)](https://twitter.com/fsaragoca)
8
-
9
- [![CircleCI](https://circleci.com/gh/fsaragoca/fastlane-plugin-google_cloud_storage.svg?style=svg)](https://circleci.com/gh/fsaragoca/fastlane-plugin-google_cloud_storage)
10
-
11
- ## Getting Started
12
-
13
- This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-google_cloud_storage`, add it to your project by running:
14
-
15
- ```bash
16
- fastlane add_plugin google_cloud_storage_update
17
- ```
18
-
19
- ## About google_cloud_storage
20
-
21
- Download and upload files from Google Cloud Storage.
22
-
23
- ## Example
24
-
25
- 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`.
26
-
27
- ## Run tests for this plugin
28
-
29
- To run both the tests, and code style validation, run
30
-
31
- ```
32
- rake
33
- ```
34
-
35
- To automatically fix many of the styling issues, use
36
- ```
37
- rubocop -a
38
- ```
39
-
40
- ## Issues and Feedback
41
-
42
- For any other issues and feedback about this plugin, please submit it to this repository.
43
-
44
- ## Troubleshooting
45
-
46
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
47
-
48
- ## Using `fastlane` Plugins
49
-
50
- For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
51
-
52
- ## About `fastlane`
53
-
54
- `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).
1
+ # google_cloud_storage plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-google_cloud_storage)
4
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
5
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
6
+
7
+ [![Twitter: @fsaragoca](https://img.shields.io/badge/contact-@fsaragoca-blue.svg?style=flat)](https://twitter.com/fsaragoca)
8
+
9
+ [![CircleCI](https://circleci.com/gh/fsaragoca/fastlane-plugin-google_cloud_storage.svg?style=svg)](https://circleci.com/gh/fsaragoca/fastlane-plugin-google_cloud_storage)
10
+
11
+ ## Getting Started
12
+
13
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-google_cloud_storage`, add it to your project by running:
14
+
15
+ ```bash
16
+ fastlane add_plugin google_cloud_storage_update
17
+ ```
18
+
19
+ ## About google_cloud_storage
20
+
21
+ Download and upload files from Google Cloud Storage.
22
+
23
+ ## Example
24
+
25
+ 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`.
26
+
27
+ ## Run tests for this plugin
28
+
29
+ To run both the tests, and code style validation, run
30
+
31
+ ```
32
+ rake
33
+ ```
34
+
35
+ To automatically fix many of the styling issues, use
36
+ ```
37
+ rubocop -a
38
+ ```
39
+
40
+ ## Issues and Feedback
41
+
42
+ For any other issues and feedback about this plugin, please submit it to this repository.
43
+
44
+ ## Troubleshooting
45
+
46
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
47
+
48
+ ## Using `fastlane` Plugins
49
+
50
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
51
+
52
+ ## About `fastlane`
53
+
54
+ `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).
@@ -1,86 +1,86 @@
1
- # frozen_string_literal: true
2
-
3
- require 'google/cloud/storage'
4
-
5
- module Fastlane
6
- module Actions
7
- # Google cloud storage check file action.
8
- # This verifies if a specific file exists in the specified bucket
9
- # it returns true if the file exists, false if it does not.
10
- class GoogleCloudStorageCheckFileAction < Action
11
- def self.run(params)
12
- Actions.verify_gem!('google-cloud-storage')
13
-
14
- storage = Helper::GoogleCloudStorageHelper.setup_storage(
15
- project: params[:project],
16
- keyfile: params[:keyfile]
17
- )
18
-
19
- bucket = Helper::GoogleCloudStorageHelper.find_bucket(
20
- storage: storage,
21
- bucket_name: params[:bucket]
22
- )
23
-
24
- begin
25
- Helper::GoogleCloudStorageHelper.find_file(
26
- bucket: bucket,
27
- file_name: params[:file_name]
28
- )
29
- true
30
- rescue StandardError
31
- false
32
- end
33
- end
34
-
35
- def self.description
36
- "Check if file exists in Google Cloud Storage"
37
- end
38
-
39
- def self.authors
40
- ["Fernando Saragoca"]
41
- end
42
-
43
- def self.return_value
44
- "Returns 'true' if object exists, 'false' if not"
45
- end
46
-
47
- def self.available_options
48
- [
49
- FastlaneCore::ConfigItem.new(key: :project,
50
- env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
51
- description: "Google Cloud Storage project identifier",
52
- optional: false,
53
- type: String),
54
- FastlaneCore::ConfigItem.new(key: :keyfile,
55
- env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
56
- description: "Google Cloud Storage keyfile",
57
- optional: false,
58
- type: String,
59
- verify_block: proc do |value|
60
- if value.nil? || value.empty?
61
- UI.user_error!("No keyfile for Google Cloud Storage action
62
- given, pass using `keyfile_path:
63
- 'path/to/file.txt'`")
64
- elsif !File.file?(value)
65
- UI.user_error!("Keyfile '#{value}' not found")
66
- end
67
- end),
68
- FastlaneCore::ConfigItem.new(key: :bucket,
69
- env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
70
- description: "Google Cloud Storage bucket",
71
- optional: false,
72
- type: String),
73
- FastlaneCore::ConfigItem.new(key: :file_name,
74
- env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME",
75
- description: "File name",
76
- optional: false,
77
- type: String)
78
- ]
79
- end
80
-
81
- # def self.supported?(platform)
82
- # true
83
- # end
84
- end
85
- end
86
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'google/cloud/storage'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ # Google cloud storage check file action.
8
+ # This verifies if a specific file exists in the specified bucket
9
+ # it returns true if the file exists, false if it does not.
10
+ class GoogleCloudStorageCheckFileAction < Action
11
+ def self.run(params)
12
+ Actions.verify_gem!('google-cloud-storage')
13
+
14
+ storage = Helper::GoogleCloudStorageHelper.setup_storage(
15
+ project: params[:project],
16
+ keyfile: params[:keyfile]
17
+ )
18
+
19
+ bucket = Helper::GoogleCloudStorageHelper.find_bucket(
20
+ storage: storage,
21
+ bucket_name: params[:bucket]
22
+ )
23
+
24
+ begin
25
+ Helper::GoogleCloudStorageHelper.find_file(
26
+ bucket: bucket,
27
+ file_name: params[:file_name]
28
+ )
29
+ true
30
+ rescue StandardError
31
+ false
32
+ end
33
+ end
34
+
35
+ def self.description
36
+ "Check if file exists in Google Cloud Storage"
37
+ end
38
+
39
+ def self.authors
40
+ ["Fernando Saragoca"]
41
+ end
42
+
43
+ def self.return_value
44
+ "Returns 'true' if object exists, 'false' if not"
45
+ end
46
+
47
+ def self.available_options
48
+ [
49
+ FastlaneCore::ConfigItem.new(key: :project,
50
+ env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
51
+ description: "Google Cloud Storage project identifier",
52
+ optional: false,
53
+ type: String),
54
+ FastlaneCore::ConfigItem.new(key: :keyfile,
55
+ env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
56
+ description: "Google Cloud Storage keyfile",
57
+ optional: false,
58
+ type: String,
59
+ verify_block: proc do |value|
60
+ if value.nil? || value.empty?
61
+ UI.user_error!("No keyfile for Google Cloud Storage action
62
+ given, pass using `keyfile_path:
63
+ 'path/to/file.txt'`")
64
+ elsif !File.file?(value)
65
+ UI.user_error!("Keyfile '#{value}' not found")
66
+ end
67
+ end),
68
+ FastlaneCore::ConfigItem.new(key: :bucket,
69
+ env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
70
+ description: "Google Cloud Storage bucket",
71
+ optional: false,
72
+ type: String),
73
+ FastlaneCore::ConfigItem.new(key: :file_name,
74
+ env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME",
75
+ description: "File name",
76
+ optional: false,
77
+ type: String)
78
+ ]
79
+ end
80
+
81
+ def self.is_supported?(*)
82
+ true
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,90 +1,90 @@
1
- # frozen_string_literal: true
2
-
3
- require 'google/cloud/storage'
4
-
5
- module Fastlane
6
- module Actions
7
- # Google Cloud Storage download action.
8
- # This downloads the specified file from the specified google
9
- # cloud storage bucket and stores it in the chosen destination.
10
- class GoogleCloudStorageCheckFileAction < Action
11
- def self.run(params)
12
- Actions.verify_gem!('google-cloud-storage')
13
-
14
- output_path = params[:output_path]
15
- output_directory = File.dirname(output_path)
16
- unless File.exist?(output_directory)
17
- Actions.sh("mkdir #{output_directory}", log: $verbose)
18
- end
19
-
20
- storage = Helper::GoogleCloudStorageHelper.setup_storage(
21
- project: params[:project],
22
- keyfile: params[:keyfile]
23
- )
24
-
25
- bucket = Helper::GoogleCloudStorageHelper.find_bucket(
26
- storage: storage,
27
- bucket_name: params[:bucket]
28
- )
29
-
30
- file = Helper::GoogleCloudStorageHelper.find_file(
31
- bucket: bucket,
32
- file_name: params[:file_name]
33
- )
34
-
35
- file.download(output_path)
36
- end
37
-
38
- def self.description
39
- "Download a file from Google Cloud Storage"
40
- end
41
-
42
- def self.authors
43
- ["Fernando Saragoca"]
44
- end
45
-
46
- def self.available_options
47
- [
48
- FastlaneCore::ConfigItem.new(key: :project,
49
- env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
50
- description: "Google Cloud Storage project identifier",
51
- optional: false,
52
- type: String),
53
- FastlaneCore::ConfigItem.new(key: :keyfile,
54
- env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
55
- description: "Google Cloud Storage keyfile",
56
- optional: false,
57
- type: String,
58
- verify_block: proc do |value|
59
- if value.nil? || value.empty?
60
- UI.user_error!("No keyfile for Google Cloud Storage action
61
- given, pass using `keyfile_path:
62
- 'path/to/file.txt'`")
63
- elsif File.file?(value) == false
64
- UI.user_error!("Keyfile '#{value}' not found")
65
- end
66
- end),
67
- FastlaneCore::ConfigItem.new(key: :bucket,
68
- env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
69
- description: "Google Cloud Storage bucket",
70
- optional: false,
71
- type: String),
72
- FastlaneCore::ConfigItem.new(key: :output_path,
73
- env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_OUTPUT_PATH",
74
- description: "Path to save downloaded file",
75
- optional: false,
76
- type: String),
77
- FastlaneCore::ConfigItem.new(key: :file_name,
78
- env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME",
79
- description: "File name",
80
- optional: false,
81
- type: String)
82
- ]
83
- end
84
-
85
- # def self.supported?(platform)
86
- # true
87
- # end
88
- end
89
- end
90
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'google/cloud/storage'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ # Google Cloud Storage download action.
8
+ # This downloads the specified file from the specified google
9
+ # cloud storage bucket and stores it in the chosen destination.
10
+ class GoogleCloudStorageCheckFileAction < Action
11
+ def self.run(params)
12
+ Actions.verify_gem!('google-cloud-storage')
13
+
14
+ output_path = params[:output_path]
15
+ output_directory = File.dirname(output_path)
16
+ unless File.exist?(output_directory)
17
+ Actions.sh("mkdir #{output_directory}", log: $verbose)
18
+ end
19
+
20
+ storage = Helper::GoogleCloudStorageHelper.setup_storage(
21
+ project: params[:project],
22
+ keyfile: params[:keyfile]
23
+ )
24
+
25
+ bucket = Helper::GoogleCloudStorageHelper.find_bucket(
26
+ storage: storage,
27
+ bucket_name: params[:bucket]
28
+ )
29
+
30
+ file = Helper::GoogleCloudStorageHelper.find_file(
31
+ bucket: bucket,
32
+ file_name: params[:file_name]
33
+ )
34
+
35
+ file.download(output_path)
36
+ end
37
+
38
+ def self.description
39
+ "Download a file from Google Cloud Storage"
40
+ end
41
+
42
+ def self.authors
43
+ ["Fernando Saragoca"]
44
+ end
45
+
46
+ def self.available_options
47
+ [
48
+ FastlaneCore::ConfigItem.new(key: :project,
49
+ env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
50
+ description: "Google Cloud Storage project identifier",
51
+ optional: false,
52
+ type: String),
53
+ FastlaneCore::ConfigItem.new(key: :keyfile,
54
+ env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
55
+ description: "Google Cloud Storage keyfile",
56
+ optional: false,
57
+ type: String,
58
+ verify_block: proc do |value|
59
+ if value.nil? || value.empty?
60
+ UI.user_error!("No keyfile for Google Cloud Storage action
61
+ given, pass using `keyfile_path:
62
+ 'path/to/file.txt'`")
63
+ elsif File.file?(value) == false
64
+ UI.user_error!("Keyfile '#{value}' not found")
65
+ end
66
+ end),
67
+ FastlaneCore::ConfigItem.new(key: :bucket,
68
+ env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
69
+ description: "Google Cloud Storage bucket",
70
+ optional: false,
71
+ type: String),
72
+ FastlaneCore::ConfigItem.new(key: :output_path,
73
+ env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_OUTPUT_PATH",
74
+ description: "Path to save downloaded file",
75
+ optional: false,
76
+ type: String),
77
+ FastlaneCore::ConfigItem.new(key: :file_name,
78
+ env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME",
79
+ description: "File name",
80
+ optional: false,
81
+ type: String)
82
+ ]
83
+ end
84
+
85
+ def self.is_supported?(*)
86
+ true
87
+ end
88
+ end
89
+ end
90
+ end
@@ -1,89 +1,89 @@
1
- # frozen_string_literal: true
2
-
3
- require 'google/cloud/storage'
4
-
5
- module Fastlane
6
- module Actions
7
- # Google Cloud Storage upload action
8
- # This uploads the specified file to the specified
9
- # Google Cloud Storage bucket under the specified filePath.
10
- class GoogleCloudStorageUploadAction < Action
11
- def self.run(params)
12
- Actions.verify_gem!('google-cloud-storage')
13
-
14
- storage = Helper::GoogleCloudStorageHelper.setup_storage(
15
- project: params[:project],
16
- keyfile: params[:keyfile]
17
- )
18
-
19
- bucket = Helper::GoogleCloudStorageHelper.find_bucket(
20
- storage: storage,
21
- bucket_name: params[:bucket]
22
- )
23
-
24
- file_name = params[:name] || File.basename(params[:content_path])
25
- bucket.create_file(params[:content_path], file_name)
26
- end
27
-
28
- def self.description
29
- "Upload a file to Google Cloud Storage"
30
- end
31
-
32
- def self.authors
33
- ["Fernando Saragoca"]
34
- end
35
-
36
- def self.available_options
37
- [
38
- FastlaneCore::ConfigItem.new(key: :project,
39
- env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
40
- description: "Google Cloud Storage project identifier",
41
- optional: false,
42
- type: String),
43
- FastlaneCore::ConfigItem.new(key: :keyfile,
44
- env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
45
- description: "Google Cloud Storage keyfile",
46
- optional: false,
47
- type: String,
48
- verify_block: proc do |value|
49
- if value.nil? || value.empty?
50
- UI.user_error!("No keyfile for Google Cloud Storage action
51
- given, pass using `keyfile_path:
52
- 'path/to/file.txt'`")
53
- elsif !File.file?(value)
54
- UI.user_error!("Keyfile '#{value}' not found")
55
- end
56
- end),
57
- FastlaneCore::ConfigItem.new(key: :bucket,
58
- env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
59
- description: "Google Cloud Storage bucket",
60
- optional: false,
61
- type: String),
62
- FastlaneCore::ConfigItem.new(key: :content_path,
63
- env_name: "GOOGLE_CLOUD_STORAGE_UPLOAD_CONTENT_PATH",
64
- description: "Path for file to upload",
65
- optional: false,
66
- type: String,
67
- verify_block: proc do |value|
68
- if value.nil? || value.empty?
69
- UI.user_error!("No content path for google_cloud_storage_upload
70
- action given, pass using `content_path:
71
- 'path/to/file.txt'`")
72
- elsif !File.file?(value)
73
- UI.user_error!("File for path '#{value}' not found")
74
- end
75
- end),
76
- FastlaneCore::ConfigItem.new(key: :name,
77
- env_name: "GOOGLE_CLOUD_STORAGE_UPLOAD_NAME",
78
- description: "File name",
79
- optional: true,
80
- type: String)
81
- ]
82
- end
83
-
84
- # def self.supported?(platform)
85
- # true
86
- # end
87
- end
88
- end
89
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'google/cloud/storage'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ # Google Cloud Storage upload action
8
+ # This uploads the specified file to the specified
9
+ # Google Cloud Storage bucket under the specified filePath.
10
+ class GoogleCloudStorageUploadAction < Action
11
+ def self.run(params)
12
+ Actions.verify_gem!('google-cloud-storage')
13
+
14
+ storage = Helper::GoogleCloudStorageHelper.setup_storage(
15
+ project: params[:project],
16
+ keyfile: params[:keyfile]
17
+ )
18
+
19
+ bucket = Helper::GoogleCloudStorageHelper.find_bucket(
20
+ storage: storage,
21
+ bucket_name: params[:bucket]
22
+ )
23
+
24
+ file_name = params[:name] || File.basename(params[:content_path])
25
+ bucket.create_file(params[:content_path], file_name)
26
+ end
27
+
28
+ def self.description
29
+ "Upload a file to Google Cloud Storage"
30
+ end
31
+
32
+ def self.authors
33
+ ["Fernando Saragoca"]
34
+ end
35
+
36
+ def self.available_options
37
+ [
38
+ FastlaneCore::ConfigItem.new(key: :project,
39
+ env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
40
+ description: "Google Cloud Storage project identifier",
41
+ optional: false,
42
+ type: String),
43
+ FastlaneCore::ConfigItem.new(key: :keyfile,
44
+ env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
45
+ description: "Google Cloud Storage keyfile",
46
+ optional: false,
47
+ type: String,
48
+ verify_block: proc do |value|
49
+ if value.nil? || value.empty?
50
+ UI.user_error!("No keyfile for Google Cloud Storage action
51
+ given, pass using `keyfile_path:
52
+ 'path/to/file.txt'`")
53
+ elsif !File.file?(value)
54
+ UI.user_error!("Keyfile '#{value}' not found")
55
+ end
56
+ end),
57
+ FastlaneCore::ConfigItem.new(key: :bucket,
58
+ env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
59
+ description: "Google Cloud Storage bucket",
60
+ optional: false,
61
+ type: String),
62
+ FastlaneCore::ConfigItem.new(key: :content_path,
63
+ env_name: "GOOGLE_CLOUD_STORAGE_UPLOAD_CONTENT_PATH",
64
+ description: "Path for file to upload",
65
+ optional: false,
66
+ type: String,
67
+ verify_block: proc do |value|
68
+ if value.nil? || value.empty?
69
+ UI.user_error!("No content path for google_cloud_storage_upload
70
+ action given, pass using `content_path:
71
+ 'path/to/file.txt'`")
72
+ elsif !File.file?(value)
73
+ UI.user_error!("File for path '#{value}' not found")
74
+ end
75
+ end),
76
+ FastlaneCore::ConfigItem.new(key: :name,
77
+ env_name: "GOOGLE_CLOUD_STORAGE_UPLOAD_NAME",
78
+ description: "File name",
79
+ optional: true,
80
+ type: String)
81
+ ]
82
+ end
83
+
84
+ def self.is_supported?(*)
85
+ true
86
+ end
87
+ end
88
+ end
89
+ end
@@ -1,35 +1,35 @@
1
- # frozen_string_literal: true
2
-
3
- require 'google/cloud/storage'
4
-
5
- module Fastlane
6
- module Helper
7
- # Google cloud storage helper class handling the setup of the storage
8
- class GoogleCloudStorageHelper
9
- def self.setup_storage(project: nil, keyfile: nil)
10
- Google::Cloud::Storage.new(
11
- project: project,
12
- keyfile: keyfile
13
- )
14
- rescue StandardError
15
- UI.user_error! "Invalid Google Cloud Storage credentials 🚫"
16
- end
17
-
18
- def self.find_bucket(storage: nil, bucket_name: nil)
19
- bucket = storage.bucket(bucket_name)
20
- if bucket.nil?
21
- UI.user_error! "Bucket '#{bucket_name}' not found 🚫"
22
- end
23
- bucket
24
- end
25
-
26
- def self.find_file(bucket: nil, file_name: nil)
27
- file = bucket.file(file_name)
28
- if file.nil?
29
- UI.user_error! "Object '#{file_name}' not found 🚫"
30
- end
31
- file
32
- end
33
- end
34
- end
35
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'google/cloud/storage'
4
+
5
+ module Fastlane
6
+ module Helper
7
+ # Google cloud storage helper class handling the setup of the storage
8
+ class GoogleCloudStorageHelper
9
+ def self.setup_storage(project: nil, keyfile: nil)
10
+ Google::Cloud::Storage.new(
11
+ project: project,
12
+ keyfile: keyfile
13
+ )
14
+ rescue StandardError
15
+ UI.user_error! "Invalid Google Cloud Storage credentials 🚫"
16
+ end
17
+
18
+ def self.find_bucket(storage: nil, bucket_name: nil)
19
+ bucket = storage.bucket(bucket_name)
20
+ if bucket.nil?
21
+ UI.user_error! "Bucket '#{bucket_name}' not found 🚫"
22
+ end
23
+ bucket
24
+ end
25
+
26
+ def self.find_file(bucket: nil, file_name: nil)
27
+ file = bucket.file(file_name)
28
+ if file.nil?
29
+ UI.user_error! "Object '#{file_name}' not found 🚫"
30
+ end
31
+ file
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,7 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
- module Fastlane
4
- module GoogleCloudStorageUpdate
5
- VERSION = "0.2.1"
6
- end
7
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Fastlane
4
+ module GoogleCloudStorageUpdate
5
+ VERSION = "0.2.3"
6
+ end
7
+ end
@@ -1,19 +1,19 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fastlane/plugin/google_cloud_storage_update/version'
4
-
5
- module Fastlane
6
- # Module for integrating with google_cloud_storage_update
7
- module GoogleCloudStorageUpdate
8
- # Return all .rb files inside the "actions" and "helper" directory
9
- def self.all_classes
10
- Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
11
- end
12
- end
13
- end
14
-
15
- # By default we want to import all available actions and helpers
16
- # A plugin can contain any number of actions and plugins
17
- Fastlane::GoogleCloudStorageUpdate.all_classes.each do |current|
18
- require current
19
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'fastlane/plugin/google_cloud_storage_update/version'
4
+
5
+ module Fastlane
6
+ # Module for integrating with google_cloud_storage_update
7
+ module GoogleCloudStorageUpdate
8
+ # Return all .rb files inside the "actions" and "helper" directory
9
+ def self.all_classes
10
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
11
+ end
12
+ end
13
+ end
14
+
15
+ # By default we want to import all available actions and helpers
16
+ # A plugin can contain any number of actions and plugins
17
+ Fastlane::GoogleCloudStorageUpdate.all_classes.each do |current|
18
+ require current
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-google_cloud_storage_update
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeroen Stoker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-09 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-storage
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.2.22
144
+ rubygems_version: 3.5.17
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Google Cloud Storage