forked from manchester-tech-events/techevents-nw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile.rb
50 lines (42 loc) · 1.1 KB
/
rakefile.rb
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
@run_options = {verbose: Rake.application.options.trace}
task :default => [:ruby_dependencies, :test, :git]
task :ruby_dependencies do
sh 'bundle install --path gems'
end
task :test => :set_env do
Dir.glob('./tests/**/*.rb').each do |test|
clear_db
rake_sh 'ruby '+ test
end
end
task :current_test do
clear_db
rake_sh "ruby tests/integration/test_add_l2_circuit_as_a_service.rb"
end
task :run do
ENV['RACK_ENV']='production'
sh 'rackup -s puma'
end
def clear_db
sh "mongo data-store --eval \"db.dropDatabase()\""
sh "mongo view-store --eval \"db.dropDatabase()\""
sh "mongo event-store --eval \"db.dropDatabase()\""
end
task :set_env do
ENV['VIEW_STORE_CONNECTION_STRING'] = 'mongodb://localhost/view-store'
ENV['DATA_STORE_CONNECTION_STRING'] = 'mongodb://localhost/data-store'
end
task :git => :ruby_dependencies do
require 'bundler/setup'
require 'git_repository'
message = ENV['m']
raise 'no commit message specified' if message.nil?
git = GitRepository.new
git.pull
git.add({:options => '-A'})
git.commit(message: message )
git.push
end
def rake_sh(command)
sh command, @run_options
end