require 'pathname' gem_name = Pathname.new(File.expand_path('..', __FILE__)).children.find{ |ch| ch.file? and ch.basename.to_s =~ /\.gemspec$/ }.basename('.gemspec').to_s task :gem do system "rm -f *.gem" system "gem build #{gem_name}.gemspec" system "gem push #{gem_name}-*.gem" system "rm -f *.gem" end task :install do system "rm -f *.gem" system "gem build #{gem_name}.gemspec" system "sudo gem install #{gem_name}-*.gem" system "rm -f #{gem_name}-*.gem" end task :uninstall do system "sudo gem uninstall -x #{gem_name}" end