Class: Fastlane::Actions::AppetizeAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::AppetizeAction
- Defined in:
- fastlane/lib/fastlane/actions/appetize.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(options) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
172 173 174 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 172 def self. ["klundberg", "giginet", "steprescott"] end |
.available_options ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 111 def self. [ FastlaneCore::ConfigItem.new(key: :api_host, env_name: "APPETIZE_API_HOST", description: "Appetize API host", default_value: 'api.appetize.io', verify_block: proc do |value| UI.user_error!("API host should not contain the scheme e.g. `https`") if value.start_with?('https') end), FastlaneCore::ConfigItem.new(key: :api_token, env_name: "APPETIZE_API_TOKEN", sensitive: true, description: "Appetize.io API Token", verify_block: proc do |value| UI.user_error!("No API Token for Appetize.io given, pass using `api_token: 'token'`") unless value.to_s.length > 0 end), FastlaneCore::ConfigItem.new(key: :url, env_name: "APPETIZE_URL", description: "URL from which the ipa file can be fetched. Alternative to :path", optional: true), FastlaneCore::ConfigItem.new(key: :platform, env_name: "APPETIZE_PLATFORM", description: "Platform. Either `ios` or `android`", default_value: 'ios'), FastlaneCore::ConfigItem.new(key: :path, env_name: "APPETIZE_FILE_PATH", description: "Path to zipped build on the local filesystem. Either this or `url` must be specified", optional: true), FastlaneCore::ConfigItem.new(key: :public_key, env_name: "APPETIZE_PUBLICKEY", description: "If not provided, a new app will be created. If provided, the existing build will be overwritten", optional: true, verify_block: proc do |value| if value.start_with?("private_") UI.user_error!("You provided a private key to appetize, please provide the public key") end end), FastlaneCore::ConfigItem.new(key: :note, env_name: "APPETIZE_NOTE", description: "Notes you wish to add to the uploaded app", optional: true), FastlaneCore::ConfigItem.new(key: :timeout, env_name: "APPETIZE_TIMEOUT", description: "The number of seconds to wait until automatically ending the session due to user inactivity. Must be 30, 60, 90, 120, 180, 300, 600, 1800, 3600 or 7200. Default is 120", type: Integer, optional: true, verify_block: proc do |value| UI.user_error!("The value provided doesn't match any of the supported options.") unless [30, 60, 90, 120, 180, 300, 600, 1800, 3600, 7200].include?(value) end) ] end |
.category ⇒ Object
176 177 178 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 176 def self.category :beta end |
.description ⇒ Object
99 100 101 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 99 def self.description "Upload your app to [Appetize.io](https://appetize.io/) to stream it in browser" end |
.details ⇒ Object
103 104 105 106 107 108 109 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 103 def self.details [ "If you provide a `public_key`, this will overwrite an existing application. If you want to have this build as a new app version, you shouldn't provide this value.", "", "To integrate appetize into your GitHub workflow check out the [device_grid guide](https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/device_grid/README.md)." ].join("\n") end |
.example_code ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 180 def self.example_code [ 'appetize( path: "./MyApp.zip", api_token: "yourapitoken", # get it from https://appetize.io/docs#request-api-token public_key: "your_public_key" # get it from https://appetize.io/dashboard )', 'appetize( path: "./MyApp.zip", api_host: "company.appetize.io", # only needed for enterprise hosted solution api_token: "yourapitoken", # get it from https://appetize.io/docs#request-api-token public_key: "your_public_key" # get it from https://appetize.io/dashboard )' ] end |
.is_supported?(platform) ⇒ Boolean
11 12 13 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 11 def self.is_supported?(platform) [:ios, :android].include?(platform) end |
.output ⇒ Object
163 164 165 166 167 168 169 170 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 163 def self.output [ ['APPETIZE_API_HOST', 'Appetize API host.'], ['APPETIZE_PUBLIC_KEY', 'a public identifier for your app. Use this to update your app after it has been initially created.'], ['APPETIZE_APP_URL', 'a page to test and share your app.'], ['APPETIZE_MANAGE_URL', 'a page to manage your app.'] ] end |
.run(options) ⇒ Object
15 16 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'fastlane/lib/fastlane/actions/appetize.rb', line 15 def self.run() require 'net/http' require 'net/http/post/multipart' require 'uri' require 'json' params = { platform: [:platform] } if [:path] params[:file] = UploadIO.new([:path], 'application/zip') else UI.user_error!('url parameter is required if no file path is specified') if [:url].nil? params[:url] = [:url] end params[:note] = [:note] if [:note].to_s.length > 0 if [:timeout] params[:timeout] = [:timeout] end uri = URI.parse(appetize_url()) req = create_request(uri, params) req.basic_auth([:api_token], nil) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if params[:platform] == 'ios' UI.("Uploading ipa to appetize... this might take a while") else UI.("Uploading apk to appetize... this might take a while") end response = http.request(req) unless response.code.to_i.between?(200, 299) UI.user_error!("Error uploading to Appetize.io: received HTTP #{response.code} with body #{response.body}") end parse_response(response) # this will raise an exception if something goes wrong UI.("App URL: #{Actions.lane_context[SharedValues::APPETIZE_APP_URL]}") UI.("Manage URL: #{Actions.lane_context[SharedValues::APPETIZE_MANAGE_URL]}") UI.("Public Key: #{Actions.lane_context[SharedValues::APPETIZE_PUBLIC_KEY]}") UI.success("Build successfully uploaded to Appetize.io") end |