-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added simple Magento modman file generator for GIT.
- Loading branch information
0 parents
commit 11c8609
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "andkirby/modman-generator", | ||
"description": "Simple script which helps generate modman file based update \"git ls-files\" command.", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Andrew Roslik", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"require": {}, | ||
"bin": [ | ||
"modman-generate" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
$ignoreFiles = array( | ||
'modman', | ||
'composer', | ||
'instructions', | ||
'\.gitignore', | ||
'README\.md', | ||
'LICENSE', | ||
); | ||
$ignoreFiles = implode('|', $ignoreFiles); | ||
$files = `git ls-files | grep -vE "($ignoreFiles)"`; | ||
|
||
//match directories | ||
preg_match_all( | ||
'~^app/code/([A-z_]+/){3}|app/etc/modules/[^\n]*|app/design/([^/\n]+/?){6}|(shell|js|skin)/[^\n]+|lib/[A-z]+/~s', | ||
$files, $matches | ||
); | ||
$list = array_unique($matches[0]); | ||
|
||
//find long string | ||
$maxLength = max(array_map('strlen', $list)); | ||
|
||
//make output | ||
foreach ($list as $item) { | ||
if (is_file($item)) { | ||
$space = str_repeat(' ', $maxLength - strlen($item) + 3); | ||
$output[] = "$item $space $item"; | ||
} else { | ||
$item = rtrim($item, '/') . '/'; | ||
$space = str_repeat(' ', $maxLength - strlen($item) + 2); | ||
$output[] = "$item* $space $item"; | ||
} | ||
} | ||
$output = implode("\n", $output); | ||
|
||
echo "'modman' file generated."; | ||
file_put_contents('modman', $output); | ||
|