Rakefile in mediainfo-0.5.1 vs Rakefile in mediainfo-0.6.0
- old
+ new
@@ -1,37 +1,60 @@
-require "rake/testtask"
-load "Rakefile.cloud" if File.exist? "Rakefile.cloud"
+require "rubygems"
+require "echoe"
-Rake::TestTask.new do |t|
- t.libs << "test"
- t.test_files = FileList["test/*_test.rb"]
- t.verbose = true
-end
-
-task :default => :test
-
-namespace :mediainfo do
- task :fixture do
- unless file = ENV["file"]
- puts "Usage: rake mediainfo:fixture file=/path/to/file"
- exit
- end
- fixture = File.expand_path "./test/fixtures/#{File.basename file}.txt"
- system "mediainfo #{file} > #{fixture}"
- if File.exist? fixture
- puts "Generated fixture #{fixture}."
- else
- puts "Error generating fixture. #{fixture} not created."
- end
+class Echoe
+ def honor_gitignore!
+ self.ignore_pattern += \
+ Dir["**/.gitignore"].inject([]) do |pattern,gitignore|
+ pattern.concat \
+ File.readlines(gitignore).
+ map { |line| line.strip }.
+ reject { |line| "" == line }.
+ map { |glob|
+ d = File.dirname(gitignore)
+ d == "." ? glob : File.join(d, glob)
+ }
+ end.flatten.uniq
end
end
-require "rubygems"
-require "echoe"
-
Echoe.new "mediainfo" do |p|
p.description = "Mediainfo is a class wrapping the mediainfo CLI (http://mediainfo.sourceforge.net)"
p.author = "Seth Thomas Rasmussen"
p.email = "sethrasmussen@gmail.com"
p.url = "http://greatseth.com"
p.ignore_pattern = %w( test/**/* )
+ p.honor_gitignore!
+end
+
+task :rexml do
+ ENV.delete "MEDIAINFO_XML_PARSER"
+ Rake::Task[:test].invoke
+end
+
+task :hpricot do
+ ENV["MEDIAINFO_XML_PARSER"] = "hpricot"
+ Rake::Task[:test].invoke
+end
+
+task :nokogiri do
+ ENV["MEDIAINFO_XML_PARSER"] = "nokogiri"
+ Rake::Task[:test].invoke
+end
+
+# TODO This doesn't work.
+task :all => [:rexml, :nokogiri, :hpricot]
+
+
+task :fixture do
+ unless file = ENV["FILE"]
+ puts "Usage: rake mediainfo:fixture file=/path/to/file"
+ exit
+ end
+ fixture = File.expand_path "./test/fixtures/#{File.basename file}.xml"
+ system "mediainfo #{file} --Output=XML > #{fixture}"
+ if File.exist? fixture
+ puts "Generated fixture #{fixture}."
+ else
+ puts "Error generating fixture. #{fixture} not created."
+ end
end