From 912998ef31132506257ebb6e92e406adf55cd92b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 16 Jul 2012 15:24:51 -0700 Subject: [PATCH] Fill in the provider API a bit more to what it is. --- lib/vagrant/plugin/v1/provider.rb | 15 +++++++++++++++ test/unit/vagrant/plugin/v1/provider_test.rb | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/plugin/v1/provider.rb b/lib/vagrant/plugin/v1/provider.rb index df974cfd8..09fe39962 100644 --- a/lib/vagrant/plugin/v1/provider.rb +++ b/lib/vagrant/plugin/v1/provider.rb @@ -5,6 +5,13 @@ module Vagrant # is responsible for creating compute resources to match the needs # of a Vagrant-configured system. class Provider + # Initialize the provider to represent the given machine. + # + # @param [Vagrant::Machine] machine The machine that this provider + # is responsible for. + def initialize(machine) + end + # This should return an action callable for the given name. # # @param [Symbol] name Name of the action. @@ -13,6 +20,14 @@ module Vagrant def action(name) nil end + + # This should return the state of the machine within this provider. + # The state can be any symbol. + # + # @return [Symbol] + def state + nil + end end end end diff --git a/test/unit/vagrant/plugin/v1/provider_test.rb b/test/unit/vagrant/plugin/v1/provider_test.rb index 578715e49..b92bd3385 100644 --- a/test/unit/vagrant/plugin/v1/provider_test.rb +++ b/test/unit/vagrant/plugin/v1/provider_test.rb @@ -1,7 +1,8 @@ require File.expand_path("../../../../base", __FILE__) describe Vagrant::Plugin::V1::Provider do - let(:instance) { described_class.new } + let(:machine) { Object.new } + let(:instance) { described_class.new(machine) } it "should return nil by default for actions" do instance.action(:whatever).should be_nil