Skip to content

Commit

Permalink
[mms] Ignore .git directories in composer bundle directories when cre…
Browse files Browse the repository at this point in the history
…ating package.xml file.
  • Loading branch information
slusarz committed Jan 13, 2015
1 parent 867e99a commit 9ef67bc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
48 changes: 48 additions & 0 deletions framework/Pear/lib/Horde/Pear/Package/Contents/Ignore/Composer.php
@@ -0,0 +1,48 @@
<?php
/**
* Copyright 2015 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @copyright 2015 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Pear
* @package Pear
*/

/**
* Ignores elements of Composer packaging/state in created packages.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2015 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Pear
* @package Pear
*/
class Horde_Pear_Package_Contents_Ignore_Composer
implements Horde_Pear_Package_Contents_Ignore
{
/**
*/
public function isIgnored(SplFileInfo $element)
{
$pathname = $element->getPathname();

/* Ignore composer state files. */
if ((strpos($pathname, 'bundle/composer.json') !== false) ||
(strpos($pathname, 'bundle/composer.lock') !== false)) {

This comment has been minimized.

Copy link
@yunosh

yunosh Jan 13, 2015

Member

Do we really want to ignore those files? Those are the normative resources of version information, which could be useful for end users too, e.g. when debugging, or when they want to try a newer bundle.

This comment has been minimized.

Copy link
@slusarz

slusarz Jan 13, 2015

Author Member

Do we want to support this? This is pretty hacky for a user to do. And we can't guarantee/support anything other than the version we distribute.

FWIW, this code doesn't actually do anything. i.e. Removing it, neither the composer.lock nor composer.json file is added via our packaging tools currently. So something else is filtering it.

This comment has been minimized.

Copy link
@yunosh

yunosh Jan 13, 2015

Member

Uh, indeed. Looks like the use case I described doesn't exist in real life.

return true;
}

/* Ignore composer generated .git data. */
if ((strpos($pathname, '/bundle/vendor/') !== false) &&
(strpos($pathname, '/.git/') !== false)) {
return true;
}

return false;
}
}
1 change: 1 addition & 0 deletions framework/Pear/lib/Horde/Pear/Package/Type/Horde.php
Expand Up @@ -109,6 +109,7 @@ public function getIgnore()
$this->getGitIgnore(),
$this->getRepositoryRoot()
),
new Horde_Pear_Package_Contents_Ignore_Composer()
)
);
}
Expand Down
10 changes: 6 additions & 4 deletions framework/Pear/package.xml
Expand Up @@ -10,7 +10,7 @@
<email>p@rdus.de</email>
<active>yes</active>
</lead>
<date>2015-01-09</date>
<date>2015-01-13</date>
<version>
<release>1.0.0alpha8</release>
<api>1.0.0</api>
Expand All @@ -21,7 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [mms] Ignore .git directories in composer bundle directories when creating package.xml file.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand All @@ -45,6 +45,7 @@
<dir name="Package">
<dir name="Contents">
<dir name="Ignore">
<file name="Composer.php" role="php" />
<file name="Composite.php" role="php" />
<file name="Dot.php" role="php" />
<file name="Git.php" role="php" />
Expand Down Expand Up @@ -326,6 +327,7 @@
<install as="Horde/Pear/Package/Contents/InstallAs.php" name="lib/Horde/Pear/Package/Contents/InstallAs.php" />
<install as="Horde/Pear/Package/Contents/List.php" name="lib/Horde/Pear/Package/Contents/List.php" />
<install as="Horde/Pear/Package/Contents/Role.php" name="lib/Horde/Pear/Package/Contents/Role.php" />
<install as="Horde/Pear/Package/Contents/Ignore/Composer.php" name="lib/Horde/Pear/Package/Contents/Ignore/Composer.php" />
<install as="Horde/Pear/Package/Contents/Ignore/Composite.php" name="lib/Horde/Pear/Package/Contents/Ignore/Composite.php" />
<install as="Horde/Pear/Package/Contents/Ignore/Dot.php" name="lib/Horde/Pear/Package/Contents/Ignore/Dot.php" />
<install as="Horde/Pear/Package/Contents/Ignore/Git.php" name="lib/Horde/Pear/Package/Contents/Ignore/Git.php" />
Expand Down Expand Up @@ -535,10 +537,10 @@
<stability>
<release>alpha</release>
<api>alpha</api></stability>
<date>2015-01-09</date>
<date>2015-01-13</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [mms] Ignore .git directories in composer bundle directories when creating package.xml file.
</notes>
</release>
</changelog>
Expand Down

0 comments on commit 9ef67bc

Please sign in to comment.