-
Notifications
You must be signed in to change notification settings - Fork 9
/
config.rb
67 lines (58 loc) · 2.48 KB
/
config.rb
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
require 'govuk_tech_docs'
require 'html-proofer'
require 'fileutils'
GovukTechDocs::SourceUrls.class_eval do
def report_issue_url
"mailto:[email protected]?subject=Problem with GOV.UK Pay technical documentation"
end
end
GovukTechDocs.configure(self)
after_build do |builder|
begin
js_source_file = File.join(config[:build_dir], 'javascripts', 'application.min.js')
js_target_file = File.join(config[:build_dir], 'javascripts', 'application.js')
File.rename(js_source_file, js_target_file)
puts "Renamed JavaScript file from application.min.js to application.js"
HTMLProofer.check_directory(config[:build_dir],
{ :assume_extension => true,
:disable_external => true,
:allow_hash_href => true,
:empty_alt_ignore => true,
:log_level => ':debug',
:url_ignore => [
/.+-authentication/,
/.+-before-you-start/,
/.+-filtering-by-date/,
/.+-set-up-3d-secure/,
/.+-splitting-results-into-pages/,
/.+-copy-your-details-into-your-gov-uk-pay-account/,
/.+-set-up-notification-settings/,
/.+-test-your-configuration/,
/.+-set-up-an-api-user/,
/.+-the-gov-uk-pay-api/,
/.+creating-a-refund-amount/,
/.+creating-a-payment-amount/,
/.+before-you-switch-to-live-support/,
/.+support-2/,
/.+set-the-payment-capture-method/
],
:url_swap => { "https://docs.payments.service.gov.uk" => "" } }).run
rescue RuntimeError => e
abort e.to_s
end
end
redirect "payment_flow_overview/index.html", to: "payment_flow/index.html"
redirect "send_card_details_api/index.html", to: "moto_payments/moto_send_card_details_api/index.html"
# Expose external assets (common analytics files) to to sprockets loader
sprockets.append_path File.join root, "node_modules"
ignore '*.test.js'
# All linked assets referenced by sprockets have to exist or they will throw
# LoadFile errors during the build process. In order to allow developers to work
# on the project without installing additional (npm) shared client side JavaScripts
# ensure all of the directories required for the common analytics code exists at
# build time
after_configuration do
FileUtils.mkdir_p 'node_modules/@govuk-pay/pay-js-commons/lib/analytics/dist'
FileUtils.mkdir_p 'node_modules/govuk-frontend/govuk/components/button'
FileUtils.touch 'node_modules/govuk-frontend/govuk/components/button/_button.scss'
end