forked from 18F/before-you-ship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
go
executable file
·87 lines (66 loc) · 2.08 KB
/
go
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
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /usr/bin/env ruby
require 'English'
Dir.chdir File.dirname(__FILE__)
def try_command_and_restart(command)
exit $CHILD_STATUS.exitstatus unless system command
exec RbConfig.ruby, *[$PROGRAM_NAME].concat(ARGV)
end
begin
require 'bundler/setup' if File.exist? 'Gemfile'
rescue LoadError
try_command_and_restart 'gem install bundler'
rescue SystemExit
try_command_and_restart 'bundle install'
end
begin
require 'go_script'
rescue LoadError
try_command_and_restart 'gem install go_script' unless File.exist? 'Gemfile'
abort "Please add \"gem 'go_script'\" to your Gemfile"
end
require 'guides_style_18f'
extend GoScript
check_ruby_version '2.1.5'
command_group :dev, 'Development commands'
def_command :update_nav, 'Update the \'navigation:\' data in _config.yml' do
GuidesStyle18F.update_navigation_configuration Dir.pwd
end
def_command :update_theme, 'Update the guides_style_18f gem' do
exec_cmd 'bundle update --source guides_style_18f'
end
def_command :update_gems, 'Update Ruby gems' do |gems|
update_gems gems
end
def_command :serve, 'Serve the site at localhost:4000' do
serve_jekyll
end
def_command :build, 'Build the site' do
build_jekyll
end
def_command :test_build, 'Build the site for testing' do
# https://github.com/jekyll/jekyll/issues/4122#issuecomment-159439360
build_jekyll('-d _test_site/')
end
require 'html-proofer'
# keep in sync with the `ignoreUrls` in `./assets/js/before-you-ship.js`
BASE_PROOFER_OPTS = {
url_ignore: [
%r{https://github.com/18F/Accessibility_Reviews}i,
%r{https://github.com/18F/DevOps}i,
%r{https://github.com/18F/handbook}i,
%r{https://github.com/18F/writing-lab},
# https://github.com/gjtorikian/html-proofer/issues/118
'#'
]
}
def_command :ci_test, 'Build and test the site, checking local URLs only' do
test_build
HTMLProofer.check_directory('./_test_site', BASE_PROOFER_OPTS.merge(
disable_external: true
)).run
end
def_command :test, 'Build and test the site, checking all URLs' do
test_build
HTMLProofer.check_directory('./_test_site', BASE_PROOFER_OPTS).run
end
execute_command ARGV