Class: Fastlane::Actions::EmergeOrderFileAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::EmergeOrderFileAction
- Defined in:
- lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 37 def self. ["Emerge Tools"] end |
.available_options ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 50 def self. [ FastlaneCore::ConfigItem.new(key: :api_token, env_name: "EMERGE_API_TOKEN", description: "An API token for Emerge", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :app_id, description: "Id of the app being built with the order file", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :output_path, description: "Path to the order file", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :order_file_version, description: "Version of the order file to download", optional: false, type: String), ] end |
.description ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 33 def self.description "Fastlane plugin to download order files" end |
.details ⇒ Object
45 46 47 48 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 45 def self.details # Optional: "" end |
.is_supported?(platform) ⇒ Boolean
72 73 74 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 72 def self.is_supported?(platform) platform == :ios end |
.return_value ⇒ Object
41 42 43 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 41 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fastlane/plugin/emerge/actions/emerge_order_file_action.rb', line 9 def self.run(params) puts "https://order-files-prod.emergetools.com/#{params[:app_id]}/#{params[:order_file_version]}" resp = Faraday.get("https://order-files-prod.emergetools.com/#{params[:app_id]}/#{params[:order_file_version]}", nil, {'X-API-Token' => params[:api_token]}) case resp.status when 200 Tempfile.create do |f| f.write(resp.body) decompressed = IO.popen(['gunzip', '-c', f.path]).read IO.write(params[:output_path], decompressed) end return 200 when 401 UI.error("Unauthorized") when 403 UI.("No order file found, this is expected for the first build of an app_id/version.") # The API will return a 403 when no order file is found, but we change that to a 200 for the # fastlane plugin because this is an expected state for a CI integraion. return 200 else UI.error("Failed to download order file code: #{resp.status}") end resp.status end |