Permalink
Browse files

I only use these tasks on OSX

  • Loading branch information...
Gabe Berke-Williams
Gabe Berke-Williams committed Nov 13, 2011
1 parent 0ec8a9a commit a0b95d95cd80cd12d3b7a0c259141e4a5d3c3c29
Showing with 7 additions and 51 deletions.
  1. +3 −24 tasks/better_thor.thor
  2. +4 −27 tasks/install.thor
View
@@ -26,40 +26,19 @@ class BetterThor < Thor
say "==> #{message}", :green
end
- def windows?
- Config::CONFIG['host_os'] =~ /mswin|mingw/
- end
-
- def osx?
- Config::CONFIG['host_os'] =~ /darwin/
- end
-
def ruby_19?
Config::CONFIG['MAJOR'] == '1' && Config::CONFIG['MINOR'] == '9'
end
# platform-specific way to represent a dotfile
# .file for Unix, _file for Windows
def dotfile_path(fname)
- if windows?
- "_#{fname}"
- else
- ".#{fname}"
- end
+ ".#{fname}"
end
def home_directory
- if ruby_19?
- # Ruby 1.9 handles Windows home dirs just fine
- # http://redmine.ruby-lang.org/issues/show/1147
- File.expand_path("~")
- else
- if windows?
- ENV['USERPROFILE']
- else
- ENV['HOME']
- end
- end
+ # Ruby 1.9 handles Windows home dirs just fine
+ ruby_19? ? File.expand_path("~") : ENV['HOME']
end
def homebrew_installed?
View
@@ -1,27 +1,15 @@
class Install < BetterThor
default_task :all
- # install:all is platform-dependent
- CROSS_PLATFORM = [:vim]
- UNIX = [:rvm] + CROSS_PLATFORM
- WINDOWS = [:pik] + CROSS_PLATFORM
- OSX = [:brews] + UNIX
+ ALL = [:brews, :rvm, :vim]
desc "all", "Install a good starting point for your platform"
def all
- if windows?
- WINDOWS.each{|t| invoke t }
- elsif osx?
- OSX.each{|t| invoke t }
- else
- UNIX.each{|t| invoke t }
- end
+ ALL.each{|t| invoke t }
end
- desc "homebrew", "Install homebrew (OSX only)"
+ desc "homebrew", "Install homebrew"
def homebrew
- fail "Not OSX, can't install Homebrew" unless osx?
-
installing 'homebrew'
# Don't fail, since they may have a broken install
warn "Homebrew already installed!" if homebrew_installed?
@@ -64,25 +52,14 @@ class Install < BetterThor
system "brew install colordiff colormake ack fortune git macvim watch memcached"
end
- desc "rvm", "Install RVM (Unixy OSes only)"
+ desc "rvm", "Install RVM"
def rvm
- fail "RVM doesn't work on Windows, install:pik instead" if windows?
-
installing 'RVM'
# Requires "bash -c" because by default, the system command uses
# /bin/sh, which chokes on the "<"s
system '/bin/bash -c "bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )"'
end
- desc "pik", "Install Pik (Windows only)"
- def pik
- fail "Pik is Windows-only, install:rvm instead" unless windows?
-
- `gem install pik`
- announce("Installed Pik gem, now run pik_install")
- announce("Help: https://github.com/vertiginous/pik")
- end
-
desc "npm", "Install NPM, the node package manager"
def npm
system "curl http://npmjs.org/install.sh | sh"

0 comments on commit a0b95d9

Please sign in to comment.