Class: Fastlane::Actions::InstallrAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::InstallrAction
- Defined in:
- lib/fastlane/actions/installr.rb
Constant Summary collapse
- INSTALLR_API =
"https://www.installrapp.com/apps.json"
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(params) ⇒ Object
- .upload_build(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, details, lane_context, method_missing, other_action, return_value, sample_return_value, sh, step_text
Class Method Details
.authors ⇒ Object
105 106 107 |
# File 'lib/fastlane/actions/installr.rb', line 105 def self. ["scottrhoyt"] end |
.available_options ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/fastlane/actions/installr.rb', line 66 def self. [ FastlaneCore::ConfigItem.new(key: :api_token, env_name: "INSTALLR_API_TOKEN", description: "API Token for Installr Access", verify_block: proc do |value| UI.user_error!("No API token for Installr given, pass using `api_token: 'token'`") unless value and !value.empty? end), FastlaneCore::ConfigItem.new(key: :ipa, env_name: "INSTALLR_IPA_PATH", description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action", default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH], verify_block: proc do |value| UI.user_error!("Couldn't find build file at path '#{value}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :notes, env_name: "INSTALLR_NOTES", description: "Release notes", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :notify, env_name: "INSTALLR_NOTIFY", description: "Groups to notify (e.g. 'dev,qa')", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :add, env_name: "INSTALLR_ADD", description: "Groups to add (e.g. 'exec,ops')", is_string: true, optional: true) ] end |
.category ⇒ Object
125 126 127 |
# File 'lib/fastlane/actions/installr.rb', line 125 def self.category :beta end |
.description ⇒ Object
62 63 64 |
# File 'lib/fastlane/actions/installr.rb', line 62 def self.description "Upload a new build to Installr" end |
.example_code ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/fastlane/actions/installr.rb', line 113 def self.example_code [ 'installr( api_token: "...", ipa: "test.ipa", notes: "The next great version of the app!", notify: "dev,qa", add: "exec,ops" )' ] end |
.is_supported?(platform) ⇒ Boolean
109 110 111 |
# File 'lib/fastlane/actions/installr.rb', line 109 def self.is_supported?(platform) [:ios].include?(platform) end |
.output ⇒ Object
99 100 101 102 103 |
# File 'lib/fastlane/actions/installr.rb', line 99 def self.output [ ['INSTALLR_BUILD_INFORMATION', 'Contains release info like :appData. See http://help.installrapp.com/api/'] ] end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fastlane/actions/installr.rb', line 10 def self.run(params) UI.success('Upload to Installr has been started. This may take some time.') response = self.upload_build(params) case response.status when 200...300 Actions.lane_context[SharedValues::INSTALLR_BUILD_INFORMATION] = response.body UI.success('Build successfully uploaded to Installr!') else UI.user_error!("Error when trying to upload build file to Installr: #{response.body}") end end |
.upload_build(params) ⇒ Object
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 |
# File 'lib/fastlane/actions/installr.rb', line 24 def self.upload_build(params) require 'faraday' require 'faraday_middleware' url = INSTALLR_API connection = Faraday.new(url) do |builder| builder.request :multipart builder.request :url_encoded builder.response :json, content_type: /\bjson$/ builder.use FaradayMiddleware::FollowRedirects builder.adapter :net_http end = {} [:qqfile] = Faraday::UploadIO.new(params[:ipa], 'application/octet-stream') if params[:notes] [:releaseNotes] = params[:notes] end if params[:notify] [:notify] = params[:notify] end if params[:add] [:add] = params[:add] end post_request = connection.post do |req| req.headers['X-InstallrAppToken'] = params[:api_token] req.body = end post_request.on_complete do |env| yield env[:status], env[:body] if block_given? end end |