forked from travis-ci/travis-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
27 lines (22 loc) · 734 Bytes
/
Rakefile
File metadata and controls
27 lines (22 loc) · 734 Bytes
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
require "knapsack"
namespace :db do
env = ENV["ENV"] || 'test'
abort "Cannot run rake db:create in production." if env == 'production'
url = "https://raw.githubusercontent.com/travis-ci/travis-migrations/master/db/main/structure.sql"
file = 'db/structure.sql'
system "curl -fs #{url} -o #{file} --create-dirs"
abort "failed to download #{url}" unless File.exist?(file)
desc "Create and migrate the #{env} database"
task :create do
sh "createdb travis_#{env}" rescue nil
sh "psql -q travis_#{env} < #{file}"
end
end
namespace :spec do
desc 'Run all specs'
task :all do
sh 'bundle exec rspec -r spec_helper spec'
end
end
task :default => :'spec:all'
Knapsack.load_tasks if defined?(Knapsack)