forked from sourcesense/cruise-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
74 lines (62 loc) · 1.77 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
71
72
73
74
require 'rake'
require 'rake/testtask'
require 'script/rake_utils'
require 'script/deploy_instance'
CONFIG_FILE = 'script/config.rb'
require_if_exists(CONFIG_FILE)
task :default => :'test:all'
desc 'Perform monitoring'
task :monitor do
begin
monitor = CruiseMonitor::Config::MONITOR
monitor.sync
rescue NameError
puts "Please, configure Cruise-monitor running:"
puts " rake init"
puts "Then edit '#{CONFIG_FILE}' file"
end
end
desc 'Initialize configuration'
task :init do
if File.exists?(CONFIG_FILE)
puts "Cruise-monitor is already configured."
puts "Edit '#{CONFIG_FILE}' to change configuration."
exit 0
end
FileUtils.copy("#{CONFIG_FILE}.example", CONFIG_FILE)
puts "Please, edit '#{CONFIG_FILE}' file"
end
desc 'Clean build info'
task :clean do
server = CruiseMonitor::Config::SERVER
File.delete(server.storage_path)
end
namespace :test do
desc 'Run all tests'
task :all => [ :unit, :integration, :acceptance ]
Rake::TestTask.new(:integration) do |t|
t.libs = ["test"] # so far, 'lib' sets monitor.rb in conflict with ruby dist
t.test_files = FileList['test/integration/**/*_test.rb']
t.verbose = false
end
Rake::TestTask.new(:acceptance) do |t|
t.libs << "test"
t.test_files = FileList['test/acceptance/**/*_test.rb']
t.verbose = false
end
Rake::TestTask.new(:unit) do |t|
t.libs << "test"
t.test_files = FileList['test/unit/**/*_test.rb']
t.verbose = false
end
end
desc 'Deploy on remote EC2 instances'
task :deploy do
options = {
:host => 'www.cruise-monitor.tk',
:user => 'ubuntu',
:credentials => in_home_folder('.ec2/build.pem')
}
instance = CruiseMonitor::DeployInstance.new(options)
instance.execute_remotely('server/script/remote_deploy_commands.sh')
end