Skip to content

Commit

Permalink
added gem:install task that either runs 'rake install', 'rake install…
Browse files Browse the repository at this point in the history
…_gem', or builds + installs a gemspec file
  • Loading branch information
drnic committed Aug 22, 2008
1 parent 5f57fe7 commit adf450f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gem/install.sake
@@ -0,0 +1,19 @@
namespace 'gem' do
desc "Builds and installs a gem within its source; uses 'rake install[_gem]' or the gemspec"
task :install do
install_tasks = `rake -T | grep "^rake install" | sed -e "s/#.*//" | sed -e "s/^rake //"`.split("\n")
if install_tasks.size > 0
task = install_tasks.first.strip
puts "Running 'rake #{task}'..."
sh "rake #{task}"
exit
end
if gemspec = Dir['*.gemspec'].first
puts "Building #{gemspec}"
sh "gem build #{gemspec}"
gem = `ls -t *.gem`.split("\n").first
puts "Installing #{gem}"
sh "sudo gem install #{gem}"
end
end
end

0 comments on commit adf450f

Please sign in to comment.