Skip to content

Commit

Permalink
fix development tasks:
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Apr 2, 2013
1 parent f7c12db commit 1173feb
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions rakelib/package.rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'rubygems'
require 'rubygems/package_task'

begin
require 'rake/extensiontask'
require 'rake/javaextensiontask'
Expand All @@ -24,24 +26,32 @@ else
unless RUBY_PLATFORM =~ /mswin|mingw/
ext.cross_compile = true
ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']

# inject 1.8/1.9 pure-ruby entry point
ext.cross_compiling do |spec|
spec.files += ["lib/#{ext.name}.rb"]
end
end
def hack_cross_compilation(ext)
# inject 1.8/1.9 pure-ruby entry point
# HACK: add these dependencies to the task instead of using cross_compiling
ext.cross_platform.each do |platform|
task = "native:#{GEMSPEC.name}:#{platform}"
if Rake::Task.task_defined?(task)
Rake::Task[task].prerequisites.unshift "lib/#{ext.name}.rb"
end
end
end

Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
em = Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
ext.ext_dir = 'ext'
ext.source_pattern = '*.{h,c,cpp}'
setup_cross_compilation(ext)
end
Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
hack_cross_compilation em

ff = Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
ext.ext_dir = 'ext/fastfilereader'
ext.source_pattern = '*.{h,c,cpp}'
setup_cross_compilation(ext)
end
hack_cross_compilation ff
end

# Setup shim files that require 1.8 vs 1.9 extensions in win32 bin gems
Expand Down Expand Up @@ -83,16 +93,4 @@ def gem_cmd(action, name, *args)
sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'"
end

Rake::Task[:clean].enhance [:clobber_package]

namespace :gem do
desc 'Install gem (and sudo if required)'
task :install => :package do
gem_cmd(:install, "pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem")
end

desc 'Uninstall gem (and sudo if required)'
task :uninstall do
gem_cmd(:uninstall, "#{GEMSPEC.name}", "-v=#{GEMSPEC.version}")
end
end
Rake::Task[:clean].enhance [:clobber_package]

0 comments on commit 1173feb

Please sign in to comment.