Project

General

Profile

Misc #10757 ยป vagrant_v3.patch

anthonycrumley (Anthony Crumley), 01/22/2015 06:39 AM

View differences:

.document
25 25
README.EXT.ja
26 26
README.ja
27 27

  
28
vagrant.md
29

  
28 30
doc
.gitignore
22 22
.pc
23 23
.ppack
24 24
.svn
25
.vagrant
25 26
Makefile
26 27
Makefile.old
27 28
extconf.h
Vagrantfile
1
# -*- mode: ruby -*-
2
# vi: set ft=ruby :
3

  
4
# Vagrant configuration for an MRI Ruby contributor environment.
5
Vagrant.configure(2) do |config|
6
  config.vm.box = "ubuntu/trusty64"
7

  
8
  # Create a private network, which allows host-only access to the machine
9
  # using a specific IP.
10
  config.vm.network "private_network", ip: "192.168.33.10"
11

  
12
  # Maps the /vagrant VM folder to the Ruby source folder.  NFS is used for
13
  # better performance and may require configuration on the host machine.
14
  config.vm.synced_folder '.', '/vagrant', nfs: true
15

  
16
  # Configure the virtual machine with enough access to processors and memory
17
  # that it will not be sluggish.
18
  config.vm.provider "virtualbox" do |v|
19
    host = RbConfig::CONFIG['host_os']
20

  
21
    # Give VM 1/4 system memory & access to all cpu cores on the host
22
    case host
23
    when /darwin/
24
      cpus = `sysctl -n hw.ncpu`.to_i
25
      # sysctl returns Bytes and we need to convert to MB
26
      mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
27
    when /linux/
28
      cpus = `nproc`.to_i
29
      # meminfo shows KB and we need to convert to MB
30
      mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
31
    else # sorry Windows folks, I can't help you
32
      cpus = 2
33
      mem = 1024
34
    end
35

  
36
    v.customize ["modifyvm", :id, "--memory", mem]
37
    v.customize ["modifyvm", :id, "--cpus", cpus]
38

  
39
    # Fix problem with time on VM getting out of sync with host.
40
    v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
41
  end
42

  
43
  # Provision the Ruby development environment with a shell script.
44
  config.vm.provision "shell", inline: <<-SHELL
45
    # Install dependencies
46
    apt-get update
47
    apt-get install -y git
48
    apt-get install -y autoconf
49
    apt-get install -y make
50
    apt-get install -y bison
51
    apt-get install -y gdb
52
    aptitude build-dep -y ruby1.9.1
53

  
54
    # Install Tcl
55
    curl -sSL -O http://prdownloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gz
56
    gunzip < tcl8.6.3-src.tar.gz | tar xvf -
57
    cd tcl8.6.3/unix
58
    ./configure
59
    make
60
    make install
61
    cd ../..
62

  
63
    # Install Tk
64
    curl -sSL -O http://prdownloads.sourceforge.net/tcl/tk8.6.3-src.tar.gz
65
    gunzip < tk8.6.3-src.tar.gz | tar xvf -
66
    cd tk8.6.3/unix
67
    ./configure
68
    make
69
    make install
70
    cd ../..
71

  
72
    # Configure for build
73
    su - vagrant -c "mkdir ~/build"
74
    [ -f /vagrant/configure ] || { cd /vagrant && su - vagrant -c autoconf; }
75
    su - vagrant -c "cd ~/build && /vagrant/configure"
76
  SHELL
77

  
78
  # Usage instructions that will be displayed whenever 'vagrant up' completes.
79
  config.vm.post_up_message = <<-USAGE_INSTRUCTIONS
80
  Helpful developer information can be found at https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto
81

  
82
  To access the MRI Ruby development virtual machine:
83

  
84
    $ vagrant ssh
85
    vagrant@vagrant-ubuntu-trusty-64:~$
86

  
87
  To build ruby:
88

  
89
    vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build
90
    vagrant@vagrant-ubuntu-trusty-64:~$ make
91

  
92
  To run MRI tests:
93

  
94
    vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build
95
    vagrant@vagrant-ubuntu-trusty-64:~$ make test-all
96

  
97
  To update RubySpec tests:
98

  
99
    vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build
100
    vagrant@vagrant-ubuntu-trusty-64:~$ make update-rubyspec
101

  
102
  To run RubySpec tests:
103

  
104
    vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build
105
    vagrant@vagrant-ubuntu-trusty-64:~$ make test-rubyspec
106

  
107
  USAGE_INSTRUCTIONS
108
end
vagrant.md
1
# Ruby Contributor Vagrant Guide
2

  
3
The following instructions will help you quickly get an MRI Ruby development environment ready for contributing in short order.
4

  
5
### Getting Started
6

  
7
1. Install Git: http://git-scm.com/downloads (or [GitHub for Windows](http://windows.github.com/) if you want a GUI)
8
2. Install VirtualBox: https://www.virtualbox.org/wiki/Downloads
9
3. Install Vagrant: https://www.vagrantup.com/
10
4. Open a terminal
11
5. Clone the project: `git clone https://github.com/ruby/ruby.git`
12
6. Enter the project directory: `cd ruby`
13

  
14
### Setting Up Vagrant
15

  
16
Build the Vagrant development environment by entering the following command:
17
```
18
vagrant up
19
```
20

  
21
The first time this command is ran will take a while because the VM image will need to download.
22

  
23
Follow the directions at the end of the installation to begin contributing.
24