Class: Fastlane::Actions::CreateGoogleDriveFolderAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::CreateGoogleDriveFolderAction
- Defined in:
- lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
94 95 96 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 94 def self. ['Kohki Miki (@giginet)'] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 48 def self. [ FastlaneCore::ConfigItem.new(key: :drive_keyfile, env_name: 'GDRIVE_KEY_FILE', description: 'Json config file', type: String, default_value: 'drive_key.json', verify_block: proc do |value| UI.user_error!("Couldn't find config keyfile at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :service_account, env_name: 'GDRIVE_SERVICE_ACCOUNT', description: 'Credential is service account', optional: true, is_string: false, default_value: false), FastlaneCore::ConfigItem.new(key: :folder_id, env_name: "GDRIVE_UPLOAD_FOLDER_ID", description: "Upload target folder id", optional: false, type: String, verify_block: proc do |value| UI.user_error!("No target folder id given, pass using `folder_id: 'some_id'`") unless value and !value.empty? end), FastlaneCore::ConfigItem.new(key: :folder_title, env_name: "GDRIVE_FOLDER_NAME", description: "Folder title of new one", optional: false, type: String, verify_block: proc do |value| UI.user_error!("No folder title given") if value.nil? || value.empty? end) ] end |
.description ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 37 def self.description 'Create new folder on Google Drive' end |
.details ⇒ Object
41 42 43 44 45 46 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 41 def self.details [ 'Create new folder on Google Drive', 'See https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md to get a keyfile' ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
98 99 100 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 98 def self.is_supported?(platform) true end |
.output ⇒ Object
83 84 85 86 87 88 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 83 def self.output [ ['GDRIVE_CREATED_FOLDER_ID', 'ID of the created folder'], ['GDRIVE_CREATED_FOLDER_URL', 'Link to the created folder'] ] end |
.return_value ⇒ Object
90 91 92 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 90 def self.return_value '`GoogleDrive::Collection` object which indicates the created folder.' 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 |
# File 'lib/fastlane/plugin/google_drive/actions/create_google_drive_folder_action.rb', line 11 def self.run(params) UI.("Using config file: #{params[:drive_keyfile]}") session = Helper::GoogleDriveHelper.setup( keyfile: params[:drive_keyfile], service_account: params[:service_account] ) folder = Helper::GoogleDriveHelper.file_by_id( session: session, fid: params[:folder_id] ) title = params[:folder_title] UI.('------------------') UI.important("Creating #{title}") new_folder = Helper::GoogleDriveHelper.create_subcollection(root_folder: folder, title: title) UI.success('Success') UI.('------------------') folder_id = new_folder.resource_id.split(':').last Actions.lane_context[SharedValues::GDRIVE_CREATED_FOLDER_ID] = folder_id Actions.lane_context[SharedValues::GDRIVE_CREATED_FOLDER_URL] = new_folder.human_url new_folder end |