Sha256: 92cfb91d457677a71f4c4474b2f1ea7c4debeef872cbff51bae424715d03ac52

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'rubygems'
require 'rake'

begin
  require 'jeweler'
  j = Jeweler::Tasks.new do |gem|
    gem.name = "capcode-render-binary"
    gem.summary = %Q{Capcode plugin to render binary file}
    gem.description = gem.summary
    gem.email = "gregoire.lejeune@free.fr"
    gem.homepage = "http://github.com/glejeune/Capcode.more/tree/master/%s" % gem.name
    gem.authors = ["Gregoire Lejeune"]
  end
  Jeweler::GemcutterTasks.new
rescue LoadError
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end

require 'json/pure'
require 'open-uri'

VERS = j.jeweler.version
NAME = j.jeweler.gemspec.name

class Rubygems
  def initialize
    url = "http://rubygems.org/api/v1/gems/#{NAME}.json"
    @version_at_rubygems = JSON.parse( open(url).read )["version"]
  end
  
  def status
    version == VERS
  end
  def self.status
    self.new.status
  end
  
  def version
    @version_at_rubygems
  end
  def self.version
    self.new.version
  end
end

namespace :gemcutter do
  desc "push to gemcutter"
  task :push => [:build] do
    unless Rubygems.status
      sh %{gem push pkg/#{NAME}-#{VERS}.gem}, :verbose => true
    else
      puts "This gem already existe in version #{VERS}!"
    end
  end
  
  desc "check gemcutter status"
  task :status do
    if Rubygems.status
      puts "This gem already existe in version #{VERS}!"
    else
      puts "This gem (#{VERS}) has nos been published! Last version at gemcutter is #{Rubygems.version}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capcode-render-binary-0.2.0 Rakefile