Project

General

Profile

Misc #10757 ยป vagrant_v4.patch

anthonycrumley (Anthony Crumley), 01/22/2015 01:20 PM

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
    rm -rf tcl*
63

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

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

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

  
84
  To access the MRI Ruby development virtual machine:
85

  
86
    $ vagrant ssh
87
    vagrant@vagrant-ubuntu-trusty-64:~$
88

  
89
  To build ruby:
90

  
91
    vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build
92
    vagrant@vagrant-ubuntu-trusty-64:~$ make
93

  
94
  To run MRI tests:
95

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

  
99
  To update RubySpec tests:
100

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

  
104
  To run RubySpec tests:
105

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

  
109
  USAGE_INSTRUCTIONS
110
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