File: Rakefile

package info (click to toggle)
ruby-marcel 1.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 13,236 kB
  • sloc: xml: 7,071; ruby: 601; makefile: 7; javascript: 3
file content (39 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new do |t|
  t.libs << "test"
  t.test_files = FileList['test/**/*_test.rb']
end

task default: :test

task :types do
  fixture_path = File.expand_path("../test/fixtures", __FILE__)

  tested_by_data = Dir["#{fixture_path}/magic/*/*"].map do |path|
    type = path.split("#{fixture_path}/magic/").last
  end

  tested_by_filename = Dir["#{fixture_path}/name/*/*"].sort.map do |path|
    type = path.split("#{fixture_path}/name/").last
    extensions = Dir["#{path}/*.*"].map { |file| File.extname(file) }
    [type, extensions]
  end

  puts "Test fixtures exist for the following types: "

  tested_by_filename.each do |(type, extensions)|
    if tested_by_data.include?(type)
      puts "    #{type} by (#{extensions.join(", ")}) and by file data"
    else
      puts "    #{type} by (#{extensions.join(", ")})"
    end
  end
end

desc "Generate data tables"
task tables: "lib/marcel/tables.rb"
file "lib/marcel/tables.rb" => %w[ data/tika.xml data/custom.xml ] do |target|
  exec "script/generate_tables.rb", *target.prerequisites, out: target.name
end