mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
Merge pull request #5 from wilr/issues/2
FIX: DRY update for managing documented module checkouts. (Fixes #2)
This commit is contained in:
commit
d50e586f7c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
src/
|
||||
.DS_Store
|
||||
silverstripe-cache
|
||||
|
29
Makefile
29
Makefile
@ -1,24 +1,17 @@
|
||||
all:
|
||||
@echo "Available commands:"
|
||||
@grep "^[^#[:space:]].*:$$" Makefile
|
||||
|
||||
update:
|
||||
@echo "Cleaning up existing folders..";
|
||||
@if [ -d $(CURDIR)/src/sapphire_master ]; then rm -rf $(CURDIR)/src/sapphire_master; fi
|
||||
@make fetch
|
||||
@make index
|
||||
|
||||
@echo "Checking out SilverStripe (Framework)..";
|
||||
@if [ -d $(CURDIR)/src/framework ]; then cd $(CURDIR)/src/framework; git pull -q; else git clone --depth=100 -q git://github.com/silverstripe/sapphire.git $(CURDIR)/src/framework; fi
|
||||
fetch:
|
||||
@./bin/update.sh $(CURDIR)
|
||||
|
||||
@echo "-- master";
|
||||
@if [ -d $(CURDIR)/src/framework_master ]; then cd $(CURDIR)/src/framework_master; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_master; cd $(CURDIR)/src/framework_master; git pull -q; fi
|
||||
|
||||
@echo "-- 3.0";
|
||||
@if [ -d $(CURDIR)/src/framework_3.0 ]; then cd $(CURDIR)/src/framework_3.0; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_3.0; cd $(CURDIR)/src/framework_3.0; git pull -q; fi
|
||||
|
||||
@echo "-- 2.4";
|
||||
@if [ -d $(CURDIR)/src/framework_2.4 ]; then cd $(CURDIR)/src/framework_2.4; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_2.4; cd $(CURDIR)/src/framework_2.4; git pull -q; fi
|
||||
|
||||
@echo "-- 2.3";
|
||||
@if [ -d $(CURDIR)/src/framework_2.3 ]; then cd $(CURDIR)/src/framework_2.3; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_2.3; cd $(CURDIR)/src/framework_2.3; git pull -q; fi
|
||||
|
||||
@echo "Building index";
|
||||
@cd $(CURDIR); php framework/cli-script.php dev/tasks/RebuildLuceneDocsIndex flush=1
|
||||
index:
|
||||
@mkdir -p $(CURDIR)/silverstripe-cache/
|
||||
@php framework/cli-script.php dev/tasks/RebuildLuceneDocsIndex flush=1
|
||||
|
||||
test:
|
||||
$(MAKE) QUERYSTRING="$(QUERYSTRING)&SkipTests=RestfulServiceTest" -C sapphire test
|
||||
|
69
README.md
69
README.md
@ -1,17 +1,68 @@
|
||||
doc.silverstripe.org
|
||||
====================
|
||||
# doc.silverstripe.org
|
||||
|
||||
This is the source code powering http://doc.silverstripe.org. It primarily consists of:
|
||||
This is the source code powering http://doc.silverstripe.org. It primarily
|
||||
consists of:
|
||||
|
||||
* SilverStripe
|
||||
* The [docsviewer](https://github.com/silverstripe/silverstripe-docsviewer) module
|
||||
* SilverStripe 3.0 framework
|
||||
* The [docsviewer](https://github.com/silverstripe/silverstripe-docsviewer)
|
||||
module.
|
||||
|
||||
Development and contribution
|
||||
----------------------------
|
||||
## Development
|
||||
|
||||
To set up a test instance:
|
||||
|
||||
* Clone this repository to a LAMP server.
|
||||
* Run "make" to check out the repositories from which is builds the docs (this will take a while the first time)
|
||||
* Run "make update" to check out the repositories from which is builds the
|
||||
docs (this will take a while the first time)
|
||||
|
||||
To contribute an improvement, submit a pull request on GitHub. Any approved pull requests will make their way onto the doc.silverstripe.org site in the next release.
|
||||
## Source Documentation Files
|
||||
|
||||
Documentation for each module is stored on the filesystem via a full git clone
|
||||
of the module to the `src/` subdirectory in this project. These checkouts are
|
||||
ignored from this repository to allow for easier updating and to keep this
|
||||
project small.
|
||||
|
||||
To update or download the source documentation at any time run the following
|
||||
make command in your terminal:
|
||||
|
||||
cd /Sites/doc.silverstripe.org/
|
||||
make fetch
|
||||
|
||||
`make fetch` will call bin/update.sh to download / update each module as listed
|
||||
in the bin/update.sh file.
|
||||
|
||||
Once the `make fetch` command has executed and downloaded the latest files,
|
||||
those files are registered along with the module version the folder relates to.
|
||||
through the `app/_config.php` file.
|
||||
|
||||
DocumentationService::register("sapphire", BASE_PATH ."/src/github/master/sapphire/docs/", '2.4');
|
||||
|
||||
## Contribution
|
||||
|
||||
To contribute an improvement to the doc.silverstripe.org functionality or
|
||||
theme, submit a pull request on GitHub. Any approved pull requests will make
|
||||
their way onto the doc.silverstripe.org site in the next release.
|
||||
|
||||
The content for doc.silverstripe.org is stored in the modules repository inside
|
||||
a "docs" folder (for example, the framework documentation is stored at
|
||||
(github.com/silverstripe/sapphire)[https://github.com/silverstripe/sapphire/tree/master/docs]).
|
||||
|
||||
If you wish to edit the documentation content, submit a pull request on that
|
||||
Github project. Updates to the content are synced regularly with
|
||||
docs.silverstripe.org via a cron job.
|
||||
|
||||
## Cron job
|
||||
|
||||
The cron job keeps doc.silverstripe.org up to date with the latest code. This
|
||||
cron task calls `make update`, a script that fetches the latest documentation
|
||||
for each module from git and rebuilds the search indexes.
|
||||
|
||||
05 * * * * sites make -f /sites/ss2doc-v2/www/Makefile -C /sites/ss2doc-v2/www update
|
||||
|
||||
## Legacy Dokuwiki
|
||||
|
||||
We assume that DokuWiki (which ran the original doc.silverstripe.org) is
|
||||
served on the same webserver from a different webroot, that's symlinked in
|
||||
under the URL http://doc.silverstripe.org/old.
|
||||
|
||||
ln -s /sites/ss2doc/www /sites/ss2doc-v2/www/old
|
||||
|
@ -1,31 +0,0 @@
|
||||
# doc.silverstripe.org #
|
||||
|
||||
## Installation ##
|
||||
|
||||
See `sapphiredocs/README.md` for main setup instructions.
|
||||
|
||||
## Source Documentation Files
|
||||
|
||||
Source registration is documented in `sapphiredocs` module.
|
||||
We keep sources in a `src/` subdirectory.
|
||||
For this project the different sources are NOT included in version control,
|
||||
because we need to check out from git and subversion (so svn:externals won't work in this case). All sources have to be checked out and updated manually.
|
||||
We use the `Makefile` for this, which exposes a new `make update` command.
|
||||
|
||||
In `mysite/_config.php`:
|
||||
|
||||
DocumentationService::register("sapphire", BASE_PATH ."/src/github/master/sapphire/docs/", '2.4');
|
||||
|
||||
When registering a new module, you have to update the `Makefile` as well.
|
||||
|
||||
## Cronjob Setup ##
|
||||
|
||||
05 * * * * sites make -f /sites/ss2doc-v2/www/Makefile -C /sites/ss2doc-v2/www update
|
||||
|
||||
## Legacy Dokuwiki ##
|
||||
|
||||
We assume that DokuWiki (which ran the original doc.silverstripe.org)
|
||||
is served on the same webserver from a different webroot, thats
|
||||
symlinked in under the URL http://doc.silverstripe.org/old.
|
||||
|
||||
ln -s /sites/ss2doc/www /sites/ss2doc-v2/www/old
|
@ -27,8 +27,8 @@ DocumentationViewer::$check_permission = false;
|
||||
DocumentationService::set_automatic_registration(false);
|
||||
DocumentationSearch::enable();
|
||||
|
||||
try{
|
||||
DocumentationService::register("framework", BASE_PATH ."/src/framework_master/docs/", 'trunk');
|
||||
try {
|
||||
DocumentationService::register("framework", BASE_PATH ."/src/framework/docs/", 'trunk');
|
||||
DocumentationService::register("framework", BASE_PATH ."/src/framework_3.0/docs/", '3.0');
|
||||
DocumentationService::register("framework", BASE_PATH ."/src/framework_2.4/docs/", '2.4');
|
||||
DocumentationService::register("framework", BASE_PATH ."/src/framework_2.3/docs/", '2.3');
|
||||
@ -47,6 +47,10 @@ DocumentationViewer::set_edit_link(
|
||||
|
||||
Object::add_extension('Controller', 'ControllerExtension');
|
||||
|
||||
if(Director::isLive()) {
|
||||
ControllerExtension::$google_analytics_code = 'UA-84547-8';
|
||||
}
|
||||
|
||||
Validator::set_javascript_validation_handler('none');
|
||||
|
||||
DocumentationSearch::set_meta_data(array(
|
||||
|
@ -1,9 +1,53 @@
|
||||
url='git@github.com:chillu/silverstripe-doc-restructuring.git'
|
||||
base=`dirname $0`
|
||||
if [ ! -d "$base/../src/github" ]; then
|
||||
mkdir $base/../src/
|
||||
git clone $url $base/../src/github
|
||||
dir=$1
|
||||
|
||||
if [ ! "$dir" ]; then
|
||||
echo "Usage: $0 /base/folder/to/docs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $base/../src/github/
|
||||
git pull origin
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: checkout
|
||||
# DESCRIPTION: Checks out a specific branch of a module into a folder. Not
|
||||
# particular good for taking up space, but at the moment separate
|
||||
# folders for each version we need will do.
|
||||
#
|
||||
# The master branch will checked out by default
|
||||
# PARAMETERS:
|
||||
# $1 - module path on github (e.g silverstripe/sapphire.git)
|
||||
# $2 - branch name (e.g 3.0)
|
||||
# $3 - module name (e.g sapphire)
|
||||
#
|
||||
#===============================================================================
|
||||
# Parameters: github path
|
||||
function checkout {
|
||||
if [ ! -d $dir/src/$3 ]; then
|
||||
echo "Cloning $1 "
|
||||
cd $dir/src
|
||||
git clone --depth=100 -q git://github.com/$1 $3 --quiet
|
||||
cd $3
|
||||
git checkout master -q
|
||||
else
|
||||
cd $dir/src/$3
|
||||
git pull -q
|
||||
git checkout master -q
|
||||
fi
|
||||
|
||||
echo "Checking out $2 from $1 into $3_$2"
|
||||
|
||||
if [ -d $dir/src/$3_$2 ]; then
|
||||
cd $dir/src/$3_$2
|
||||
else
|
||||
cp -R $dir/src/$3 $dir/src/$3_$2
|
||||
cd $dir/src/$3_$2
|
||||
fi
|
||||
|
||||
git reset --hard -q
|
||||
git checkout $2 -q
|
||||
git pull -q
|
||||
}
|
||||
|
||||
checkout 'silverstripe/sapphire.git' '3.0' 'framework'
|
||||
checkout 'silverstripe/sapphire.git' '2.4' 'framework'
|
||||
checkout 'silverstripe/sapphire.git' '2.3' 'framework'
|
||||
|
||||
echo "Done."
|
@ -1 +1 @@
|
||||
Subproject commit f322d7a5287c354852674efad87645d344d078bd
|
||||
Subproject commit 4ffa1c71e66a5771a1ebb95163f8ad092821efd0
|
@ -1 +1 @@
|
||||
Subproject commit 19a7d311180c4f842992570d8e3e97439ac51bf2
|
||||
Subproject commit 5bf2212b22289d80bb6f6d840d03f0c744434c30
|
Loading…
x
Reference in New Issue
Block a user