Sha256: 456d3c561b17efc4ea8759e9e4dc52ee01a3c8f893abdeb68d9a25bc6867ded3

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

require 'rubygems'
require 'rake'

begin
  require 'jeweler'
  j = Jeweler::Tasks.new do |gem|
    gem.name = "capcode-render-static"
    gem.summary = %Q{Capcode plugin to render static 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"]
    
    gem.add_dependency('mime-types')
  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-static-0.4.0 Rakefile