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 = "~/.hobo/base/base.ovf"
|
||||||
config.vm.base_mac = "0800279C2E41"
|
config.vm.base_mac = "0800279C2E41"
|
||||||
|
config.vm.project_directory = "/hobo"
|
||||||
config.vm.forward_port("ssh", 22, 2222)
|
config.vm.forward_port("ssh", 22, 2222)
|
||||||
end
|
end
|
|
@ -46,6 +46,7 @@ module Hobo
|
||||||
class VMConfig < Base
|
class VMConfig < Base
|
||||||
attr_accessor :base
|
attr_accessor :base
|
||||||
attr_accessor :base_mac
|
attr_accessor :base_mac
|
||||||
|
attr_accessor :project_directory
|
||||||
attr_reader :forwarded_ports
|
attr_reader :forwarded_ports
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
|
|
@ -64,6 +64,7 @@ error
|
||||||
forward_ports
|
forward_ports
|
||||||
setup_shared_folder
|
setup_shared_folder
|
||||||
start
|
start
|
||||||
|
mount_shared_folder
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -116,6 +117,14 @@ error
|
||||||
@vm.save(true)
|
@vm.save(true)
|
||||||
end
|
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
|
def start
|
||||||
HOBO_LOGGER.info "Booting VM..."
|
HOBO_LOGGER.info "Booting VM..."
|
||||||
@vm.start(:headless, true)
|
@vm.start(:headless, true)
|
||||||
|
|
|
@ -80,6 +80,7 @@ class VMTest < Test::Unit::TestCase
|
||||||
@vm.expects(:forward_ports).in_sequence(create_seq)
|
@vm.expects(:forward_ports).in_sequence(create_seq)
|
||||||
@vm.expects(:setup_shared_folder).in_sequence(create_seq)
|
@vm.expects(:setup_shared_folder).in_sequence(create_seq)
|
||||||
@vm.expects(:start).in_sequence(create_seq)
|
@vm.expects(:start).in_sequence(create_seq)
|
||||||
|
@vm.expects(:mount_shared_folder).in_sequence(create_seq)
|
||||||
@vm.create
|
@vm.create
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -183,6 +184,17 @@ class VMTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
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
|
context "suspending and resuming a vm" do
|
||||||
should "put the vm in a suspended state" do
|
should "put the vm in a suspended state" do
|
||||||
saved_state_expectation(false)
|
saved_state_expectation(false)
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Test::Unit::TestCase
|
||||||
|
|
||||||
config.vm.base = "foo"
|
config.vm.base = "foo"
|
||||||
config.vm.base_mac = "42"
|
config.vm.base_mac = "42"
|
||||||
|
config.vm.project_directory = "/hobo"
|
||||||
config.vm.forward_port("ssh", 22, 2222)
|
config.vm.forward_port("ssh", 22, 2222)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue