class GemHadar

def gem_push_task

def gem_push_task
  namespace :gem do
    path = "pkg/#{name_version}.gem"
    desc "Push gem file #{File.basename(path)} to rubygems"
    task :push do
      if File.exist?(path)
        if ask?("Do you really want to push #{path.inspect} to rubygems? "\
          "(yes/NO) ", /\Ayes\z/i)
        then
          sh "gem push #{path}"
        else
          exit 1
        end
      else
        warn "Cannot push gem to rubygems: #{path.inspect} doesn't exist."
        exit 1
      end
    end
  end
end