Browse files

modify the bundler:gemfile task to add the ':platform => :ruby' const…

…raint to rexical and racc in the generated Gemfile.
  • Loading branch information...
1 parent 0ed0d87 commit ae80ec138db5c89179f4beabfa24ae9bacfc51ea @jvshahid jvshahid committed Jul 24, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 Rakefile
@@ -118,6 +118,20 @@ desc "Generate css/parser.rb and css/tokenizer.rex"
task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
+# This is a big hack to make sure that the racc and rexical
+# dependencies in the Gemfile are constrainted to ruby platforms
+# (i.e. MRI and Rubinius). There's no way to do that through hoe,
+# and any solution will require changing hoe and hoe-bundler.
+old_gemfile_task = Rake::Task['bundler:gemfile']
+task 'bundler:gemfile' do
+ old_gemfile_task.invoke
+ lines ='Gemfile', 'r') { |f| f.readlines }.map do |line|
+ line =~ /racc|rexical/ ? "#{line.strip}, :platform => :ruby" : line
+ end
+'Gemfile', 'w') { |f| lines.each { |line| f.puts line } }
file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
racc = RbConfig::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
racc = "#{::RbConfig::CONFIG['bindir']}/racc" if racc.empty?

4 comments on commit ae80ec1


John, I'm getting

Don't know how to build task 'bundler:gemfile'

on both JRuby and MRI from "rake" or "rake test" . What am I missing? Should I install some gem?


Thanks, John. I could run "rake" as well as "rake test."

BTW, I can't see my previous comment on this. I'm not sure where that has gone. I'm glad you could read it.

Please sign in to comment.