Skip to content

Commit

Permalink
Merge branch 'release/1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanChepurnyi committed Feb 26, 2016
2 parents e888a50 + c77fa96 commit 42fb297
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 111 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"description": "Layout Compiler For Magento",
"require": {
"php": ">=5.4.0",
"magento-hackathon/magento-composer-installer": "*",
"symfony/filesystem": ">2.3"
"magento-hackathon/magento-composer-installer": "*"
},
"require-dev": {
"magento/core": "1.9.1.0",
Expand Down
112 changes: 56 additions & 56 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<config>
<modules>
<EcomDev_LayoutCompiler>
<codeVersion>1.0.1</codeVersion>
<codeVersion>1.0.2</codeVersion>
</EcomDev_LayoutCompiler>
</modules>
<global>
Expand Down
27 changes: 5 additions & 22 deletions src/lib/EcomDev/LayoutCompiler/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ class EcomDev_LayoutCompiler_Compiler
*/
protected $parsers;

/**
* File system instance
*
* @var Filesystem
*/
private $fileSystem;

/**
* Constructs a new compiler instance
*
Expand Down Expand Up @@ -67,8 +60,6 @@ public function __construct(array $options = array())
$this->setParser($key, $value);
}
}

$this->fileSystem = new Filesystem();
}

/**
Expand Down Expand Up @@ -132,7 +123,7 @@ public function compile(SourceInterface $source, MetadataInterface $metadata = n
}

foreach ($metadata->getHandles() as $handleName) {
$this->fileSystem->remove($metadata->getHandlePath($handleName));
@unlink($metadata->getHandlePath($handleName));
}
}

Expand All @@ -151,8 +142,8 @@ public function compile(SourceInterface $source, MetadataInterface $metadata = n
if (isset($result[$handle])) {
$fileToSave = $metadata->getHandlePath($handle);
$path = dirname($fileToSave);
if (!$this->fileSystem->exists($path)) {
$this->fileSystem->mkdir($path, 0755);
if (!is_dir($path)) {
mkdir($path, 0755, true);
}

$tmpFile = $path . DIRECTORY_SEPARATOR . uniqid('tempfile');
Expand All @@ -172,16 +163,8 @@ public function compile(SourceInterface $source, MetadataInterface $metadata = n

file_put_contents($tmpFile, $content);

$this->fileSystem->rename(
$tmpFile,
$fileToSave,
true
);

$this->fileSystem->chmod(
$fileToSave,
0644
);
rename($tmpFile, $fileToSave);
chmod($fileToSave, 0644);
}

}
Expand Down
34 changes: 4 additions & 30 deletions src/lib/EcomDev/LayoutCompiler/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,6 @@ class EcomDev_LayoutCompiler_Index
*/
private $hexTable;

/**
* File system instance
*
* @var Filesystem
*/
private $fileSystem;

/**
* Initializes file system instance
*
*/
public function __construct()
{
$this->fileSystem = new Filesystem();
}

/**
* Loads an index by metadata parameters
*
Expand Down Expand Up @@ -214,25 +198,15 @@ public function save(array $parameters)
$lines[] = sprintf('$this->addMetadata(%s);', var_export($metadata, true));
}

if (!$this->fileSystem->exists($this->getSavePath())) {
$this->fileSystem->mkdir($this->getSavePath(), 0755);
if (!is_dir($this->getSavePath())) {
mkdir($this->getSavePath(), 0755, true);
}

$tmpFile = $this->getSavePath() . DIRECTORY_SEPARATOR . uniqid('tempfile');
$filePath = $this->getIndexFileName($parameters);
file_put_contents($tmpFile, "<?php \n" . implode("\n", $lines));

$this->fileSystem->rename(
$tmpFile,
$filePath,
true
);

$this->fileSystem->chmod(
$filePath,
0644
);

rename($tmpFile, $filePath);
chmod($filePath, 0644);
return $this;
}
}

0 comments on commit 42fb297

Please sign in to comment.