Scaffold config, plugin and provider classes
This commit is contained in:
parent
a579f04bce
commit
faa2aaa6ab
4 changed files with 55 additions and 1 deletions
|
@ -1,7 +1,8 @@
|
|||
require "vagrant-lxc/version"
|
||||
|
||||
require "vagrant-lxc/plugin"
|
||||
|
||||
module Vagrant
|
||||
module LXC
|
||||
# Your code goes here...
|
||||
end
|
||||
end
|
||||
|
|
6
lib/vagrant-lxc/config.rb
Normal file
6
lib/vagrant-lxc/config.rb
Normal 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
23
lib/vagrant-lxc/plugin.rb
Normal 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
|
24
lib/vagrant-lxc/provider.rb
Normal file
24
lib/vagrant-lxc/provider.rb
Normal 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
|
Loading…
Reference in a new issue