Class: Fastlane::Actions::AndroidDownloadFileByVersionAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AndroidDownloadFileByVersionAction
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
84 85 86 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 84 def self. ['Automattic'] end |
.available_options ⇒ Object
40 41 42 43 44 45 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 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 40 def self. [ FastlaneCore::ConfigItem.new(key: :library_name, description: 'The display name of the library', type: String, optional: false), FastlaneCore::ConfigItem.new(key: :import_key, description: 'The key which is used in build.gradle to reference the version of the library to import', type: String, optional: false), FastlaneCore::ConfigItem.new(key: :repository, description: "The GitHub repository slug ('<orgname>/<reponame>') which hosts the library project", type: String, optional: false), FastlaneCore::ConfigItem.new(key: :file_path, description: 'The path of the file to download', type: String, optional: false), FastlaneCore::ConfigItem.new(key: :download_folder, description: 'The download folder', type: String, optional: true, default_value: Dir.tmpdir), FastlaneCore::ConfigItem.new(key: :github_release_prefix, description: 'The prefix which is used in the GitHub release title', type: String, optional: true), FastlaneCore::ConfigItem.new(key: :build_gradle_path, description: 'Path to the build.gradle file', type: String, optional: true, conflicting_options: [:project_root_folder]), Fastlane::Helper::GithubHelper.github_token_config_item, Fastlane::Helper::Deprecated.project_root_folder_config_item, ] end |
.description ⇒ Object
31 32 33 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 31 def self.description 'Downloads a file from a GitHub release based on the version used by the client app' end |
.details ⇒ Object
35 36 37 38 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 35 def self.details 'This action extracts the version of the library which is imported by the client app' \ 'and downloads the request file from the relevant GitHub release' end |
.is_supported?(platform) ⇒ Boolean
88 89 90 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 88 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
77 78 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 77 def self.output end |
.return_value ⇒ Object
80 81 82 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 80 def self.return_value 'The path where the file was downloaded to (typically <download_folder>/<basename(file_path)>), or nil if there was an issue downloading the file' end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb', line 4 def self.run(params) require_relative '../../helper/android/android_localize_helper' require_relative '../../helper/github_helper' project_root_folder = params[:project_root_folder] build_gradle_path = params[:build_gradle_path] || File.join(project_root_folder || '.', 'build.gradle') version = Fastlane::Helper::Android::VersionHelper.get_library_version_from_gradle_config( build_gradle_path: build_gradle_path, import_key: params[:import_key] ) UI.user_error!("Can't find any reference for key #{params[:import_key]}") if version.nil? UI. "Downloading #{params[:file_path]} from #{params[:repository]} at version #{version} to #{params[:download_folder]}" github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) github_helper.download_file_from_tag( repository: params[:repository], tag: "#{params[:github_release_prefix]}#{version}", file_path: params[:file_path], download_folder: params[:download_folder] ) end |