Sha256: 4cac1ce824015041dbe19e5c53bd00b1341e59d2eae62c978f2508cfc28bc7f8

Contents?: true

Size: 960 Bytes

Versions: 43

Compression:

Stored size: 960 Bytes

Contents

module Vagrant
  module Command
    module Helpers
      # Initializes the environment by pulling the environment out of
      # the configuration hash and sets up the UI if necessary.
      def initialize_environment(args, options, config)
        raise Errors::CLIMissingEnvironment if !config[:env]
        @env = config[:env]
      end

      # This returns an array of {VM} objects depending on the arguments
      # given to the command.
      def target_vms(name=nil)
        raise Errors::NoEnvironmentError if !env.root_path

        name ||= self.name rescue nil

        @target_vms ||= begin
          if env.multivm?
            return env.vms_ordered if !name
            vm = env.vms[name.to_sym]
            raise Errors::VMNotFoundError, :name => name if !vm
          else
            raise Errors::MultiVMEnvironmentRequired if name
            vm = env.vms.values.first
          end

          [vm]
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 5 rubygems

Version Path
vagrantup-0.8.9 lib/vagrant/command/helpers.rb
vagrantup-0.8.8 lib/vagrant/command/helpers.rb
vagrantup-0.8.7 lib/vagrant/command/helpers.rb
vagrantup-0.8.6 lib/vagrant/command/helpers.rb
vagrantup-0.8.5 lib/vagrant/command/helpers.rb
vagrantup-0.8.4 lib/vagrant/command/helpers.rb
vagrantup-0.8.3 lib/vagrant/command/helpers.rb
vagrantup-0.8.2 lib/vagrant/command/helpers.rb
vagrantup-0.8.10 lib/vagrant/command/helpers.rb
vagrantup-0.8.1 lib/vagrant/command/helpers.rb
vagrantup-0.8.0 lib/vagrant/command/helpers.rb
vagrantup-0.7.8 lib/vagrant/command/helpers.rb
vagrantup-0.7.7 lib/vagrant/command/helpers.rb
vagrantup-0.7.6 lib/vagrant/command/helpers.rb
vagrantup-0.7.5 lib/vagrant/command/helpers.rb
vagrantup-0.7.4 lib/vagrant/command/helpers.rb
vagrantup-0.7.3 lib/vagrant/command/helpers.rb
vagrantup-0.7.2 lib/vagrant/command/helpers.rb
vagrantup-0.7.1 lib/vagrant/command/helpers.rb
vagrantup-0.7.0 lib/vagrant/command/helpers.rb