This repo is a template for building a Ruby Vagrant host plugin. Follow the steps to setup your own host plugin!
- Copy this repo. Its a template so follow the Github instructions to create a repo from a template using the UI, or use the github cli.
$ gh repo create vagrant-host-myspecialhost --template hashicorp/vagrant-host-plugin-ruby-template --public
-
Update the gemspec. Choose a good, descriptive name for your project. Rename
my-vagrant-host-plugin-ruby-template.gemspecto reflect this, and fill out the required information. -
Rename all the references of
my-vagrant-host-plugin-ruby-template.gemspecto your new name.
-
Rename
vagrant-host.rbto match the name of your plugin and update the contents of the file. This includes updating the module nameMyVagrantHostPlugin, the name and description fields and thehost(:myhostplugin) doline. -
Rename all the references of
MyVagrantHostPluginto your new name. -
Update the host detection method in
lib/host/host.rb. This method will be run by Vagrant to determine if the host is running the OS assumed by the plugin.
- Add any new capabilities the plugin needs to the
host/capmodule. Be sure to register the capabilities.
- Commit all your changes if you haven't already.
$ git add -A
$ git commit -m "My Vagrant host plugin"
- Build your plugin
$ gem build my-vagrant-host-plugin-ruby-template.gemspec
Successfully built RubyGem
Name: my-vagrant-host-plugin
Version: 0.0.1
File: my-vagrant-host-plugin-0.0.1.gem
- (optional) Push your gem to RubyGems
$ gem push my-vagrant-host-plugin-0.0.1.gem
- Install your plugin
# Install from the locally built gem
$ vagrant plugin install my-vagrant-host-plugin-0.0.1.gem
# If you pushed the gem to RubyGems, install from RubyGems
$ vagrant plugin install my-vagrant-host-plugin