Sha256: f13391828cb61489f3d1a398f8c175dd5ab1e86631f1a978f8f463d581252597

Contents?: true

Size: 957 Bytes

Versions: 7

Compression:

Stored size: 957 Bytes

Contents

module Vagrant
  class VM < Actions::Runner
    include Vagrant::Util

    attr_accessor :vm
    attr_accessor :from

    class << self
      # Finds a virtual machine by a given UUID and either returns
      # a Vagrant::VM object or returns nil.
      def find(uuid)
        vm = VirtualBox::VM.find(uuid)
        return nil if vm.nil?
        new(vm)
      end
    end

    def initialize(vm=nil)
      @vm = vm
    end

    def package(out_path, include_files=[])
      add_action(Actions::VM::Export)
      add_action(Actions::VM::Package, out_path, include_files)
      execute!
    end

    def start
      return if @vm.running?

      execute!(Actions::VM::Start)
    end

    def destroy
      execute!(Actions::VM::Down)
    end

    def suspend
      execute!(Actions::VM::Suspend)
    end

    def resume
      execute!(Actions::VM::Resume)
    end

    def saved?
      @vm.saved?
    end

    def powered_off?; @vm.powered_off? end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
vagrantup-0.1.4 lib/vagrant/vm.rb
vagrantup-0.1.3 lib/vagrant/vm.rb
vagrantup-0.1.2 lib/vagrant/vm.rb
vagrant-0.1.4 lib/vagrant/vm.rb
vagrant-0.1.4.pre.a lib/vagrant/vm.rb
vagrant-0.1.3 lib/vagrant/vm.rb
vagrant-0.1.2 lib/vagrant/vm.rb