forked from crashlytics/crashlytics-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
46 lines (36 loc) · 1.24 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
#!/usr/bin/env rake
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'bundler/gem_tasks'
RSpec::Core::RakeTask.new('spec')
desc 'Run tests'
task :default => :spec
namespace :services do
desc 'Writes a YAML config to $FILE || the current directory'
task :config do
$:.unshift "#{ File.dirname(__FILE__) }/lib"
require 'service'
require 'yaml'
file = ENV['FILE'] || File.join(File.dirname(__FILE__), 'service_hooks.yml')
services = []
Service.services.each do |identifier, svc|
services << {
:identifier => identifier,
:name => svc.title,
:events => svc.handles,
:schema => svc.schema,
:pages => svc.pages }
end
services.sort! { |x, y| x[:identifier] <=> y[:identifier] }
output = YAML::dump(services)
File.open(file, 'w') { |io| io << output }
puts output
end
desc 'Copy service_hooks.yml to other projects'
task :copy do
file = ENV['FILE'] || File.join(File.dirname(__FILE__), 'service_hooks.yml')
FileUtils.cp file, '/srv/crashlytics/config/notifier/service_hooks.yml'
FileUtils.cp file, '/srv/crashlytics/config/www/service_hooks.yml'
FileUtils.cp file, '/crashlytics/chef/deploy/templates/default/service_hooks.yml'
end
end