class Travis::CLI::Encrypt
def run(*args)
def run(*args) confirm = force_interactive.nil? || force_interactive error "cannot combine --override and --append" if append? and override? error "--append without --add makes no sense" if append? and not add? error "--override without --add makes no sense" if override? and not add? self.override |= !config_key.start_with?('env.') if add? and not append? if args.first =~ %r{\w+/\w+} && !args.first.include?("=") warn "WARNING: The name of the repository is now passed to the command with the -r option:" warn " #{command("encrypt [...] -r #{args.first}")}" warn " If you tried to pass the name of the repository as the first argument, you" warn " probably won't get the results you wanted.\n" end data = args.join(" ") if data.empty? say color("Reading from stdin, press Ctrl+D when done", :info) if $stdin.tty? data = $stdin.read end data = split? ? data.split("\n") : [data.strip] warn_env_assignments(data) encrypted = data.map { |data| repository.encrypt(data) } if config_key set_config encrypted.map { |e| { 'secure' => e } } confirm_and_save_travis_config confirm else list = encrypted.map { |data| format(data.inspect, " secure: %s") } say(list.join("\n"), template(__FILE__), :none) end rescue OpenSSL::PKey::RSAError => error error "#{error.message.sub(" for key size", "")} - consider using " << color("travis encrypt-file", [:red, :bold]) << color(" or ", :red) << color("travis env set", [:red, :bold]) end