forked from snap-ci/docs.snap-ci.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.rb
147 lines (130 loc) · 5.66 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
require File.expand_path('../lib/helpers', __FILE__)
require File.expand_path('../lib/extensions', __FILE__)
require 'active_support/core_ext/numeric/time'
helpers AsArrayHelper
helpers TopicLinkTagHelper
helpers SidebarHelper
helpers ResourcesHelper
helpers CommandLineOutputHelper
helpers VersionsHelper
helpers ApiExampleRenderingHelper
Middleman::Extensions.register(:remove_ordering_prefix, RemoveOrderingPrefixExt)
Middleman::Extensions.register(:retina_image_ext, RetinaImageExt)
activate :retina_image_ext
activate :automatic_image_sizes
activate :remove_ordering_prefix
activate :directory_indexes
activate :syntax
configure :development do
activate :livereload
end
page "/sitemap.xml", :layout => false
ignore 'assets/**/*.txt'
ignore 'assets/**/*.html'
ignore 'api-requests/*'
ignore '.idea/*'
config[:file_watcher_ignore] += [
%r{api-requests/.*/response.headers.txt},
%r{api-requests/.*/response.body.json},
/^\.idea(\/|$)/,
/^lib(\/|$)/,
]
set :url_root, 'https://docs.snap-ci.com'
set :fonts_dir, 'assets/fonts'
set :css_dir, 'assets/stylesheets'
set :js_dir, 'assets/javascripts'
set :images_dir, 'assets/images'
set :partials_dir, 'partials'
set :markdown_engine, :kramdown
set :markdown, :auto_ids => false
if ENV['S3_BUCKET']
# to disable the warning about periods in s3 bucket name.
Fog.credentials = { :path_style => true }
activate :s3_redirect do |config|
config.bucket = ENV['S3_BUCKET']
config.region = 'us-east-1'
config.aws_access_key_id = ENV['S3_ACCESS_KEY']
config.aws_secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
# don't s3 redirect immediately after build
config.after_build = false
end
activate :s3_sync do |config|
config.bucket = ENV['S3_BUCKET']
config.region = 'us-east-1'
config.aws_access_key_id = ENV['S3_ACCESS_KEY']
config.aws_secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
config.delete = true
# don't s3 sync immediately after build
config.after_build = false
end
if ENV['CLOUDFRONT_DISTRIBUTION']
activate :cloudfront do |cf|
cf.access_key_id = ENV['S3_ACCESS_KEY']
cf.secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
cf.distribution_id = ENV['CLOUDFRONT_DISTRIBUTION']
cf.after_build = false # default is false
end
end
default_caching_policy max_age: 10.minutes, must_revalidate: true
%w(
the_ci_environment/index
the_ci_environment/languages
the_ci_environment/languages/index
the_ci_environment/languages/ruby-jruby
the_ci_environment/languages/python
the_ci_environment/languages/nodejs
the_ci_environment/languages/php
the_ci_environment/languages/java
the_ci_environment/languages/groovy-gradle
the_ci_environment/languages/c-c++
the_ci_environment/languages/android
the_ci_environment/databases/index
the_ci_environment/databases/relational
the_ci_environment/databases/no-sql
the_ci_environment/testing_with_browsers
the_ci_environment/complete-package-list
environment_variables
deployments/heroku_deployments
deployments/aws_deployments
working_with_branches/cloned_pipelines
working_with_branches/integration_pipelines
working_with_branches/automatic_branch_tracking
speeding_up_builds/pipeline_parallelism
speeding_up_builds/caching
notifications/campfire_and_hipchat_notifications
notifications/webhook_notifications
notifications/cctray_notifications
managing_your_github_connection/revoking_privileges
managing_your_github_connection/managing_membership
api/index
).each do |old_path|
new_path = old_path.gsub('_', '-')
new_path = new_path.gsub(/\/index$/, '') if new_path.end_with?('/index')
redirect "/#{old_path}/", "/#{new_path}/"
end
{
'/api/introduction/' => '/api/',
'/databases/' => '/the-ci-environment/databases/',
'/pipeline/introduction/' => '/pipeline/',
'/pipeline_clones_and_integration_pipelines/cloned_pipelines/' => '/working-with-branches/cloned-pipelines/',
'/pipeline_clones_and_integration_pipelines/integration_pipelines/' => '/working-with-branches/integration-pipelines/',
'/pipeline_clones_and_integration_pipelines/automatically_tracking_branches/' => '/working-with-branches/automatic-branch-tracking/',
'/pipeline_clones_and_integration_pipelines/automatic_branch_tracking/' => '/working-with-branches/automatic-branch-tracking/',
'/supported_platforms/' => '/the-ci-environment/',
'/the_ci_environment/the_ci_environment/' => '/the-ci-environment/',
'/the_ci_environment/languages/overview/' => '/the-ci-environment/languages/',
'/deployments/heroku/basic_heroku/' => '/deployments/heroku-deployments/',
'/deployments/heroku/custom_heroku_stage/' => '/deployments/heroku-deployments/',
'/notifications/campfire-and-hipchat-notifications' => '/notifications/campfire/',
'/the-ci-environment/languages/nodejs/' => '/the-ci-environment/languages/nodejs-iojs/',
}.each do |old_path, new_path|
redirect old_path.dup, new_path.dup
end
redirect '/', '/getting-started/'
end
configure :build do
activate :minify_css
activate :minify_javascript
activate :asset_hash
activate :relative_assets
end