-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
103 lines (86 loc) · 2.63 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
require "rails"
require "rake"
require "bundler"
Bundler::GemHelper.install_tasks
require "bundler/setup"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "engine_cart/rake_task"
require "solr_wrapper"
require "solr_wrapper/rake_task"
require "blacklight/allmaps/rake_task"
task default: :ci
desc "Run specs"
RSpec::Core::RakeTask.new
task ci: ["engine_cart:generate"] do
system "rake blacklight_allmaps:seed"
Rake::Task["spec"].invoke
end
namespace :blacklight_allmaps do
desc "Put sample data into solr"
task seed: ["engine_cart:generate"] do
within_test_app do
ENV["RAILS_ENV"] ||= "test"
# Seed Blacklight data
# system "rake blacklight:index:seed"
# Seed GeoBlacklight data
# system "rake geoblacklight:index:seed[:remote]"
if ENV["LIGHT"] == "geoblacklight"
# Seed Blacklight Allmaps GeoBlacklight data
system "rake blacklight_allmaps:index:gbl_fixtures"
else
# Seed Blacklight Allmaps Blacklight data
system "rake blacklight_allmaps:index:bl_fixtures"
end
# Harvest Allmaps data
# rake db:fixtures:load (if necessary)
# system "rake blacklight_allmaps:sidecars:harvest:allmaps"
end
end
desc "Run Solr and Blacklight 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(__dir__, "solr", ENV["LIGHT"], "conf")) do
Rake::Task["blacklight_allmaps:seed"].invoke
within_test_app do
system "bundle exec rails s #{args[:rails_server_args]}"
end
end
end
end
desc "Run Solr and seed with sample data"
task :solr 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", ENV["LIGHT"], "conf")
) do
system "rake blacklight_allmaps:seed"
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