Permalink
Browse files

Reorganizing init/ to accomodate Ubuntu and OSX shared init code. Add…

…ing rbenv and ruby-build as submodules, linking to their bins directly (no longer using brew for them).
  • Loading branch information...
1 parent fbbfa0e commit 3b9a46852cccb7c956c65b2d41554a77ea1668de @cowboy committed Dec 27, 2011
Showing with 98 additions and 76 deletions.
  1. +6 −0 .gitmodules
  2. +28 −0 init/_osx.sh
  3. +13 −0 init/_ubuntu.sh
  4. +17 −0 init/nodejs.sh
  5. +0 −71 init/osx.sh
  6. +25 −0 init/ruby.sh
  7. +0 −3 init/ubuntu.sh
  8. +1 −0 libs/rbenv
  9. +1 −0 libs/ruby-build
  10. +7 −2 source/rbenv.sh
View
@@ -4,3 +4,9 @@
[submodule "libs/nvm"]
path = libs/nvm
url = git://github.com/creationix/nvm.git
+[submodule "libs/rbenv"]
+ path = libs/rbenv
+ url = git://github.com/sstephenson/rbenv.git
+[submodule "libs/ruby-build"]
+ path = libs/ruby-build
+ url = git://github.com/sstephenson/ruby-build.git
View
@@ -0,0 +1,28 @@
+# OSX-only stuff. Abort if not OSX.
+[[ "$OSTYPE" =~ ^darwin ]] || return 1
+
+# Install Homebrew.
+if [[ ! "$(type -P brew)" ]]; then
+ e_header "Installing Homebrew"
+ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
+ brew update
+fi
+
+# Install Homebrew recipes.
+if [[ "$(type -P brew)" ]]; then
+ recipes=(git node tree sl lesspipe)
+
+ list="$(to_install "${recipes[*]}" "$(brew list)")"
+ if [[ "$list" ]]; then
+ e_header "Installing Homebrew recipes: $list"
+ brew install $list
+ fi
+
+ # Newer OSX XCode comes with an LLVM gcc which rbenv can't use.
+ source ~/.dotfiles/source/rbenv.sh
+ if [[ ! "$RBENV_CC" && ! "$(brew list | grep -w "gcc")" ]]; then
+ e_header "Installing Homebrew-alt gcc recipe"
+ echo "Note: this step can take 15+ minutes, but a non-LLVM gcc is required by rbenv."
+ skip || brew install https://github.com/adamv/homebrew-alt/raw/master/duplicates/gcc.rb
+ fi
+fi
View
@@ -0,0 +1,13 @@
+# Ubuntu-only stuff. Abort if not Ubuntu.
+[[ "$(cat /etc/issue 2> /dev/null)" =~ Ubuntu ]] || return 1
+
+# Update apt
+sudo apt-get update
+sudo apt-get -qqy upgrade
+
+# Install tools and programs.
+sudo apt-get -qqy install build-essential
+sudo apt-get -qqy install git-core
+sudo apt-get -qqy install nodejs
+sudo apt-get -qqy install ruby rubygems1.8
+sudo apt-get -qqy install tree sl lesspipe
View
@@ -0,0 +1,17 @@
+# Install Npm.
+if [[ "$(type -P node)" && ! "$(type -P npm)" ]]; then
+ e_header "Installing Npm"
+ curl http://npmjs.org/install.sh | sh
+fi
+
+# Install Npm modules.
+if [[ "$(type -P npm)" ]]; then
+ modules=(jshint uglify-js)
+
+ { pushd "$(npm config get prefix)/lib/node_modules"; installed=(*); popd; } > /dev/null
+ list="$(to_install "${modules[*]}" "${installed[*]}")"
+ if [[ "$list" ]]; then
+ e_header "Installing Npm modules: $list"
+ npm install -g $list
+ fi
+fi
View
@@ -1,71 +0,0 @@
-# OSX-only stuff. Abort if not OSX.
-[[ "$OSTYPE" =~ ^darwin ]] || return 1
-
-# Install Homebrew.
-if [[ ! "$(type -P brew)" ]]; then
- e_header "Installing Homebrew"
- /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
- brew update
-fi
-
-# Install Homebrew recipes.
-if [[ "$(type -P brew)" ]]; then
- recipes=(git node rbenv ruby-build tree sl lesspipe)
-
- list="$(to_install "${recipes[*]}" "$(brew list)")"
- if [[ "$list" ]]; then
- e_header "Installing Homebrew recipes: $list"
- brew install $list
- fi
-
- # Newer OSX XCode comes with an LLVM gcc which rbenv can't use.
- source ~/.dotfiles/source/rbenv.sh
- if [[ ! "$RBENV_CC" && ! "$(brew list | grep -w "gcc")" ]]; then
- e_header "Installing Homebrew-alt gcc recipe"
- echo "Note: this step can take 15+ minutes, but a non-LLVM gcc is required by rbenv."
- skip || brew install https://github.com/adamv/homebrew-alt/raw/master/duplicates/gcc.rb
- fi
-fi
-
-# Install Ruby.
-if [[ "$(type -P rbenv)" ]]; then
- versions=(1.9.2-p290 1.8.7-p352)
-
- list="$(to_install "${versions[*]}" "$(rbenv versions | sed 's/^[* ]*//;s/ .*//')")"
- if [[ "$list" ]]; then
- e_header "Installing Ruby versions: $list"
- source ~/.dotfiles/source/rbenv.sh
- for version in $list; do CC="$RBENV_CC" rbenv install "$version"; done
- [[ "$(echo "$list" | grep -w "${versions[0]}")" ]] && rbenv global "${versions[0]}"
- rbenv rehash
- fi
-fi
-
-# Install Gems.
-if [[ "$(type -P gem)" ]]; then
- gems=(bundler awesome_print interactive_editor)
-
- list="$(to_install "${gems[*]}" "$(gem list | awk '{print $1}')")"
- if [[ "$list" ]]; then
- e_header "Installing Ruby gems: $list"
- gem install $list
- fi
-fi
-
-# Install Npm (for some reason, the brew recipe doesn't do this).
-if [[ "$(type -P node)" && ! "$(type -P npm)" ]]; then
- e_header "Installing Npm"
- curl http://npmjs.org/install.sh | sh
-fi
-
-# Install Npm modules.
-if [[ "$(type -P npm)" ]]; then
- modules=(jshint uglify-js)
-
- { pushd "$(npm config get prefix)/lib/node_modules"; installed=(*); popd; } > /dev/null
- list="$(to_install "${modules[*]}" "${installed[*]}")"
- if [[ "$list" ]]; then
- e_header "Installing Npm modules: $list"
- npm install -g $list
- fi
-fi
View
@@ -0,0 +1,25 @@
+source ~/.dotfiles/source/rbenv.sh
+
+# Install Ruby.
+if [[ "$(type -P rbenv)" ]]; then
+ versions=(1.9.2-p290 1.8.7-p352)
+
+ list="$(to_install "${versions[*]}" "$(rbenv versions | sed 's/^[* ]*//;s/ .*//')")"
+ if [[ "$list" ]]; then
+ e_header "Installing Ruby versions: $list"
+ for version in $list; do CC="$RBENV_CC" rbenv install "$version"; done
+ [[ "$(echo "$list" | grep -w "${versions[0]}")" ]] && rbenv global "${versions[0]}"
+ rbenv rehash
+ fi
+fi
+
+# Install Gems.
+if [[ "$(type -P gem)" ]]; then
+ gems=(bundler awesome_print interactive_editor)
+
+ list="$(to_install "${gems[*]}" "$(gem list | awk '{print $1}')")"
+ if [[ "$list" ]]; then
+ e_header "Installing Ruby gems: $list"
+ gem install $list
+ fi
+fi
View
@@ -1,3 +0,0 @@
-# Ubuntu-only stuff. Abort if not Ubuntu.
-[[ "$(cat /etc/issue 2> /dev/null)" =~ Ubuntu ]] || return 1
-
Submodule rbenv added at 114b81
Submodule ruby-build added at 414d44
View
@@ -1,4 +1,8 @@
-# Rbenv requires a non-LLVM gcc. So, attempt to find one.
+# Add rbenv and ruby-build binaries into the path.
+PATH=$PATH:~/.dotfiles/libs/rbenv/bin:~/.dotfiles/libs/ruby-build/bin
+export PATH
+
+# rbenv requires a non-LLVM gcc. So, attempt to find one.
# Note this issue:
# https://github.com/sstephenson/ruby-build/issues/109
export RBENV_CC="$(
@@ -14,6 +18,7 @@ export RBENV_CC="$(
done
)"
-# rbenv.
+# init.
[[ "$(type -P rbenv)" && ! "$(type -t _rbenv)" ]] && eval "$(rbenv init -)"
+
alias rbenv='CC="$RBENV_CC" rbenv'

0 comments on commit 3b9a468

Please sign in to comment.