-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathconfig.rb
93 lines (77 loc) · 2.35 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
# Per-page layout changes:
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
page '/', layout: 'layout'
page '/learn/*', layout: 'guide', data: { sidebar: 'learn/sidebar' }
page '/blog/*', data: { sidebar: 'blog/sidebar' }
# Helpers
helpers do
def nav_link_to(link_text, url, options = {})
root = options.delete(:root)
is_active = (!root && current_page.url.start_with?(url)) ||
current_page.url == url
options[:class] ||= ''
options[:class] << '--is-active' if is_active
link_to(link_text, url, options)
end
def learn_root_resource
sitemap.find_resource_by_destination_path('learn/index.html')
end
def sections_as_resources(resource)
sections = resource.data.sections
sections.map do |s|
destination_path = resource.url + "#{s}/index.html"
sitemap.find_resource_by_destination_path(destination_path)
end
end
def head_title
current_page.data.title.nil? ? 'ROM' : "ROM - #{current_page.data.title}"
end
def copyright
"© 2014-#{Time.now.year} Ruby Object Mapper."
end
def design_by
url = 'https://github.com/angeloashmore'
"Design by #{link_to '@angeloashmore', url}."
end
def logo_by
url = 'https://github.com/kapowaz'
"Logo by #{link_to '@kapowaz', url}."
end
end
# General configuration
set :build_dir, 'docs'
set :layout, 'content'
set :css_dir, 'assets/stylesheets'
set :js_dir, 'assets/javascripts'
set :markdown_engine, :redcarpet
set :markdown, tables: true, autolink: true, gh_blockcode: true, fenced_code_blocks: true
set :disqus_embed_url, 'https://rom-rb-blog.disqus.com/embed.js'
activate :blog,
prefix: 'blog',
layout: 'blog_article',
permalink: '{title}.html',
paginate: true,
tag_template: 'blog/tag.html'
activate :syntax, css_class: 'syntax'
activate :directory_indexes
activate :external_pipeline,
name: :webpack,
command: build? ? './node_modules/webpack/bin/webpack.js --bail' : './node_modules/webpack/bin/webpack.js --watch -d',
source: '.tmp/dist',
latency: 1
if ENV['NEXT']
activate :deploy do |deploy|
deploy.deploy_method = :rsync
deploy.host = 'next.rom-rb.org'
deploy.path = '/var/www/next.rom-rb.org'
deploy.clean = true
end
else
activate :deploy, deploy_method: :git
end
# Development-specific configuration
configure :development do
activate :livereload
end