Class: Fastlane::Actions::AppetizeAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::AppetizeAction
- Defined in:
- lib/fastlane/actions/appetize.rb
Constant Summary collapse
- APPETIZE_URL_BASE =
'https://api.appetize.io/v1/app/update'
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(options) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, details, return_value, sh, step_text
Class Method Details
.author ⇒ Object
112 113 114 |
# File 'lib/fastlane/actions/appetize.rb', line 112 def self. "giginet" end |
.available_options ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/fastlane/actions/appetize.rb', line 81 def self. [FastlaneCore::ConfigItem.new(key: :api_token, env_name: "APPETIZE_API_TOKEN", description: "Appetize.io API Token", is_string: true, verify_block: proc do |value| raise "No API Token for Appetize.io given, pass using `api_token: 'token'`".red unless value.to_s.length > 0 end), FastlaneCore::ConfigItem.new(key: :url, env_name: "APPETIZE_URL", description: "Target url of the zipped build", is_string: true, verify_block: proc do |value| raise "No URL of your zipped build".red unless value.to_s.length > 0 end), FastlaneCore::ConfigItem.new(key: :private_key, env_name: "APPETIZE_PRIVATEKEY", description: "privateKey which specify each applications", optional: true) ] end |
.description ⇒ Object
77 78 79 |
# File 'lib/fastlane/actions/appetize.rb', line 77 def self.description "Create or Update apps on Appetize.io" end |
.is_supported?(platform) ⇒ Boolean
13 14 15 |
# File 'lib/fastlane/actions/appetize.rb', line 13 def self.is_supported?(platform) platform == :ios end |
.output ⇒ Object
103 104 105 106 107 108 109 110 |
# File 'lib/fastlane/actions/appetize.rb', line 103 def self.output [ ['APPETIZE_PRIVATE_KEY', 'a string that is used to prove "ownership" of your app - save this so that you may subsequently update the app'], ['APPETIZE_PUBLIC_KEY', 'a public identiifer for your app'], ['APPETIZE_APP_URL', 'a page to test and share your app'], ['APPETIZE_MANAGE_URL', 'a page to manage your app'] ] end |
.run(options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fastlane/actions/appetize.rb', line 17 def self.run() require 'net/http' require 'uri' require 'json' uri = URI.parse(APPETIZE_URL_BASE) https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true req = Net::HTTP::Post.new(uri.request_uri, initheader: {'Content-Type' => 'application/json'}) params = { token: [:api_token], url: [:url], platform: 'ios' } params.merge!(privateKey: [:private_key]) unless [:private_key].nil? req.body = JSON.generate(params) response = https.request(req) raise 'Error when trying to upload ipa to Appetize.io'.red unless parse_response(response) Helper.log.info "App URL: #{Actions.lane_context[SharedValues::APPETIZE_APP_URL]}" Helper.log.info "Manage URL: #{Actions.lane_context[SharedValues::APPETIZE_MANAGE_URL]}" Helper.log.info "App Private Key: #{Actions.lane_context[SharedValues::APPETIZE_PRIVATE_KEY]}" Helper.log.info "Build successfully uploaded to Appetize.io".green end |