From d530e7b7caa0e1caa30f33e8e7af104d35d41b4f Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Mon, 5 Dec 2016 11:06:35 +1300 Subject: [PATCH] API Simplify branches for docs to major versions only --- .htaccess | 26 ++++--- app/_config/docs-repositories.yml | 22 +----- app/_config/docsviewer.yml | 24 ++++++- composer.json | 7 +- composer.lock | 71 ++++++++++--------- .../Includes/DocumentationVersions.ss | 14 ++-- 6 files changed, 88 insertions(+), 76 deletions(-) diff --git a/.htaccess b/.htaccess index d57a53abe..431b96a0b 100644 --- a/.htaccess +++ b/.htaccess @@ -36,14 +36,20 @@ ErrorDocument 500 /assets/error-500.html RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^framework/main\.php RewriteRule ^sapphire/?(.*) https://docs.silverstripe.org/framework/$1 [R=301,L] - + # Rewrite framework to the new base url RewriteCond %{REQUEST_URI} ^/?framework/en/ RewriteRule ^framework/en/(.*)$ /en/$1 [R=301,NC,QSA,L] # Docs in /contributing are version agnostic, and should always point to latest - RewriteCond %{REQUEST_URI} !(4.0) - RewriteRule ^(.*)/(.*)/contributing/?(.*)?$ /$1/4.0/contributing/$3 [R=301,L] + RewriteCond %{REQUEST_URI} !(4) + RewriteRule ^(.*)/(.*)/contributing/?(.*)?$ /$1/4/contributing/$3 [R=301,L] + + # Redirect 4.0 docs to 4 (new major version) + RewriteRule ^en/4\.0/(.*)?$ /en/4/$1 [R=301,L] + + # Redirect any version > 3.4 to 3 branch + RewriteRule ^en/3\.[5-9]/(.*)?$ /en/3/$1 [R=301,L] # DokuWiki rewrite rules: Need to happen before other rules in order to redirect /doku.php?id= # to /pagename, which can then be matched by the legacy rewrite rules further down @@ -128,7 +134,7 @@ ErrorDocument 500 /assets/error-500.html RewriteRule ^(.*)/installation/windows-pi/?$ /$1/getting_started/installation/other_installation_options/windows_platform_installer [R=301,L] RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/installation/windows-wamp/?$ /$1/getting_started/installation/windows [R=301,L] - + RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/misc/coding-conventions/?$ /$1/getting_started/coding_conventions [R=301,L] RewriteCond %{REQUEST_URI} !(3.0|2.4) @@ -152,16 +158,16 @@ ErrorDocument 500 /assets/error-500.html RewriteCond %{REQUEST_URI} !en/2.4/topics/reference/requirements RewriteRule ^en/2.4/topics/reference/requirements/?$ /en/2.4/reference/requirements [R=301,L] - # + # RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/reference/aspects/?$ /$1/developer_guides/extending/aspects [R=301,L] - # + # RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/reference/cms-architecture/?$ /$1/developer_guides/customising_the_admin_interface/cms_architecture [R=301,L] RewriteCond %{REQUEST_URI} !en/developer_guides/customising_the_admin_interface/reference/cms-architecture RewriteRule ^en/developer_guides/customising_the_admin_interface/reference/cms-architecture/?$ /en/developer_guides/customising_the_admin_interface/cms_architecture [R=301,L] - # + # RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/reference/grid-field/?$ /$1/developer_guides/forms/field_types/gridfield [R=301,L] RewriteCond %{REQUEST_URI} !(3.0|2.4) @@ -294,7 +300,7 @@ ErrorDocument 500 /assets/error-500.html RewriteRule ^(.*)/tutorials/2-extending-a-basic-site/?$ /$1/tutorials/extending-a-basic-site [R=301,L] # RewriteRule ^(.*)/tutorials/3-forms/?$ /$1/tutorials/forms [R=301,L] - # + # RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/tutorials/4-site-search/?$ /$1/tutorials/site_search [R=301,L] RewriteCond %{REQUEST_URI} !(3.0|2.4) @@ -304,7 +310,7 @@ ErrorDocument 500 /assets/error-500.html RewriteRule ^(.*)/tutorials/5-dataobject-relationship-management/?$ /$1/tutorials/dataobject_relationship_management [R=301,L] RewriteCond %{REQUEST_URI} !(3.0|2.4) RewriteRule ^(.*)/tutorials/5-dataobject-relationship-management/?$ /$1/tutorials/dataobject-relationship-management [R=301,L] - + RewriteCond %{REQUEST_URI} !(3.|2.) RewriteRule ^(.*)/getting_started/coding_conventions/?$ /$1/contributing/coding_conventions [R=301,L] @@ -348,7 +354,7 @@ ErrorDocument 500 /assets/error-500.html RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$ RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L] - + ErrorDocument 404 /assets/error-404.html diff --git a/app/_config/docs-repositories.yml b/app/_config/docs-repositories.yml index 787189ce2..76f4ad873 100644 --- a/app/_config/docs-repositories.yml +++ b/app/_config/docs-repositories.yml @@ -13,24 +13,4 @@ RefreshMarkdownTask: - - silverstripe/silverstripe-framework - framework - - "3.4" - - - - silverstripe/silverstripe-framework - - framework - - "3.3" - - - - silverstripe/silverstripe-framework - - framework - - "3.2" - - - - silverstripe/silverstripe-framework - - framework - - "3.1" - - - - silverstripe/silverstripe-framework - - framework - - "3.0" - - - - silverstripe/silverstripe-framework - - framework - - "2.4" + - "3" diff --git a/app/_config/docsviewer.yml b/app/_config/docsviewer.yml index 21e619732..ce744a0dc 100644 --- a/app/_config/docsviewer.yml +++ b/app/_config/docsviewer.yml @@ -12,39 +12,59 @@ DocumentationManifest: - Path: "assets/src/framework_master/docs/" Title: "Framework" - Version: "4.0" + VersionTitle: "4.x" + Version: "4" Branch: "master" DefaultEntity: true + - + Path: "assets/src/framework_3/docs/" + Title: "Framework" + VersionTitle: "3.x" + Version: "3" + Branch: "3" + Stable: true + DefaultEntity: true - Path: "assets/src/framework_3.4/docs/" Title: "Framework" + VersionTitle: "3.4" Version: "3.4" Branch: "3.4" - Stable: true + Archived: true DefaultEntity: true - Path: "assets/src/framework_3.3/docs/" Title: "Framework" + VersionTitle: "3.3" Version: "3.3" Branch: "3.3" + Archived: true DefaultEntity: true - Path: "assets/src/framework_3.2/docs/" Title: "Framework" + VersionTitle: "3.3" Version: "3.2" + Archived: true DefaultEntity: true - Path: "assets/src/framework_3.1/docs/" Title: "Framework" + VersionTitle: "3.1" Version: "3.1" + Archived: true DefaultEntity: true - Path: "assets/src/framework_3.0/docs/" Title: "Framework" + VersionTitle: "3.0" Version: "3.0" + Archived: true DefaultEntity: true - Path: "assets/src/framework_2.4/docs/" Title: "Framework" + VersionTitle: "2.4" Version: "2.4" + Archived: true DefaultEntity: true diff --git a/composer.json b/composer.json index df7df41a6..91756da5b 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "require": { "ext-gd": "*", "ext-mbstring": "*", - "silverstripe/docsviewer": "dev-master", + "silverstripe/docsviewer": "^2.0@beta", "silverstripe/framework": "^3.2", "silverstripe/toolbar": "^4.2", "silverstripe/dynamodb": "^1.1", @@ -23,8 +23,5 @@ "process-timeout": 600 }, "minimum-stability": "dev", - "prefer-stable": true, - "scripts": { - - } + "prefer-stable": true } diff --git a/composer.lock b/composer.lock index 3350d083d..62f1af650 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "e6ed503e08d9e9ccf302c7fe3057b177", - "content-hash": "8c652b05aa3bdebb477f26c03e4cd66b", + "hash": "fe77eae7f153ec8d70ba905ae736c1f3", + "content-hash": "db0fd420bda434d99cd25d69e6acf238", "packages": [ { "name": "aws/aws-sdk-php", @@ -179,16 +179,16 @@ }, { "name": "doctrine/cache", - "version": "v1.6.0", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" + "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", - "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", + "url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3", "shasum": "" }, "require": { @@ -245,7 +245,7 @@ "cache", "caching" ], - "time": "2015-12-31 16:37:02" + "time": "2016-10-29 11:16:17" }, { "name": "erusev/parsedown", @@ -554,16 +554,16 @@ }, { "name": "silverstripe/docsviewer", - "version": "dev-master", + "version": "2.0.0-beta4", "source": { "type": "git", "url": "https://github.com/silverstripe/silverstripe-docsviewer.git", - "reference": "9d7a1f621049980167a5a3ba4e7b418a62ee55ee" + "reference": "40d70a0b32f1ea63594238ab25aba9d9397416b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silverstripe/silverstripe-docsviewer/zipball/9d7a1f621049980167a5a3ba4e7b418a62ee55ee", - "reference": "9d7a1f621049980167a5a3ba4e7b418a62ee55ee", + "url": "https://api.github.com/repos/silverstripe/silverstripe-docsviewer/zipball/40d70a0b32f1ea63594238ab25aba9d9397416b7", + "reference": "40d70a0b32f1ea63594238ab25aba9d9397416b7", "shasum": "" }, "require": { @@ -591,7 +591,7 @@ "documentation", "silverstripe" ], - "time": "2016-11-07 13:31:41" + "time": "2016-12-04 21:22:45" }, { "name": "silverstripe/dynamodb", @@ -636,16 +636,16 @@ }, { "name": "silverstripe/framework", - "version": "3.4.1", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/silverstripe/silverstripe-framework.git", - "reference": "1f06e6dd18419cda02d58a78f39f6613c067a3ed" + "reference": "179996b5f9ccbaab8882cafbf16c389623521b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silverstripe/silverstripe-framework/zipball/1f06e6dd18419cda02d58a78f39f6613c067a3ed", - "reference": "1f06e6dd18419cda02d58a78f39f6613c067a3ed", + "url": "https://api.github.com/repos/silverstripe/silverstripe-framework/zipball/179996b5f9ccbaab8882cafbf16c389623521b72", + "reference": "179996b5f9ccbaab8882cafbf16c389623521b72", "shasum": "" }, "require": { @@ -656,6 +656,11 @@ "phpunit/phpunit": "~3.7" }, "type": "silverstripe-module", + "extra": { + "branch-alias": { + "3.x-dev": "3.5.x-dev" + } + }, "autoload": { "classmap": [ "tests/behat/features/bootstrap" @@ -681,7 +686,7 @@ "framework", "silverstripe" ], - "time": "2016-08-15 06:29:38" + "time": "2016-11-28 12:35:19" }, { "name": "silverstripe/toolbar", @@ -729,16 +734,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.12", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8" + "reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/889983a79a043dfda68f38c38b6dba092dd49cd8", - "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/25c576abd4e0f212e678fe8b2bd9a9a98c7ea934", + "reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934", "shasum": "" }, "require": { @@ -785,7 +790,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-07-28 16:56:28" + "time": "2016-10-13 01:43:15" }, { "name": "unclecheese/display-logic", @@ -896,16 +901,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { @@ -939,7 +944,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2016-10-03 07:40:28" }, { "name": "phpunit/php-text-template", @@ -1200,16 +1205,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.12", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e7540734bad981fe59f8ef14b6fc194ae9df8d9c" + "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e7540734bad981fe59f8ef14b6fc194ae9df8d9c", - "reference": "e7540734bad981fe59f8ef14b6fc194ae9df8d9c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/befb26a3713c97af90d25dd12e75621ef14d91ff", + "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff", "shasum": "" }, "require": { @@ -1245,13 +1250,13 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-09-02 01:57:56" + "time": "2016-11-14 16:15:57" } ], "aliases": [], "minimum-stability": "dev", "stability-flags": { - "silverstripe/docsviewer": 20, + "silverstripe/docsviewer": 10, "phpunit/phpunit": 0 }, "prefer-stable": true, diff --git a/themes/docs/templates/Includes/DocumentationVersions.ss b/themes/docs/templates/Includes/DocumentationVersions.ss index bc466b09f..d3ebda095 100644 --- a/themes/docs/templates/Includes/DocumentationVersions.ss +++ b/themes/docs/templates/Includes/DocumentationVersions.ss @@ -1,17 +1,21 @@ -<% if Versions %> +<% if $Versions %>
Versions: