forked from geoblacklight/geoblacklight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
97 lines (85 loc) · 2.62 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# encoding: UTF-8
require 'rails'
begin
require 'bundler/setup'
require 'bundler/gem_tasks'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'solr_wrapper'
require 'engine_cart/rake_task'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
desc 'Run style checker'
RuboCop::RakeTask.new(:rubocop) do |task|
task.requires << 'rubocop-rspec'
task.fail_on_error = true
end
desc 'Run test suite and style checker'
task spec: :rubocop do
RSpec::Core::RakeTask.new(:spec)
end
desc 'Run Teaspoon JavaScript tests'
task :teaspoon do
system('teaspoon --require=.internal_test_app/spec/teaspoon_env.rb')
end
desc 'Run test suite'
task ci: ['geoblacklight:generate'] do
SolrWrapper.wrap do |solr|
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'conf')) do
within_test_app do
system 'RAILS_ENV=test rake geoblacklight:index:seed'
end
Rake::Task['geoblacklight:coverage'].invoke
end
end
# Run JavaScript tests
Rake::Task['teaspoon'].invoke
end
spec = Gem::Specification.find_by_name 'geo_combine'
load "#{spec.gem_dir}/lib/tasks/geo_combine.rake"
namespace :geoblacklight do
desc 'Run tests with coverage'
task :coverage do
ENV['COVERAGE'] = 'true'
Rake::Task['spec'].invoke
end
desc 'Create the test rails app'
task generate: ['engine_cart:generate'] do
end
namespace :internal do
task seed: ['engine_cart:generate'] do
within_test_app do
system 'bundle exec rake geoblacklight:index:seed'
system 'bundle exec rake geoblacklight:downloads:mkdir'
end
end
end
desc 'Run Solr and GeoBlacklight for interactive development'
task :server, [:rails_server_args] do |_t, args|
if File.exist? EngineCart.destination
within_test_app do
system 'bundle update'
end
else
Rake::Task['engine_cart:generate'].invoke
end
SolrWrapper.wrap(port: '8983') do |solr|
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'conf')) do
Rake::Task['geoblacklight:internal:seed'].invoke
within_test_app do
puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
puts "\n^C to stop"
puts ' '
begin
system "bundle exec rails s #{args[:rails_server_args]}"
rescue Interrupt
puts 'Shutting down...'
end
end
end
end
end
end
task default: [:ci]