Move unused files
Project: http://git-wip-us.apache.org/repos/asf/sling-site/repo Commit: http://git-wip-us.apache.org/repos/asf/sling-site/commit/cd9ef8d5 Tree: http://git-wip-us.apache.org/repos/asf/sling-site/tree/cd9ef8d5 Diff: http://git-wip-us.apache.org/repos/asf/sling-site/diff/cd9ef8d5 Branch: refs/heads/master Commit: cd9ef8d5793719351150af66be6cef2562fce557 Parents: 3147202 Author: Bertrand Delacretaz <bdelacre...@apache.org> Authored: Wed Jun 14 07:20:15 2017 -0400 Committer: Bertrand Delacretaz <bdelacre...@apache.org> Committed: Wed Jun 14 07:20:15 2017 -0400 ---------------------------------------------------------------------- OLD-from-apache-cms/lib/path.pm | 39 + OLD-from-apache-cms/lib/view.pm | 434 +++++ OLD-from-apache-cms/update-obr.sh | 51 + UNUSED-from-tamaya-example/bake-jenkins.sh | 7 + UNUSED-from-tamaya-example/copysite.sh | 7 + WEBSITE-HOWTO.txt | 46 +- bake-jenkins.sh | 7 - cms-notes-2012.txt | 68 - copysite.sh | 7 - lib/path.pm | 39 - lib/view.pm | 434 ----- .../AI/Sling Logo - All Styles.ai | 802 ++++++++ .../PDF/Sling Logo - All Styles.pdf | 881 +++++++++ .../PNG/Sling Logo - Close c...@1x.png | Bin 0 -> 9992 bytes .../PNG/Sling Logo - Close c...@2x.png | Bin 0 -> 21038 bytes .../PNG/Sling Logo - Close c...@3x.png | Bin 0 -> 47967 bytes .../PNG/Sling Logo - With u...@1x.png | Bin 0 -> 15575 bytes .../PNG/Sling Logo - With u...@2x.png | Bin 0 -> 34834 bytes .../PNG/Sling Logo - With u...@3x.png | Bin 0 -> 79153 bytes .../PNG/Sling l...@1x.png | Bin 0 -> 11401 bytes .../PNG/Sling l...@2x.png | Bin 0 -> 25989 bytes .../PNG/Sling l...@3x.png | Bin 0 -> 60660 bytes .../SVG/Sling Logo - Close Crop.svg | 1 + .../SVG/Sling Logo - With URL.svg | 1 + .../SVG/Sling Logo.svg | 1 + .../favicon.ico | Bin 0 -> 1150 bytes .../microsling-bw.svg | 1032 ++++++++++ .../microsling.svg | 1799 ++++++++++++++++++ .../sling-bw.svg | 1020 ++++++++++ .../sling.svg | 1774 +++++++++++++++++ .../AI/Sling Logo - All Styles.ai | 802 -------- .../PDF/Sling Logo - All Styles.pdf | 881 --------- .../PNG/Sling Logo - Close c...@1x.png | Bin 9992 -> 0 bytes .../PNG/Sling Logo - Close c...@2x.png | Bin 21038 -> 0 bytes .../PNG/Sling Logo - Close c...@3x.png | Bin 47967 -> 0 bytes .../PNG/Sling Logo - With u...@1x.png | Bin 15575 -> 0 bytes .../PNG/Sling Logo - With u...@2x.png | Bin 34834 -> 0 bytes .../PNG/Sling Logo - With u...@3x.png | Bin 79153 -> 0 bytes .../PNG/Sling l...@1x.png | Bin 11401 -> 0 bytes .../PNG/Sling l...@2x.png | Bin 25989 -> 0 bytes .../PNG/Sling l...@3x.png | Bin 60660 -> 0 bytes .../SVG/Sling Logo - Close Crop.svg | 1 - .../SVG/Sling Logo - With URL.svg | 1 - .../SVG/Sling Logo.svg | 1 - .../favicon.ico | Bin 1150 -> 0 bytes .../microsling-bw.svg | 1032 ---------- .../microsling.svg | 1799 ------------------ .../sling-bw.svg | 1020 ---------- .../sling.svg | 1774 ----------------- update-obr.sh | 51 - 50 files changed, 7850 insertions(+), 7962 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/OLD-from-apache-cms/lib/path.pm ---------------------------------------------------------------------- diff --git a/OLD-from-apache-cms/lib/path.pm b/OLD-from-apache-cms/lib/path.pm new file mode 100644 index 0000000..5e95026 --- /dev/null +++ b/OLD-from-apache-cms/lib/path.pm @@ -0,0 +1,39 @@ +package path; +use ASF::Value; + +# taken from django's url.py + +our @patterns = ( + [qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }], + [qr!^/sitemap\.html$!, sitemap => { headers => { title => "Sling Sitemap" }}], + [qr!^/downloads\.list$!, downloads => { template => "downloads.html" }], +) ; + +# for specifying interdependencies between files + +#our %dependencies = ( +# "/sling/sitemap.html" => [ grep s!^content!!, glob "content/sling/*.mdtext" ], +#); + +1; + +=head1 LICENSE + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + + http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/OLD-from-apache-cms/lib/view.pm ---------------------------------------------------------------------- diff --git a/OLD-from-apache-cms/lib/view.pm b/OLD-from-apache-cms/lib/view.pm new file mode 100644 index 0000000..9770af2 --- /dev/null +++ b/OLD-from-apache-cms/lib/view.pm @@ -0,0 +1,434 @@ +package view; + +# +# BUILD CONSTRAINT: all views must return $content, $extension. +# additional return values (as seen below) are optional. However, +# careful use of symlinks and dependency management in path.pm can +# resolve most issues with this constraint. +# + +use strict; +use warnings; +use Dotiac::DTL qw/Template/; +use Dotiac::DTL::Addon::markup; +use ASF::Util qw/read_text_file shuffle/; +use File::Temp qw/tempfile/; +use LWP::Simple; +use SVN::Client; +use File::Find; +use File::Basename; + +push @Dotiac::DTL::TEMPLATE_DIRS, "templates"; + +# This is most widely used view. It takes a +# 'template' argument and a 'path' argument. +# Assuming the path ends in foo.mdtext, any files +# like foo/bar.mdtext will be parsed and +# passed to the template in the "bar" (hash) +# variable. + +sub single_narrative { + my %args = @_; + my $file = "content$args{path}"; + my $template = $args{template}; + $args{path} =~ s/\.mdtext$/\.html/; + $args{breadcrumbs} = breadcrumbs($args{path}); + $args{svninfo} = svninfo($file); + + read_text_file $file, \%args; + + $args{refs} = {}; + + # render tip box with reference to Confluence export + # if translation for a page is still pending + if($args{headers}->{translation_pending}) { + $args{oldpage} = "/site/" . basename($args{path}); + } + + # ensure loading child pages + my $page_path = $file; + $page_path =~ s/\.[^.]+$//; + if (-d $page_path) { + $args{children} = {}; + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{children}->{$1} = read_ref_page_data($f); + $args{refs}->{$1} = $args{children}->{$1}; + } + } + + # ensure loading pages referenced with ref.XXX.* + while( $args{content} =~ /refs\.([^.]+)\./g ) { + my $label = $1; + if(!$args{refs}->{$label}) { + my $refPagePath; + find(sub { + if(!$refPagePath && $_ eq "$label.mdtext") { + $refPagePath = $File::Find::name; + } + }, "content"); + + if($refPagePath) { + $args{refs}->{$label} = read_ref_page_data($refPagePath); + } + } + } + +# $args{sidenav} = {}; +# read_text_file "templates/sidenav.mdtext", $args{sidenav} ; + +# select STDOUT ; +# $| = 1 ; +# for my $ke (keys %args) { +# print STDOUT "$ke \n"; +# } + + # use the content as a template if it contains Django templates + if ($args{content} =~ /\{[{%][^}]*[%}]\}/) { + print STDOUT "Applying $args{path} as a Django template\n"; + $args{content} = Dotiac::DTL->new(\$args{content})->render(\%args); + } + + return Dotiac::DTL::Template($template)->render(\%args), html => \%args; +} + +# The specially crafted download page +# Input is a list of artifacts formatted as: +# +# <title>|<id>|<version>[|<qualifier>] +# +# Special handling if title is "sling": This denotes the +# version of the Sling Launchpad distribution whie is +# rendered specially: The id is actually the launchpad +# distribution version +sub downloads { + my %args = @_; + my $file = "content$args{path}"; + my $template = $args{template}; + $args{path} =~ s/\.list$/\.html/; + $args{breadcrumbs} = breadcrumbs($args{path}); + $args{svninfo} = svninfo($file); + + read_text_file $file, \%args; + + my $result = "|Artifact | Version | Binary | Source|\n|--|--|--|--|\n"; + my $maven = "|Artifact | Version | Binary | Source|\n|--|--|--|--|\n"; + my $launchpad = "| Artifact | Version | Provides | Package |\n|-|-|-|-|\n"; + my $ide = "|Artifact | Version | Provides | Update site |\n|--|--|--|--|\n"; + + my @lines = split( /\n/, $args{content} ); + @lines = sort @lines; + for my $line (@lines) { + next if (!$line || $line =~ /^\s*#/); + + my ($title, $artifact, $version, $classifier, $ext) = split(/\|/, $line); + $ext = "jar" unless ($ext); + $classifier = ($classifier) ? "-$classifier" : ""; + + if ($title eq "sling") { + + $launchpad .="| Sling Standalone Application | $artifact | A self-runnable Sling jar. | " . downloadLink("org.apache.sling.launchpad-$artifact.jar"). "|\n"; + $launchpad .="| Sling Web Application | $artifact | A ready-to run Sling webapp as a war file. | " . downloadLink("org.apache.sling.launchpad-$artifact-webapp.war"). "|\n"; + $launchpad .="| Sling Source Release | $artifact | The released Sling source code. | " . downloadLink("org.apache.sling.launchpad-$artifact-source-release.zip")." |\n"; + } elsif ( $title eq "sling-ide-tooling" ) { + + $ide .= "| Sling IDE Tooling for Eclipse | $artifact | A p2 update site which can be installed in Eclipse. | " . downloadLinkWithoutSigs("eclipse/$artifact", "Update site") . " " . downloadLink("org.apache.sling.ide.p2update-$artifact.zip", "(zip download)") ." |\n"; + } else { + + my $target = \$result; + my $artifactLabel; + if ($ext eq "war") { + $artifactLabel = "Web Application"; + } elsif ($classifier eq "-app") { + $artifactLabel = "Java Application"; + } elsif ($artifact =~/^maven-.*-plugin|.*-maven-plugin/) { + $target = \$maven; + $artifactLabel = "Maven Plugin"; + } else { + $artifactLabel = "Bundle"; + } + + ${$target} .= "|$title|$version|" . downloadLink("$artifact-$version$classifier.$ext", $artifactLabel) . " | " . downloadLink("$artifact-$version-source-release.zip", "Source ZIP") . "|\n"; + } + } + + $args{launchpad} = $launchpad; + $args{content} = $result; + $args{maven} = $maven; + $args{ide} = $ide; + + return Dotiac::DTL::Template($template)->render(\%args), html => \%args; +} + +# Has the same behavior as the above for foo/bar.txt +# files, parsing them into a bar variable for the template. +# Otherwise presumes the template is the path. + +sub news_page { + my %args = @_; + my $template = "content$args{path}"; + $args{breadcrumbs} = breadcrumbs($args{path}); + + my $page_path = $template; + $page_path =~ s/\.[^.]+$//; + if (-d $page_path) { + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{$1} = {}; + read_text_file $f, $args{$1}; + } + } + + for ((fetch_doap_url_list())[0..2]) { + push @{$args{projects}}, parse_doap($_); + } + + return Dotiac::DTL::Template($template)->render(\%args), html => \%args; +} + +# Recursive Sitemap generation +# Taken from: http://svn.apache.org/repos/asf/chemistry/site/trunk/lib/view.pm +sub sitemap { + my %args = @_; + my $template = "content$args{path}"; + my $file = $template; + + # Find the list of files + my ($dir) = ($file =~ /^(.*)\/.*?/); + my $entries = {}; + sitemapFind($dir, $entries); + + my $sitemap = "<ul>\n"; + $sitemap = sitemapRender($sitemap, $entries, ""); + $sitemap .= "</ul>\n"; + $args{sitemap} = $sitemap; + + return Dotiac::DTL::Template($template)->render(\%args), html => \%args; +} + +sub sitemapFind { + my ($dir, $entries) = @_; + $entries->{"title"} = ""; + $entries->{"entries"} = {}; + my %entries = ( "title"=>"", "entries"=>{} ); + + foreach my $item (<$dir/*>) { + my ($rel) = ($item =~ /^.*\/(.*?)$/); + + if(-d $item) { + # Only consider folders which have content page by them + if(-f "$item.mdtext") { + $rel .= ".mdtext" ; + $entries->{"entries"}->{$rel} = {}; + sitemapFind($item, $entries->{"entries"}->{$rel}); + } + } elsif($item =~ /\.(html|mdtext)$/) { + # Grab the title + my $title = $rel; + if($rel =~ /\.mdtext$/) { + my %args; + read_text_file $item, \%args; + $title = $args{"headers"}->{"title"}; + } elsif ($rel =~ /\.png$/ || $rel =~ /\.jpg$/) { + next; + } else { + open F, "<$item"; + my $file = ""; + while(my $line = <F>) { + $file .= $line; + } + close F; + + if($file =~ /block\s+title\s*\%\}(.*?)\{/) { + $title = $1; + } elsif($file =~ /title\>(.*?)\</) { + $title = $1; + } + } + + # Process + if($rel =~ /^index\.(html|mdtext)$/) { + $entries->{"title"} = $title; + } else { + $entries->{entries}->{$rel}->{title} = $title; + } + } + } + return %entries; +} + +sub sitemapRender { + my ($sitemap, $dir, $path) = @_; + my %entries = %{$dir->{"entries"}}; + + foreach my $e (sort keys %entries) { + my $fn = $e; + $fn =~ s/\.mdtext/.html/; + if($fn eq "images/" or $fn eq "resources/") { + next; + } + + my $title = $entries{$e}->{title}; + unless($title) { + $title = $e; + } + + $sitemap .= "<li><a href=\"$path/$fn\">".$title."</a>"; + if($entries{$e}->{entries}) { + my $parent = $e; + $parent =~ s/\.mdtext$//; + $sitemap .= "<ul>\n"; + $sitemap = sitemapRender($sitemap, $entries{$e}, "$path/$parent"); + $sitemap .= "</ul>\n"; + } + $sitemap .= "</li>\n"; + } + return $sitemap; +} + + + +sub exports { + my %args = @_; + my $template = "content$args{path}"; + $args{breadcrumbs} = breadcrumbs($args{path}); + + my $page_path = $template; + $page_path =~ s/\.[^.]+$/.page/; + if (-d $page_path) { + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{$1} = {}; + read_text_file $f, $args{$1}; + } + $args{table} = `xsltproc $page_path/eccnmatrix.xsl $page_path/eccnmatrix.xml`; + + } + + return Dotiac::DTL::Template($template)->render(\%args), html => \%args; +} + +sub parse_doap { + my $url = shift; + my $doap = get $url or die "Can't get $url: $!\n"; + my ($fh, $filename) = tempfile("XXXXXX"); + print $fh $doap; + close $fh; + my $result = eval `xsltproc lib/doap2perl.xsl $filename`; + unlink $filename; + return $result; +} + +sub fetch_doap_url_list { + my $xml = get "http://svn.apache.org/repos/asf/infrastructure/site-tools/trunk/projects/files.xml" + or die "Can't get doap file list: $!\n"; + my ($fh, $filename) = tempfile("XXXXXX"); + print $fh $xml; + close $fh; + chomp(my @urls = grep /^http/, `xsltproc lib/list2urls.xsl $filename`); + unlink $filename; + shuffle \@urls; + return @urls; +} + +1; + + +# Reads data of a referenced page +sub read_ref_page_data { + my $file = shift; + my $out = {}; + + read_text_file $file, $out; + $out->{path} = "$file"; + $out->{path} =~ s/content(\/.*)\.mdtext/$1.html/; + + return $out; +} + +sub downloadLink { + my ($artifact, $label) = @_; + my $dp = "http://www.apache.org/dist"; + $label = $artifact unless ($label); + return "[$label]([preferred]sling/$artifact) ([asc]($dp/sling/$artifact.asc), [md5]($dp/sling/$artifact.md5))"; +} + +sub downloadLinkWithoutSigs { + + my ($artifact, $label) = @_; + $label = $artifact unless ($label); + return "[$label]([preferred]sling/$artifact)"; +} + +sub breadcrumbs { + my @path = split m!/!, shift; + pop @path; + my @rv; + my $relpath = ""; + my $ext; + my $sep = "/"; + for (@path) { + $relpath .= "$sep$_"; + if ($_) { + $_ = ""; + my $datafile = "content$relpath.mdtext"; + my %data; + if (-f $datafile) { + read_text_file $datafile, \%data; + $ext = ".html"; + $sep = "/"; + my $title = ${data{headers}}{title}; + if ($title) { + $_ = $title; + } + } + } else { + $_ = "Home"; + $ext = ""; + $sep = ""; + } + push @rv, qq(<a href="$relpath$ext">$_</a>) if $_; + } + return join " » ", @rv; +} + + +# Returns information on the last change to the file +# as a reference to a has with three properties +# - rev The SVN Revision +# - date The last modification date (seconds since the epoch) +# - author of the revision +sub svninfo { + my $source = $_[0]; + my %info; + my $receiver = sub { + my $svninfo = $_[1]; + $info{rev} = $svninfo->last_changed_rev; + $info{date} = $svninfo->last_changed_date / 1000000; + $info{author} = $svninfo->last_changed_author; + }; + + my $ctx = SVN::Client->new; + $ctx->info($source, undef, undef, $receiver, 0); + return \%info; +} + + +=head1 LICENSE + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/OLD-from-apache-cms/update-obr.sh ---------------------------------------------------------------------- diff --git a/OLD-from-apache-cms/update-obr.sh b/OLD-from-apache-cms/update-obr.sh new file mode 100755 index 0000000..edef12a --- /dev/null +++ b/OLD-from-apache-cms/update-obr.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Note: so far this is only tested on Mac OSX. Please remove this comment +# if it works on Linux, or fix if it doesn't. + +if [ "$2" == "" ]; then + echo "Usage: sh $0 <module> <version>" + echo " e.g. sh $0 org.apache.sling.commons.threads 3.2.2" + exit 1 +fi + +MODULE=$1 +VERSION=$2 + +TMP_DIR=tmp-update-obr/$MODULE-$VERSION + +URL_PREFIX=https://repository.apache.org/content/groups/public/org/apache/sling/$MODULE/$VERSION +JAR_NAME=$MODULE-$VERSION.jar +POM_NAME=$MODULE-$VERSION.pom + +SITE_DIR=$(pwd) + +function download { + FILE=$1 + curl -fO $URL_PREFIX/$FILE 2> /dev/null + if [ "$?" != "0" ]; then + echo Failed to download artifact $URL_PREFIX/$FILE + echo Please verify that the desired artifact is available. + exit 1; + fi +} + +mkdir -p $TMP_DIR + +( + cd $TMP_DIR + + download $POM_NAME + download $JAR_NAME + + mvn org.apache.felix:maven-bundle-plugin:deploy-file \ + -Dfile=$JAR_NAME -DpomFile=$POM_NAME \ + -DbundleUrl=http://repo1.maven.org/maven2/org/apache/sling/$MODULE/$VERSION/$JAR_NAME \ + -Durl=file:///$SITE_DIR/content/obr \ + -DprefixUrl=http://repo1.maven.org/maven2 \ + -DremoteOBR=sling.xml +) + +rm -rf tmp-update-obr/ +echo OBR updated successfully. Please review the changes and commit. + http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/UNUSED-from-tamaya-example/bake-jenkins.sh ---------------------------------------------------------------------- diff --git a/UNUSED-from-tamaya-example/bake-jenkins.sh b/UNUSED-from-tamaya-example/bake-jenkins.sh new file mode 100755 index 0000000..3d3283b --- /dev/null +++ b/UNUSED-from-tamaya-example/bake-jenkins.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x +echo "Starting to bake our project homepage ...." +export JBAKE_HOME="$(dirname "$0")/bin/jbake-2.5.1" +echo $JBAKE_HOME +$JBAKE_HOME/bin/jbake -b --reset +echo "DONE" + http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/UNUSED-from-tamaya-example/copysite.sh ---------------------------------------------------------------------- diff --git a/UNUSED-from-tamaya-example/copysite.sh b/UNUSED-from-tamaya-example/copysite.sh new file mode 100755 index 0000000..19c9008 --- /dev/null +++ b/UNUSED-from-tamaya-example/copysite.sh @@ -0,0 +1,7 @@ + #!/bin/bash +echo "Starting to bake our project homepage ...." +export JBAKE_HOME="$(dirname "$0")/bin/jbake-2.5.1" +echo $JBAKE_HOME +$JBAKE_HOME/bin/jbake -b +echo "Copying stuff from original into new branch ..." +git checkout asf-site && ./copy-site.sh http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/WEBSITE-HOWTO.txt ---------------------------------------------------------------------- diff --git a/WEBSITE-HOWTO.txt b/WEBSITE-HOWTO.txt index 02e5c00..b592fe9 100644 --- a/WEBSITE-HOWTO.txt +++ b/WEBSITE-HOWTO.txt @@ -1,47 +1,3 @@ How to update the Sling website ------------------------------- - -INTRO ------ -The http://sling.apache.org/ website is managed by the ASF CMS -(http://cms.apache.org). - -All Sling committers have read-write access to the website content, -but it's good practice to discuss big changes on the dev list in advance. - -Content is provided in markdown structured text format, see cms.a.o for -pointers to syntax and conventions. - -See also http://wiki.apache.org/general/ApacheCms2010 for help and links. - -WORKING IN SVN --------------- -Committing content under - https://svn.apache.org/repos/asf/sling/site/trunk/ -causes a staging build of the website to be executed. - -The staged content becomes available under - http://sling.staging.apache.org/ - -The build process can be followed at - http://ci.apache.org/builders/sling-site-staging - -See the existing content for how to add images and additional files. - -To push the changes in production, connect to -https://cms.apache.org/sling/publish with your LDAP credentials (as set -on people.apache.org). - -BROWSER-BASED EDITING AND PUBLISHING ------------------------------------- -Starting at https://cms.apache.org/sling/ , one can get a working copy, -edit it if needed (with simple preview) and publish it to the live site. - -THAT'S IT ---------- -The Apache CMS is a simple tool compared to some of the CMS we're used to. - -The nice thing is that the workflow happens in svn, so it's no different -than what we do for code. - -Enjoy. +TODO describe how to use the JBake/gitpubsub setup. http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/bake-jenkins.sh ---------------------------------------------------------------------- diff --git a/bake-jenkins.sh b/bake-jenkins.sh deleted file mode 100755 index 3d3283b..0000000 --- a/bake-jenkins.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -x -echo "Starting to bake our project homepage ...." -export JBAKE_HOME="$(dirname "$0")/bin/jbake-2.5.1" -echo $JBAKE_HOME -$JBAKE_HOME/bin/jbake -b --reset -echo "DONE" - http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/cms-notes-2012.txt ---------------------------------------------------------------------- diff --git a/cms-notes-2012.txt b/cms-notes-2012.txt deleted file mode 100644 index cb42b7f..0000000 --- a/cms-notes-2012.txt +++ /dev/null @@ -1,68 +0,0 @@ -Working on the conversion of the Sling website to the ASF CMS, -see https://issues.apache.org/jira/browse/SLING-2002 - -Notes on pages: - - * Start the file with a Title: line to define the page - title and the first H1 tag. - - * The last modification information from SVN (revision, - committer, and date/time) is automatically added when - the page is rendered - - * Excerpts can be added to a page using the Excerpt - metadata. - - * Metadata from child pages can be referred to in the - content with the Django variable reference notation - using the child page name (without extension) as - its container; e.g. for the child page named - "childpag": - {{ children.childpage.headers.excerpt }} - {{ children.childpage.headers.title }} - - * Content Pages can contain Django templates of the - form {{...}} and {%...%}. If so, the page content - is evaluated as a Django template before running - it through the page template. - - * Any page in the site can be referenced with refs.pagename - returning properties: - .path - the absolute path of the page on the site - .headers - page headers (e.g. .title, .excerpt) - .content - the raw page content - All pages in the children namespace are also available in - the refs namespace - - -Some usefull hints: - - * Printing title of another page "handler": - {{ refs.handler.headers.title }} - - * Printing excerpt of another page "handler": - {{ refs.handler.headers.excerpt }} - - * Linking to another page "handler": - ({{ refs.handler.path }}) - - * Printing title as a link to another page "handler": - [{{ refs.handler.headers.title }}]({{ refs.handler.path }}) - - * Printing excerpt as a link to another page "handler": - [{{ refs.handler.headers.excerpt }}]({{ refs.handler.path }}) - - * Print a bullet pointed child page list: - {% for label, page in children %}* [{{ page.headers.title }}]({{ page.path }}) - {% endfor %} - Note: It is important to have the first part as a single line, - otherwise the Django/Markdown combo will create list for each - entry. - - * Code Highlighting works by indenting code by four blanks. - To indicate the type of highlighting preced the code style text with - either :::<lexer> to get high lighted code using the given <lexer> - or #!<lexer> to get high lighted code with line numbers using the - given <lexer>. - See http://www.apache.org/dev/cmsref.html#code-hilighter for main info - See http://pygments.org/docs/lexers/ for supported lexers \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/copysite.sh ---------------------------------------------------------------------- diff --git a/copysite.sh b/copysite.sh deleted file mode 100755 index 19c9008..0000000 --- a/copysite.sh +++ /dev/null @@ -1,7 +0,0 @@ - #!/bin/bash -echo "Starting to bake our project homepage ...." -export JBAKE_HOME="$(dirname "$0")/bin/jbake-2.5.1" -echo $JBAKE_HOME -$JBAKE_HOME/bin/jbake -b -echo "Copying stuff from original into new branch ..." -git checkout asf-site && ./copy-site.sh http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/lib/path.pm ---------------------------------------------------------------------- diff --git a/lib/path.pm b/lib/path.pm deleted file mode 100644 index 5e95026..0000000 --- a/lib/path.pm +++ /dev/null @@ -1,39 +0,0 @@ -package path; -use ASF::Value; - -# taken from django's url.py - -our @patterns = ( - [qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }], - [qr!^/sitemap\.html$!, sitemap => { headers => { title => "Sling Sitemap" }}], - [qr!^/downloads\.list$!, downloads => { template => "downloads.html" }], -) ; - -# for specifying interdependencies between files - -#our %dependencies = ( -# "/sling/sitemap.html" => [ grep s!^content!!, glob "content/sling/*.mdtext" ], -#); - -1; - -=head1 LICENSE - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - - http://git-wip-us.apache.org/repos/asf/sling-site/blob/cd9ef8d5/lib/view.pm ---------------------------------------------------------------------- diff --git a/lib/view.pm b/lib/view.pm deleted file mode 100644 index 9770af2..0000000 --- a/lib/view.pm +++ /dev/null @@ -1,434 +0,0 @@ -package view; - -# -# BUILD CONSTRAINT: all views must return $content, $extension. -# additional return values (as seen below) are optional. However, -# careful use of symlinks and dependency management in path.pm can -# resolve most issues with this constraint. -# - -use strict; -use warnings; -use Dotiac::DTL qw/Template/; -use Dotiac::DTL::Addon::markup; -use ASF::Util qw/read_text_file shuffle/; -use File::Temp qw/tempfile/; -use LWP::Simple; -use SVN::Client; -use File::Find; -use File::Basename; - -push @Dotiac::DTL::TEMPLATE_DIRS, "templates"; - -# This is most widely used view. It takes a -# 'template' argument and a 'path' argument. -# Assuming the path ends in foo.mdtext, any files -# like foo/bar.mdtext will be parsed and -# passed to the template in the "bar" (hash) -# variable. - -sub single_narrative { - my %args = @_; - my $file = "content$args{path}"; - my $template = $args{template}; - $args{path} =~ s/\.mdtext$/\.html/; - $args{breadcrumbs} = breadcrumbs($args{path}); - $args{svninfo} = svninfo($file); - - read_text_file $file, \%args; - - $args{refs} = {}; - - # render tip box with reference to Confluence export - # if translation for a page is still pending - if($args{headers}->{translation_pending}) { - $args{oldpage} = "/site/" . basename($args{path}); - } - - # ensure loading child pages - my $page_path = $file; - $page_path =~ s/\.[^.]+$//; - if (-d $page_path) { - $args{children} = {}; - for my $f (grep -f, glob "$page_path/*.mdtext") { - $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; - $args{children}->{$1} = read_ref_page_data($f); - $args{refs}->{$1} = $args{children}->{$1}; - } - } - - # ensure loading pages referenced with ref.XXX.* - while( $args{content} =~ /refs\.([^.]+)\./g ) { - my $label = $1; - if(!$args{refs}->{$label}) { - my $refPagePath; - find(sub { - if(!$refPagePath && $_ eq "$label.mdtext") { - $refPagePath = $File::Find::name; - } - }, "content"); - - if($refPagePath) { - $args{refs}->{$label} = read_ref_page_data($refPagePath); - } - } - } - -# $args{sidenav} = {}; -# read_text_file "templates/sidenav.mdtext", $args{sidenav} ; - -# select STDOUT ; -# $| = 1 ; -# for my $ke (keys %args) { -# print STDOUT "$ke \n"; -# } - - # use the content as a template if it contains Django templates - if ($args{content} =~ /\{[{%][^}]*[%}]\}/) { - print STDOUT "Applying $args{path} as a Django template\n"; - $args{content} = Dotiac::DTL->new(\$args{content})->render(\%args); - } - - return Dotiac::DTL::Template($template)->render(\%args), html => \%args; -} - -# The specially crafted download page -# Input is a list of artifacts formatted as: -# -# <title>|<id>|<version>[|<qualifier>] -# -# Special handling if title is "sling": This denotes the -# version of the Sling Launchpad distribution whie is -# rendered specially: The id is actually the launchpad -# distribution version -sub downloads { - my %args = @_; - my $file = "content$args{path}"; - my $template = $args{template}; - $args{path} =~ s/\.list$/\.html/; - $args{breadcrumbs} = breadcrumbs($args{path}); - $args{svninfo} = svninfo($file); - - read_text_file $file, \%args; - - my $result = "|Artifact | Version | Binary | Source|\n|--|--|--|--|\n"; - my $maven = "|Artifact | Version | Binary | Source|\n|--|--|--|--|\n"; - my $launchpad = "| Artifact | Version | Provides | Package |\n|-|-|-|-|\n"; - my $ide = "|Artifact | Version | Provides | Update site |\n|--|--|--|--|\n"; - - my @lines = split( /\n/, $args{content} ); - @lines = sort @lines; - for my $line (@lines) { - next if (!$line || $line =~ /^\s*#/); - - my ($title, $artifact, $version, $classifier, $ext) = split(/\|/, $line); - $ext = "jar" unless ($ext); - $classifier = ($classifier) ? "-$classifier" : ""; - - if ($title eq "sling") { - - $launchpad .="| Sling Standalone Application | $artifact | A self-runnable Sling jar. | " . downloadLink("org.apache.sling.launchpad-$artifact.jar"). "|\n"; - $launchpad .="| Sling Web Application | $artifact | A ready-to run Sling webapp as a war file. | " . downloadLink("org.apache.sling.launchpad-$artifact-webapp.war"). "|\n"; - $launchpad .="| Sling Source Release | $artifact | The released Sling source code. | " . downloadLink("org.apache.sling.launchpad-$artifact-source-release.zip")." |\n"; - } elsif ( $title eq "sling-ide-tooling" ) { - - $ide .= "| Sling IDE Tooling for Eclipse | $artifact | A p2 update site which can be installed in Eclipse. | " . downloadLinkWithoutSigs("eclipse/$artifact", "Update site") . " " . downloadLink("org.apache.sling.ide.p2update-$artifact.zip", "(zip download)") ." |\n"; - } else { - - my $target = \$result; - my $artifactLabel; - if ($ext eq "war") { - $artifactLabel = "Web Application"; - } elsif ($classifier eq "-app") { - $artifactLabel = "Java Application"; - } elsif ($artifact =~/^maven-.*-plugin|.*-maven-plugin/) { - $target = \$maven; - $artifactLabel = "Maven Plugin"; - } else { - $artifactLabel = "Bundle"; - } - - ${$target} .= "|$title|$version|" . downloadLink("$artifact-$version$classifier.$ext", $artifactLabel) . " | " . downloadLink("$artifact-$version-source-release.zip", "Source ZIP") . "|\n"; - } - } - - $args{launchpad} = $launchpad; - $args{content} = $result; - $args{maven} = $maven; - $args{ide} = $ide; - - return Dotiac::DTL::Template($template)->render(\%args), html => \%args; -} - -# Has the same behavior as the above for foo/bar.txt -# files, parsing them into a bar variable for the template. -# Otherwise presumes the template is the path. - -sub news_page { - my %args = @_; - my $template = "content$args{path}"; - $args{breadcrumbs} = breadcrumbs($args{path}); - - my $page_path = $template; - $page_path =~ s/\.[^.]+$//; - if (-d $page_path) { - for my $f (grep -f, glob "$page_path/*.mdtext") { - $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; - $args{$1} = {}; - read_text_file $f, $args{$1}; - } - } - - for ((fetch_doap_url_list())[0..2]) { - push @{$args{projects}}, parse_doap($_); - } - - return Dotiac::DTL::Template($template)->render(\%args), html => \%args; -} - -# Recursive Sitemap generation -# Taken from: http://svn.apache.org/repos/asf/chemistry/site/trunk/lib/view.pm -sub sitemap { - my %args = @_; - my $template = "content$args{path}"; - my $file = $template; - - # Find the list of files - my ($dir) = ($file =~ /^(.*)\/.*?/); - my $entries = {}; - sitemapFind($dir, $entries); - - my $sitemap = "<ul>\n"; - $sitemap = sitemapRender($sitemap, $entries, ""); - $sitemap .= "</ul>\n"; - $args{sitemap} = $sitemap; - - return Dotiac::DTL::Template($template)->render(\%args), html => \%args; -} - -sub sitemapFind { - my ($dir, $entries) = @_; - $entries->{"title"} = ""; - $entries->{"entries"} = {}; - my %entries = ( "title"=>"", "entries"=>{} ); - - foreach my $item (<$dir/*>) { - my ($rel) = ($item =~ /^.*\/(.*?)$/); - - if(-d $item) { - # Only consider folders which have content page by them - if(-f "$item.mdtext") { - $rel .= ".mdtext" ; - $entries->{"entries"}->{$rel} = {}; - sitemapFind($item, $entries->{"entries"}->{$rel}); - } - } elsif($item =~ /\.(html|mdtext)$/) { - # Grab the title - my $title = $rel; - if($rel =~ /\.mdtext$/) { - my %args; - read_text_file $item, \%args; - $title = $args{"headers"}->{"title"}; - } elsif ($rel =~ /\.png$/ || $rel =~ /\.jpg$/) { - next; - } else { - open F, "<$item"; - my $file = ""; - while(my $line = <F>) { - $file .= $line; - } - close F; - - if($file =~ /block\s+title\s*\%\}(.*?)\{/) { - $title = $1; - } elsif($file =~ /title\>(.*?)\</) { - $title = $1; - } - } - - # Process - if($rel =~ /^index\.(html|mdtext)$/) { - $entries->{"title"} = $title; - } else { - $entries->{entries}->{$rel}->{title} = $title; - } - } - } - return %entries; -} - -sub sitemapRender { - my ($sitemap, $dir, $path) = @_; - my %entries = %{$dir->{"entries"}}; - - foreach my $e (sort keys %entries) { - my $fn = $e; - $fn =~ s/\.mdtext/.html/; - if($fn eq "images/" or $fn eq "resources/") { - next; - } - - my $title = $entries{$e}->{title}; - unless($title) { - $title = $e; - } - - $sitemap .= "<li><a href=\"$path/$fn\">".$title."</a>"; - if($entries{$e}->{entries}) { - my $parent = $e; - $parent =~ s/\.mdtext$//; - $sitemap .= "<ul>\n"; - $sitemap = sitemapRender($sitemap, $entries{$e}, "$path/$parent"); - $sitemap .= "</ul>\n"; - } - $sitemap .= "</li>\n"; - } - return $sitemap; -} - - - -sub exports { - my %args = @_; - my $template = "content$args{path}"; - $args{breadcrumbs} = breadcrumbs($args{path}); - - my $page_path = $template; - $page_path =~ s/\.[^.]+$/.page/; - if (-d $page_path) { - for my $f (grep -f, glob "$page_path/*.mdtext") { - $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; - $args{$1} = {}; - read_text_file $f, $args{$1}; - } - $args{table} = `xsltproc $page_path/eccnmatrix.xsl $page_path/eccnmatrix.xml`; - - } - - return Dotiac::DTL::Template($template)->render(\%args), html => \%args; -} - -sub parse_doap { - my $url = shift; - my $doap = get $url or die "Can't get $url: $!\n"; - my ($fh, $filename) = tempfile("XXXXXX"); - print $fh $doap; - close $fh; - my $result = eval `xsltproc lib/doap2perl.xsl $filename`; - unlink $filename; - return $result; -} - -sub fetch_doap_url_list { - my $xml = get "http://svn.apache.org/repos/asf/infrastructure/site-tools/trunk/projects/files.xml" - or die "Can't get doap file list: $!\n"; - my ($fh, $filename) = tempfile("XXXXXX"); - print $fh $xml; - close $fh; - chomp(my @urls = grep /^http/, `xsltproc lib/list2urls.xsl $filename`); - unlink $filename; - shuffle \@urls; - return @urls; -} - -1; - - -# Reads data of a referenced page -sub read_ref_page_data { - my $file = shift; - my $out = {}; - - read_text_file $file, $out; - $out->{path} = "$file"; - $out->{path} =~ s/content(\/.*)\.mdtext/$1.html/; - - return $out; -} - -sub downloadLink { - my ($artifact, $label) = @_; - my $dp = "http://www.apache.org/dist"; - $label = $artifact unless ($label); - return "[$label]([preferred]sling/$artifact) ([asc]($dp/sling/$artifact.asc), [md5]($dp/sling/$artifact.md5))"; -} - -sub downloadLinkWithoutSigs { - - my ($artifact, $label) = @_; - $label = $artifact unless ($label); - return "[$label]([preferred]sling/$artifact)"; -} - -sub breadcrumbs { - my @path = split m!/!, shift; - pop @path; - my @rv; - my $relpath = ""; - my $ext; - my $sep = "/"; - for (@path) { - $relpath .= "$sep$_"; - if ($_) { - $_ = ""; - my $datafile = "content$relpath.mdtext"; - my %data; - if (-f $datafile) { - read_text_file $datafile, \%data; - $ext = ".html"; - $sep = "/"; - my $title = ${data{headers}}{title}; - if ($title) { - $_ = $title; - } - } - } else { - $_ = "Home"; - $ext = ""; - $sep = ""; - } - push @rv, qq(<a href="$relpath$ext">$_</a>) if $_; - } - return join " » ", @rv; -} - - -# Returns information on the last change to the file -# as a reference to a has with three properties -# - rev The SVN Revision -# - date The last modification date (seconds since the epoch) -# - author of the revision -sub svninfo { - my $source = $_[0]; - my %info; - my $receiver = sub { - my $svninfo = $_[1]; - $info{rev} = $svninfo->last_changed_rev; - $info{date} = $svninfo->last_changed_date / 1000000; - $info{author} = $svninfo->last_changed_author; - }; - - my $ctx = SVN::Client->new; - $ctx->info($source, undef, undef, $receiver, 0); - return \%info; -} - - -=head1 LICENSE - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License.