vagrant/ubuntu/Vagrantfile in forj-1.0.9 vs vagrant/ubuntu/Vagrantfile in forj-1.0.10

- old
+ new

@@ -3,10 +3,12 @@ # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. + + Vagrant.configure(2) do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. @@ -38,18 +40,31 @@ # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" config.vm.synced_folder "../../", "/srv/forj" + lorj = false if ENV.key?('lorj_src') lorj_src = File.expand_path(ENV['lorj_src']) git_data = File.join(lorj_src, '.git', 'config') if File.exist?(git_data) && open(git_data) { |f| f.grep(/forj-oss\/lorj/) } config.vm.synced_folder ENV['lorj_src'], "/srv/lorj" + lorj=true end end + src_data = {} + if ENV.key?('src') + # Support '<path1>:cmd1[;cmd2[;...]];|[path2:cmd3...]' + src_list = ENV['src'].split(';|') + src_list.each do |src| + src_name, cmd = src.split(':') + src_data[src_name] = cmd + config.vm.synced_folder src_name, File.join('/srv', File.basename(src_name)) + end + end + # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider "virtualbox" do |vb| @@ -84,8 +99,14 @@ priv = { privileged: true } config.vm.provision "shell", priv.merge(inline: "apt-get update") config.vm.provision "shell", priv.merge(inline: "apt-get install ruby1.9.1 ruby1.9.1-dev rubygems1.9.1 build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev libxml2-dev libxslt-dev git -y") config.vm.provision "shell", priv.merge(inline: "gem install bundler --no-rdoc --no-ri") config.vm.provision "shell", priv.merge(inline: "gem install rake --no-rdoc --no-ri") + config.vm.provision "shell", inline: "echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile.d/local.sh" + src_data.each do |key, value| + path = File.join('/srv', File.basename(key)) + value = "echo 'Nothing more to do in #{path}'" if value.nil? + config.vm.provision "shell", inline: "cd #{path} ; #{value}" + end config.vm.provision "shell", inline: "/srv/forj/vagrant/configure/install.sh" - config.vm.provision "shell", inline: "echo 'echo \"Call /srv/forj/vagrant/configure/install.sh to reinstall forj/lorj from source\"' >> ~vagrant/.bash_profile" + config.vm.provision "shell", inline: "echo \"echo 'Call sudo /srv/forj/vagrant/configure/install.sh to reinstall forj/lorj from source'\" >> ~vagrant/.bash_profile" end