forked from samvera-deprecated/rubydora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
73 lines (57 loc) · 1.79 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
70
71
72
require 'rubygems'
require 'bundler'
require 'jettywrapper'
require 'bundler/gem_tasks'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
# Get your spec rake tasks working in RSpec 2.0
require 'rspec/core/rake_task'
desc 'Default: run ci build.'
task :default => :ci
desc "Run specs"
RSpec::Core::RakeTask.new do |t|
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
t.rcov = true
t.rcov_opts = %w{--exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data}
end
end
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.options = ["--readme", "README.rdoc"]
end
desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -I lib -r rubydora.rb"
end
desc "Execute Continuous Integration build"
task :ci => 'jetty:clean' do
unless ENV['environment'] == 'test'
exec("rake ci environment=test")
end
jetty_params = {
:jetty_home => File.expand_path(File.dirname(__FILE__) + '/jetty'),
:quiet => false,
:jetty_port => ENV['TEST_JETTY_PORT'] || 8983,
:solr_home => File.expand_path(File.dirname(__FILE__) + '/jetty/solr'),
:fedora_home => File.expand_path(File.dirname(__FILE__) + '/jetty/fedora/default'),
:startup_wait => 90,
:java_opts => ['-Xmx256m', '-XX:MaxPermSize=128m']
}
error = Jettywrapper.wrap(jetty_params) do
Rake::Task['coverage'].invoke
Rake::Task['yard'].invoke
end
raise "test failures: #{error}" if error
end
desc "Execute specs with coverage"
task :coverage do
# Put spec opts in a file named .rspec in root
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
ENV['COVERAGE'] = 'true' unless ruby_engine == 'jruby'
Rake::Task['spec'].invoke
end