Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 855aabd

Browse files
committed
initial commit
0 parents  commit 855aabd

File tree

11 files changed

+300
-0
lines changed

11 files changed

+300
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
composer.lock
3+
config/*
4+
export/*
5+
packages/*
6+
public/*
7+
source/*
8+
vendor/*

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Brad Frost, http://bradfrostweb.com & Dave Olsen, http://dmolsen.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Pattern Lab Standard Edition for Twig [BETA]
2+
3+
The Standard Edition for Twig gives developers and designers a clean base from which to develop Twig-based patterns.
4+
5+
## Installing the Standard Edition for Twig
6+
7+
### 1. Install Composer
8+
9+
Pattern Lab uses [Composer](https://getcomposer.org/) to manage project dependencies. To install Composer type the following two lines in the command line:
10+
11+
curl -sS https://getcomposer.org/installer | php
12+
mv composer.phar /usr/local/bin/composer
13+
14+
Then close and re-open your command line terminal.
15+
16+
### 2. Install the Standard Edition
17+
18+
Use Composer's `create-project` feature to install the Standard Edition into a location of your choosing. Type:
19+
20+
cd install/location/
21+
composer create-project pattern-lab/edition-twig-standard your-project-name && cd $_
22+
23+
This will create a directory called `your-project-name`.
24+
25+
### 3. Install a StarterKit
26+
27+
To install a near-empty StarterKit project as a starting point you can run:
28+
29+
php core/console --starterkit --init
30+
31+
### 4. Generate Pattern Lab
32+
33+
To generate Pattern Lab for the first time and make sure everything was installed correctly type:
34+
35+
php core/console --generate
36+
37+
To list all available commands type:
38+
39+
php core/console --help
40+
41+
### 5. Start the server to see your Pattern Lab web site
42+
43+
You can use PHP's built-in web server to review your Pattern Lab project in a browser. In a new terminal window type:
44+
45+
php core/console --server
46+
47+
And then visit [http://localhost:8080](http://localhost:8080)

composer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "pattern-lab/edition-twig-standard",
3+
"description": "The Twig-based Standard Edition of Pattern Lab. Installs all Twig-related assets except for a StarterKit.",
4+
"keywords": ["pattern lab"],
5+
"homepage": "http://patternlab.io",
6+
"license": "MIT",
7+
"type": "project",
8+
"authors": [
9+
{
10+
"name": "Dave Olsen",
11+
"email": "[email protected]",
12+
"homepage": "http://dmolsen.com",
13+
"role": "Lead Developer"
14+
}
15+
],
16+
"support": {
17+
"issues": "https://github.com/pattern-lab/patternlab-php/issues",
18+
"wiki": "http://patternlab.io/docs/",
19+
"source": "https://github.com/pattern-lab/patternlab-php/releases"
20+
},
21+
"autoload": {
22+
"psr-0": {
23+
"PatternLab": "core/src/"
24+
}
25+
},
26+
"minimum-stability": "dev",
27+
"prefer-stable": true,
28+
"require": {
29+
"php": ">=5.3.6",
30+
"pattern-lab/core": "dev-dev",
31+
"pattern-lab/patternengine-twig": "dev-dev",
32+
"pattern-lab/styleguidekit-twig-default": "dev-dev"
33+
},
34+
"scripts": {
35+
"pre-install-cmd": [
36+
"PatternLab\\Installer::preInstallCmd"
37+
],
38+
"post-package-install": [
39+
"PatternLab\\Installer::postPackageInstall"
40+
],
41+
"post-package-update": [
42+
"PatternLab\\Installer::postPackageUpdate"
43+
],
44+
"pre-package-uninstall": [
45+
"PatternLab\\Installer::prePackageUninstall"
46+
]
47+
}
48+
}

core/bin/composer.phar

941 KB
Binary file not shown.

core/console

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/*!
4+
* Pattern Lab Builder CLI
5+
*
6+
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
7+
* Licensed under the MIT license
8+
*
9+
*/
10+
11+
use \PatternLab\Config;
12+
use \PatternLab\Console;
13+
use \PatternLab\Dispatcher;
14+
use \PatternLab\Timer;
15+
16+
// check to see if json_decode exists. might be disabled in installs of PHP 5.5
17+
if (!function_exists("json_decode")) {
18+
print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n";
19+
exit;
20+
}
21+
22+
// set-up the project base directory
23+
$baseDir = __DIR__."/../";
24+
25+
// auto-load classes
26+
if (file_exists($baseDir."vendor/autoload.php")) {
27+
require($baseDir."vendor/autoload.php");
28+
} else {
29+
print "it doesn't appear that pattern lab has been set-up yet...\n";
30+
print "please install pattern lab's dependencies by typing: php core/bin/composer.phar install...\n";
31+
exit;
32+
}
33+
34+
// start the timer
35+
Timer::start();
36+
37+
// load the options
38+
Console::init();
39+
Config::init($baseDir);
40+
41+
// initialize the dispatcher & note that the config has been loaded
42+
Dispatcher::init();
43+
Dispatcher::getInstance()->dispatch("config.configLoadEnd");
44+
45+
// run the console
46+
Console::run();

core/scripts/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
DIR="$( cd "$( dirname "$0" )" && pwd )"
3+
cd "$DIR/../../"
4+
php "core/bin/composer.phar" install
5+
php "core/console" -g

core/scripts/updateComposer.command

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
DIR="$( cd "$( dirname "$0" )" && pwd )"
3+
cd "$DIR/../../"
4+
php "core/bin/composer.phar" self-update

core/server/router.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/*!
4+
* Router for the PHP Server
5+
*
6+
* Copyright (c) 2014 Dave Olsen
7+
* Licensed under the MIT license
8+
*
9+
*/
10+
11+
use \PatternLab\Config;
12+
13+
// set-up the project base directory
14+
$baseDir = __DIR__."/../../";
15+
16+
// auto-load classes
17+
if (file_exists($baseDir."vendor/autoload.php")) {
18+
require($baseDir."vendor/autoload.php");
19+
} else {
20+
print "it doesn't appear that pattern lab has been set-up yet...\n";
21+
print "please install pattern lab's dependencies by typing: php core/bin/composer.phar install...\n";
22+
exit;
23+
}
24+
25+
// load the options and be quiet about it
26+
Config::init($baseDir, false);
27+
28+
if (($_SERVER["SCRIPT_NAME"] == "") || ($_SERVER["SCRIPT_NAME"] == "/")) {
29+
30+
require("index.html");
31+
32+
} else if (file_exists(Config::getOption("publicDir").$_SERVER["SCRIPT_NAME"])) {
33+
34+
return false;
35+
36+
} else {
37+
38+
header("HTTP/1.0 404 Not Found");
39+
print "file doesn't exist.";
40+
41+
}

0 commit comments

Comments
 (0)