-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRakefile
44 lines (39 loc) · 1.13 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
$:.unshift File.join( File.dirname(__FILE__), "lib")
require 'rspec/core/rake_task'
require 'sorting_office'
require 'colorize'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = '--exclude-pattern "spec/big_old_list_spec.rb"'
end
task :bootstrap do
# Download and extract database dump
puts "Downloading the database dump...".green
`wget https://s3-eu-west-1.amazonaws.com/download.openaddressesuk.org/sorting_office/dump.tar.gz 2>&1`
puts "Extracting the files...".green
`tar -zxvf dump.tar.gz 2>&1`
# Mongo import the extract
puts "Importing the data...".green
`mongorestore --db distiller ./dump/distiller 2>&1`
# Run the indexes
puts "Running the indexes...".green
Locality.es.index_all
Town.es.index_all
# Clean up
puts "Cleaning up...".green
`rm dump.tar.gz 2>&1`
`rm -rf ./dump 2>&1`
puts "Done!".green
end
namespace :es do
task :index do
print "Indexing localities...".yellow
Locality.es.index.create
Locality.es.index_all
print " Done!\n".green
print "Indexing towns...".yellow
Town.es.index.create
Town.es.index_all
print " Done!\n".green
end
end
task :default => :spec