Sha256: 64cc201be39bd5eedb42a1b4bcb674638a403d0f2d8acdcde17e3ac50444f5bc

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 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'

class MyGem
  attr_reader :local_version
  attr_reader :rubygems_version
  attr_reader :name
  
  def initialize( version, name )
    @local_version = version
    @name = name
    url = "http://rubygems.org/api/v1/gems/#{@name}.json"
    @rubygems_version = JSON.parse( open(url).read )["version"]
  end
  
  def status
    @rubygems_version == @local_version
  end
end

MYGEM = MyGem.new( j.jeweler.version, j.jeweler.gemspec.name )

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capcode-render-binary-0.3.0 Rakefile