-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
69 lines (52 loc) · 1.54 KB
/
Rakefile
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
60
61
62
63
64
65
66
67
68
69
# encoding: UTF-8
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/clean'
require 'rake/testtask'
require 'ssc.nob/version'
# If PKG_DIR or JAR_FILE are changed,
# then 'config/warble.rb' also needs to be changed.
PKG_DIR = 'pkg'
JAR_FILE = File.join(PKG_DIR,'ssc.nob.jar')
CLEAN.exclude('.git/','stock/')
CLOBBER.include('doc/')
task default: [:test]
Rake::TestTask.new do |t|
t.libs = ['lib','test']
t.pattern = File.join('test','**','*_test.rb')
t.description += ": '#{t.pattern}'"
t.options = '--pride'
t.verbose = true
t.warning = true
end
desc 'Create a runnable Jar using Warbler for release'
task :jar do |t|
puts <<~HELP
============================================
Make sure Warbler is installed:
[jruby]$ bundler install
[jruby]$ bundler update
Or if the above doesn't work:
[jruby]$ gem install warbler
If this task fails, try using Bundler:
[jruby]$ bundler exec rake jar
Or try using Warbler directly:
$ warble
Check 'config/warble.rb' for configuration.
============================================
HELP
mkdir(PKG_DIR,verbose: true) unless Dir.exist?(PKG_DIR)
sh('warble')
end
# This doesn't depend on ':jar' task
# because Warbler naively deletes and creates a new Jar every time.
desc 'Run the Jar created by Warbler'
task :runjar do |t|
# Manually create the Jar only if it doesn't exist.
if !File.exist?(JAR_FILE)
jar_task = Rake::Task[:jar]
jar_task.reenable
jar_task.invoke
end
sh('java','-jar',JAR_FILE)
end