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
|
require 'date'
require 'rake/packagetask'
task :tarball do
Rake::PackageTask.new("comp-268-2", DateTime.now.strftime("%y%m").to_i) do |package|
package.need_tar_gz = true
package.package_files.add([
'.dockerignore',
'.gitignore',
'Dockerfile',
'Gemfile*',
'README.*',
'Rakefile',
'doc/*.pdf',
'package.json',
'pom.xml',
'src/**/*.java',
'src/**/*.md',
'src/**/*.pdf',
'yarn.lock',
])
end
Rake.application['repackage'].invoke
end
def run_cli(selection = nil)
sh "java -cp target/assignment2*.jar ca.mokhan.comp268.App #{selection}"
end
task(:pdf) do
mdpdf = `yarn bin mdpdf`.chomp
Dir.chdir(__dir__) do
readmes = (Dir["src/**/*.md"] + ['README.md']).sort
readmes.each do |file|
sh "node #{mdpdf} #{file}"
end
end
end
task(:clean) { sh 'rm -fr pkg target src/**/README.pdf' }
task(:test) { sh 'mvn test' }
task(doc: [:pdf]) { sh 'mvn javadoc:javadoc' }
task publish: [:clean, :test, :doc, :tarball]
task(:build) { sh "mvn package" }
desc "run the CLI"
task(run: :build) { run_cli }
1.upto(10) do |n|
desc "run the CLI for program #{n}"
task("run#{n}": :build) { run_cli(n) }
end
task default: [:publish]
|