made extension more rake-compiler friendly, made the spec task depend on "compile"

This commit is contained in:
Aaron Patterson 2010-06-30 08:06:39 +08:00 committed by Brian Lopez
parent fdf3e53933
commit 04b9fe17cc
6 changed files with 14 additions and 8 deletions

View File

@ -1,7 +1,7 @@
# encoding: UTF-8
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
JEWELER = Jeweler::Tasks.new do |gem|
gem.name = "mysql2"
gem.summary = "A simple, fast Mysql library for Ruby, binding to libmysql"
gem.email = "seniorlopez@gmail.com"
@ -10,7 +10,7 @@ begin
gem.require_paths = ["lib", "ext"]
gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n")
gem.files = `git ls-files`.split("\n")
gem.extensions = ["ext/extconf.rb"]
gem.extensions = ["ext/mysql2/extconf.rb"]
gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
# gem.rubyforge_project = "mysql2"
end
@ -20,6 +20,8 @@ end
require 'rake'
require 'spec/rake/spectask'
gem 'rake-compiler', '>= 0.4.1'
require "rake/extensiontask"
desc "Run all examples with RCov"
Spec::Rake::SpecTask.new('spec:rcov') do |t|
@ -32,4 +34,7 @@ end
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/']
t.spec_opts << '--options' << 'spec/spec.opts'
end
end
Rake::ExtensionTask.new("mysql2", JEWELER.gemspec)
Rake::Task[:spec].prerequisites << :compile

View File

@ -80,4 +80,4 @@ File.unlink 'confout'
$CFLAGS << ' -Wall -Wextra -funroll-loops'
# $CFLAGS << ' -O0 -ggdb3'
create_makefile('mysql2_ext')
create_makefile('mysql2/mysql2')

View File

@ -753,7 +753,7 @@ static VALUE rb_raise_mysql2_error(MYSQL *client) {
}
/* Ruby Extension initializer */
void Init_mysql2_ext() {
void Init_mysql2() {
rb_require("date");
rb_require("bigdecimal");

View File

@ -1,9 +1,9 @@
# encoding: UTF-8
require 'mysql2_ext'
require 'mysql2.so'
# = Mysql2
#
# A modern, simple and very fast Mysql library for Ruby - binding to libmysql
module Mysql2
VERSION = "0.1.8"
end
end

View File

@ -1,5 +1,6 @@
# encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
require 'rubygems'
require 'active_record'
require 'active_record/connection_adapters/mysql2_adapter'
@ -145,4 +146,4 @@ describe ActiveRecord::ConnectionAdapters::Mysql2Adapter do
test.set_test.should eql('val1,val2')
end
end
end
end