Class: Vagrant::Command::UpgradeTo060Command
- Defined in:
- lib/vagrant/command/upgrade_to_060.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods included from Helpers
#initialize_environment, #target_vms
Constructor Details
This class inherits a constructor from Vagrant::Command::Base
Instance Method Details
#execute ⇒ Object
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 |
# File 'lib/vagrant/command/upgrade_to_060.rb', line 8 def execute @env.ui.warn I18n.t("vagrant.commands.upgrade_to_060.info"), :prefix => false @env.ui.warn "", :prefix => false if !@env.ui.yes? I18n.t("vagrant.commands.upgrade_to_060.ask"), :prefix => false, :color => :yellow @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.quit"), :prefix => false return end local_data = @env.local_data if !local_data.empty? if local_data[:active] @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.already_done"), :prefix => false return end # Backup the previous file @env.ui.info I18n.t("vagrant.commands.upgrade_to_060.backing_up"), :prefix => false FileUtils.cp(local_data.file_path, "#{local_data.file_path}.bak-#{Time.now.to_i}") # Gather the previously set virtual machines into a single # active hash active = local_data.inject({}) do |acc, data| key, uuid = data acc[key.to_sym] = uuid acc end # Set the active hash to the active list and save it local_data.clear local_data[:active] = active local_data.commit end @env.ui.confirm I18n.t("vagrant.commands.upgrade_to_060.complete"), :prefix => false end |