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 :default do system "gem build #{gem_name}.gemspec" system "sudo gem install *.gem" end task :clean do system "sudo gem uninstall -x #{gem_name}" system "rm -f *.gem" end task :push do system "gem push *.gem" end