Skip to content

Commit

Permalink
Rakefile: Add a method to install a gem
Browse files Browse the repository at this point in the history
  • Loading branch information
kalbasit committed Nov 2, 2011
1 parent baad78a commit 71f3c8b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ def find_gem(gem_name)
end
end

# Install a gem
#
# @param [String] The gem name
def install_gem(gem_name)
require 'rubygems'

# Install the gem only if it can't be found
if find_gem(gem_name).length == 0
sh "gem install #{gem_name}"
end
rescue Janus::RubyGemsNotFoundError
puts "Could not install the gem #{gem_name}, please do so manually."
puts "gem install #{gem_name}"
end

task expand("~/.vimrc") => "vimrc" do
sh "ln -s ~/.vim/vimrc ~/.vimrc"
end
Expand Down

0 comments on commit 71f3c8b

Please sign in to comment.