fastlane-plugin-google_cloud_storage_rebooted 0.1.2

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: 0bd7b393a6a0d4d6c88bbef719523073cb9646470f62240e7b4acfd41ef0ad00
4
+ data.tar.gz: 31a46149b827e9a2f5410379b36155ca1ab3307b0638a9327a85315930e4f948
5
+ SHA512:
6
+ metadata.gz: 017df650113bbbbfa85eeb0224680782e55c4942a54c438a861bd593188a8a74114eda2c125ed92d3cdfc595a1b490698410d934861a5ede7954ac293d0acfe7
7
+ data.tar.gz: 10bd5f66893c574e77d218a11620553c2a61176ebb8a22eabdc9b48e0d2a0aec5308a9e786dbedd67427a67f0bdd869513cbd59d063b35524699065f7996ca40
data/LICENSE ADDED
@@ -0,0 +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.
data/README.md ADDED
@@ -0,0 +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
+ [![Twitter: @fsaragoca](https://img.shields.io/badge/contact-@fsaragoca-blue.svg?style=flat)](https://twitter.com/fsaragoca)
5
+
6
+ [![CircleCI](https://circleci.com/gh/ShiriNmi1520/fastlane-plugin-google_cloud_storage/tree/master.svg?style=svg)
7
+
8
+ ## About
9
+ We are currently trying to contact the owner of the origin fork to contribute under the same name @ RubyGems, but we are still waiting for a response. Any help would be appreciated.
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
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).
@@ -0,0 +1,79 @@
1
+ require 'google/cloud/storage'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class GoogleCloudStorageCheckFileAction < Action
6
+ def self.run(params)
7
+ Actions.verify_gem!('google-cloud-storage')
8
+
9
+ storage = Helper::GoogleCloudStorageHelper.setup_storage(
10
+ project: params[:project],
11
+ keyfile: params[:keyfile]
12
+ )
13
+
14
+ bucket = Helper::GoogleCloudStorageHelper.find_bucket(
15
+ storage: storage,
16
+ bucket_name: params[:bucket]
17
+ )
18
+
19
+ begin
20
+ Helper::GoogleCloudStorageHelper.find_file(
21
+ bucket: bucket,
22
+ file_name: params[:file_name]
23
+ )
24
+ true
25
+ rescue
26
+ false
27
+ end
28
+ end
29
+
30
+ def self.description
31
+ "Check if file exists in Google Cloud Storage"
32
+ end
33
+
34
+ def self.authors
35
+ ["Fernando Saragoca"]
36
+ end
37
+
38
+ def self.return_value
39
+ "Returns 'true' if object exists, 'false' if not"
40
+ end
41
+
42
+ def self.available_options
43
+ [
44
+ FastlaneCore::ConfigItem.new(key: :project,
45
+ env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
46
+ description: "Google Cloud Storage project identifier",
47
+ optional: false,
48
+ type: String),
49
+ FastlaneCore::ConfigItem.new(key: :keyfile,
50
+ env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
51
+ description: "Google Cloud Storage keyfile",
52
+ optional: false,
53
+ type: String,
54
+ verify_block: proc do |value|
55
+ if value.nil? || value.empty?
56
+ UI.user_error!("No keyfile for Google Cloud Storage action given, pass using `keyfile_path: 'path/to/file.txt'`")
57
+ elsif File.file?(value) == false
58
+ UI.user_error!("Keyfile '#{value}' not found")
59
+ end
60
+ end),
61
+ FastlaneCore::ConfigItem.new(key: :bucket,
62
+ env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
63
+ description: "Google Cloud Storage bucket",
64
+ optional: false,
65
+ type: String),
66
+ FastlaneCore::ConfigItem.new(key: :file_name,
67
+ env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME",
68
+ description: "File name",
69
+ optional: false,
70
+ type: String)
71
+ ]
72
+ end
73
+
74
+ def self.is_supported?(platform)
75
+ true
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,83 @@
1
+ require 'google/cloud/storage'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class GoogleCloudStorageDownloadAction < Action
6
+ def self.run(params)
7
+ Actions.verify_gem!('google-cloud-storage')
8
+
9
+ output_path = params[:output_path]
10
+ output_directory = File.dirname(output_path)
11
+ unless File.exist?(output_directory)
12
+ Actions.sh("mkdir #{output_directory}", log: $verbose)
13
+ end
14
+
15
+ storage = Helper::GoogleCloudStorageHelper.setup_storage(
16
+ project: params[:project],
17
+ keyfile: params[:keyfile]
18
+ )
19
+
20
+ bucket = Helper::GoogleCloudStorageHelper.find_bucket(
21
+ storage: storage,
22
+ bucket_name: params[:bucket]
23
+ )
24
+
25
+ file = Helper::GoogleCloudStorageHelper.find_file(
26
+ bucket: bucket,
27
+ file_name: params[:file_name]
28
+ )
29
+
30
+ file.download(output_path)
31
+ end
32
+
33
+ def self.description
34
+ "Download a file from Google Cloud Storage"
35
+ end
36
+
37
+ def self.authors
38
+ ["Fernando Saragoca"]
39
+ end
40
+
41
+ def self.available_options
42
+ [
43
+ FastlaneCore::ConfigItem.new(key: :project,
44
+ env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
45
+ description: "Google Cloud Storage project identifier",
46
+ optional: false,
47
+ type: String),
48
+ FastlaneCore::ConfigItem.new(key: :keyfile,
49
+ env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
50
+ description: "Google Cloud Storage keyfile",
51
+ optional: false,
52
+ type: String,
53
+ verify_block: proc do |value|
54
+ if value.nil? || value.empty?
55
+ UI.user_error!("No keyfile for Google Cloud Storage action given, pass using `keyfile_path: 'path/to/file.txt'`")
56
+ elsif File.file?(value) == false
57
+ UI.user_error!("Keyfile '#{value}' not found")
58
+ end
59
+ end),
60
+ FastlaneCore::ConfigItem.new(key: :bucket,
61
+ env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
62
+ description: "Google Cloud Storage bucket",
63
+ optional: false,
64
+ type: String),
65
+ FastlaneCore::ConfigItem.new(key: :output_path,
66
+ env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_OUTPUT_PATH",
67
+ description: "Path to save downloaded file",
68
+ optional: false,
69
+ type: String),
70
+ FastlaneCore::ConfigItem.new(key: :file_name,
71
+ env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME",
72
+ description: "File name",
73
+ optional: false,
74
+ type: String)
75
+ ]
76
+ end
77
+
78
+ def self.is_supported?(platform)
79
+ true
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,84 @@
1
+ require 'google/cloud/storage'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class GoogleCloudStorageUploadAction < Action
6
+ def self.run(params)
7
+ Actions.verify_gem!('google-cloud-storage')
8
+
9
+ storage = Helper::GoogleCloudStorageHelper.setup_storage(
10
+ project: params[:project],
11
+ keyfile: params[:keyfile]
12
+ )
13
+
14
+ bucket = Helper::GoogleCloudStorageHelper.find_bucket(
15
+ storage: storage,
16
+ bucket_name: params[:bucket]
17
+ )
18
+ if !params[:destination_path].empty?
19
+ bucket.create_file(params[:content_path], "#{params[:destination_path]}/#{File.basename(params[:content_path])}")
20
+ else
21
+ bucket.create_file(params[:content_path], "#{File.basename(params[:content_path])}")
22
+ end
23
+ end
24
+
25
+ def self.description
26
+ "Upload a file to Google Cloud Storage"
27
+ end
28
+
29
+ def self.authors
30
+ ["Fernando Saragoca"]
31
+ end
32
+
33
+ def self.available_options
34
+ [
35
+ FastlaneCore::ConfigItem.new(key: :project,
36
+ env_name: "GOOGLE_CLOUD_STORAGE_PROJECT",
37
+ description: "Google Cloud Storage project identifier",
38
+ optional: false,
39
+ type: String),
40
+ FastlaneCore::ConfigItem.new(key: :keyfile,
41
+ env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE",
42
+ description: "Google Cloud Storage keyfile",
43
+ optional: false,
44
+ type: String,
45
+ verify_block: proc do |value|
46
+ if value.nil? || value.empty?
47
+ UI.user_error!("No keyfile for Google Cloud Storage action given, pass using `keyfile_path: 'path/to/file.txt'`")
48
+ elsif File.file?(value) == false
49
+ UI.user_error!("Keyfile '#{value}' not found")
50
+ end
51
+ end),
52
+ FastlaneCore::ConfigItem.new(key: :bucket,
53
+ env_name: "GOOGLE_CLOUD_STORAGE_BUCKET",
54
+ description: "Google Cloud Storage bucket",
55
+ optional: false,
56
+ type: String),
57
+ FastlaneCore::ConfigItem.new(key: :content_path,
58
+ env_name: "GOOGLE_CLOUD_STORAGE_UPLOAD_CONTENT_PATH",
59
+ description: "Path for file to upload",
60
+ optional: false,
61
+ type: String,
62
+ verify_block: proc do |value|
63
+ if value.nil? || value.empty?
64
+ UI.user_error!("No content path for google_cloud_storage_upload action given, pass using `content_path: 'path/to/file.txt'`")
65
+ elsif File.file?(value) == false
66
+ UI.user_error!("File for path '#{value}' not found")
67
+ end
68
+ end),
69
+ FastlaneCore::ConfigItem.new(key: :destination_path,
70
+ env_name: "GOOGLE_CLOUD_STORAGE_UPLOAD_DESTINATION_PATH",
71
+ description: "Destination path for file to upload, if not specified, file will be uploaded to Root directory",
72
+ optional: true,
73
+ type: String,
74
+ default_value: ""
75
+ ),
76
+ ]
77
+ end
78
+
79
+ def self.is_supported?(platform)
80
+ true
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,32 @@
1
+ require 'google/cloud/storage'
2
+
3
+ module Fastlane
4
+ module Helper
5
+ class GoogleCloudStorageHelper
6
+ def self.setup_storage(project: nil, keyfile: nil)
7
+ Google::Cloud::Storage.new(
8
+ project: project,
9
+ keyfile: keyfile
10
+ )
11
+ rescue
12
+ UI.user_error! "Invalid Google Cloud Storage credentials 🚫"
13
+ end
14
+
15
+ def self.find_bucket(storage: nil, bucket_name: nil)
16
+ bucket = storage.bucket(bucket_name)
17
+ if bucket.nil?
18
+ UI.user_error! "Bucket '#{bucket_name}' not found 🚫"
19
+ end
20
+ bucket
21
+ end
22
+
23
+ def self.find_file(bucket: nil, file_name: nil)
24
+ file = bucket.file(file_name)
25
+ if file.nil?
26
+ UI.user_error! "Object '#{file_name}' not found 🚫"
27
+ end
28
+ file
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module GoogleCloudStorage
3
+ VERSION = "0.1.2"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/google_cloud_storage/version'
2
+
3
+ module Fastlane
4
+ module GoogleCloudStorage
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::GoogleCloudStorage.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-google_cloud_storage_rebooted
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Huang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: google-cloud-storage
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fastlane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 2.0.5
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 2.0.5
111
+ description:
112
+ email: s20026352@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/google_cloud_storage.rb
120
+ - lib/fastlane/plugin/google_cloud_storage/actions/google_cloud_storage_check_file_action.rb
121
+ - lib/fastlane/plugin/google_cloud_storage/actions/google_cloud_storage_download_action.rb
122
+ - lib/fastlane/plugin/google_cloud_storage/actions/google_cloud_storage_upload_action.rb
123
+ - lib/fastlane/plugin/google_cloud_storage/helper/google_cloud_storage_helper.rb
124
+ - lib/fastlane/plugin/google_cloud_storage/version.rb
125
+ homepage: https://github.com/ShiriNmi1520/fastlane-plugin-google_cloud_storage
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubygems_version: 3.2.3
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: "Google Cloud Storage plugin for fastlane that implements upload & download
148
+ operation.\U0001F680"
149
+ test_files: []