-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
70 lines (61 loc) · 1.67 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
begin
require "bundler/setup"
rescue LoadError
warn "You must `gem install bundler` and `bundle install` to run rake tasks"
end
if defined?(YARD::Rake::YardocTask)
YARD::Rake::YardocTask.new(:yard)
end
begin
require "bundler/gem_tasks"
task :release do
unless `git rev-parse --abbrev-ref HEAD`.chomp == "master"
warn "Gem can only be released from the master branch"
exit 1
end
end
rescue Bundler::GemspecError
warn "Gem tasks not available because gemspec not defined"
end
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError
warn "You must install rspec to run the spec rake tasks"
end
require "standard/rake"
desc "run the specs using appraisal"
task :appraisals do
exec "bundle exec appraisal rake spec"
end
namespace :appraisals do
desc "install all the appraisal gemspecs"
task :install do
exec "bundle exec appraisal install"
end
end
namespace :data do
desc "Process the raw USGS GNIS file into separate CSV files"
task :preprocess_gnis_data do
require_relative "data/lib/us_geo_data"
USGeoData::Gnis.new.preprocess
end
desc "Generate the distribution CSV files from the raw data files and processed GNIS files"
task :dump_dist do
require_relative "data/lib/us_geo_data"
USGeoData.dump_all
end
end
namespace :db do
desc "Dump the database schema to db/schema.rb"
task :dump_schema do
exec <<~BASH
cd explorer_app
BUNDLE_GEMFILE=$(pwd)/Gemfile bundle
BUNDLE_GEMFILE=$(pwd)/Gemfile DATABASE_URL=sqlite3:tmp/db.sqlite3: bundle exec rails db:migrate
rm -f tmp/db.sqlite3
mv db/schema.rb ../db/schema.rb
BASH
end
end