Sha256: ff3d518052734a5277f9b16ef6228f155c4449a3bac6409c248cf49256d9e5c7

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

require "rubygems"
require "echoe"

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

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.github.com/mediainfo"
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mediainfo-0.6.1 Rakefile