Skip to content
Permalink
Browse files
place website files in root during production build, and fix ruby errors
  • Loading branch information
ahgittin committed Dec 15, 2014
1 parent b1bf9d7 commit 73bc5f9b61a0503a58d95af85721963e3be0a950
Showing 5 changed files with 27 additions and 14 deletions.
@@ -1,9 +1,15 @@
#!/bin/bash -e

set -x
function build() {
echo JEKYLL running with: jekyll build --config _config.yml,_build/production-config.yml
jekyll build --config _config.yml,_build/production-config.yml || return 1
echo JEKYLL completed, now promoting _site/website/ to _site/
# the generated files are already in _site/ due to url rewrites along the way, but images etc are not
cp -r _site/website/* _site/
rm -rf _site/website
echo FINISHED: website pages are in `pwd`/_site
}

rm -rf _site
( jekyll build --config _config.yml,_scripts/production-config.yml &&
echo site docs are in `pwd`/_site ) ||
echo ERROR - could not build docs in `pwd`
build || echo ERROR: could not build docs in `pwd`

@@ -1,6 +1,8 @@

url: https://brooklyn.incubator.apache.org
baseurl: ""

path:
website: ""

dependency_mode: remote

@@ -6,7 +6,7 @@
#
module BrooklynMetadata

BROOKLYN_VERSION = "0.7.0-M1"
BROOKLYN_VERSION = "0.7.0-M1" unless defined? BROOKLYN_VERSION

class Generator < Jekyll::Generator
def generate(site)
@@ -57,4 +57,4 @@ def generate(site)
}
end
end
end
end
@@ -17,7 +17,7 @@ def initialize(tag_name, text, tokens)
end
def render(context)
jekyllSite = context.registers[:site]
dir = jekyllSite.source+'/'+File.dirname(context['page']['url'])
dir = jekyllSite.source+'/'+File.dirname(context['page']['path'])
filename = @text.strip
filename = context[filename] || filename
if !filename.match(/^\/.*/)
@@ -43,7 +43,7 @@ def render(context)
# support vars (above) and relative paths in filename (below - need the right path if there is a subsequent link)
dir = filename
if !filename.match(/^\/.*/)
dir = File.dirname(context['page']['url']) + '/' + filename
dir = File.dirname(context['page']['path']) + '/' + filename
end
dir = dir.gsub(/\/\/+/,'/')
filename = dir.sub(/^.*\//, '')
@@ -1,8 +1,8 @@
# Builds a hierarchical structure for the site, based on the YAML front matter of each page
# Starts from a page called "index.md", and follows "children" links in the YAML front matter
module SiteStructure
ROOT = "/website/index.md"

BROOKLYN_WEBSITE_ROOT = "/website/index.md" unless defined? BROOKLYN_WEBSITE_ROOT

class Generator < Jekyll::Generator
def find_page_with_path_absolute_or_relative_to(site, path, referrent)
@@ -16,12 +16,17 @@ def find_page_with_path_absolute_or_relative_to(site, path, referrent)
end

throw "Could not find a page called: #{path} (referenced from #{referrent ? referrent.path : "root"})" unless page


if (page.url.start_with?("/website"))
page.url.slice!("/website")
page.url.prepend(site.config['path']['website'])
end

page
end

def generate(site)
root_page = find_page_with_path_absolute_or_relative_to(site, SiteStructure::ROOT, nil)
root_page = find_page_with_path_absolute_or_relative_to(site, SiteStructure::BROOKLYN_WEBSITE_ROOT, nil)
navgroups = root_page.data['navgroups']
navgroups.each do |ng|
ng['page'] = find_page_with_path_absolute_or_relative_to(site, ng['page'], root_page)
@@ -30,7 +35,7 @@ def generate(site)
end
end
site.data['navgroups'] = navgroups
site.data['structure'] = gen_structure(site, SiteStructure::ROOT, nil, navgroups)
site.data['structure'] = gen_structure(site, SiteStructure::BROOKLYN_WEBSITE_ROOT, nil, navgroups)
end

def gen_structure(site, pagename, parent, navgroups)

0 comments on commit 73bc5f9

Please sign in to comment.