This repository was archived by the owner on Aug 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
73 lines (61 loc) · 2.22 KB
/
Rakefile
File metadata and controls
73 lines (61 loc) · 2.22 KB
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
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
LisSequenceSearch::Application.load_tasks
task :default => :'jasmine:ci'
# Travis Tasks
namespace :travis do
task :install do
Rake::Task["travis:create_db_config"].execute
Rake::Task["travis:quorum_settings"].execute
Rake::Task["travis:db_migrate"].execute
end
task :spec do
Rake::Task["travis:install"].execute
["rake jasmine:ci JASMINE_PORT=53331"].each do |cmd|
puts "Starting to run #{cmd}..."
system("export DISPLAY=:99.0 && bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0
end
Rake::Task["travis:remove_db_config"].execute
end
task :db_migrate => :environment do
puts "Migrating the database..."
cmds = [
"rake quorum:install:migrations",
"rake db:migrate",
"rake db:test:prepare"
]
cmds.each do |cmd|
system("bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0
end
end
task :quorum_settings => :environment do
puts "Installing quorum_settings..."
settings = File.expand_path("../spec/config/quorum_settings.yml", __FILE__)
config = File.expand_path("../config", __FILE__)
FileUtils.cp settings, config
end
task :create_db_config do
config = File.expand_path("../config", __FILE__)
File.open(File.join(config, "database.yml"), "w+") do |file|
file.puts "\nmysql: &mysql\n adapter: mysql2\n" <<
" database: lis_sequence_search_test\n username: root\n"
file.puts "\npostgresql: &postgresql\n adapter: postgresql\n" <<
" database: lis_sequence_search_test\n username: postgres\n" <<
" min_messages: ERROR\n"
file.puts "\ndefaults: &defaults\n pool: 5\n" <<
" timeout: 5000\n host: localhost\n" <<
" <<: *<%= ENV['DB'] %>\n"
file.puts "\ntest:\n <<: *defaults"
end
end
task :remove_db_config do
config = File.expand_path("../config", __FILE__)
if File.exists?(File.join(config, "database.yml"))
FileUtils.rm File.join(config, "database.yml")
end
end
end