Project

General

Profile

Actions

Misc #10757

closed

Vagrant environment for MRI contributors

Added by anthonycrumley (Anthony Crumley) about 9 years ago. Updated over 2 years ago.

Status:
Rejected
Assignee:
-
[ruby-core:67670]

Description

This patch includes a Vagrant file that will quickly and easily setup a development environment for MRI contributors. Following are some benefits of having a vagrant setup for contributors.

  • Increase the number of contributors by making it easier to get started.
  • Easy setup for someone that wants to contribute to the Ruby test suite but does not really want to become a C developer. (This is my personal motivation)
  • A canonical environment to create and work through issues on.

Files

vagrant.patch (4.12 KB) vagrant.patch anthonycrumley (Anthony Crumley), 01/18/2015 03:43 AM
vagrant_v2.patch (4.3 KB) vagrant_v2.patch anthonycrumley (Anthony Crumley), 01/20/2015 03:59 AM
vagrant_v3.patch (4.91 KB) vagrant_v3.patch anthonycrumley (Anthony Crumley), 01/22/2015 06:39 AM
vagrant_v4.patch (4.94 KB) vagrant_v4.patch anthonycrumley (Anthony Crumley), 01/22/2015 01:20 PM

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

Why build-dep ruby1.9.1?
Debian seems having ruby2.1.

Updated by anthonycrumley (Anthony Crumley) about 9 years ago

That is a good question. I don't know why but it is what is recommended in the developer how to and the Travis CI setup uses it as well.

https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto
https://travis-ci.org/ruby/ruby/jobs/46524624#L89

When I try to use ruby2.1 I get the following result.

vagrant@precise64:~$ sudo aptitude build-dep -y ruby2.1
Unable to find the source package for "ruby2.1".
Unable to find the source package for "ruby2.1".
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

Updated by anthonycrumley (Anthony Crumley) about 9 years ago

Added a setting to VirtualBox to cause the time to be better synced with the host machine. This resolves an issue in make where the common.mk file ends up with a future timestamp and make does not like that.

Actions #4

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

That image is Ubuntu 12.04, just after 2.0 release.
I'm afraid that is too old in these days.

And I'm not sure if these files are nice to be bundled or distributed separatedly.

Anyway, my patch against your v2 patch:

  • add vagrant.md to .document file
  • clean up trailing spaces
  • use case...when instead of repeated host =~
  • not overwrite existing configure file
  • use https: instead of http:
  • insert a blank line necessary for code block markdown
diff --git i/.document w/.document
index e4fc2b4..c3b3328 100644
--- i/.document
+++ w/.document
@@ -25,4 +25,6 @@ README.EXT.ja
 README.md
 README.ja.md
 
+vagrant.md
+
 doc
diff --git i/Vagrantfile w/Vagrantfile
index 47c72e1..ab9db58 100644
--- i/Vagrantfile
+++ w/Vagrantfile
@@ -9,7 +9,7 @@ Vagrant.configure(2) do |config|
   # 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 
+  # 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
 
@@ -19,11 +19,12 @@ Vagrant.configure(2) do |config|
     host = RbConfig::CONFIG['host_os']
 
     # Give VM 1/4 system memory & access to all cpu cores on the host
-    if host =~ /darwin/
+    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
-    elsif host =~ /linux/
+    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
@@ -57,7 +58,7 @@ Vagrant.configure(2) do |config|
     apt-get install -y gdb
     aptitude build-dep -y ruby1.9.1
     su - vagrant -c "mkdir ~/build"
-    su - vagrant -c "cd /vagrant && autoconf"
+    [ -f /vagrant/configure ] || { cd /vagrant && su - vagrant -c autoconf; }
     su - vagrant -c "cd ~/build && /vagrant/configure"
   SHELL
 
@@ -82,7 +83,7 @@ Vagrant.configure(2) do |config|
 
     vagrant@precise64:~$ cd ~/build
     vagrant@precise64:~$ make update-rubyspec
-     
+
   To run RubySpec tests:
 
     vagrant@precise64:~$ cd ~/build
diff --git i/vagrant.md w/vagrant.md
index 24b67b7..f50a986 100644
--- i/vagrant.md
+++ w/vagrant.md
@@ -6,7 +6,7 @@ The following instructions will help you quickly get an MRI Ruby development env
 
 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: http://www.vagrantup.com/
+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`
@@ -14,6 +14,7 @@ The following instructions will help you quickly get an MRI Ruby development env
 ### Setting Up Vagrant
 
 Build the Vagrant development environment by entering the following command:
+
 ```
 vagrant up
 ```

Updated by anthonycrumley (Anthony Crumley) about 9 years ago

Nice catch on the Ubuntu version being old.

  • Included patch by Nobu
  • Updated Ubuntu to trusty64
  • Added the Tcl/Tk dependency
  • Removed nasty openssl hacks because trusty64 already has updated openssl
  • Included a link to the Developer How To in vagrant up post message

Updated by anthonycrumley (Anthony Crumley) about 9 years ago

Clean up after the Tck/Tk installs.

Updated by anthonycrumley (Anthony Crumley) about 9 years ago

Are there any additional improvements you would like for me to make to this Vagrant configuration?

Updated by anthonycrumley (Anthony Crumley) about 9 years ago

Nobu,

Is there anything you would like for me to do to make this patch acceptable?

Thanks,

Anthony

Updated by hsbt (Hiroshi SHIBATA) over 2 years ago

  • Status changed from Open to Rejected

I understood that vagrant is useful software. But We have no strong reason to use it instead of other container tools like docker in 2021.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0