Skip to content

Instantly share code, notes, and snippets.

@NeMO84
Created April 11, 2011 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeMO84/914608 to your computer and use it in GitHub Desktop.
Save NeMO84/914608 to your computer and use it in GitHub Desktop.
Rakefile fix for gwik's Rakefile running on diff version of rspec
require 'rubygems'
require 'rspec/core/rake_task'
# Make tasks (originally from curb) -----------------------------------------------------
MAKECMD = ENV['MAKE_CMD'] || 'make'
MAKEOPTS = ENV['MAKE_OPTS'] || ''
FFMPEG_SO = "ext/FFMPEG_core.#{Config::MAKEFILE_CONFIG['DLEXT']}"
file 'ext/Makefile' => 'ext/extconf.rb' do
Dir.chdir('ext') do
ruby "extconf.rb #{ENV['EXTCONF_OPTS']}"
end
end
def make(target = '')
Dir.chdir('ext') do
pid = system("#{MAKECMD} #{MAKEOPTS} #{target}")
$?.exitstatus
end
end
# Let make handle dependencies between c/o/so - we'll just run it.
file FFMPEG_SO => (['ext/Makefile'] + Dir['ext/*.c'] + Dir['ext/*.h']) do
m = make
fail "Make failed (status #{m})" unless m == 0
end
desc "Compile the shared object"
task :compile => [FFMPEG_SO]
task :build => :compile do
%x{cd 'ext' && make clean all && cd '..'}
$?.success?
end
task :default => :build
desc "Run specs"
RSpec::Core::RakeTask.new do |t|
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
# Put spec opts in a file named .rspec in root
end
desc "Generate code coverage"
RSpec::Core::RakeTask.new(:coverage) do |t|
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
t.rcov = true
t.rcov_opts = ['--exclude', 'spec']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment