forked from cloudfoundry-attic/dea_ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
45 lines (35 loc) · 920 Bytes
/
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
# coding: UTF-8
require "ci/reporter/rake/rspec"
require "rspec/core/rake_task"
require "rspec/core/version"
Dir.glob(File.expand_path("../lib/tasks/*", __FILE__)).each { |f| require f }
reports_dir = File.expand_path("spec_reports")
ENV["CI_REPORTS"] = reports_dir
task :ensure_coding do
patterns = [
/Rakefile$/,
/\.rb$/,
]
files = `git ls-files`.split.select do |file|
patterns.any? { |e| e.match(file) }
end
header = "# coding: UTF-8\n\n"
files.each do |file|
content = File.read(file)
unless content.start_with?(header)
File.open(file, "w") do |f|
f.write(header)
f.write(content)
end
end
end
end
namespace :config do
desc "Check if configuration file is valid"
task :check, :file do |t, args|
require "yaml"
require "dea/config"
config = YAML.load(File.read(args[:file]))
Dea::Config.schema.validate(config)
end
end