Skip to content
Browse files

Make development dependencies easier to install.

There's a Rake task that will install frex and racc now, and the tasks
that generate the CSS parser are smarter about trying to find the racc
binary.

  # installs frex and racc
  $ rake install:deps
  • Loading branch information...
1 parent 20d5d3d commit da6292db83366196c2b0da247628d3507db11d7a @jbarnette jbarnette committed Nov 26, 2008
Showing with 43 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +7 −0 README.txt
  3. +34 −1 Rakefile
View
2 .gitignore
@@ -13,3 +13,5 @@ lib/nokogiri/css/generated_tokenizer.rb
mkmf.log
cross
tags
+stash
+
View
7 README.txt
@@ -73,6 +73,13 @@ The bug tracker is available here:
* sudo gem install nokogiri
+== DEVELOPMENT:
+
+Developing Nokogiri requires racc and frex.
+
+* rake install:deps
+* rake test
+
== LICENSE:
(The MIT License)
View
35 Rakefile
@@ -87,7 +87,9 @@ end
file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
begin
- sh "racc -o #{t.name} #{t.prerequisites.first}"
+ racc = `which racc`.strip
+ racc = "#{::Config::CONFIG['bindir']}/racc" if racc.empty?
+ sh "#{racc} -o #{t.name} #{t.prerequisites.first}"
rescue
abort "need racc, get the tarball from http://i.loveruby.net/archive/racc/racc-1.4.5-all.tar.gz"
end
@@ -279,6 +281,37 @@ namespace :test do
end
end
+namespace :install do
+ desc "Install frex and racc for development"
+ task :deps => %w(frex racc)
+
+ directory "stash"
+
+ file "stash/racc-1.4.5-all.tar.gz" => "stash" do |t|
+ puts "Downloading racc to #{t.name}..."
+
+ Dir.chdir File.dirname(t.name) do
+ url = "http://i.loveruby.net/archive/racc/racc-1.4.5-all.tar.gz"
+ system "wget #{url} || curl -O #{url}"
+ end
+ end
+
+ task :racc => "stash/racc-1.4.5-all.tar.gz" do |t|
+ sh "tar xvf #{t.prerequisites.first} -C stash"
+
+ Dir.chdir "stash/#{File.basename(t.prerequisites.first, ".tar.gz")}" do
+ sh "ruby setup.rb config"
+ sh "ruby setup.rb setup"
+ sh "sudo ruby setup.rb install"
+ end
+
+ puts "The racc binary is likely in #{::Config::CONFIG["bindir"]}."
+ end
+
+ task :frex do
+ sh "sudo gem install aaronp-frex -s http://gems.github.com"
+ end
+end
# Only do this on unix, since we can't build on windows
unless windows

0 comments on commit da6292d

Please sign in to comment.
Something went wrong with that request. Please try again.