Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

move to rake-compiler

  • Loading branch information...
commit d5f3190093b8ff960551d54b8d28b9133cd75a41 1 parent 9254c61
@brianmario authored
View
7 .gitignore
@@ -1,9 +1,10 @@
_10lines_
doc
ext/Makefile
-ext/*.o
-ext/*.so
-ext/*.bundle
+*.o
+*.so
+*.bundle
pkg
.bundle
+tmp
Gemfile.lock
View
2  .rspec
@@ -0,0 +1,2 @@
+--colour
+--format=documentation
View
35 Rakefile
@@ -1,14 +1,35 @@
require 'bundler'
Bundler::GemHelper.install_tasks
-desc "Build the C extension"
-task :build_extensions do
- Dir.chdir File.expand_path('../ext', __FILE__) do
- system 'make distclean' if File.exists?('Makefile')
- system 'ruby extconf.rb && make'
+# rspec
+begin
+ require 'rspec'
+ require 'rspec/core/rake_task'
+
+ desc "Run all examples with RCov"
+ RSpec::Core::RakeTask.new('spec:rcov') do |t|
+ t.rcov = true
+ end
+ RSpec::Core::RakeTask.new('spec') do |t|
+ t.verbose = true
end
+
+ task :default => :spec
+rescue LoadError
+ puts "rspec, or one of its dependencies, is not available. Install it with: sudo gem install rspec"
end
-require 'rspec/core/rake_task'
+# rake-compiler
+require 'rake' unless defined? Rake
+
+gem 'rake-compiler', '>= 0.7.5'
+require "rake/extensiontask"
+
+Rake::ExtensionTask.new('bzip2') do |ext|
+ ext.cross_compile = true
+ ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
+
+ ext.lib_dir = File.join 'lib', 'bzip2'
+end
-RSpec::Core::RakeTask.new(:spec)
+Rake::Task[:spec].prerequisites << :compile
View
22 bzip2-ruby.gemspec
@@ -1,6 +1,4 @@
-# -*- encoding: utf-8 -*-
-$:.push File.expand_path('../lib', __FILE__)
-require 'bzip2/version'
+require './lib/bzip2/version'
Gem::Specification.new do |s|
s.name = 'bzip2-ruby'
@@ -8,13 +6,19 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.authors = ['Guy Decoux', 'Brian Lopezs']
s.email = ['seniorlopez@gmail.com']
+ s.extensions = ['ext/extconf.rb']
+ s.extra_rdoc_files = [
+ "README.rdoc"
+ ]
+ s.files = `git ls-files`.split("\n")
s.homepage = 'http://github.com/brianmario/bzip2-ruby'
- s.summary = 'Ruby C bindings to libbzip2.'
-
- s.extensions = ['ext/extconf.rb']
- s.files = `git ls-files`.split("\n")
- s.test_files = `git ls-files -- spec/*`.split("\n")
+ s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ['lib', 'ext']
+ s.rubygems_version = %q{1.4.2}
+ s.summary = 'Ruby C bindings to libbzip2.'
+ s.test_files = `git ls-files spec`.split("\n")
- s.add_development_dependency 'rspec', '>= 2.0.0'
+ # tests
+ s.add_development_dependency 'rake-compiler', ">= 0.7.5"
+ s.add_development_dependency 'rspec', ">= 2.0.0"
end
View
2  ext/bzip2.c → ext/bzip2/bzip2.c
@@ -1708,7 +1708,7 @@ static VALUE bz_s_new(int argc, VALUE *argv, VALUE obj) {
return res;
}
-void Init_bzip2_ext() {
+void Init_bzip2() {
VALUE bz_mBzip2;
VALUE bz_mBzip2Singleton;
View
4 ext/extconf.rb → ext/bzip2/extconf.rb
@@ -3,7 +3,7 @@
dir_config('bz2')
have_header('bzlib.h')
-$CFLAGS << ' -Wall -funroll-loops '
+$CFLAGS << ' -Wall -funroll-loops'
# $CFLAGS << ' -O0 -ggdb -Wextra'
if have_library("bz2", "BZ2_bzWriteOpen")
@@ -15,7 +15,7 @@
$CFLAGS << ' -DRUBY_19_COMPATIBILITY'
end
- create_makefile('bzip2_ext')
+ create_makefile('bzip2')
else
puts "libbz2 not found, maybe try manually specifying --with-bz2-dir to find it?"
end
View
1  lib/bzip2-ruby.rb
@@ -1 +0,0 @@
-require 'bzip2'
View
2  lib/bzip2.rb
@@ -1,4 +1,4 @@
-require 'bzip2_ext'
+require 'bzip2/bzip2'
require 'bzip2/version'
# This is the base module for the +bzip2-ruby+ gem. Beneath it are the classes
Please sign in to comment.
Something went wrong with that request. Please try again.