Shared folder is now properly mounted on hobo-up
This commit is contained in:
parent
3b53bdc79e
commit
7fd4ee0160
|
@ -10,5 +10,6 @@ Hobo::Config.run do |config|
|
|||
|
||||
config.vm.base = "~/.hobo/base/base.ovf"
|
||||
config.vm.base_mac = "0800279C2E41"
|
||||
config.vm.project_directory = "/hobo"
|
||||
config.vm.forward_port("ssh", 22, 2222)
|
||||
end
|
|
@ -46,6 +46,7 @@ module Hobo
|
|||
class VMConfig < Base
|
||||
attr_accessor :base
|
||||
attr_accessor :base_mac
|
||||
attr_accessor :project_directory
|
||||
attr_reader :forwarded_ports
|
||||
|
||||
def initialize
|
||||
|
|
|
@ -64,6 +64,7 @@ error
|
|||
forward_ports
|
||||
setup_shared_folder
|
||||
start
|
||||
mount_shared_folder
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
@ -116,6 +117,14 @@ error
|
|||
@vm.save(true)
|
||||
end
|
||||
|
||||
def mount_shared_folder
|
||||
HOBO_LOGGER.info "Mounting shared folders..."
|
||||
Hobo::SSH.execute do |ssh|
|
||||
ssh.exec!("sudo mkdir -p #{Hobo.config.vm.project_directory}")
|
||||
ssh.exec!("sudo mount -t vboxsf hobo-root-path #{Hobo.config.vm.project_directory}")
|
||||
end
|
||||
end
|
||||
|
||||
def start
|
||||
HOBO_LOGGER.info "Booting VM..."
|
||||
@vm.start(:headless, true)
|
||||
|
|
|
@ -80,6 +80,7 @@ class VMTest < Test::Unit::TestCase
|
|||
@vm.expects(:forward_ports).in_sequence(create_seq)
|
||||
@vm.expects(:setup_shared_folder).in_sequence(create_seq)
|
||||
@vm.expects(:start).in_sequence(create_seq)
|
||||
@vm.expects(:mount_shared_folder).in_sequence(create_seq)
|
||||
@vm.create
|
||||
end
|
||||
end
|
||||
|
@ -183,6 +184,17 @@ class VMTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
context "mounting the shared folders" do
|
||||
should "create the directory then mount the shared folder" do
|
||||
mount_seq = sequence("mount_seq")
|
||||
ssh = mock("ssh")
|
||||
ssh.expects(:exec!).with("sudo mkdir -p #{Hobo.config.vm.project_directory}").in_sequence(mount_seq)
|
||||
ssh.expects(:exec!).with("sudo mount -t vboxsf hobo-root-path #{Hobo.config.vm.project_directory}").in_sequence(mount_seq)
|
||||
Hobo::SSH.expects(:execute).yields(ssh)
|
||||
@vm.mount_shared_folder
|
||||
end
|
||||
end
|
||||
|
||||
context "suspending and resuming a vm" do
|
||||
should "put the vm in a suspended state" do
|
||||
saved_state_expectation(false)
|
||||
|
|
|
@ -36,6 +36,7 @@ class Test::Unit::TestCase
|
|||
|
||||
config.vm.base = "foo"
|
||||
config.vm.base_mac = "42"
|
||||
config.vm.project_directory = "/hobo"
|
||||
config.vm.forward_port("ssh", 22, 2222)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue