Scaffold config, plugin and provider classes

This commit is contained in:
Fabio Rehm 2013-02-28 00:20:54 -03:00
parent a579f04bce
commit faa2aaa6ab
4 changed files with 55 additions and 1 deletions

View file

@ -1,7 +1,8 @@
require "vagrant-lxc/version"
require "vagrant-lxc/plugin"
module Vagrant
module LXC
# Your code goes here...
end
end

View file

@ -0,0 +1,6 @@
module Vagrant
module LXC
class Config < Vagrant.plugin("2", :config)
end
end
end

23
lib/vagrant-lxc/plugin.rb Normal file
View file

@ -0,0 +1,23 @@
require "vagrant"
module Vagrant
module LXC
class Plugin < Vagrant.plugin("2")
name "Linux Containers (LXC) provider"
description <<-EOF
The LXC provider allows Vagrant to manage and control
LXC-based virtual machines.
EOF
provider(:lxc) do
require File.expand_path("../provider", __FILE__)
Provider
end
config(:lxc, :provider) do
require File.expand_path("../config", __FILE__)
Config
end
end
end
end

View file

@ -0,0 +1,24 @@
require "vagrant-lxc/machine_state"
require "log4r"
module Vagrant
module LXC
# DISCUSS: VirtualBox provider has a #machine_id_changed, do we need to handle it as well?
class Provider < Vagrant.plugin("2", :provider)
def initialize(machine)
@logger = Log4r::Logger.new("vagrant::provider::lxc")
@machine = machine
end
def state
LXC::MachineState.new(@machine)
end
def to_s
id = @machine.id ? @machine.id : "new VM"
"LXC (#{id})"
end
end
end
end