summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2019-06-04 20:19:38 -0600
committermo <mo.khan@gmail.com>2019-06-04 20:19:38 -0600
commit0f3a597eead0e8ddbe693c021ee63adda56ab88c (patch)
tree0bc24e09abb6decd9573c583543a96dcc995caa0 /Rakefile
parentfc5df8dafe0c0cdeeded97e06d0a6bb06a6a656e (diff)
accept command line argument to run specific exercise
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile19
1 files changed, 8 insertions, 11 deletions
diff --git a/Rakefile b/Rakefile
index f906359..855f0a8 100644
--- a/Rakefile
+++ b/Rakefile
@@ -10,6 +10,10 @@ Rake::PackageTask.new("comp-268-2", DateTime.now.strftime("%y%m").to_i) do |pack
])
end
+def run_cli(selection = nil)
+ sh "java -cp target/assignment2*.jar ca.mokhan.comp268.App #{selection}"
+end
+
task(:pdf) do
Dir["src/**/*.md"].each do |file|
sh "node ./node_modules/.bin/mdpdf #{file}"
@@ -21,16 +25,9 @@ task(:clean) { sh 'rm -fr pkg target' }
task(:test) { sh 'mvn test' }
task(doc: [:pdf]) { sh 'mvn javadoc:javadoc' }
task publish: [:clean, :test, :doc, :repackage]
-task :run do
- sh "mvn package"
- sh "java -cp target/assignment2*.jar ca.mokhan.comp268.App"
-end
-
-task :run1 do
- Dir.chdir 'src/Q1' do
- sh 'javac ReversedSentence.java'
- sh 'java ReversedSentence'
- end
-end
+task(:build) { sh "mvn package" }
+task(run: :build) { run_cli }
+task(run1: :build) { run_cli(1) }
+task(:run2) { run_cli(2) }
task default: [:publish]