Sha256: d9c10954fe789c40906b05c2dff3c97dc3e00aecd7c194c12b5c25ff2d108101

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

require 'rspec/core/rake_task'
require 'rubygems/package_task'
require 'rake/extensiontask'

Dir[File.expand_path("../*gemspec", __FILE__)].reverse.each do |gemspec_path|
  gemspec = eval(IO.read(gemspec_path))
  Gem::PackageTask.new(gemspec).define
end

require 'ffi_yajl/version'

desc "Run all specs against both extensions"
task :spec do
  Rake::Task["spec:ffi"].invoke
  Rake::Task["spec:ext"].invoke
end

namespace :spec do
  desc "Run all specs against ffi extension"
  RSpec::Core::RakeTask.new(:ffi) do |t|
    ENV['FORCE_FFI_YAJL'] = "ffi"
    t.pattern = FileList['spec/**/*_spec.rb']
  end
  if !defined?(RUBY_ENGINE) || RUBY_ENGINE !~ /jruby/
    desc "Run all specs again c extension"
    RSpec::Core::RakeTask.new(:ext) do |t|
      ENV['FORCE_FFI_YAJL'] = "ext"
      t.pattern = FileList['spec/**/*_spec.rb']
    end
  end
end

desc "Build it and ship it"
task :ship => [:clean, :gem] do
  sh("git tag #{FFI_Yajl::VERSION}")
  sh("git push --tags")
  Dir[File.expand_path("../pkg/*.gem", __FILE__)].reverse.each do |built_gem|
    sh("gem push #{built_gem}")
  end
end

unix_gemspec = eval(File.read("ffi-yajl.gemspec"))

task :clean do
  sh "rm -rf pkg/* lib/ffi_yajl/ext/*"
end

desc "install the gem locally"
task :install => [:package] do
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
    sh %{gem install pkg/#{unix_gemspec.name}-#{unix_gemspec.version}-universal-java.gem}
  else
    sh %{gem install pkg/#{unix_gemspec.name}-#{unix_gemspec.version}.gem}
  end
end

spec = Gem::Specification.load('ffi-yajl.gemspec')

Rake::ExtensionTask.new do |ext|
  ext.name = 'libyajl'
  ext.lib_dir = 'lib'
  ext.ext_dir = 'ext/libyajl2'
  ext.gem_spec = spec
end

Rake::ExtensionTask.new do |ext|
  ext.name = 'encoder'
  ext.lib_dir = 'lib/ffi_yajl/ext'
  ext.ext_dir = 'ext/ffi_yajl/ext/encoder'
  ext.gem_spec = spec
end

Rake::ExtensionTask.new do |ext|
  ext.name = 'parser'
  ext.lib_dir = 'lib/ffi_yajl/ext'
  ext.ext_dir = 'ext/ffi_yajl/ext/parser'
  ext.gem_spec = spec
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-yajl-0.0.4 Rakefile
ffi-yajl-0.0.4-universal-java Rakefile
ffi-yajl-0.0.3-universal-java Rakefile
ffi-yajl-0.0.3 Rakefile