github.com/leowmjw/otto@v0.2.1-0.20160126165905-6400716cf085/builtin/app/go/data/common/dev-dep/Vagrantfile.tpl (about)

     1  # Generated by Otto, do not edit!
     2  #
     3  # This is the Vagrantfile generated by Otto for building the
     4  # binary that is used as a dependency for development.
     5  #
     6  # Do not hand-edit this file. To modify this, use the Appfile.
     7  
     8  Vagrant.configure("2") do |config|
     9    config.vm.box = "hashicorp/precise64"
    10  
    11    # Setup a synced folder from our working directory to /vagrant
    12    config.vm.synced_folder '{{ path.working }}', "{{ shared_folder_path }}",
    13      owner: "vagrant", group: "vagrant"
    14  
    15    {% if import_path != "" %}
    16    # Disable the default synced folder
    17    config.vm.synced_folder ".", "/vagrant", disabled: true
    18    {% endif %}
    19  
    20    # Enable SSH agent forwarding so getting private dependencies works
    21    config.ssh.forward_agent = true
    22  
    23    # Setup a synced folder from where our compiled data is to
    24    # /otto. We do this to access the build script.
    25    config.vm.synced_folder File.join('{{ path.compiled }}', 'dev-dep'), "/otto"
    26  
    27    # Setup a synced folder from where the cache dir is
    28    config.vm.synced_folder '{{ path.cache }}', "/otto-cache"
    29  
    30    # Install Go build environment
    31    config.vm.provision "shell", inline: $script_golang
    32  
    33    config.vm.provider :parallels do |p, o|
    34      o.vm.box = "parallels/ubuntu-12.04"
    35    end
    36  end
    37  
    38  $script_golang = <<SCRIPT
    39  set -e
    40  
    41  oe() { $@ 2>&1 | logger -t otto > /dev/null; }
    42  ol() { echo "[otto] $@"; }
    43  
    44  # If we have Go, then do nothing
    45  if command -v go >/dev/null 2>&1; then
    46      ol "Go already installed! Otto won't install Go."
    47      exit 0
    48  fi
    49  
    50  ol "Downloading Go {{ dev_go_version }}..."
    51  oe wget -q -O /home/vagrant/go.tar.gz https://storage.googleapis.com/golang/go{{ dev_go_version }}.linux-amd64.tar.gz
    52  
    53  ol "Untarring Go..."
    54  oe sudo tar -C /usr/local -xzf /home/vagrant/go.tar.gz
    55  
    56  ol "Making GOPATH..."
    57  oe sudo mkdir -p /opt/gopath
    58  fstype=$(find /opt/gopath -mindepth 0 -maxdepth 0 -type d -printf "%F")
    59  find /opt/gopath -fstype ${fstype} -print0 | xargs -0 -n 100 chown vagrant:vagrant
    60  
    61  ol "Setting up PATH..."
    62  echo 'export PATH=/opt/gopath/bin:/usr/local/go/bin:$PATH' >> /home/vagrant/.bashrc
    63  echo 'export GOPATH=/opt/gopath' >> /home/vagrant/.bashrc
    64  
    65  ol "Installing VCSs for go get..."
    66  oe sudo apt-get update -y
    67  oe sudo apt-get install -y git bzr mercurial
    68  
    69  ol "Configuring Go to use SSH instead of HTTP..."
    70  git config --global url."git@github.com:".insteadOf "https://github.com/"
    71  SCRIPT