This repository has been archived by the owner on Jun 2, 2021. It is now read-only.
forked from cloudfoundry/cloud_controller_ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
55 lines (44 loc) · 1.39 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
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 = ['spec:all', :check_doc_links]
ENV['RUBOCOP_FIRST'] ? default_tasks.unshift(:rubocop_autocorrect) : default_tasks.push(:rubocop_autocorrect)
task default: default_tasks
task :rubocop_autocorrect do
require 'rubocop'
cli = RuboCop::CLI.new
exit_code = cli.run(%w(--auto-correct --fail-level autocorrect))
exit(exit_code) if exit_code != 0
end
desc 'Check docs for broken links'
task :check_doc_links do
require 'English'
require 'rainbow'
puts Rainbow('Checking links in all docs...').green
Bundler.with_clean_env do
Dir.chdir('docs/v3') do
cmd = 'bundle install && npm install && npm run checkdocs'
py2_path = '/usr/bin/python2.7'
if File.exist?(py2_path)
cmd = "npm config set python #{py2_path} #{cmd}"
end
status = system(cmd)
exit $CHILD_STATUS.exitstatus if !status
puts Rainbow('check_doc_links OK').green
end
end
end