This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
319 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
.DS_Store | ||
export/* | ||
public/* | ||
source/* | ||
config.ini | ||
latest-change.txt | ||
*-ck.js | ||
*.sass-cache/ | ||
source/styleguide/* | ||
vendor/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "pattern-lab/edition-mustache-standard", | ||
"description": "The Standard Edition of Pattern Lab for Mustache. Installs all Mustache-related dependencies.", | ||
"keywords": ["pattern lab", "mustache"], | ||
"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/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=5.3.6", | ||
"pattern-lab/core": "^2.0.0", | ||
"pattern-lab/patternengine-mustache": "^2.0.0", | ||
"pattern-lab/styleguidekit-mustache-default": "^3.0.0" | ||
}, | ||
"scripts": { | ||
"server": "php core/console --server", | ||
"generate": "php core/console --generate", | ||
"watch": "php core/console --watch", | ||
"start": "php core/console --server --with-watch", | ||
"post-install-cmd": [ | ||
"PatternLab\\Installer::postInstallCmd" | ||
], | ||
"post-update-cmd": [ | ||
"PatternLab\\Installer::postUpdateCmd" | ||
], | ||
"post-root-package-install": [ | ||
"PatternLab\\Installer::setProjectInstall", | ||
"PatternLab\\Installer::getSuggestedStarterKits", | ||
"PatternLab\\Installer::getConfigOverrides" | ||
], | ||
"post-package-install": [ | ||
"PatternLab\\Installer::postPackageInstall" | ||
], | ||
"post-package-update": [ | ||
"PatternLab\\Installer::postPackageUpdate" | ||
], | ||
"pre-package-uninstall": [ | ||
"PatternLab\\Installer::prePackageUninstall" | ||
] | ||
}, | ||
"extra": { | ||
"patternlab": { | ||
"starterKitSuggestions": [ | ||
"pattern-lab/starterkit-mustache-demo", | ||
"pattern-lab/starterkit-mustache-base" | ||
] | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/*! | ||
* Pattern Lab Builder CLI | ||
* | ||
* Copyright (c) 2016 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__.DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR; | ||
|
||
// auto-load classes | ||
if (file_exists($baseDir."vendor".DIRECTORY_SEPARATOR."autoload.php")) { | ||
require($baseDir."vendor".DIRECTORY_SEPARATOR."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: composer 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/*! | ||
* Router for the PHP Server | ||
* | ||
* Copyright (c) 2016 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."; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<?php | ||
|
||
/*! | ||
* Installer Class | ||
* | ||
* Copyright (c) 2016 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 \Composer\Installer\PackageEvent; | ||
use \PatternLab\InstallerUtil; | ||
|
||
class Installer { | ||
|
||
protected static $installerInfo = array("projectInstall" => false, "packagesRemove" => false, "suggestedStarterKits" => array(), "configOverrides" => array(), "patternLabPackages" => array()); | ||
|
||
/** | ||
* Get any config overrides that may exist for the edition | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function getConfigOverrides(Event $event) { | ||
|
||
$extra = $event->getComposer()->getPackage()->getExtra(); | ||
if (isset($extra["patternlab"]) && isset($extra["patternlab"]["config"]) && is_array($extra["patternlab"]["config"])) { | ||
self::$installerInfo["configOverrides"] = $extra["patternlab"]["config"]; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Get the package info from each patternlab-* package's composer.json | ||
* @param {String} the type of event fired during the composer install | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function getPackageInfo($type, $event) { | ||
|
||
$package = ($type == "update") ? $event->getOperation()->getTargetPackage() : $event->getOperation()->getPackage(); | ||
$packageType = $package->getType(); | ||
$packageExtra = $package->getExtra(); | ||
$packageInfo = array(); | ||
|
||
// make sure we're only evaluating pattern lab packages | ||
if (strpos($packageType,"patternlab-") !== false) { | ||
|
||
$packageInfo["name"] = $package->getName(); | ||
$packageInfo["type"] = $packageType; | ||
$packageInfo["pathBase"] = $event->getComposer()->getInstallationManager()->getInstallPath($package); | ||
$packageInfo["pathDist"] = $packageInfo["pathBase"].DIRECTORY_SEPARATOR."dist".DIRECTORY_SEPARATOR; | ||
$packageInfo["extra"] = (isset($packageExtra["patternlab"])) ? $packageExtra["patternlab"] : array(); | ||
|
||
self::$installerInfo["packages"][] = $packageInfo; | ||
|
||
} | ||
|
||
} | ||
|
||
/** | ||
* Get the suggested starter kits from the root package composer.json | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function getSuggestedStarterKits(Event $event) { | ||
|
||
$extra = $event->getComposer()->getPackage()->getExtra(); | ||
if (isset($extra["patternlab"]) && isset($extra["patternlab"]["starterKitSuggestions"]) && is_array($extra["patternlab"]["starterKitSuggestions"])) { | ||
self::$installerInfo["suggestedStarterKits"] = $extra["patternlab"]["starterKitSuggestions"]; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Run the centralized postInstallCmd | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function postInstallCmd(Event $event) { | ||
|
||
InstallerUtil::postInstallCmd(self::$installerInfo, $event); | ||
|
||
} | ||
|
||
/** | ||
* Run the centralized postUpdateCmd | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function postUpdateCmd(Event $event) { | ||
|
||
InstallerUtil::postUpdateCmd(self::$installerInfo, $event); | ||
|
||
} | ||
|
||
/** | ||
* Clean-up when a package is removed | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function postPackageInstall(PackageEvent $event) { | ||
|
||
self::getPackageInfo("install", $event); | ||
|
||
} | ||
|
||
/** | ||
* Clean-up when a package is removed | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function postPackageUpdate(PackageEvent $event) { | ||
|
||
self::getPackageInfo("update", $event); | ||
|
||
} | ||
|
||
/** | ||
* Clean-up when a package is removed | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function prePackageUninstall(PackageEvent $event) { | ||
|
||
// make sure the postUpdateCmd doesnt actually do anything | ||
self::setPackagesRemove(); | ||
|
||
// get the basic package info | ||
$package = $event->getOperation()->getPackage(); | ||
$packageType = $package->getType(); | ||
$packageInfo = array(); | ||
|
||
// make sure we're only evaluating pattern lab packages. remove attributes related to them. | ||
if (strpos($packageType,"patternlab-") !== false) { | ||
|
||
$packageInfo["name"] = $package->getName(); | ||
$packageInfo["type"] = $packageType; | ||
$packageInfo["pathBase"] = $event->getComposer()->getInstallationManager()->getInstallPath($package); | ||
|
||
InstallerUtil::packageRemove($packageInfo); | ||
|
||
} | ||
|
||
} | ||
|
||
/** | ||
* Set the packages remove boolean to true | ||
*/ | ||
public static function setPackagesRemove() { | ||
|
||
self::$installerInfo["packagesRemove"] = true; | ||
|
||
} | ||
|
||
/** | ||
* Set the project install boolean to true | ||
* @param {Object} a script event object from composer | ||
*/ | ||
public static function setProjectInstall(Event $event) { | ||
|
||
self::$installerInfo["projectInstall"] = true; | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.