Sha256: f106d5da9a2c8eeacd1831b6e6dd2abe1ffdd271d12570d2f733d24a308d832a

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

require 'json'
require 'awesome_print'
require 'io/console'

module Calabash
  module CLI
    # @!visibility private
    module SetupKeystore
      # @!visibility private
      def parse_setup_keystore_arguments!
        set_platform!(:android)

        settings = {}

        puts "Please enter keystore information to use a custom keystore instead of the default"

        settings[:keystore_location] = File.expand_path(prompt('Please enter a path to the keystore'))
        settings[:keystore_store_password] = prompt('Please enter the password for the keystore (storepass)', true)
        settings[:keystore_alias] = prompt('Please enter the alias. Leave blank for auto-detection.')
        settings[:keystore_key_password] = prompt('Please enter the password for the key (keypass). Leave blank if it is the same as the store password.', true)

        File.open(Android::Build::JavaKeystore::CALABASH_KEYSTORE_SETTINGS_FILENAME, 'w') do |file|
          file.puts(JSON.pretty_generate(settings))
        end

        puts "Saved your settings to '#{Android::Build::JavaKeystore::CALABASH_KEYSTORE_SETTINGS_FILENAME}'. You can edit the settings manually or run this setup script again"
      end

      # @!visibility private
      def prompt(message, secure = false)
        puts message

        if secure
          STDIN.noecho(&:gets).chomp
        else
          STDIN.gets.chomp
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
calabash-2.0.0.pre11 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.pre10 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.pre9 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.prelegacy4 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.prelegacy3 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.prelegacy2 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.prelegacy lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.pre6 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.pre5 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.pre4 lib/calabash/cli/setup_keystore.rb
calabash-2.0.0.pre3 lib/calabash/cli/setup_keystore.rb