Skip to content

Commit

Permalink
Merge pull request #43 from mikeartix/master
Browse files Browse the repository at this point in the history
Asset files: search for license at the start of the file
  • Loading branch information
ga-devfront authored Feb 4, 2025
2 parents a80160c + ba50674 commit 8b77b1f
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Command/UpdateLicensesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,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>

0 comments on commit 8b77b1f

Please sign in to comment.