diff --git a/Rakefile b/Rakefile index ec3fa41..589d052 100644 --- a/Rakefile +++ b/Rakefile @@ -1,23 +1,20 @@ require 'bundler/setup' -Bundler::GemHelper.install_tasks -class Bundler::GemHelper - def clean? - sh_with_code('git diff --exit-code --ignore-submodules')[1] == 0 - end -end - require 'rspec/core/rake_task' + +Bundler::GemHelper.install_tasks RSpec::Core::RakeTask.new(:spec) -require File.expand_path '../ext/libv8/make.rb', __FILE__ -require File.expand_path '../ext/libv8/checkout.rb', __FILE__ -include Libv8::Make -include Libv8::Checkout +module Helpers + module_function + def get_binary_gemspec(platform = RUBY_PLATFORM) + gemspec = eval(File.read('libv8.gemspec')) + gemspec.platform = Gem::Platform.new(platform) + gemspec + end -desc "setup the vendored v8 source to correspond to the libv8 gem version" -task :checkout do - sh "git submodule update --init" - checkout! + def binary_gem_name + File.basename get_binary_gemspec.cache_file + end end desc "compile v8 via the ruby extension mechanism" @@ -25,30 +22,9 @@ task :compile do sh "ruby ext/libv8/extconf.rb" end -desc "manually invoke the GYP compile. Useful for seeing debug output" -task :manual_compile do - require File.expand_path '../ext/libv8/arch.rb', __FILE__ - include Libv8::Arch - Dir.chdir(V8_Source) do - sh %Q{#{make} -j2 #{libv8_arch}.release ARFLAGS.target=crs} - end -end - -def get_binary_gemspec(platform = RUBY_PLATFORM) - gemspec = eval(File.read('libv8.gemspec')) - gemspec.platform = Gem::Platform.new(platform) - gemspec -end - -begin - binary_gem_name = File.basename get_binary_gemspec.cache_file -rescue - binary_gem_name = '' -end - -desc "build a binary gem #{binary_gem_name}" +desc "build a binary gem #{Helpers.binary_gem_name}" task :binary => :compile do - gemspec = get_binary_gemspec + gemspec = Helpers.get_binary_gemspec gemspec.extensions.clear # We don't need most things for the binary gemspec.files = [] @@ -77,12 +53,5 @@ task :clean do sh "git submodule foreach git clean -df" end -desc "build a binary on heroku (you must have vulcan configured for this)" -task :vulcan => directory("tmp/vulcan") do - Dir.chdir('tmp/vulcan') do - sh "vulcan build -v -c 'LANG=en_US.UTF-8 export BIN=/`pwd`/bin && export GEM=$BIN/gem && curl https://s3.amazonaws.com/heroku-buildpack-ruby/ruby-1.9.3.tgz > ruby-1.9.3.tgz && tar xf ruby-1.9.3.tgz && cd /tmp && $GEM fetch libv8 --platform=ruby --version=#{Libv8::VERSION} && $GEM unpack libv8*.gem && $GEM install bundler -n $BIN --no-ri --no-rdoc && cd libv8-#{Libv8::VERSION} && $BIN/bundle && $BIN/bundle exec rake binary' -p /tmp/libv8-#{Libv8::VERSION}" - end -end - -task :default => [:checkout, :compile, :spec] -task :build => [:clean, :checkout] +task :default => [:compile, :spec] +task :build => [:clean] diff --git a/libv8.gemspec b/libv8.gemspec index 8ebd992..74ca21b 100644 --- a/libv8.gemspec +++ b/libv8.gemspec @@ -14,7 +14,6 @@ Gem::Specification.new do |s| s.rubyforge_project = "libv8" - s.files = `git ls-files`.split("\n") s.files += Dir.chdir("vendor/v8") do `git ls-files`.split("\n").reject {|f| f =~ /^out|^test|^benchmarks/}.map {|f| "vendor/v8/#{f}"} @@ -32,5 +31,4 @@ Gem::Specification.new do |s| s.add_development_dependency "rspec" s.add_development_dependency "rspec-spies" s.add_development_dependency "rubysl", "~> 2.0" if RUBY_ENGINE == "rbx" - s.add_development_dependency "vulcan" end