You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ri...@apache.org on 2014/12/17 18:54:09 UTC
[32/50] [abbrv] incubator-brooklyn-site git commit: place website
files in root during production build, and fix ruby errors
place website files in root during production build, and fix ruby errors
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/commit/73bc5f9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/tree/73bc5f9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/diff/73bc5f9b
Branch: refs/heads/master
Commit: 73bc5f9b61a0503a58d95af85721963e3be0a950
Parents: b1bf9d7
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Dec 15 16:25:58 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Dec 15 16:50:44 2014 +0000
----------------------------------------------------------------------
_build/production-build.sh | 14 ++++++++++----
_build/production-config.yml | 4 +++-
_plugins/brooklyn_metadata.rb | 4 ++--
_plugins/read.rb | 4 ++--
_plugins/site_structure.rb | 15 ++++++++++-----
5 files changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/blob/73bc5f9b/_build/production-build.sh
----------------------------------------------------------------------
diff --git a/_build/production-build.sh b/_build/production-build.sh
index b9a5134..6e0fb18 100755
--- a/_build/production-build.sh
+++ b/_build/production-build.sh
@@ -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`
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/blob/73bc5f9b/_build/production-config.yml
----------------------------------------------------------------------
diff --git a/_build/production-config.yml b/_build/production-config.yml
index e9a1f08..38ade04 100644
--- a/_build/production-config.yml
+++ b/_build/production-config.yml
@@ -1,6 +1,8 @@
url: https://brooklyn.incubator.apache.org
-baseurl: ""
+
+path:
+ website: ""
dependency_mode: remote
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/blob/73bc5f9b/_plugins/brooklyn_metadata.rb
----------------------------------------------------------------------
diff --git a/_plugins/brooklyn_metadata.rb b/_plugins/brooklyn_metadata.rb
index 32020a1..c0dcc3d 100644
--- a/_plugins/brooklyn_metadata.rb
+++ b/_plugins/brooklyn_metadata.rb
@@ -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 @@ module BrooklynMetadata
}
end
end
-end
\ No newline at end of file
+end
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/blob/73bc5f9b/_plugins/read.rb
----------------------------------------------------------------------
diff --git a/_plugins/read.rb b/_plugins/read.rb
index 6ad390a..e4058e5 100644
--- a/_plugins/read.rb
+++ b/_plugins/read.rb
@@ -17,7 +17,7 @@ module JekyllRead
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 @@ module JekyllRead
# 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(/^.*\//, '')
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn-site/blob/73bc5f9b/_plugins/site_structure.rb
----------------------------------------------------------------------
diff --git a/_plugins/site_structure.rb b/_plugins/site_structure.rb
index 049cc65..6cfe1f9 100644
--- a/_plugins/site_structure.rb
+++ b/_plugins/site_structure.rb
@@ -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 @@ module SiteStructure
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 @@ module SiteStructure
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)