File: ruby-tests.rake

package info (click to toggle)
nanoc 4.13.3-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,576 kB
  • sloc: ruby: 41,538; sh: 31; makefile: 15
file content (56 lines) | stat: -rw-r--r-- 1,324 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require 'gem2deb/rake/spectask'
require 'gem2deb/rake/testtask'

ENV["CI"] = "1"

EXCLUDED_TESTS = [
  'nanoc/test/filters/test_markaby.rb',
  'nanoc/test/filters/test_rainpress.rb',
  'nanoc/test/filters/test_coffeescript.rb',
]

Gem2Deb::Rake::TestTask.new(:test_nanoc) do |t|
  t.libs = ['nanoc/test', 'nanoc/lib', 'nanoc-core/lib', 'nanoc-cli/lib', 'nanoc-spec/lib']
  t.test_files = FileList['nanoc/test/**/*_spec.rb'] + FileList['nanoc/test/**/test_*.rb']-EXCLUDED_TESTS
end

ENV["RUBYLIB"] ||= ""
ENV["RUBYLIB"] += ":" + File.expand_path(File.dirname(__FILE__) + "/../nanoc-spec/lib")


subprojects = %w[
  nanoc
  nanoc-core
  nanoc-cli
  nanoc-live
  nanoc-external
  nanoc-deploying
]
subprojects.each do |subproject|
  task "spec-#{subproject}" do |t|
    Dir.chdir(subproject) do |dir|
      puts "=> #{t.name}"
      begin
        mv 'lib',  'lib.off'
        ruby "-S", "rspec", "--exclude-pattern=spec/**/{gem,meta,manifest}_spec.rb"
      ensure
        mv 'lib.off',  'lib'
        puts
        puts "<= #{t.name}"
      end
    end
  end
end

task :default do
  subtasks = ["test_nanoc"] + subprojects.map { |p| "spec-#{p}" }
  failed = []
  subtasks.each do |t|
    begin
      Rake::Task[t].invoke
    rescue
      failed << t
    end
  end
  fail "Failed: #{failed.join(', ')}" unless failed.empty?
end