-
Notifications
You must be signed in to change notification settings - Fork 113
/
config.rb
117 lines (102 loc) · 4.04 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
require "./helpers/constants"
require "./lib/languages"
require "./helpers/custom_helpers"
require "./helpers/deployment_walkthrough_helpers"
require "./lib/kramdown_patch"
include CustomHelpers
include DeploymentWalkthroughHelpers
#################################################
# Page options, layouts, aliases and proxies
#################################################
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
# proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
# :which_fake_page => "Rendering a fake page with a local variable" }
redir = Proc.new do |path, url|
prefix = URI(config[:url_root]).path
<<-END
<html>
<head>
<link rel="canonical" href="#{prefix}#{url}" />
<meta http-equiv=refresh content="0; url=#{prefix}#{url}" />
<meta name="robots" content="noindex,follow" />
<meta http-equiv="cache-control" content="no-cache" />
</head>
<body>
</body>
</html>
END
end
redirect("index.html", {to: "/tutorials/what_is_passenger/index.html"}, &redir)
redirect('tutorials/index.html', {to: '/tutorials/what_is_passenger/index.html'}, &redir)
redirect('advanced_guides/index.html', {to: '/advanced_guides/install_and_upgrade/index.html'}, &redir)
redirect('references/index.html', {to: '/references/config_reference/index.html'}, &redir)
[:oss, :enterprise].each do |edition|
proxy "/tutorials/deploy_to_production/launch_server/#{edition}/index.html",
"/tutorials/deploy_to_production/launch_server/shared/index.html"
[:digital_ocean,:aws].each do |platform|
proxy "/tutorials/deploy_to_production/launch_server/#{edition}/#{platform}/index.html",
"/tutorials/deploy_to_production/launch_server/shared/#{platform}/index.html"
end
end
[:oss, :enterprise].each do |edition|
[:digital_ocean,:ownserver,:aws].each do |platform|
proxy "/tutorials/deploy_to_production/installations/#{edition}/#{platform}/index.html",
"/tutorials/deploy_to_production/installations/#{edition}/platform.html"
[:meteor,:ruby,:node,:python].each do |lang|
proxy "/tutorials/deploy_to_production/installations/#{edition}/#{platform}/#{lang}/index.html",
"/tutorials/deploy_to_production/installations/#{edition}/lang.html"
[:apache,:nginx, :standalone].each do |integration|
proxy "/tutorials/deploy_to_production/installations/#{edition}/#{platform}/#{lang}/#{integration}/index.html",
"/tutorials/deploy_to_production/installations/#{edition}/shared/#{lang}/#{integration}/index.html"
end
end
end
end
[:oss, :enterprise].each do |edition|
[:digital_ocean,:ownserver,:aws].each do |platform|
proxy "/tutorials/deploy_to_production/deploying_your_app/#{edition}/#{platform}/index.html",
"/tutorials/deploy_to_production/deploying_your_app/platform.html"
[:meteor,:ruby,:node,:python].each do |lang|
proxy "/tutorials/deploy_to_production/deploying_your_app/#{edition}/#{platform}/#{lang}/index.html",
"/tutorials/deploy_to_production/deploying_your_app/lang.html"
end
end
end
#################################################
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
set :markdown_engine, :kramdown
set :relative_links, true
activate :syntax
activate :relative_assets
configure :development do
set :url_root, DEVELOPMENT_URL_ROOT
set :hiring_banner, true
end
# Build-specific configuration
configure :build do
set :url_root, PRODUCTION_URL_ROOT
set :google_analytics, false
set :hiring_banner, true
activate :search_engine_sitemap
end
# external pipeline/webpack
activate :external_pipeline,
name: :webpack,
command: build? ? 'npm run build' : 'npm run watch',
source: 'tmp/webpack',
latency: 1