mirror of
https://github.com/pattern-lab/edition-php-twig-standard.git
synced 2025-01-16 20:18:15 +01:00
initial commit
This commit is contained in:
commit
855aabdd42
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
.DS_Store
|
||||
composer.lock
|
||||
config/*
|
||||
export/*
|
||||
packages/*
|
||||
public/*
|
||||
source/*
|
||||
vendor/*
|
20
LICENSE
Normal file
20
LICENSE
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Brad Frost, http://bradfrostweb.com & Dave Olsen, http://dmolsen.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
README.md
Normal file
47
README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# Pattern Lab Standard Edition for Twig [BETA]
|
||||
|
||||
The Standard Edition for Twig gives developers and designers a clean base from which to develop Twig-based patterns.
|
||||
|
||||
## Installing the Standard Edition for Twig
|
||||
|
||||
### 1. Install Composer
|
||||
|
||||
Pattern Lab uses [Composer](https://getcomposer.org/) to manage project dependencies. To install Composer type the following two lines in the command line:
|
||||
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
|
||||
Then close and re-open your command line terminal.
|
||||
|
||||
### 2. Install the Standard Edition
|
||||
|
||||
Use Composer's `create-project` feature to install the Standard Edition into a location of your choosing. Type:
|
||||
|
||||
cd install/location/
|
||||
composer create-project pattern-lab/edition-twig-standard your-project-name && cd $_
|
||||
|
||||
This will create a directory called `your-project-name`.
|
||||
|
||||
### 3. Install a StarterKit
|
||||
|
||||
To install a near-empty StarterKit project as a starting point you can run:
|
||||
|
||||
php core/console --starterkit --init
|
||||
|
||||
### 4. Generate Pattern Lab
|
||||
|
||||
To generate Pattern Lab for the first time and make sure everything was installed correctly type:
|
||||
|
||||
php core/console --generate
|
||||
|
||||
To list all available commands type:
|
||||
|
||||
php core/console --help
|
||||
|
||||
### 5. Start the server to see your Pattern Lab web site
|
||||
|
||||
You can use PHP's built-in web server to review your Pattern Lab project in a browser. In a new terminal window type:
|
||||
|
||||
php core/console --server
|
||||
|
||||
And then visit [http://localhost:8080](http://localhost:8080)
|
48
composer.json
Normal file
48
composer.json
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "pattern-lab/edition-twig-standard",
|
||||
"description": "The Twig-based Standard Edition of Pattern Lab. Installs all Twig-related assets except for a StarterKit.",
|
||||
"keywords": ["pattern lab"],
|
||||
"homepage": "http://patternlab.io",
|
||||
"license": "MIT",
|
||||
"type": "project",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Dave Olsen",
|
||||
"email": "dmolsen@gmail.com",
|
||||
"homepage": "http://dmolsen.com",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/pattern-lab/patternlab-php/issues",
|
||||
"wiki": "http://patternlab.io/docs/",
|
||||
"source": "https://github.com/pattern-lab/patternlab-php/releases"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PatternLab": "core/src/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=5.3.6",
|
||||
"pattern-lab/core": "dev-dev",
|
||||
"pattern-lab/patternengine-twig": "dev-dev",
|
||||
"pattern-lab/styleguidekit-twig-default": "dev-dev"
|
||||
},
|
||||
"scripts": {
|
||||
"pre-install-cmd": [
|
||||
"PatternLab\\Installer::preInstallCmd"
|
||||
],
|
||||
"post-package-install": [
|
||||
"PatternLab\\Installer::postPackageInstall"
|
||||
],
|
||||
"post-package-update": [
|
||||
"PatternLab\\Installer::postPackageUpdate"
|
||||
],
|
||||
"pre-package-uninstall": [
|
||||
"PatternLab\\Installer::prePackageUninstall"
|
||||
]
|
||||
}
|
||||
}
|
BIN
core/bin/composer.phar
Normal file
BIN
core/bin/composer.phar
Normal file
Binary file not shown.
46
core/console
Normal file
46
core/console
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* Pattern Lab Builder CLI
|
||||
*
|
||||
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
*/
|
||||
|
||||
use \PatternLab\Config;
|
||||
use \PatternLab\Console;
|
||||
use \PatternLab\Dispatcher;
|
||||
use \PatternLab\Timer;
|
||||
|
||||
// check to see if json_decode exists. might be disabled in installs of PHP 5.5
|
||||
if (!function_exists("json_decode")) {
|
||||
print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// set-up the project base directory
|
||||
$baseDir = __DIR__."/../";
|
||||
|
||||
// auto-load classes
|
||||
if (file_exists($baseDir."vendor/autoload.php")) {
|
||||
require($baseDir."vendor/autoload.php");
|
||||
} else {
|
||||
print "it doesn't appear that pattern lab has been set-up yet...\n";
|
||||
print "please install pattern lab's dependencies by typing: php core/bin/composer.phar install...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// start the timer
|
||||
Timer::start();
|
||||
|
||||
// load the options
|
||||
Console::init();
|
||||
Config::init($baseDir);
|
||||
|
||||
// initialize the dispatcher & note that the config has been loaded
|
||||
Dispatcher::init();
|
||||
Dispatcher::getInstance()->dispatch("config.configLoadEnd");
|
||||
|
||||
// run the console
|
||||
Console::run();
|
1
core/scripts/README
Normal file
1
core/scripts/README
Normal file
@ -0,0 +1 @@
|
||||
This is a Mac OS X-compatible script. If you don't have a Mac please use the command line instructions to install Pattern Lab.
|
5
core/scripts/installPatternLab.command
Normal file
5
core/scripts/installPatternLab.command
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
cd "$DIR/../../"
|
||||
php "core/bin/composer.phar" install
|
||||
php "core/console" -g
|
4
core/scripts/updateComposer.command
Normal file
4
core/scripts/updateComposer.command
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
cd "$DIR/../../"
|
||||
php "core/bin/composer.phar" self-update
|
41
core/server/router.php
Normal file
41
core/server/router.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* Router for the PHP Server
|
||||
*
|
||||
* Copyright (c) 2014 Dave Olsen
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
*/
|
||||
|
||||
use \PatternLab\Config;
|
||||
|
||||
// set-up the project base directory
|
||||
$baseDir = __DIR__."/../../";
|
||||
|
||||
// auto-load classes
|
||||
if (file_exists($baseDir."vendor/autoload.php")) {
|
||||
require($baseDir."vendor/autoload.php");
|
||||
} else {
|
||||
print "it doesn't appear that pattern lab has been set-up yet...\n";
|
||||
print "please install pattern lab's dependencies by typing: php core/bin/composer.phar install...\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// load the options and be quiet about it
|
||||
Config::init($baseDir, false);
|
||||
|
||||
if (($_SERVER["SCRIPT_NAME"] == "") || ($_SERVER["SCRIPT_NAME"] == "/")) {
|
||||
|
||||
require("index.html");
|
||||
|
||||
} else if (file_exists(Config::getOption("publicDir").$_SERVER["SCRIPT_NAME"])) {
|
||||
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
print "file doesn't exist.";
|
||||
|
||||
}
|
80
core/src/PatternLab/Installer.php
Normal file
80
core/src/PatternLab/Installer.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/*!
|
||||
* Installer Class
|
||||
*
|
||||
* Copyright (c) 2014 Dave Olsen, http://dmolsen.com
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
* References the InstallerUtil class that is included in pattern-lab/core
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PatternLab;
|
||||
|
||||
use \Composer\Script\Event;
|
||||
use \PatternLab\InstallerUtil;
|
||||
|
||||
class Installer {
|
||||
|
||||
/**
|
||||
* Run the PL tasks when a package is installed
|
||||
* @param {Object} a script event object from composer
|
||||
*/
|
||||
public static function postPackageInstall(Event $event) {
|
||||
|
||||
// make sure pattern lab has been loaded
|
||||
if (class_exists("\PatternLab\Config")) {
|
||||
|
||||
InstallerUtil::postPackageInstall($event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the PL tasks when a package is updated
|
||||
* @param {Object} a script event object from composer
|
||||
*/
|
||||
public static function postPackageUpdate(Event $event) {
|
||||
|
||||
// make sure pattern lab has been loaded
|
||||
if (class_exists("\PatternLab\Config")) {
|
||||
|
||||
InstallerUtil::postPackageUpdate($event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure certain things are set-up before running composer's install
|
||||
* @param {Object} a script event object from composer
|
||||
*/
|
||||
public static function preInstallCmd(Event $event) {
|
||||
|
||||
// make sure pattern lab has been loaded
|
||||
if (class_exists("\PatternLab\Config")) {
|
||||
|
||||
InstallerUtil::preInstallCmd($event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the PL tasks when a package is removed
|
||||
* @param {Object} a script event object from composer
|
||||
*/
|
||||
public static function prePackageUninstall(Event $event) {
|
||||
|
||||
// make sure pattern lab has been loaded
|
||||
if (class_exists("\PatternLab\Config")) {
|
||||
|
||||
InstallerUtil::prePackageUninstallCmd($event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user