-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
126 lines (111 loc) · 3.38 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# encoding: UTF-8
# frozen_string_literal: true
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 'solr_wrapper/rake_task'
require 'engine_cart/rake_task'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'solr_wrapper/rake_task'
desc 'Run RuboCop style checker'
RuboCop::RakeTask.new(:rubocop) do |task|
task.requires << 'rubocop-rspec'
task.fail_on_error = true
end
task(:spec).clear
RSpec::Core::RakeTask.new(:spec) do |t|
t.verbose = false
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'
system 'RAILS_ENV=test bundle exec rails webpacker:compile'
end
Rake::Task['geoblacklight:coverage'].invoke
end
end
# Run JavaScript tests
Rake::Task['teaspoon'].invoke
end
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
desc 'Run Solr and seed with sample data'
task :solr do
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
sleep
rescue Interrupt
puts 'Shutting down...'
end
end
end
end
end
end
task default: [:ci]