-
Notifications
You must be signed in to change notification settings - Fork 25
/
Rakefile
50 lines (40 loc) · 1.18 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
# -*- ruby -*-
begin
require 'rake'
require 'rspec/core/rake_task'
rescue LoadError
end
task :default => :prepare
task :prepare => :install_lockjar do
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
require 'lock_jar'
# get jarfile relative the gem dir
lockfile = File.expand_path("../Jarfile.lock", __FILE__)
LockJar.install(lockfile)
end
end
task :install_lockjar do
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
require 'rubygems'
require 'rubygems/dependency_installer'
inst = Gem::DependencyInstaller.new
inst.install 'lock_jar', '~> 0.7.2'
end
end
desc "Run all RSpec tests"
require 'rspec'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
# setting for rake compiler
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
require 'lock_jar'
LockJar.lock
locked_jars = LockJar.load
require 'rake/javaextensiontask'
Rake::JavaExtensionTask.new('diametric') do |ext|
jruby_home = ENV['MY_RUBY_HOME'] # this is available of rvm
jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar'] + locked_jars
ext.classpath = jars.map {|x| File.expand_path x}.join ':'
ext.name = 'diametric_service'
end
end