forked from cloudfoundry/cloud_controller_ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
51 lines (41 loc) · 1.32 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
ENV['SINATRA_ACTIVESUPPORT_WARNING'] = 'false'
if ENV['DB'] == 'postgresql'
warn('Resetting env var DB from postgresql to postgres...')
ENV['DB'] = 'postgres'
end
require File.expand_path('config/boot', __dir__)
require 'yaml'
require 'sequel'
require 'steno'
require 'cloud_controller'
require_relative 'lib/tasks/rake_config'
Rails.application.load_tasks
begin
require 'parallel_tests/tasks'
rescue LoadError
# this isn't needed in a production environment so the gem will not exist
end
default_tasks = [:rubocop_autocorrect, 'spec:all', :check_doc_links]
task default: default_tasks
task rubocop_autocorrect: :environment do
require 'rubocop'
cli = RuboCop::CLI.new
exit_code = cli.run(%w[--autocorrect --fail-level autocorrect])
exit(exit_code) if exit_code != 0
end
desc 'Check docs for broken links'
task check_doc_links: :environment do
require 'English'
require 'rainbow'
puts Rainbow('Checking links in all docs...').green
Bundler.with_unbundled_env do
Dir.chdir('docs/v3') do
cmd = 'bundle install && npm install && npm run checkdocs'
py2_path = '/usr/bin/python2.7'
cmd = "npm config set python #{py2_path} #{cmd}" if File.exist?(py2_path)
status = system(cmd)
exit $CHILD_STATUS.exitstatus unless status
puts Rainbow('check_doc_links OK').green
end
end
end