Commit Graph

4799 Commits

Author SHA1 Message Date
Mitchell Hashimoto e24f6e50b5 core: depend on Vagrant by path, rather than by version 2014-01-07 14:04:13 -08:00
Mitchell Hashimoto 7a78e2bca7 Update changelog 2014-01-07 13:59:51 -08:00
Mitchell Hashimoto 3f4058471c core: installing a plugin from a gem doesn't constrain it 2014-01-07 13:56:51 -08:00
Mitchell Hashimoto ba85627c21 Merge pull request #2769 from mitchellh/f-bundlerize
Plugin dependency management revamp

This is a huge revamp of how plugin dependency management is done. To understand the changes here, a brief history lesson is in order:

Since Vagrant 1.1, plugins have been loaded as RubyGems. Once Vagrant was loaded, it would iterate through a list of installed plugins, and `require` that plugin. This mostly worked okay. But the devil is in the details, and the edge cases were _really_ bad. In addition to the edge cases (mentioned below), building things like updaters, version constraints (">= 1.0", "< 1.1"), etc. all had to be done manually. This seemed silly, since RubyGems itself (and Bundler) do these sort of things for you. Why reinvent the wheel?

As for edge cases: the primary edge case is that since the dependencies of Vagrant and its respective plugins weren't resolved as a whole, you can run into cases where plugin installation succeeded, but plugin loading failed because Vagrant already loaded a common dependency with the wrong version. An example explains this best:

* Vagrant depends on "A >= 1.0, < 1.2"
* vagrant-plugin depends on "A = 1.1"
* When you run Vagrant, it loads the latest possible matching dependencies, so it would load A 1.2
* When Vagrant loads vagrant-plugin, it can't load, because A 1.2 is active, so A 1.1 can't be loaded.

The error above should never happen: the versions available for A should satisfy both Vagrant and vagrant-plugin (by loading v1.1 for both). 

With this new branch, all plugin installation, dependency resolution, updating, etc. is managed by [Bundler](http://gembundler.com). This has yielded numerous benefits:

* Vagrant now resolves dependencies before Vagrant is even loaded. This ensures that all plugins will be able to load. No more conflicts at run-time.

* Conflicts are detected at `vagrant plugin install` time. This means that if there would be a crash if that plugin were to load, the plugin won't even install and a human-friendly error is shown to the end user.

* `vagrant plugin install` now accepts complex version constraints such as "~> 1.0.0" or ">= 1.0, < 1.1". Vagrant stores these constraints for updating, which leads to the next point.

* `vagrant plugin update` without arguments now updates all installed plugins, respecting the constraints specified by `vagrant plugin install`.

* `vagrant plugin update NAME` will only update that gem (still respecting constraints). 

* Internally, there are a lot more unit tests. /cc @phinze :)

The goal of this branch was to replace the _existing_ system and functionality with Bundler-ized management. It did not introduce any new features except where they naturally fell into place (version constraints). However, with this new system, many new possibilities are also available:

* Vagrant environment local plugins (i.e. a Gemfile but for a specific Vagrant environment). 

* Plugin installation from git

I'm sure those will be pursued at some point in the future.

This fixes: #2612, #2406, #2428
2014-01-07 10:53:41 -08:00
Mitchell Hashimoto 4f623f6422 Remove temporary line 2014-01-07 10:52:07 -08:00
Mitchell Hashimoto 79602ab37b update vagrant-spec config 2014-01-07 10:51:01 -08:00
Mitchell Hashimoto 582e1096e4 Allow forcing plugins with VAGRANT_FORCE_PLUGINS 2014-01-07 10:50:10 -08:00
Mitchell Hashimoto b353865da1 core: specific versions "0.1.0" don't equate to "= 0.1.0" 2014-01-07 10:13:30 -08:00
Mitchell Hashimoto 198e142794 commands/plugin: add more tests for installgem 2014-01-06 10:55:34 -08:00
Mitchell Hashimoto 3cefcda1e3 core: when installig local plugins, don't fetch remote 2014-01-06 10:52:14 -08:00
Mitchell Hashimoto 5197d3d86f core: generate bogus gemfile so that a random lockfile isn't loaded 2014-01-06 10:43:20 -08:00
Mitchell Hashimoto 86cab61c27 commands/plugin: support installing from file 2014-01-06 09:27:37 -08:00
Mitchell Hashimoto 3f9fb2ef03 core: reset the specification lookup when isolating gems 2014-01-06 09:27:26 -08:00
Joe Stump 83f68630d6 Update README to note running Vagrant in a bundle disables plugins by default. 2014-01-06 09:29:16 -07:00
Thomas Grainger feb748f488 Allow defining of <install-type> and <install-type-args> 2014-01-06 12:22:43 +00:00
Mitchell Hashimoto 677275e43c core: whoops, don't print Gemfile 2014-01-05 23:14:43 -08:00
Mitchell Hashimoto f612ec7549 core: support plugin sources, and mask Bundler errors 2014-01-05 23:13:49 -08:00
Mitchell Hashimoto 84ecca5c15 core: statefile can track sources, not sure if we'll use it though 2014-01-05 22:50:55 -08:00
Mitchell Hashimoto 35d711c91b commands/plugin: add tests for UpdateGems 2014-01-05 22:37:29 -08:00
Mitchell Hashimoto 0117521744 commands/plugin: vagrant update is fancier now (see website docs) 2014-01-05 22:33:05 -08:00
Mitchell Hashimoto 576075f1ac core: remove "update" => true because its not needed 2014-01-05 21:37:39 -08:00
Mitchell Hashimoto f778d706f7 core: set the Bundler UI in initialization 2014-01-05 21:37:24 -08:00
Mitchell Hashimoto ad0651a29b website/docs: update docs on `vagrant plugin` 2014-01-05 21:28:16 -08:00
Mitchell Hashimoto 561e65ec72 commands/plugin: list shows version constraints and entrypoints 2014-01-05 21:16:41 -08:00
Mitchell Hashimoto e231890e7e commands/plugin: UninstallPlugin tests 2014-01-05 21:10:43 -08:00
Mitchell Hashimoto bef7051943 commands/plugin: InstallGem tests 2014-01-05 21:08:55 -08:00
Mitchell Hashimoto aeb0d1a480 commands/plugin: fix plugin existence middleware, add tests 2014-01-05 20:57:55 -08:00
Mitchell Hashimoto 5fe2994005 commands/plugin: convert all actions to use the new classes 2014-01-05 20:50:25 -08:00
Mitchell Hashimoto 8904319beb commands/plugin: install version and entrypoints work 2014-01-05 20:47:02 -08:00
Mitchell Hashimoto 9dc1307b7c commands/plugin: remove --plugin-prerelease 2014-01-05 17:46:20 -08:00
Mitchell Hashimoto 0c73a5ee05 remove clean on install... doesn't work right now 2014-01-05 17:40:38 -08:00
Mitchell Hashimoto a571222431 core: tolerate errors in gemrc 2014-01-05 17:12:01 -08:00
Mitchell Hashimoto d368b3cf62 core: Tolerate syntax errors in ~/.gemrc [GH-2760] 2014-01-05 17:11:24 -08:00
Mitchell Hashimoto 2fd144611e Cleaning gems properly only removes them from the local dir 2014-01-05 17:04:50 -08:00
Mitchell Hashimoto eabc0f04fa friendly errors if a non-existent gem install is tried 2014-01-05 16:57:51 -08:00
Mitchell Hashimoto fe8842c795 Fix failing tests 2014-01-05 16:54:10 -08:00
Mitchell Hashimoto 36f64db874 Always setup plugins, but just don't always require them 2014-01-05 16:49:25 -08:00
Mitchell Hashimoto f7e4c4df6b setup the Bundler path always 2014-01-05 16:43:59 -08:00
Mitchell Hashimoto e69723b63c core: Plugin::Manager.installed_specs doesn't use Bundler 2014-01-05 16:31:49 -08:00
Mitchell Hashimoto f8b49afe8a Nice error message on plugin install conflict 2014-01-05 16:28:05 -08:00
Mitchell Hashimoto 8861510520 Lower some branching logic 2014-01-05 16:17:39 -08:00
Mitchell Hashimoto 73c71dbcc6 Work some things around so that Bundler is not setup with no plugins 2014-01-05 16:16:04 -08:00
Mitchell Hashimoto f51b6d0708 Lock to log4r < 1.1.11 because we got fucked
1.1.11 was released today and seriously broke backwards compatibility.
While they never officially made any promise to follow semver, it is
almost expected at this point, but log4r decided to just fuck that.

1.1.11 changed the arity of Log4r::Logger.initialize. That seriously
breaks _everything_.

Darwin awarddddddddd goes to...
2014-01-05 16:07:24 -08:00
Mitchell Hashimoto 76de267d1e Don't load plugins again on `vagrant plugin` commands 2014-01-05 16:04:53 -08:00
Mitchell Hashimoto 8823f43f3a commands/plugin: error if uninstall non-existent plugin 2014-01-05 16:03:00 -08:00
Mitchell Hashimoto e1c9431085 commands/plugin: uninstall works again 2014-01-05 16:02:00 -08:00
Mitchell Hashimoto 8cfa24143d Put plugins in their own Gemfile group so we can load on their own 2014-01-05 15:57:10 -08:00
Mitchell Hashimoto e800743d06 fast-path vagrant --version 2014-01-05 15:32:19 -08:00
Mitchell Hashimoto 177bfc1d0c Lock to log4r < 1.1.11 because we got fucked
1.1.11 was released today and seriously broke backwards compatibility.
While they never officially made any promise to follow semver, it is
almost expected at this point, but log4r decided to just fuck that.

1.1.11 changed the arity of Log4r::Logger.initialize. That seriously
breaks _everything_.

Darwin awarddddddddd goes to...
2014-01-05 15:27:20 -08:00
Mitchell Hashimoto 817f7f326e fast path Vagrant --version 2014-01-05 15:27:03 -08:00