mitchellh/vagrant — pull request #2947 by mitchellh (2014-02-07 17:20:58+00:00)
Title: Core refactor: "Vagrantfile" abstraction

This introduces a change into the core that doesn't affect any usage/configuration currently (and is therefore backwards compatible).

This change introduces the `Vagrant::Vagrantfile` class, and removes some responsibilities from the `Vagrant::Environment` class and places them in the Vagrantfile class. Previously, the Environment was fully responsible for environmental state (directories, config loading, action runner, etc.) as well as loading the Vagrantfile and getting `Vagrant::Machine`s out of it (`#machine`, `#machine_names`, etc.).

Now, `Vagrant::Vagrantfile` is responsible for loading Vagrantfiles and getting machines out of them.

The `Vagrant::Environment`'s responsibilities now are just to store environmental data such as where Vagrant should put certain data, run an action, etc. The API of `Vagrant::Environment` still has the machine methods, which just load a default Vagrantfile in the current working directory. This is the same behavior as before.

This abstraction makes it possible to actually load and launch machines from outside the typical Vagrantfile. This functionality is being used in some private plugins that HashiCorp is currently developing, but will also be used in some future features for Vagrant proper.