Skip to content

Commit

Permalink
Configure Bundler for parallel gem installs
Browse files Browse the repository at this point in the history
* Set it globally for OS X.
* Determine number of cores dynamically.
* Pick one number less than number of cores to avoid deadlock errors.
  http://archlever.blogspot.com/2013/09/lies-damned-lies-and-truths-backed-by.html
* Only install `--pre` for Bundler.
* Remove `pg` and `unicorn` gems as they will be installed during `bundle`
  for a Rails project.
  • Loading branch information
Dan Croak committed Dec 1, 2013
1 parent 098e418 commit ef81f6e
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -22,7 +22,8 @@ rendered `linux`, `linux-preqrequisites`, or `mac` files. `git diff` is your
friend - check the output. If it looks as expected, commit the rendered
installation files.

4) A reminder: be extra sure to render the installation files before issuing a pull request.
4) A reminder: be extra sure to render the installation files before issuing a
pull request.

Supporting additional distros or operating systems
==================================================
Expand Down
1 change: 1 addition & 0 deletions Manifest.linux
Expand Up @@ -9,4 +9,5 @@ linux-components/debian-derivative-packages
linux-components/silver-searcher-from-source
linux-components/rbenv
common-components/ruby-environment
linux-components/bundler
linux-components/heroku
1 change: 1 addition & 0 deletions Manifest.mac
Expand Up @@ -9,4 +9,5 @@ mac-components/packages
mac-components/rbenv
mac-components/compiler-and-libraries
common-components/ruby-environment
mac-components/bundler
mac-components/heroku
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -62,7 +62,6 @@ What it sets up
* Homebrew for managing operating system libraries (OS X only)
* ImageMagick for cropping and resizing images
* Postgres for storing relational data
* Postgres gem for talking to Postgres from Ruby
* Qt for headless JavaScript testing via Capybara Webkit
* Rails gem for writing web applications
* Rbenv for managing versions of the Ruby programming language
Expand Down
7 changes: 5 additions & 2 deletions common-components/ruby-environment
Expand Up @@ -8,8 +8,11 @@ fancy_echo "Setting Ruby 2.0.0-p247 as global default Ruby ..."
fancy_echo "Updating to latest Rubygems version ..."
gem update --system

fancy_echo "Installing critical Ruby gems for Rails development ..."
gem install bundler pg rails unicorn --no-document
fancy_echo "Installing Bundler to install project-specific Ruby gems ..."
gem install bundler --no-document --pre

fancy_echo "Installing Rails ..."
gem install rails --no-document

fancy_echo "Installing GitHub CLI client ..."
curl http://hub.github.com/standalone -sLo ~/.bin/hub
Expand Down
12 changes: 10 additions & 2 deletions linux
Expand Up @@ -115,14 +115,22 @@ fancy_echo "Setting Ruby 2.0.0-p247 as global default Ruby ..."
fancy_echo "Updating to latest Rubygems version ..."
gem update --system

fancy_echo "Installing critical Ruby gems for Rails development ..."
gem install bundler pg rails unicorn --no-document
fancy_echo "Installing Bundler to install project-specific Ruby gems ..."
gem install bundler --no-document --pre

fancy_echo "Installing Rails ..."
gem install rails --no-document

fancy_echo "Installing GitHub CLI client ..."
curl http://hub.github.com/standalone -sLo ~/.bin/hub
chmod +x ~/.bin/hub
### end common-components/ruby-environment

fancy_echo "Configuring Bundler for faster, parallel gem installation ..."
number_of_cores=`nproc`
bundle config --global jobs `expr $number_of_cores - 1`
### end linux-components/bundler

fancy_echo "Installing Heroku CLI client ..."
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

Expand Down
3 changes: 3 additions & 0 deletions linux-components/bundler
@@ -0,0 +1,3 @@
fancy_echo "Configuring Bundler for faster, parallel gem installation ..."
number_of_cores=`nproc`
bundle config --global jobs `expr $number_of_cores - 1`
12 changes: 10 additions & 2 deletions mac
Expand Up @@ -121,14 +121,22 @@ fancy_echo "Setting Ruby 2.0.0-p247 as global default Ruby ..."
fancy_echo "Updating to latest Rubygems version ..."
gem update --system

fancy_echo "Installing critical Ruby gems for Rails development ..."
gem install bundler pg rails unicorn --no-document
fancy_echo "Installing Bundler to install project-specific Ruby gems ..."
gem install bundler --no-document --pre

fancy_echo "Installing Rails ..."
gem install rails --no-document

fancy_echo "Installing GitHub CLI client ..."
curl http://hub.github.com/standalone -sLo ~/.bin/hub
chmod +x ~/.bin/hub
### end common-components/ruby-environment

fancy_echo "Configuring Bundler for faster, parallel gem installation ..."
number_of_cores=`sysctl -n hw.ncpu`
bundle config --global jobs `expr $number_of_cores - 1`
### end mac-components/bundler

fancy_echo "Installing Heroku CLI client ..."
brew install heroku-toolbelt

Expand Down
3 changes: 3 additions & 0 deletions mac-components/bundler
@@ -0,0 +1,3 @@
fancy_echo "Configuring Bundler for faster, parallel gem installation ..."
number_of_cores=`sysctl -n hw.ncpu`
bundle config --global jobs `expr $number_of_cores - 1`

0 comments on commit ef81f6e

Please sign in to comment.