lib/travis/cli/encrypt_file.rb in travis-1.8.12.travis.1125.9 vs lib/travis/cli/encrypt_file.rb in travis-1.8.12.travis.1135.9
- old
+ new
@@ -21,10 +21,12 @@
on '-a', '--add [STAGE]', 'automatically add command to .travis.yml (default stage is before_install)' do |c, stage|
c.stage = stage || 'before_install'
end
def run(input_path, output_path = nil)
+ confirm = force_interactive.nil? || force_interactive
+
self.decrypt_to ||= decrypt_to_for(input_path)
output_path ||= File.basename(output_path_for(input_path))
self.output = $stdout.tty? ? StringIO.new : $stderr if output_path == '-'
result = transcode(input_path)
@@ -38,11 +40,11 @@
error "requires --decrypt-to option when reading from stdin" unless decrypt_to?
set_env_vars(input_path)
command = decrypt_command(output_path)
- stage ? store_command(command) : print_command(command)
+ stage ? store_command(command, confirm) : print_command(command)
notes(input_path, output_path)
end
end
@@ -57,14 +59,14 @@
def print_command(command)
empty_line
say command, template(__FILE__)
end
- def store_command(command)
+ def store_command(command, confirm)
travis_config[stage] = Array(travis_config[stage])
travis_config[stage].delete(command)
travis_config[stage].unshift(command)
- save_travis_config
+ confirm_and_save_travis_config confirm
end
def decrypt_command(path)
"openssl aes-256-cbc -K $#{env_name(path, :key)} -iv $#{env_name(path, :iv)} -in #{escape_path(path)} -out #{escape_path(decrypt_to)} -d"
end