sandric
sandric

Reputation: 2470

How to require local vagrant plugin (vagrant 1.5.0.dev)

How can I require plugin that im currently developing without publishing it to the rubygems? Before I could require with Vagrant.require_plugin, but now Its printing me out that its deprecated.

here's my gemfile

source 'https://rubygems.org'

gem 'bundler'

gem "vagrant", github: "mitchellh/vagrant"

group :plugin do
  gem 'vagrant-sheogorath', :path => '/Users/sandric/vagrant-sheogorath/'
end

here's my Vagrantfile:

require "vagrant-sheogorath"

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end

when I'm running bundle exec vagrant plugin list here's the output:

sandric@sandric-mac ~/v/provision> bundle exec vagrant plugin list
Vagrant appears to be running in a Bundler environment. Your
existing Gemfile will be used. Vagrant will not auto-load any plugins.
You must load any plugins you want manually in a Vagrantfile. You can
force Vagrant to take over with VAGRANT_FORCE_BUNDLER.

You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

No plugins installed.

and when I try to install it:

sandric@sandric-mac ~/v/provision> bundle exec vagrant plugin install vagrant-sheogorath
Vagrant appears to be running in a Bundler environment. Your
existing Gemfile will be used. Vagrant will not auto-load any plugins.
You must load any plugins you want manually in a Vagrantfile. You can
force Vagrant to take over with VAGRANT_FORCE_BUNDLER.

You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

Installing the 'vagrant-sheogorath' plugin. This can take a few minutes...
ERROR warden: Error occurred: Vagrant's built-in bundler management mechanism is disabled because
Vagrant is running in an external bundler environment. In these
cases, plugin management does not work with Vagrant. To install
plugins, use your own Gemfile. To load plugins, either put the
plugins in the `plugins` group in your Gemfile or manually require
them in a Vagrantfile.

Upvotes: 1

Views: 2219

Answers (1)

Emyl
Emyl

Reputation: 10536

It seems that you don't need to install plugins while developing. You just need to include it in the :plugin group of your Gemfile, and Vagrant should load it for you at runtime.

By the way, on the repository master branch an updated version of the plugin development doc page already exists.

Upvotes: 1

Related Questions