-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy patharclight.rake
73 lines (63 loc) · 1.91 KB
/
arclight.rake
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
# frozen_string_literal: true
require 'solr_wrapper'
require 'engine_cart/rake_task'
require 'rspec/core/rake_task'
require 'arclight'
class DependencyNotInstalled < StandardError; end
desc 'Run test suite'
task ci: %w[arclight:generate] do
SolrWrapper.wrap do |solr|
solr.with_collection do
Rake::Task['arclight:seed'].invoke
within_test_app do
## Do stuff inside arclight app here
end
Rake::Task['spec'].invoke
end
end
end
desc 'Run Eslint'
task :eslint do
raise DependencyNotInstalled, 'ESLint not found. Please run yarn install.' unless File.exist?('./node_modules/.bin/eslint')
exit 1 unless system './node_modules/.bin/eslint app/assets/javascripts'
end
namespace :arclight do
desc 'Generate a test application'
task generate: %w[engine_cart:generate]
desc 'Run Solr and Blacklight for interactive development'
task :server, %i[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
print 'Starting Solr...'
SolrWrapper.wrap do |solr|
puts 'done.'
solr.with_collection do
Rake::Task['arclight:seed'].invoke
within_test_app do
system "bundle exec rails s #{args[:rails_server_args]}"
end
end
end
end
desc 'Seed fixture data to Solr'
task :seed do
puts 'Seeding index with data from spec/fixtures/ead...'
Dir.glob('spec/fixtures/ead/*.xml').each do |file|
# no REPOSITORY_ID
ENV['FILE'] = file
Rake::Task['arclight:index'].invoke
end
Dir.glob('spec/fixtures/ead/*').each do |dir|
next unless File.directory?(dir)
ENV['REPOSITORY_ID'] = File.basename(dir)
ENV['REPOSITORY_FILE'] = 'spec/fixtures/config/repositories.yml'
ENV['DIR'] = dir
Rake::Task['arclight:index_dir'].invoke
end
end
end