Misc #10757 » vagrant_v3.patch
| .document | ||
|---|---|---|
| 
     README.EXT.ja 
   | 
||
| 
     README.ja 
   | 
||
| 
     vagrant.md 
   | 
||
| 
     doc 
   | 
||
| .gitignore | ||
|---|---|---|
| 
     .pc 
   | 
||
| 
     .ppack 
   | 
||
| 
     .svn 
   | 
||
| 
     .vagrant 
   | 
||
| 
     Makefile 
   | 
||
| 
     Makefile.old 
   | 
||
| 
     extconf.h 
   | 
||
| Vagrantfile | ||
|---|---|---|
| 
     # -*- mode: ruby -*- 
   | 
||
| 
     # vi: set ft=ruby : 
   | 
||
| 
     # Vagrant configuration for an MRI Ruby contributor environment. 
   | 
||
| 
     Vagrant.configure(2) do |config| 
   | 
||
| 
       config.vm.box = "ubuntu/trusty64" 
   | 
||
| 
       # Create a private network, which allows host-only access to the machine 
   | 
||
| 
       # using a specific IP. 
   | 
||
| 
       config.vm.network "private_network", ip: "192.168.33.10" 
   | 
||
| 
       # Maps the /vagrant VM folder to the Ruby source folder.  NFS is used for 
   | 
||
| 
       # better performance and may require configuration on the host machine. 
   | 
||
| 
       config.vm.synced_folder '.', '/vagrant', nfs: true 
   | 
||
| 
       # Configure the virtual machine with enough access to processors and memory 
   | 
||
| 
       # that it will not be sluggish. 
   | 
||
| 
       config.vm.provider "virtualbox" do |v| 
   | 
||
| 
         host = RbConfig::CONFIG['host_os'] 
   | 
||
| 
         # Give VM 1/4 system memory & access to all cpu cores on the host 
   | 
||
| 
         case host 
   | 
||
| 
         when /darwin/ 
   | 
||
| 
           cpus = `sysctl -n hw.ncpu`.to_i 
   | 
||
| 
           # sysctl returns Bytes and we need to convert to MB 
   | 
||
| 
           mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4 
   | 
||
| 
         when /linux/ 
   | 
||
| 
           cpus = `nproc`.to_i 
   | 
||
| 
           # meminfo shows KB and we need to convert to MB 
   | 
||
| 
           mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4 
   | 
||
| 
         else # sorry Windows folks, I can't help you 
   | 
||
| 
           cpus = 2 
   | 
||
| 
           mem = 1024 
   | 
||
| 
         end 
   | 
||
| 
         v.customize ["modifyvm", :id, "--memory", mem] 
   | 
||
| 
         v.customize ["modifyvm", :id, "--cpus", cpus] 
   | 
||
| 
         # Fix problem with time on VM getting out of sync with host. 
   | 
||
| 
         v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ] 
   | 
||
| 
       end 
   | 
||
| 
       # Provision the Ruby development environment with a shell script. 
   | 
||
| 
       config.vm.provision "shell", inline: <<-SHELL 
   | 
||
| 
         # Install dependencies 
   | 
||
| 
         apt-get update 
   | 
||
| 
         apt-get install -y git 
   | 
||
| 
         apt-get install -y autoconf 
   | 
||
| 
         apt-get install -y make 
   | 
||
| 
         apt-get install -y bison 
   | 
||
| 
         apt-get install -y gdb 
   | 
||
| 
         aptitude build-dep -y ruby1.9.1 
   | 
||
| 
         # Install Tcl 
   | 
||
| 
         curl -sSL -O http://prdownloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gz 
   | 
||
| 
         gunzip < tcl8.6.3-src.tar.gz | tar xvf - 
   | 
||
| 
         cd tcl8.6.3/unix 
   | 
||
| 
         ./configure 
   | 
||
| 
         make 
   | 
||
| 
         make install 
   | 
||
| 
         cd ../.. 
   | 
||
| 
         # Install Tk 
   | 
||
| 
         curl -sSL -O http://prdownloads.sourceforge.net/tcl/tk8.6.3-src.tar.gz 
   | 
||
| 
         gunzip < tk8.6.3-src.tar.gz | tar xvf - 
   | 
||
| 
         cd tk8.6.3/unix 
   | 
||
| 
         ./configure 
   | 
||
| 
         make 
   | 
||
| 
         make install 
   | 
||
| 
         cd ../.. 
   | 
||
| 
         # Configure for build 
   | 
||
| 
         su - vagrant -c "mkdir ~/build" 
   | 
||
| 
         [ -f /vagrant/configure ] || { cd /vagrant && su - vagrant -c autoconf; } 
   | 
||
| 
         su - vagrant -c "cd ~/build && /vagrant/configure" 
   | 
||
| 
       SHELL 
   | 
||
| 
       # Usage instructions that will be displayed whenever 'vagrant up' completes. 
   | 
||
| 
       config.vm.post_up_message = <<-USAGE_INSTRUCTIONS 
   | 
||
| 
       Helpful developer information can be found at https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto 
   | 
||
| 
       To access the MRI Ruby development virtual machine: 
   | 
||
| 
         $ vagrant ssh 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ 
   | 
||
| 
       To build ruby: 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ make 
   | 
||
| 
       To run MRI tests: 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ make test-all 
   | 
||
| 
       To update RubySpec tests: 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ make update-rubyspec 
   | 
||
| 
       To run RubySpec tests: 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/build 
   | 
||
| 
         vagrant@vagrant-ubuntu-trusty-64:~$ make test-rubyspec 
   | 
||
| 
       USAGE_INSTRUCTIONS 
   | 
||
| 
     end 
   | 
||
| vagrant.md | ||
|---|---|---|
| 
     # Ruby Contributor Vagrant Guide 
   | 
||
| 
     The following instructions will help you quickly get an MRI Ruby development environment ready for contributing in short order. 
   | 
||
| 
     ### Getting Started 
   | 
||
| 
     1. Install Git: http://git-scm.com/downloads (or [GitHub for Windows](http://windows.github.com/) if you want a GUI) 
   | 
||
| 
     2. Install VirtualBox: https://www.virtualbox.org/wiki/Downloads 
   | 
||
| 
     3. Install Vagrant: https://www.vagrantup.com/ 
   | 
||
| 
     4. Open a terminal 
   | 
||
| 
     5. Clone the project: `git clone https://github.com/ruby/ruby.git` 
   | 
||
| 
     6. Enter the project directory: `cd ruby` 
   | 
||
| 
     ### Setting Up Vagrant 
   | 
||
| 
     Build the Vagrant development environment by entering the following command: 
   | 
||
| 
     ``` 
   | 
||
| 
     vagrant up 
   | 
||
| 
     ``` 
   | 
||
| 
     The first time this command is ran will take a while because the VM image will need to download. 
   | 
||
| 
     Follow the directions at the end of the installation to begin contributing. 
   | 
||