Class: Fastlane::Helper::GoogleCloudStorageHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/google_cloud_storage_rebooted/helper/google_cloud_storage_helper.rb

Class Method Summary collapse

Class Method Details

.find_bucket(storage: nil, bucket_name: nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/fastlane/plugin/google_cloud_storage_rebooted/helper/google_cloud_storage_helper.rb', line 15

def self.find_bucket(storage: nil, bucket_name: nil)
  bucket = storage.bucket(bucket_name)
  if bucket.nil?
    UI.user_error! "Bucket '#{bucket_name}' not found 🚫"
  end
  bucket
end

.find_file(bucket: nil, file_name: nil) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/google_cloud_storage_rebooted/helper/google_cloud_storage_helper.rb', line 23

def self.find_file(bucket: nil, file_name: nil)
  file = bucket.file(file_name)
  if file.nil?
    UI.user_error! "Object '#{file_name}' not found 🚫"
  end
  file
end

.setup_storage(project: nil, keyfile: nil) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fastlane/plugin/google_cloud_storage_rebooted/helper/google_cloud_storage_helper.rb', line 6

def self.setup_storage(project: nil, keyfile: nil)
  Google::Cloud::Storage.new(
    project: project,
    keyfile: keyfile
  )
rescue
  UI.user_error! "Invalid Google Cloud Storage credentials 🚫"
end