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

Commit 70eadc8

Browse files
committed
Merge branch 'hotfix-windows-core-source' into dev
2 parents 9b9bf6a + 73f937a commit 70eadc8

File tree

7 files changed

+35
-31
lines changed

7 files changed

+35
-31
lines changed

core/lib/Mustache/Loader/PatternLoader.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function loadFile($name)
109109

110110
// get the real file path for the pattern
111111
$fileName = $this->getFileName($partialName);
112-
112+
//print $fileName."\n";
113113
// throw error if path is not found
114114
if (!file_exists($fileName)) {
115115
throw new Mustache_Exception_UnknownTemplateException($name);
@@ -143,29 +143,30 @@ protected function getFileName($name)
143143
{
144144

145145
$fileName = "";
146+
$dirSep = DIRECTORY_SEPARATOR;
146147

147148
// test to see what kind of path was supplied
148149
$posDash = strpos($name,"-");
149-
$posSlash = strpos($name,"/");
150+
$posSlash = strpos($name,$dirSep);
150151
if (($posSlash === false) && ($posDash !== false)) {
151152

152153
list($patternType,$pattern) = $this->getPatternInfo($name);
153154

154155
// see if the pattern is an exact match for patternPaths. if not iterate over patternPaths to find a likely match
155156
if (isset($this->patternPaths[$patternType][$pattern])) {
156-
$fileName = $this->baseDir."/".$this->patternPaths[$patternType][$pattern]["patternSrcPath"];
157+
$fileName = $this->baseDir.$dirSep.$this->patternPaths[$patternType][$pattern]["patternSrcPath"];
157158
} else if (isset($this->patternPaths[$patternType])) {
158159
foreach($this->patternPaths[$patternType] as $patternMatchKey=>$patternMatchValue) {
159160
$pos = strpos($patternMatchKey,$pattern);
160161
if ($pos !== false) {
161-
$fileName = $this->baseDir."/".$patternMatchValue["patternSrcPath"];
162+
$fileName = $this->baseDir.$dirSep.$patternMatchValue["patternSrcPath"];
162163
break;
163164
}
164165
}
165166
}
166167

167168
} else {
168-
$fileName = $this->baseDir."/".$name;
169+
$fileName = $this->baseDir.$dirSep.$name;
169170
}
170171

171172
if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) {

core/lib/PatternLab/Builder.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public function __construct($config = array()) {
7777
}
7878

7979
// set-up the source & public dirs
80-
$this->sp = "/../../../source/_patterns/";
81-
$this->pp = "/../../../public/patterns/";
80+
$this->sp = "/../../../source/_patterns".DIRECTORY_SEPARATOR;
81+
$this->pp = "/../../../public/patterns".DIRECTORY_SEPARATOR;
8282
$this->sd = __DIR__."/../../../source";
8383
$this->pd = __DIR__."/../../../public";
8484

@@ -504,6 +504,7 @@ protected function gatherPatternInfo() {
504504
$patternType = "";
505505
$patternSubtype = "";
506506
$patternSubtypeSet = false;
507+
$dirSep = DIRECTORY_SEPARATOR;
507508

508509
// initialize various arrays
509510
$this->navItems = array();
@@ -521,7 +522,7 @@ protected function gatherPatternInfo() {
521522
foreach($patternObjects as $name => $object) {
522523

523524
$name = str_replace(__DIR__.$this->sp,"",$name);
524-
$depth = substr_count($name,"/");
525+
$depth = substr_count($name,$dirSep);
525526

526527
// track old types and subtypes for increment purposes
527528

@@ -587,15 +588,15 @@ protected function gatherPatternInfo() {
587588
* Mustache patterns
588589
*************************************/
589590

590-
$patternFull = $object->getFilename(); // 00-colors.mustache
591-
$pattern = str_replace(".mustache","",$patternFull); // 00-colors
591+
$patternFull = $object->getFilename(); // 00-colors.mustache
592+
$pattern = str_replace(".mustache","",$patternFull); // 00-colors
592593

593594
if ($patternSubtypeSet) {
594-
$patternPath = $patternType."/".$patternSubtype."/".$pattern; // 00-atoms/01-global/00-colors
595-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-01-global-00-colors (file path)
595+
$patternPath = $patternType.$dirSep.$patternSubtype.$dirSep.$pattern; // 00-atoms/01-global/00-colors
596+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-01-global-00-colors (file path)
596597
} else {
597-
$patternPath = $patternType."/".$pattern; // 00-atoms/00-colors
598-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-00-colors (file path)
598+
$patternPath = $patternType.$dirSep.$pattern; // 00-atoms/00-colors
599+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-00-colors (file path)
599600
}
600601

601602
// track to see if this pattern should get rendered
@@ -605,9 +606,9 @@ protected function gatherPatternInfo() {
605606
if ($patternFull[0] != "_") {
606607

607608
// set-up the names
608-
$patternDash = $this->getPatternName($pattern,false); // colors
609-
$patternClean = str_replace("-"," ",$patternDash); // colors (dashes replaced with spaces)
610-
$patternPartial = $patternTypeDash."-".$patternDash; // atoms-colors
609+
$patternDash = $this->getPatternName($pattern,false); // colors
610+
$patternClean = str_replace("-"," ",$patternDash); // colors (dashes replaced with spaces)
611+
$patternPartial = $patternTypeDash."-".$patternDash; // atoms-colors
611612

612613
// set-up the info for the nav
613614
$patternInfo = array("patternPath" => $patternPathDash."/".$patternPathDash.".html",
@@ -667,11 +668,11 @@ protected function gatherPatternInfo() {
667668

668669
// add to patternPaths
669670
if ($patternSubtypeSet) {
670-
$patternPath = $patternType."/".$patternSubtype."/".$pattern; // 00-atoms/01-global/00-colors
671-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-01-global-00-colors (file path)
671+
$patternPath = $patternType.$dirSep.$patternSubtype.$dirSep.$pattern; // 00-atoms/01-global/00-colors
672+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-01-global-00-colors (file path)
672673
} else {
673-
$patternPath = $patternType."/".$pattern; // 00-atoms/00-colors
674-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-00-colors (file path)
674+
$patternPath = $patternType.$dirSep.$pattern; // 00-atoms/00-colors
675+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-00-colors (file path)
675676
}
676677

677678
// add all patterns to patternPaths

core/lib/PatternLab/Generator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public function generate($enableCSS = false) {
5656

5757
// gather all of the various pattern info
5858
$this->gatherPatternInfo();
59-
59+
60+
6061
// clean the public directory to remove old files
6162
if ($this->cleanPublic == "true") {
6263
$this->cleanPublic();

core/lib/PatternLab/Migrator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ public function migrate($diffVersion = false) {
3535

3636
if (!$migration->isDot() && $migration->isFile() && ($filename[0] != "_")) {
3737

38+
$basePath = __DIR__."/../../../";
3839
$migrationData = json_decode(file_get_contents($migration->getPathname()));
39-
$sourcePath = __DIR__."/../../../".$migrationData->sourcePath;
40-
$destinationPath = __DIR__."/../../../".$migrationData->destinationPath;
4140
$checkType = $migrationData->checkType;
41+
$sourcePath = ($checkType == "fileExists") ? $basePath.$migrationData->sourcePath : $basePath.$migrationData->sourcePath.DIRECTORY_SEPARATOR;
42+
$destinationPath = ($checkType == "fileExists") ? $basePath.$migrationData->destinationPath : $basePath.$migrationData->destinationPath.DIRECTORY_SEPARATOR;
4243

4344
if ($checkType == "dirEmpty") {
4445

@@ -118,7 +119,7 @@ protected function runMigration($filename, $sourcePath, $destinationPath, $singl
118119
$fileName = str_replace($sourcePath,"",$object->getPathname());
119120

120121
// check to see if it's a new directory
121-
if ($object->isDir() && !is_dir($destinationPath.$fileName)) {
122+
if ($object->isDir() && !is_dir($destinationPath.$fileName)) {
122123
mkdir($destinationPath.$fileName);
123124
} else if ($object->isFile()) {
124125
copy($sourcePath.$fileName,$destinationPath.$fileName);

core/migrations/001-move-source.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sourcePath": "core/source/",
3-
"destinationPath": "source/",
2+
"sourcePath": "core/source",
3+
"destinationPath": "source",
44
"checkType": "dirEmpty"
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sourcePath": "core/styleguide/",
3-
"destinationPath": "public/styleguide/",
2+
"sourcePath": "core/styleguide",
3+
"destinationPath": "public/styleguide",
44
"checkType": "versionDiffDir"
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sourcePath": "core/source/_patterns/00-atoms/00-meta/",
3-
"destinationPath": "source/_patterns/00-atoms/00-meta/",
2+
"sourcePath": "core/source/_patterns/00-atoms/00-meta",
3+
"destinationPath": "source/_patterns/00-atoms/00-meta",
44
"checkType": "dirExists"
55
}

0 commit comments

Comments
 (0)