Class: Fastlane::Actions::GoogleCloudStorageCheckFileAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GoogleCloudStorageCheckFileAction
- Defined in:
- lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_download_action.rb,
lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_check_file_action.rb
Overview
Google cloud storage check file action. This verifies if a specific file exists in the specified bucket it returns true if the file exists, false if it does not.
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported? ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
42 43 44 |
# File 'lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_download_action.rb', line 42 def self. ["Fernando Saragoca"] end |
.available_options ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_download_action.rb', line 46 def self. [ FastlaneCore::ConfigItem.new(key: :project, env_name: "GOOGLE_CLOUD_STORAGE_PROJECT", description: "Google Cloud Storage project identifier", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :keyfile, env_name: "GOOGLE_CLOUD_STORAGE_KEYFILE", description: "Google Cloud Storage keyfile", optional: false, type: String, verify_block: proc do |value| if value.nil? || value.empty? UI.user_error!("No keyfile for Google Cloud Storage action given, pass using `keyfile_path: 'path/to/file.txt'`") elsif File.file?(value) == false UI.user_error!("Keyfile '#{value}' not found") end end), FastlaneCore::ConfigItem.new(key: :bucket, env_name: "GOOGLE_CLOUD_STORAGE_BUCKET", description: "Google Cloud Storage bucket", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :output_path, env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_OUTPUT_PATH", description: "Path to save downloaded file", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :file_name, env_name: "GOOGLE_CLOUD_STORAGE_DOWNLOAD_FILE_NAME", description: "File name", optional: false, type: String) ] end |
.description ⇒ Object
38 39 40 |
# File 'lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_download_action.rb', line 38 def self.description "Download a file from Google Cloud Storage" end |
.is_supported? ⇒ Boolean
85 86 87 |
# File 'lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_download_action.rb', line 85 def self.is_supported?(*) true end |
.return_value ⇒ Object
43 44 45 |
# File 'lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_check_file_action.rb', line 43 def self.return_value "Returns 'true' if object exists, 'false' if not" end |
.run(params) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fastlane/plugin/google_cloud_storage_update/actions/google_cloud_storage_update_download_action.rb', line 11 def self.run(params) Actions.verify_gem!('google-cloud-storage') output_path = params[:output_path] output_directory = File.dirname(output_path) unless File.exist?(output_directory) Actions.sh("mkdir #{output_directory}", log: $verbose) end storage = Helper::GoogleCloudStorageHelper.setup_storage( project: params[:project], keyfile: params[:keyfile] ) bucket = Helper::GoogleCloudStorageHelper.find_bucket( storage: storage, bucket_name: params[:bucket] ) file = Helper::GoogleCloudStorageHelper.find_file( bucket: bucket, file_name: params[:file_name] ) file.download(output_path) end |