From da5791df500b01864bccdd059bc515f72d03fe15 Mon Sep 17 00:00:00 2001 From: jovenden Date: Fri, 30 Jun 2017 15:45:57 +1200 Subject: [PATCH] Migrate to SSP --- .gitignore | 5 +- .htaccess | 32 +++++++++ .platform.yml | 12 ++++ README.md | 12 ++-- htdocs/browserconfig.xml => browserconfig.xml | 0 conf/apigen/templates/@layout.latte | 67 +++++++++--------- errors/404.html | 24 +++++++ errors/error-styles.css | 56 +++++++++++++++ htdocs/.htaccess | 18 ----- makedoc.sh | 4 +- htdocs/manifest.json => manifest.json | 0 resources/.DS_Store | Bin 0 -> 6148 bytes {htdocs => resources}/.gitignore | 0 .../image}/android-chrome-144x144.png | Bin .../image}/android-chrome-192x192.png | Bin .../image}/android-chrome-36x36.png | Bin .../image}/android-chrome-48x48.png | Bin .../image}/android-chrome-72x72.png | Bin .../image}/android-chrome-96x96.png | Bin .../image}/apple-touch-icon-114x114.png | Bin .../image}/apple-touch-icon-120x120.png | Bin .../image}/apple-touch-icon-144x144.png | Bin .../image}/apple-touch-icon-152x152.png | Bin .../image}/apple-touch-icon-180x180.png | Bin .../image}/apple-touch-icon-57x57.png | Bin .../image}/apple-touch-icon-60x60.png | Bin .../image}/apple-touch-icon-72x72.png | Bin .../image}/apple-touch-icon-76x76.png | Bin .../image}/apple-touch-icon-precomposed.png | Bin .../image}/apple-touch-icon.png | Bin {htdocs => resources/image}/favicon-16x16.png | Bin .../image}/favicon-194x194.png | Bin {htdocs => resources/image}/favicon-32x32.png | Bin {htdocs => resources/image}/favicon-96x96.png | Bin {htdocs => resources/image}/favicon.ico | Bin {htdocs => resources/image}/favicon.png | Bin .../image}/mstile-144x144.png | Bin .../image}/mstile-150x150.png | Bin .../image}/mstile-310x150.png | Bin .../image}/mstile-310x310.png | Bin {htdocs => resources/image}/mstile-70x70.png | Bin .../image}/safari-pinned-tab.svg | 0 .../resources => resources/js}/combined.js | 4 +- {htdocs/search => search}/lookup.php | 2 +- src/Lookup.php | 2 +- tests/LookupTest.php | 20 +++--- 46 files changed, 178 insertions(+), 80 deletions(-) create mode 100644 .htaccess create mode 100644 .platform.yml rename htdocs/browserconfig.xml => browserconfig.xml (100%) create mode 100644 errors/404.html create mode 100644 errors/error-styles.css delete mode 100644 htdocs/.htaccess rename htdocs/manifest.json => manifest.json (100%) create mode 100644 resources/.DS_Store rename {htdocs => resources}/.gitignore (100%) rename {htdocs => resources/image}/android-chrome-144x144.png (100%) rename {htdocs => resources/image}/android-chrome-192x192.png (100%) rename {htdocs => resources/image}/android-chrome-36x36.png (100%) rename {htdocs => resources/image}/android-chrome-48x48.png (100%) rename {htdocs => resources/image}/android-chrome-72x72.png (100%) rename {htdocs => resources/image}/android-chrome-96x96.png (100%) rename {htdocs => resources/image}/apple-touch-icon-114x114.png (100%) rename {htdocs => resources/image}/apple-touch-icon-120x120.png (100%) rename {htdocs => resources/image}/apple-touch-icon-144x144.png (100%) rename {htdocs => resources/image}/apple-touch-icon-152x152.png (100%) rename {htdocs => resources/image}/apple-touch-icon-180x180.png (100%) rename {htdocs => resources/image}/apple-touch-icon-57x57.png (100%) rename {htdocs => resources/image}/apple-touch-icon-60x60.png (100%) rename {htdocs => resources/image}/apple-touch-icon-72x72.png (100%) rename {htdocs => resources/image}/apple-touch-icon-76x76.png (100%) rename {htdocs => resources/image}/apple-touch-icon-precomposed.png (100%) rename {htdocs => resources/image}/apple-touch-icon.png (100%) rename {htdocs => resources/image}/favicon-16x16.png (100%) rename {htdocs => resources/image}/favicon-194x194.png (100%) rename {htdocs => resources/image}/favicon-32x32.png (100%) rename {htdocs => resources/image}/favicon-96x96.png (100%) rename {htdocs => resources/image}/favicon.ico (100%) rename {htdocs => resources/image}/favicon.png (100%) rename {htdocs => resources/image}/mstile-144x144.png (100%) rename {htdocs => resources/image}/mstile-150x150.png (100%) rename {htdocs => resources/image}/mstile-310x150.png (100%) rename {htdocs => resources/image}/mstile-310x310.png (100%) rename {htdocs => resources/image}/mstile-70x70.png (100%) rename {htdocs => resources/image}/safari-pinned-tab.svg (100%) rename {htdocs/master/resources => resources/js}/combined.js (99%) rename {htdocs/search => search}/lookup.php (85%) diff --git a/.gitignore b/.gitignore index ec7927e..91e9b1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /assets/ -/htdocs/2.4/ -/htdocs/master/ -/htdocs/3.*/ /vendor/ +/modulesource/ +/en/ diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..6946d88 --- /dev/null +++ b/.htaccess @@ -0,0 +1,32 @@ + + SetEnv HTTP_MOD_REWRITE On + RewriteEngine On + + # "Symlink" the root to the latest release (with "moved temporarily") + RewriteRule ^/?$ /en/3.6/ [R=302,L] + + # Remove trailing slashes, ensures the redirect to en works + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)/$ /$1 [L,R] + + # Lookup script (used to be a SS app, now just a simple script) + RewriteCond %{REQUEST_URI} ^/search/lookup$ + RewriteRule ^search/lookup /search/lookup.php [L,R=301,QSA] + + # "Symlink" a "current" folder to the latest release + RewriteRule ^.*/current.*?(.*)? /en/3.6/$1 [R=301,L] + + # Rewrite trunk to master + RewriteRule ^.*/trunk/.*(.*)? /en/master/$1 [L,R=301] + + # Docs are stored in en - serve from there + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_URI} !^.*/en/.*$ [NC] + RewriteRule .* /en%{REQUEST_URI} [L,R=301] + + # Rewrite PHPDocumentor links for apigen + RewriteCond %{REQUEST_FILENAME} !^class- + RewriteRule ^/?(trunk|[23]\.[0-9])/.*/(.+)\.html$ /$1/class-$2.html [R=301] + + ErrorDocument 404 /errors/404.html + \ No newline at end of file diff --git a/.platform.yml b/.platform.yml new file mode 100644 index 0000000..bc4ca00 --- /dev/null +++ b/.platform.yml @@ -0,0 +1,12 @@ +infrastructure: ^3 +shared_dirs: + mysite: + modulesource: {} + en: {} +crons: + mytask: + time: "0 3 * * *" + command: "/var/www/mysite/www/makedoc.sh | logger -t SilverStripe_cron" +url_rules: + mysite: + - '^.*html': 'apache' diff --git a/README.md b/README.md index 94e0e2d..99465d1 100644 --- a/README.md +++ b/README.md @@ -32,21 +32,17 @@ generated through [APIGen](http://apigen.org/). ### Add a New Version * Copy a version section block in `makedoc.sh` and update the version number - * Update the .gitignore to ignore any new files generated in `htdocs` (you don't want to commit the static generated files!) + * Update the .gitignore to ignore any new files generated in `en` which is a directory synlinked outside of the web root (you don't want to commit the static generated files!) * Run `makedoc.sh` and confirm the generation runs through properly * Make a commit of the updated `makedoc.sh` - * Update the redirections in `htdocs/.htaccess` to the stable version number + * Update the redirections in `.htaccess` to the stable version number * Make a separate commit with the redirection (explained in deployment below) **Please note:** Often the `master` branch will be representing an unstable major version (currently 4). When this needs -to be updated, please edit `htdocs/search/lookup.php`. +to be updated, please edit `search/lookup.php`. ### Deployment to production - 1. Raise a ticket with ops team (they have to run a script after deployment) - 2. Login to SilverStripe Platform (you'll need to ensure you have "api" stack permissions) - 3. Deploy the commit that contains the update to `makedoc.sh` - 4. Ops will run this script to generate the new static files. - 5. Once this is complete, deploy the commit with the redirects. + This is now hosted on SilverStripe Platform, you can deploy from the dashboard. `makedoc.sh` is run on a nightly cron as defined in `platform.yml`. ### Symbol Lookup diff --git a/htdocs/browserconfig.xml b/browserconfig.xml similarity index 100% rename from htdocs/browserconfig.xml rename to browserconfig.xml diff --git a/conf/apigen/templates/@layout.latte b/conf/apigen/templates/@layout.latte index bce1d21..08c1a92 100644 --- a/conf/apigen/templates/@layout.latte +++ b/conf/apigen/templates/@layout.latte @@ -20,28 +20,27 @@ the file LICENSE.md that was distributed with this source code. - {include #title}{if 'overview' !== $active && $config->title} | {$config->title}{/if} {var typeKitJS = '//use.typekit.net/emt4dhq.js'} - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - + @@ -51,28 +50,26 @@ the file LICENSE.md that was distributed with this source code. }catch(e){} - {var combinedJs = 'resources/combined.js'} + {var combinedJs = '/resources/js/combined.js'} {var elementListJs = 'elementlist.js'} - - {var styleCss = 'resources/style.css'} - - - {* CUSTOM: Toolbar support *} - - {* CUSTOM: CSS *} {var customCss = 'resources/custom.css'} {var ionicons = 'resources/ionicons.min.css'} + + + {* CUSTOM: Toolbar support *} + +