Class: Fastlane::Actions::FivAndroidKeystoreAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FivAndroidKeystoreAction
- Defined in:
- lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
116 117 118 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 116 def self. ["fivethree"] end |
.available_options ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 82 def self. [ FastlaneCore::ConfigItem.new( key: :keystore_path, env_name: "FIV_KEYSTORE_PATH", description: "Path to android keystore", is_string: true, default_value: "./fastlane/android"), FastlaneCore::ConfigItem.new( key: :keystore_name, env_name: "FIV_KEYSTORE_NAME", description: "Name of the keystore", is_string: true, optional: false), FastlaneCore::ConfigItem.new( key: :key_alias, env_name: "FIV_ANDROID_KEYSTORE_ALIAS", description: "Key alias of the keystore", is_string: true, optional: false) ] end |
.description ⇒ Object
74 75 76 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 74 def self.description "Generate an Android keystore file or validate keystore exists" end |
.details ⇒ Object
78 79 80 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 78 def self.details "Generate an Android keystore file or validate keystore exists" end |
.is_supported?(platform) ⇒ Boolean
120 121 122 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 120 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
105 106 107 108 109 110 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 105 def self.output [ ['ANDROID_KEYSTORE_KEYSTORE_PATH', 'Path to keystore'], ['ANDROID_KEYSTORE_RELEASE_SIGNING_PATH', 'Path to release-signing.properties'] ] end |
.return_value ⇒ Object
112 113 114 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 112 def self.return_value "Path to keystore" 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 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 64 65 66 67 68 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_android_keystore.rb', line 4 def self.run(params) keystore_path = params[:keystore_path] keystore_name = params[:keystore_name] keystore_file = File.join(keystore_path, keystore_name) + '.keystore' # Validating output doesn't exist yet for our android signing info if File.directory?(keystore_path) if File.exists?(keystore_file) return keystore_file end else UI. "android keystore doesnt exist yet. creating one for you..." Dir.mkdir keystore_path end puts "Please enter the keystore password for new keystore with atleast 6 characters:" keychain_entry = CredentialsManager::AccountManager.new(user: "#{keystore_name}_android_keystore_storepass") password = keychain_entry.password puts "Please enter the keystore password for new keystore atleast 6 characters:" keypass_entry = CredentialsManager::AccountManager.new(user: "#{keystore_name}_android_keystore_keypass") key_password = keypass_entry.password alias_name = params[:key_alias] puts "Keystore alias #{alias_name}" full_name = Fastlane::Actions::PromptAction.run(text:"Enter kexystore full name") org = Fastlane::Actions::PromptAction.run(text:"Enter kexystore org") org_unit = Fastlane::Actions::PromptAction.run(text:"Enter kexystore org unit") city_locality = Fastlane::Actions::PromptAction.run(text:"Enter city") state_province = Fastlane::Actions::PromptAction.run(text:"Enter state") country = Fastlane::Actions::PromptAction.run(text:"country") # Create keystore with command unless File.file?(keystore_file) keytool = "keytool -genkey -v \ -keystore #{keystore_file} \ -alias #{alias_name} \ -keyalg RSA -keysize 2048 -validity 10000 \ -storepass #{password} \ -keypass #{key_password} \ -dname \"CN=#{full_name}, OU=#{org_unit}, O=#{org}, L=#{city_locality}, S=#{state_province}, C=#{country}\" " sh keytool else UI. "Keystore file already exists - #{keystore_file}" end # Create release-signing.properties for automatic signing with Ionic release_signing_path = File.join(keystore_path, "release-signing.properties") unless File.file?(release_signing_path) out_file = File.new(release_signing_path, "w") out_file.puts("storeFile=#{keystore_name}") out_file.puts("storePassword=#{password}") out_file.puts("keyAlias=#{alias_name}") out_file.puts("keyPassword=#{key_password}") out_file.close else UI. "release-signing.properties file already exists - #{release_signing_path}" end return keystore_file end |