Repository navigation
Expand file tree
/
Copy pathRakefile
More file actions
59 lines (50 loc) · 1.4 KB
/
Copy pathRakefile
File metadata and controls
59 lines (50 loc) · 1.4 KB
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
57
58
59
require "rubygems"
require 'bundler/setup'
require "minitest/test_task"
# rake test: runs test/**/test_*.rb. The gems themselves are built from
# ocran.gemspec and ocran-source.gemspec (see .github/workflows/gem-release.yml).
Minitest::TestTask.create
task :default => :test
WINDOWS = Gem.win_platform?
STUB_DIR = "share/ocran"
BUILD_DIR = "src"
if WINDOWS
STUB_NAMES = %w[stub stubw]
STUB_EXE_EXT = ".exe"
else
STUB_NAMES = %w[stub]
STUB_EXE_EXT = ""
end
desc "Builds all necessary artifacts (currently stubs)"
task :build => :build_stub
task :build_stub do
if WINDOWS
sh "ridk exec make -C #{BUILD_DIR}"
STUB_NAMES.each do |name|
cp "#{BUILD_DIR}/#{name}.exe", "#{STUB_DIR}/#{name}.exe"
end
else
sh "make -C #{BUILD_DIR}"
cp "#{BUILD_DIR}/stub", "#{STUB_DIR}/stub"
File.chmod(0755, "#{STUB_DIR}/stub")
end
end
STUB_NAMES.each do |name|
stub_path = "#{STUB_DIR}/#{name}#{STUB_EXE_EXT}"
file stub_path => :build_stub
end
task :clean do
rm_f STUB_NAMES.map { |name| "#{STUB_DIR}/#{name}#{STUB_EXE_EXT}" }
if WINDOWS
sh "ridk exec make -C #{BUILD_DIR} clean"
else
sh "make -C #{BUILD_DIR} clean"
end
end
task :test_single, [:test_name] do |t, args|
if args[:test_name].nil?
puts "You must provide a test name. e.g., rake test_single[YourTestClassName]"
else
sh "ruby #{File.join("test", "test_ocra.rb")} -n test_#{args[:test_name]}"
end
end