Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset files: search for license at the start of the file #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Command/UpdateLicensesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private function addLicenseToFile(SplFileInfo $file, string $startDelimiter = '\
$content = $file->getContents();
$oldContent = $content;
// Regular expression found thanks to Stephen Ostermiller's Blog. http://blog.ostermiller.org/find-comment
$regex = '%' . $startDelimiter . '\*([^*]|[\r\n]|(\*+([^*' . $endDelimiter . ']|[\r\n])))*\*+' . $endDelimiter . '%';
$regex = '%^' . $startDelimiter . '\*([^*]|[\r\n]|(\*+([^*' . $endDelimiter . ']|[\r\n])))*\*+' . $endDelimiter . '%';
$matches = [];
$text = $this->text;
if ($startDelimiter != '\/') {
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/expected/fakemodule/views/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
body {
font-family: sans-serif;
background-color: tomato; /* a wonderful color */
}
23 changes: 23 additions & 0 deletions tests/integration/expected/fakemodule/views/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
(function () {
document.querySelector('button').addEventListener('click', function () {
alert('Hello world!'); /* a wonderful message */
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{#**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*#}
<div class="actions">
{% if showButton %}
<button type="button">Click Me</button> {#* a wonderful button for the user *#}
{% endif %}
</div>
23 changes: 23 additions & 0 deletions tests/integration/expected/fakemodule/views/templates/app.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*}
<div class="actions">
{if $showButton}
<button type="button">Click Me</button> {* a wonderful button for the user *}
{/if}
</div>
4 changes: 4 additions & 0 deletions tests/integration/module-samples/fakemodule/views/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
font-family: sans-serif;
background-color: tomato; /* a wonderful color */
}
5 changes: 5 additions & 0 deletions tests/integration/module-samples/fakemodule/views/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function () {
document.querySelector('button').addEventListener('click', function () {
alert('Hello world!'); /* a wonderful message */
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="actions">
{% if showButton %}
<button type="button">Click Me</button> {#* a wonderful button for the user *#}
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="actions">
{if $showButton}
<button type="button">Click Me</button> {* a wonderful button for the user *}
{/if}
</div>
Loading