Class: Fastlane::Actions::AppsignerAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AppsignerAction
- Defined in:
- lib/fastlane/plugin/appsigner/actions/appsigner_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/appsigner/actions/appsigner_action.rb', line 33 def self. ["Valeriy Makarshin"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/appsigner/actions/appsigner_action.rb', line 41 def self. [ FastlaneCore::ConfigItem.new(key: :domain, env_name: "APPSIGNER_DOMAIN", description: "The domain of your AppSigner service", optional: false, type: String, verify_block: proc do |value| UI.user_error!("No domain") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :secret_key, env_name: "APPSIGNER_SECRET_KEY", description: "Secret key from AppSigner", optional: false, type: String, verify_block: proc do |value| UI.user_error!("No secret_key") if value.to_s.length == 0 end), FastlaneCore::ConfigItem.new(key: :apk_path, env_name: "APPSIGNER_APK_PATH", description: "The path to your apk for sign", optional: false, type: String, verify_block: proc do |value| UI.user_error!("No apk_path") if value.to_s.length == 0 end) ] end |
.description ⇒ Object
29 30 31 |
# File 'lib/fastlane/plugin/appsigner/actions/appsigner_action.rb', line 29 def self.description "AppSigner" end |
.details ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/appsigner/actions/appsigner_action.rb', line 37 def self.details "AppSigner" end |
.is_supported?(platform) ⇒ Boolean
70 71 72 |
# File 'lib/fastlane/plugin/appsigner/actions/appsigner_action.rb', line 70 def self.is_supported?(platform) :android == platform 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 26 27 |
# File 'lib/fastlane/plugin/appsigner/actions/appsigner_action.rb', line 4 def self.run(params) require 'net/http' require 'uri' uri = URI.parse('%s/api/v1/app/sign/' % params[:domain]) header = { 'X-SIGNER-SECRET': params[:secret_key], 'Content-Disposition': 'inline; filename="%s"' % File.basename(params[:apk_path]), 'Content-Type': 'application/octet-stream' } request = Net::HTTP::Post.new(uri.request_uri, header) request.body = File.read(params[:apk_path]) response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end unless response.kind_of? Net::HTTPSuccess print("response.body = %s\n" % response.body) raise response.error! end open(params[:apk_path], "wb") do |file| file.write(response.body) end end |