Skip to content

Instantly share code, notes, and snippets.

@gotbahn
Created September 19, 2015 07:12
Show Gist options
  • Save gotbahn/8cb178f9a84ed85f1eac to your computer and use it in GitHub Desktop.
Save gotbahn/8cb178f9a84ed85f1eac to your computer and use it in GitHub Desktop.
Magento 2 Beta deployer & symlinks fix
Index: magento2ce/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- magento2ce/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php (revision )
+++ magento2ce/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php (revision )
@@ -51,7 +51,12 @@
return $this->replace($matchContent, $asset);
};
$content = $this->removeComments($chain->getContent());
- $chain->setContent(preg_replace_callback(self::REPLACE_PATTERN, $replaceCallback, $content));
+
+ $processedContent = preg_replace_callback(self::REPLACE_PATTERN, $replaceCallback, $content);
+
+ if ($processedContent !== $content) {
+ $chain->setContent($processedContent);
+ }
}
/**
Index: magento2ce/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- magento2ce/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php (revision )
+++ magento2ce/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php (revision )
@@ -113,6 +113,8 @@
->method('create')
->with('less')
->willReturn($this->getMock('Magento\Framework\Less\FileGenerator', [], [], '', false));
+ $asset = $this->getMockForAbstractClass('Magento\Framework\View\Asset\LocalInterface');
+ $asset->expects($this->once())->method('getContentType')->willReturn('type');
$this->assetRepo->expects($this->once())
->method('createAsset')
->with(
@@ -123,9 +125,7 @@
'locale' => 'en_US'
]
)
- ->willReturn(
- $this->getMockForAbstractClass('Magento\Framework\View\Asset\LocalInterface')
- );
+ ->willReturn($asset);
$this->assetSource->expects($this->once())->method('findSource')->willReturn('/dev/null');
$this->chainFactory->expects($this->once())->method('create')->willReturn(
Index: magento2ce/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- magento2ce/app/code/Magento/Developer/Console/Command/CssDeployCommand.php (revision )
+++ magento2ce/app/code/Magento/Developer/Console/Command/CssDeployCommand.php (revision )
@@ -219,21 +219,23 @@
]
);
+ $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
$sourceFile = $this->assetSource->findSource($asset);
- $content = \file_get_contents($sourceFile);
+ $relativePath = $rootDir->getRelativePath($sourceFile);
+ $content = $rootDir->readFile($relativePath);
$chain = $this->chainFactory->create(
[
'asset' => $asset,
'origContent' => $content,
- 'origContentType' => $asset->getContentType()
+ 'origContentType' => $asset->getContentType(),
+ 'origAssetPath' => $relativePath
]
);
$processedCoreFile = $sourceFileGenerator->generateFileTree($chain);
$targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
- $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
$source = $rootDir->getRelativePath($processedCoreFile);
$destination = $asset->getPath();
$rootDir->copyFile($source, $destination, $targetDir);
@praful-rajput
Copy link

Hello,
I am using WAMP with Win 7. How I can execute this patch?

Ans I seem same file at https://github.com/magento/magento2/blob/master/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php
Branch : Master
Not seem such changes as you mentioned in your patch.

@praful-rajput
Copy link

In which branch we have to work ? develop or master ?

@praful-rajput
Copy link

I got answer for my query.
http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html#instgde-prereq-compose-clone
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment