Convert comands to V2 plugins.
This commit is contained in:
parent
be294e002a
commit
e8370f0098
|
@ -92,6 +92,15 @@ module Vagrant
|
||||||
c.register([:"1", :host]) { Plugin::V1::Host }
|
c.register([:"1", :host]) { Plugin::V1::Host }
|
||||||
c.register([:"1", :provider]) { Plugin::V1::Provider }
|
c.register([:"1", :provider]) { Plugin::V1::Provider }
|
||||||
c.register([:"1", :provisioner]) { Plugin::V1::Provisioner }
|
c.register([:"1", :provisioner]) { Plugin::V1::Provisioner }
|
||||||
|
|
||||||
|
c.register(:"2") { Plugin::V2::Plugin }
|
||||||
|
c.register([:"2", :command]) { Plugin::V2::Command }
|
||||||
|
c.register([:"2", :communicator]) { Plugin::V2::Communicator }
|
||||||
|
c.register([:"2", :config]) { Plugin::V2::Config }
|
||||||
|
c.register([:"2", :guest]) { Plugin::V2::Guest }
|
||||||
|
c.register([:"2", :host]) { Plugin::V2::Host }
|
||||||
|
c.register([:"2", :provider]) { Plugin::V2::Provider }
|
||||||
|
c.register([:"2", :provisioner]) { Plugin::V2::Provisioner }
|
||||||
end
|
end
|
||||||
|
|
||||||
# The source root is the path to the root directory of
|
# The source root is the path to the root directory of
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'optparse'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
# Manages the command line interface to Vagrant.
|
# Manages the command line interface to Vagrant.
|
||||||
class CLI < Vagrant.plugin("1", :command)
|
class CLI < Vagrant.plugin("2", :command)
|
||||||
def initialize(argv, env)
|
def initialize(argv, env)
|
||||||
super
|
super
|
||||||
|
|
||||||
|
@ -33,12 +33,7 @@ module Vagrant
|
||||||
# then we also just print the help and exit.
|
# then we also just print the help and exit.
|
||||||
command_class = nil
|
command_class = nil
|
||||||
if @sub_command
|
if @sub_command
|
||||||
Vagrant.plugin("1").registered.each do |plugin|
|
command_class = Vagrant.plugin("2").manager.commands[@sub_command.to_sym]
|
||||||
if plugin.command.has_key?(@sub_command.to_sym)
|
|
||||||
command_class = plugin.command.get(@sub_command.to_sym)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if !command_class || !@sub_command
|
if !command_class || !@sub_command
|
||||||
|
@ -69,11 +64,9 @@ module Vagrant
|
||||||
# Add the available subcommands as separators in order to print them
|
# Add the available subcommands as separators in order to print them
|
||||||
# out as well.
|
# out as well.
|
||||||
keys = []
|
keys = []
|
||||||
Vagrant.plugin("1").registered.each do |plugin|
|
Vagrant.plugin("2").manager.commands.each do |key, _|
|
||||||
plugin.command.each do |key, _|
|
|
||||||
keys << key
|
keys << key
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
keys.sort.each do |key|
|
keys.sort.each do |key|
|
||||||
opts.separator " #{key}"
|
opts.separator " #{key}"
|
||||||
|
|
|
@ -14,6 +14,19 @@ module Vagrant
|
||||||
@registered = []
|
@registered = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This returns all the registered commands.
|
||||||
|
#
|
||||||
|
# @return [Hash]
|
||||||
|
def commands
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
@registered.each do |plugin|
|
||||||
|
result.merge!(plugin.command.to_hash)
|
||||||
|
end
|
||||||
|
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
# This returns all the registered communicators.
|
# This returns all the registered communicators.
|
||||||
#
|
#
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'optparse'
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandBox
|
module CommandBox
|
||||||
module Command
|
module Command
|
||||||
class Add < Vagrant.plugin("1", :command)
|
class Add < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'optparse'
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandBox
|
module CommandBox
|
||||||
module Command
|
module Command
|
||||||
class List < Vagrant.plugin("1", :command)
|
class List < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'optparse'
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandBox
|
module CommandBox
|
||||||
module Command
|
module Command
|
||||||
class Remove < Vagrant.plugin("1", :command)
|
class Remove < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'optparse'
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandBox
|
module CommandBox
|
||||||
module Command
|
module Command
|
||||||
class Repackage < Vagrant.plugin("1", :command)
|
class Repackage < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'optparse'
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandBox
|
module CommandBox
|
||||||
module Command
|
module Command
|
||||||
class Root < Vagrant.plugin("1", :command)
|
class Root < Vagrant.plugin("2", :command)
|
||||||
def initialize(argv, env)
|
def initialize(argv, env)
|
||||||
super
|
super
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandBox
|
module CommandBox
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "box command"
|
name "box command"
|
||||||
description "The `box` command gives you a way to manage boxes."
|
description "The `box` command gives you a way to manage boxes."
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandDestroy
|
module CommandDestroy
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandDestroy
|
module CommandDestroy
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "destroy command"
|
name "destroy command"
|
||||||
description "The `destroy` command destroys your virtual machines."
|
description "The `destroy` command destroys your virtual machines."
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ require "vagrant/util/safe_puts"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandGem
|
module CommandGem
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
include Vagrant::Util::SafePuts
|
include Vagrant::Util::SafePuts
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandGem
|
module CommandGem
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "gem command"
|
name "gem command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
Provides an interface to RubyGems that can be used to install
|
Provides an interface to RubyGems that can be used to install
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandHalt
|
module CommandHalt
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandHalt
|
module CommandHalt
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "halt command"
|
name "halt command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `halt` command halts your virtual machine.
|
The `halt` command halts your virtual machine.
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'vagrant/util/template_renderer'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandInit
|
module CommandInit
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandInit
|
module CommandInit
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "init command"
|
name "init command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `init` command sets up your working directory to be a
|
The `init` command sets up your working directory to be a
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandPackage
|
module CommandPackage
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ module VagrantPlugins
|
||||||
# better in the future. We just hardcode this to keep VirtualBox working
|
# better in the future. We just hardcode this to keep VirtualBox working
|
||||||
# for now.
|
# for now.
|
||||||
provider = nil
|
provider = nil
|
||||||
Vagrant.plugin("1").registered.each do |plugin|
|
Vagrant.plugin("2").registered.each do |plugin|
|
||||||
provider = plugin.provider.get(:virtualbox)
|
provider = plugin.provider.get(:virtualbox)
|
||||||
break if provider
|
break if provider
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandPackage
|
module CommandPackage
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "package command"
|
name "package command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `package` command will take a previously existing Vagrant
|
The `package` command will take a previously existing Vagrant
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandProvision
|
module CommandProvision
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
opts = OptionParser.new do |o|
|
opts = OptionParser.new do |o|
|
||||||
o.banner = "Usage: vagrant provision [vm-name]"
|
o.banner = "Usage: vagrant provision [vm-name]"
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandProvision
|
module CommandProvision
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "provision command"
|
name "provision command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `provision` command provisions your virtual machine based on the
|
The `provision` command provisions your virtual machine based on the
|
||||||
|
|
|
@ -6,7 +6,7 @@ require Vagrant.source_root.join("plugins/commands/up/start_mixins")
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandReload
|
module CommandReload
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
# We assume that the `up` plugin exists and that we'll have access
|
# We assume that the `up` plugin exists and that we'll have access
|
||||||
# to this.
|
# to this.
|
||||||
include VagrantPlugins::CommandUp::StartMixins
|
include VagrantPlugins::CommandUp::StartMixins
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandReload
|
module CommandReload
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "reload command"
|
name "reload command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `reload` command will halt, reconfigure your machine based on
|
The `reload` command will halt, reconfigure your machine based on
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandResume
|
module CommandResume
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
opts = OptionParser.new do |o|
|
opts = OptionParser.new do |o|
|
||||||
o.banner = "Usage: vagrant resume [vm-name]"
|
o.banner = "Usage: vagrant resume [vm-name]"
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandResume
|
module CommandResume
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "resume command"
|
name "resume command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `resume` command resumes a suspend virtual machine.
|
The `resume` command resumes a suspend virtual machine.
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandSSH
|
module CommandSSH
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandSSH
|
module CommandSSH
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "ssh command"
|
name "ssh command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `ssh` command provides SSH access to the virtual machine.
|
The `ssh` command provides SSH access to the virtual machine.
|
||||||
|
|
|
@ -4,7 +4,7 @@ require "vagrant/util/safe_puts"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandSSHConfig
|
module CommandSSHConfig
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
include Vagrant::Util::SafePuts
|
include Vagrant::Util::SafePuts
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandSSHConfig
|
module CommandSSHConfig
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "ssh-config command"
|
name "ssh-config command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `ssh-config` command dumps an OpenSSH compatible configuration
|
The `ssh-config` command dumps an OpenSSH compatible configuration
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandStatus
|
module CommandStatus
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandStatus
|
module CommandStatus
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "status command"
|
name "status command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `status` command shows the status of all your virtual machines
|
The `status` command shows the status of all your virtual machines
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'optparse'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandSuspend
|
module CommandSuspend
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
def execute
|
def execute
|
||||||
opts = OptionParser.new do |o|
|
opts = OptionParser.new do |o|
|
||||||
o.banner = "Usage: vagrant suspend [vm-name]"
|
o.banner = "Usage: vagrant suspend [vm-name]"
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandSuspend
|
module CommandSuspend
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "suspend command"
|
name "suspend command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `suspend` command suspends a running virtual machine.
|
The `suspend` command suspends a running virtual machine.
|
||||||
|
|
|
@ -6,7 +6,7 @@ require File.expand_path("../start_mixins", __FILE__)
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandUp
|
module CommandUp
|
||||||
class Command < Vagrant.plugin("1", :command)
|
class Command < Vagrant.plugin("2", :command)
|
||||||
include StartMixins
|
include StartMixins
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "vagrant"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module CommandUp
|
module CommandUp
|
||||||
class Plugin < Vagrant.plugin("1")
|
class Plugin < Vagrant.plugin("2")
|
||||||
name "up command"
|
name "up command"
|
||||||
description <<-DESC
|
description <<-DESC
|
||||||
The `up` command brings the virtual environment up and running.
|
The `up` command brings the virtual environment up and running.
|
||||||
|
|
Loading…
Reference in New Issue