[cairo-commit:00173] rcairo/rcairo [master] Jeweler -> gemspec + bundler

null+rcairo at clear-code.com null+rcairo at clear-code.com
Sun Mar 25 10:23:14 UTC 2012


Kouhei Sutou	2012-03-25 19:23:14 +0900 (Sun, 25 Mar 2012)

  New Revision: 74b8a9e4dac0ab84412c172a1eb89f04d1e98b53

  Log:
    Jeweler -> gemspec + bundler

  Added files:
    cairo.gemspec
  Modified files:
    Gemfile
    Rakefile

  Modified: Gemfile (+1 -11)
===================================================================
--- Gemfile    2012-03-25 18:40:00 +0900 (4a37145)
+++ Gemfile    2012-03-25 19:23:14 +0900 (914657b)
@@ -2,14 +2,4 @@
 
 source "http://rubygems.org/"
 
-gem 'pkg-config'
-
-group :development, :test do
-  gem "test-unit"
-  gem "test-unit-notify"
-  gem "rake"
-  gem "rake-compiler"
-  gem "jeweler"
-  gem "yard"
-  gem "packnga"
-end
+gemfile

  Modified: Rakefile (+5 -40)
===================================================================
--- Rakefile    2012-03-25 18:40:00 +0900 (14b7cb0)
+++ Rakefile    2012-03-25 19:23:14 +0900 (718ac0e)
@@ -7,7 +7,7 @@ require 'fileutils'
 require 'rubygems'
 require 'rubygems/package_task'
 require 'yard'
-require 'jeweler'
+require 'bundler/gem_helper'
 require 'rake/extensiontask'
 require 'packnga'
 
@@ -19,44 +19,9 @@ $LOAD_PATH.unshift(cairo_ext_dir)
 $LOAD_PATH.unshift(cairo_lib_dir)
 ENV["RUBYLIB"] = "#{cairo_lib_dir}:#{cairo_ext_dir}:#{ENV['RUBYLIB']}"
 
-def guess_rcairo_version(cairo_ext_dir)
-  version = {}
-  File.open(File.join(cairo_ext_dir, "rb_cairo.h")) do |rb_cairo_h|
-    rb_cairo_h.each_line do |line|
-      case line
-      when /\A#define RB_CAIRO_VERSION_([A-Z]+) (\d+)/
-        version[$1.downcase] = $2
-      end
-    end
-  end
-  [version["major"], version["minor"], version["micro"]].join(".")
-end
-
-ENV["VERSION"] ||= guess_rcairo_version(cairo_ext_dir)
-version = ENV["VERSION"].dup
-spec = nil
-Jeweler::Tasks.new do |_spec|
-  spec = _spec
-  spec.name = "cairo"
-  spec.version = version
-  spec.rubyforge_project = 'cairo'
-  spec.homepage = 'http://cairographics.org/rcairo'
-  authors = File.join(base_dir, "AUTHORS")
-  spec.authors = ["Kouhei Sutou"]
-  spec.email = ["kou at cozmixng.org"]
-  spec.summary = 'Ruby bindings for cairo'
-  spec.description = "Ruby bindings for cairo"
-  spec.license = "Ruby's"
-  spec.files = FileList["{lib,samples}/**/*.rb",
-                        "ext/**/{*.def,depend,*.rb,*.c,*.h}",
-                        "AUTHORS", "COPYING", "GPL", "Gemfile",
-                        "NEWS", "README.rdoc", "Rakefile"]
-  spec.test_files = FileList["test/**/*.rb"]
-end
-
-Rake::Task["release"].prerequisites.clear
-Jeweler::RubygemsDotOrgTasks.new do
-end
+helper = Bundler::GemHelper.new(base_dir)
+helper.install
+spec = helper.gemspec
 
 Gem::PackageTask.new(spec) do |pkg|
   pkg.need_tar_gz = true
@@ -132,7 +97,7 @@ end
 
 # for releasing
 task :dist do
-  sh "./dist.sh", version
+  sh "./dist.sh", spec.version
 end
 
 # for documentation

  Added: cairo.gemspec (+44 -0) 100644
===================================================================
--- /dev/null
+++ cairo.gemspec    2012-03-25 19:23:14 +0900 (f9c97f4)
@@ -0,0 +1,44 @@
+# -*- mode: ruby; coding: utf-8 -*-
+
+base_dir = File.dirname(__FILE__)
+cairo_ext_dir = File.join(base_dir, "ext", "cairo")
+
+guess_rcairo_version = lambda do |cairo_ext_dir|
+  version = {}
+  File.open(File.join(cairo_ext_dir, "rb_cairo.h")) do |rb_cairo_h|
+    rb_cairo_h.each_line do |line|
+      case line
+      when /\A#define RB_CAIRO_VERSION_([A-Z]+) (\d+)/
+        version[$1.downcase] = $2
+      end
+    end
+  end
+  [version["major"], version["minor"], version["micro"]].join(".")
+end
+
+Gem::Specification.new do |s|
+  s.name = "cairo"
+  s.version = guess_rcairo_version.call(cairo_ext_dir)
+  s.authors = ["Kouhei Sutou"]
+  s.email = ["kou at cozmixng.org"]
+  s.summary = "Ruby bindings for cairo"
+  s.description = "Ruby bindings for cairo"
+  s.homepage = "http://cairographics.org/rcairo"
+  s.licenses = ["Ruby's"]
+  s.require_paths = ["lib"]
+  s.rubyforge_project = "cairo"
+  s.extensions = ["ext/cairo/extconf.rb"]
+
+  s.files = ["AUTHORS", "COPYING", "GPL", "Gemfile", "NEWS", "README.rdoc"]
+  s.files += ["Rakefile"]
+  s.files += Dir.glob("{lib,samples}/**/*.rb")
+  s.files += Dir.glob("ext/**/{*.def,depend,*.rb,*.c,*.h}")
+  s.test_files = Dir.glob("test/**/*.rb")
+  s.extra_rdoc_files = ["README.rdoc"]
+
+  s.add_runtime_dependency("pkg-config")
+  s.add_development_dependency("bundler")
+  s.add_development_dependency("test-unit-notify")
+  s.add_development_dependency("rake-compiler")
+  s.add_development_dependency("packnga")
+end



More information about the cairo-commit mailing list