Got some binaries in, a shell for VM management

This commit is contained in:
Mitchell Hashimoto 2010-01-29 22:21:35 -08:00
parent 626326932c
commit e9d731cfcf
7 changed files with 56 additions and 3 deletions

12
bin/hobo Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env ruby
begin
require File.expand_path(File.join(File.dirname(__FILE__), "../vendor/gems/ruby/1.8/environment"))
rescue LoadError
end
require 'git-style-binary/command'
GitStyleBinary.primary do
version "Somewhere between 0 and 0.1"
run { educate }
end

26
bin/hobo-up Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env ruby
begin
require File.expand_path(File.join(File.dirname(__FILE__), "../vendor/gems/ruby/1.8/environment"))
rescue LoadError
end
require 'git-style-binary/command'
# Get hobo
hobodir = File.join(File.dirname(__FILE__), '..', 'lib')
$:.unshift(hobodir) unless $:.include?(hobodir)
require 'hobo'
GitStyleBinary.command do
short_desc "create the hobo environment"
banner <<-EOS
Usage: #{command.full_name} #{all_options_string}
Create the hobo environment.
EOS
run do |command|
Hobo::VM.up
end
end

View File

@ -5,9 +5,11 @@ PROJECT_ROOT = File.join(libdir, '..')
require 'ostruct'
require 'ftools'
require 'logger'
require 'virtualbox'
require 'hobo/config'
require 'hobo/env'
require 'hobo/ssh'
require 'hobo/vm'
# TODO: Make this configurable
log_output = ENV['HOBO_ENV'] == 'test' ? nil : STDOUT

View File

@ -1,6 +1,4 @@
module Hobo
module_function
def config

View File

@ -1,6 +1,6 @@
module Hobo
class SSH
SCRIPT = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'hobo-ssh-expect.sh')
SCRIPT = File.join(File.dirname(__FILE__), '..', '..', 'script', 'hobo-ssh-expect.sh')
def self.connect(opts={})
Kernel.exec "#{SCRIPT} #{uname(opts)} #{pass(opts)} #{host(opts)} #{port(opts)}".strip

15
lib/hobo/vm.rb Normal file
View File

@ -0,0 +1,15 @@
module Hobo
class VM
class <<self
# Bring up the virtual machine. Imports the base image and
# provisions it.
def up
HOBO_LOGGER.info "Importing base VM (#{Hobo.config[:vm][:base]})..."
vm = VirtualBox::VM.import(File.expand_path(Hobo.config[:vm][:base]))
HOBO_LOGGER.info "Persisting the VM UUID (#{vm.uuid})..."
# TODO: persist it! dot file in the root (where Hobofile is)
end
end
end
end