forked from twolfson/vagrant-lime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
92 lines (80 loc) · 2.88 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# Update apt-get once
$update_apt_get = <<SCRIPT
if ! test -f .updated_apt_get; then
sudo apt-get update
touch .updated_apt_get
fi
SCRIPT
config.vm.provision "shell", inline: $update_apt_get
# Add Python3.3
$install_python3 = <<SCRIPT
if ! which python3.3 &> /dev/null; then
# https://github.com/limetext/lime/blob/dbd2d9f6d0ea3f28b763b40c7d505d03570bd779/.travis.yml#L6-L8
sudo apt-get install python-software-properties -y
echo 'yes' | sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.3 python3.3-dev -y
fi
SCRIPT
config.vm.provision "shell", inline: $install_python3
# Install dependencies
$install_dependencies = <<SCRIPT
if ! which git &> /dev/null; then
# mercurial is for one of the dependencies inside of make
# build-essential contains `g++` which is for `cmake`
# libonig-dev is a dependency for `limetext/lime`
# pkg-config is a dependency for `go get`
sudo apt-get install cmake make mercurial git build-essential libonig-dev pkg-config -y
# Add patch for oniguruma
cd /usr/lib/pkgconfig
sudo wget https://raw.githubusercontent.com/limetext/rubex/ecf1f23794e3230cc857cf4dab44af3a2af04c46/oniguruma.pc
fi
SCRIPT
config.vm.provision "shell", inline: $install_dependencies
# Install go
$install_go = <<SCRIPT
if ! test -d /vagrant/code/go &> /dev/null; then
# Download go
# https://code.google.com/p/go/wiki/Downloads?tm=2
cd /tmp
wget https://storage.googleapis.com/golang/go1.2.2.linux-amd64.tar.gz
# Extract go and add to PATH
sudo tar -C /usr/local -xzvf go1.2.2.linux-amd64.tar.gz
sudo bash -c "echo 'export PATH=\$PATH:/usr/local/go/bin' >> /etc/profile"
source /etc/profile
fi
SCRIPT
config.vm.provision "shell", inline: $install_go
# Install limetext/lime
$install_lime = <<SCRIPT
if ! test -d /vagrant/code/go; then
# Define GOPATH for packages
# http://golang.org/doc/code.html#GOPATH
export GOPATH=/vagrant/code/go
mkdir -p $GOPATH
# Download the termbox frontend (installs to $GOPATH)
go get github.com/limetext/lime/frontend/termbox
# Add dependencies
cd $GOPATH/src/github.com/limetext/lime
git submodule update --init
# Build the frontend
cd $GOPATH/src/github.com/limetext/lime/frontend/termbox
go build
fi
SCRIPT
config.vm.provision "shell", inline: $install_lime
# Notify the user how to run `lime`
$notify_user = <<SCRIPT
echo "\\`lime\\` successfully constructed!"
echo "To run \\`lime\\`, run the following:"
echo "vagrant ssh"
echo "cd /vagrant/code/go/src/github.com/limetext/lime/frontend/termbox"
echo "./termbox"
SCRIPT
config.vm.provision "shell", inline: $notify_user
end