Rakefile 795 Bytes
Newer Older
1
# frozen_string_literal: true
2

3 4 5
require "rake/testtask"

test_files = Dir.glob("test/**/*_test.rb")
6

7
desc "Default Task"
8 9 10
task default: :test

task :package
11 12

# Run the unit tests
Ondrej Sury's avatar
Ondrej Sury committed
13
Rake::TestTask.new do |t|
14 15
  t.libs << "test"
  t.test_files = test_files
16 17 18

  t.warning = true
  t.verbose = true
19
  t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
20 21 22
end

namespace :test do
23 24
  task :isolated do
    test_files.all? do |file|
25 26
      sh(Gem.ruby, "-w", "-Ilib:test", file)
    end || raise("Failures")
27
  end
28
end
29 30

task :lines do
31
  load File.expand_path("..", __dir__) + "/tools/line_statistics"
32 33
  files = FileList["lib/**/*.rb"]
  CodeTools::LineStatistics.new(files).print_loc
34 35
end

36
rule ".rb" => ".y" do |t|
37 38 39
  sh "racc -l -o #{t.name} #{t.source}"
end

40
task compile: "lib/action_dispatch/journey/parser.rb"