Skip to content

Commit

Permalink
PHP 7 compatibility (Merge pull request #44 from steverhoades/fixes-43)
Browse files Browse the repository at this point in the history
Might need some additional testing/work after, but it looks like this fixes the PHP 7 issues with the skeleton. (Fixes #43)
  • Loading branch information
beryllium committed Dec 16, 2016
2 parents 2e5ef0d + 23afbeb commit e4b0049
Show file tree
Hide file tree
Showing 7 changed files with 2,970 additions and 342 deletions.
46 changes: 31 additions & 15 deletions README.md
Expand Up @@ -25,24 +25,40 @@ A very basic Sculpin based blog supporting the following features:
* A blog tag index at `/blog/tags/$tag`. Similar to the blog archive
except broken down by each tag.

Install
-------

```bash
$ composer install
```

Build
-----

### If You Already Have Sculpin

sculpin install
sculpin generate --watch --server
php vendor/bin/sculpin generate --watch --server

Your newly generated clone of sculpin-blog-skeleton is now
accessible at `http://localhost:8000/`.

### If You Need Sculpin
Component Management
--------------------
If you wish to install components via composer and have them automatically installed into your source directory you will need the following configuration options to your composer.json file.

- component-dir: The directory you wish the components to be installed
- components: An array of component names to be installed

curl -O https://download.sculpin.io/sculpin.phar
php sculpin.phar install
php sculpin.phar generate --watch --server
```
"config": {
"component-dir": "source/components",
"components": [
"components/bootstrap",
"components/jquery",
"components/highlightjs"
]
}
```

The component manager will introspect these values to determine what it needs to copy into your source directory on `composer install`.

Previewing Development Builds
-----------------------------
Expand All @@ -60,26 +76,26 @@ commands. This will start a simple webserver listening at `localhost:8000`.
To serve files right after generating them, use the `generate` command with
the `--server` option:

sculpin generate --server
php vendor/bin/sculpin generate --server

To listen on a different port, specify the `--port` option:

sculpin generate --server --port=9999
php vendor/bin/sculpin generate --server --port=9999

Combine with `--watch` to have Sculpin pick up changes as you make them:

sculpin generate --server --watch
php vendor/bin/sculpin generate --server --watch


##### Server Command

To serve files that have already been generated, use the `serve` command:

sculpin serve
php vendor/bin/sculpin serve

To listen on a different port, specify the `--port` option:

sculpin serve --port=9999
php vendor/bin/sculpin serve --port=9999


### Using a Standard Webserver
Expand All @@ -103,11 +119,11 @@ Publishing Production Builds
When `--env=prod` is specified, the site will be generated in `output_prod/`. This
is the location of your production build.

sculpin generate --env=prod
php vendor/bin/sculpin generate --env=prod

These files are suitable to be transferred directly to a production host. For example:

sculpin generate --env=prod
php vendor/bin/sculpin generate --env=prod
rsync -avze 'ssh -p 999' output_prod/ user@yoursculpinsite.com:public_html

If you want to make sure that rsync deletes files that you deleted locally on the on the remote too, add the `--delete` option to the rsync command:
Expand Down
39 changes: 39 additions & 0 deletions component-manager.php
@@ -0,0 +1,39 @@
<?php
namespace ComponentManager;

use Composer\Script\Event;
use Symfony\Component\Filesystem\Filesystem;

class ComponentManager
{
public static function postComposerInstall(Event $event)
{
$config = $event->getComposer()->getConfig();
$componentDir = $config->get('component-dir');
$components = $config->get('components');
$vendorDir = $config->get('vendor-dir');

// if either configuration is empty it's a noop
if (empty($componentDir) || empty($components)) {
return;
}

$componentDir = __DIR__ .'/'. $componentDir;

if (!is_dir($componentDir)) {
mkdir($componentDir);
}

$filesystem = new Filesystem();

foreach ($components as $component) {
$componentSource = $vendorDir .'/'. $component;

if (!is_dir($componentSource)) {
continue;
}

$filesystem->mirror($componentSource, $componentDir .'/'. basename($component));
}
}
}
42 changes: 42 additions & 0 deletions composer.json
@@ -0,0 +1,42 @@
{
"name": "sculpin/blog-skeleton",
"description": "A Skeleton for a Sculpin Based Blog",
"type": "sculpin-skeleton",
"license": "MIT",
"authors": [
{
"name": "Dragonfly Development Inc.",
"email": "info@dflydev.com",
"homepage": "http://dflydev.com"
},
{
"name": "Beau Simensen",
"email": "beau@dflydev.com",
"homepage": "http://beausimensen.com"
}
],
"require": {
"sculpin/sculpin": "^2.1@dev",
"dflydev/embedded-composer": "^1.0@dev",
"kriswallsmith/assetic": "1.1.2",
"components/bootstrap": "^3.3",
"components/jquery": "^3.1",
"components/highlightjs": "^9.7"
},
"config": {
"component-dir": "source/components",
"components": [
"components/bootstrap",
"components/jquery",
"components/highlightjs"
]
},
"scripts": {
"post-install-cmd": [
"ComponentManager\\ComponentManager::postComposerInstall"
]
},
"autoload": {
"classmap": ["component-manager.php"]
}
}

0 comments on commit e4b0049

Please sign in to comment.