This repository was archived by the owner on Nov 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Apply patch to fix Schematron attribute paths #11
Merged
thewilkybarkid
merged 5 commits into
libero:master
from
thewilkybarkid:schematron-attribute-path
Mar 6, 2019
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e5e7032
Apply patch to fix Schematron attribute paths
thewilkybarkid d6664b3
Merge branch 'master' into schematron-attribute-path
thewilkybarkid abbad3d
Change library and add output
thewilkybarkid 2b1fb4e
Add comment
thewilkybarkid 52de032
Add depth
thewilkybarkid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
/phpcs.xml | ||
/phpstan.neon | ||
/phpunit.xml | ||
/tmp/ | ||
/vendor/ |
This file contains hidden or 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 |
---|---|---|
|
@@ -3,15 +3,22 @@ | |
|
||
declare(strict_types=1); | ||
|
||
use GitWrapper\GitWrapper; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
require_once __DIR__.'/../vendor/autoload.php'; | ||
|
||
$filesystem = new Filesystem(); | ||
|
||
$target = __DIR__.'/../lib/schematron'; | ||
|
||
$base = 'https://github.com/Schematron/schematron/raw/master'; | ||
$git = new GitWrapper(); | ||
$git->streamOutput(); | ||
|
||
$repoUri = 'https://github.com/Schematron/schematron'; | ||
$repoDir = __DIR__.'/../tmp/schematron'; | ||
$patchesDir = __DIR__.'/../tmp/patches'; | ||
$targetDir = __DIR__.'/../lib/schematron'; | ||
$patches = [ | ||
'https://github.com/Schematron/schematron/pull/81.patch', // Fixes attribute paths. | ||
]; | ||
$files = [ | ||
'LICENSE', | ||
'trunk/schematron/code/iso_schematron_skeleton_for_xslt1.xsl', | ||
|
@@ -20,8 +27,29 @@ | |
'trunk/converters/code/ToSchematron/ExtractSchFromXSD.xsl', | ||
]; | ||
|
||
$filesystem->remove(new FilesystemIterator($target)); | ||
if (!$filesystem->exists($repoDir)) { | ||
$filesystem->mkdir($repoDir); | ||
$repo = $git->cloneRepository($repoUri, $repoDir, ['depth' => 1]); | ||
} else { | ||
$repo = $git->workingCopy($repoDir); | ||
$repo->fetch('origin', 'master', ['depth' => 1]); | ||
$repo->reset(['hard' => true], 'origin/master'); | ||
} | ||
|
||
foreach ($patches as $patch) { | ||
$patchTarget = "${patchesDir}/".md5($patch); | ||
|
||
echo "Downloading {$patch} to {$patchTarget}\n"; | ||
$filesystem->copy($patch, $patchTarget); | ||
$repo->apply($patchTarget, ['verbose' => true]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think by default the patches remain tracked in Git as a change not staged for commit. The interaction with updates should work because then a |
||
} | ||
|
||
$filesystem->remove(new FilesystemIterator($targetDir)); | ||
|
||
foreach ($files as $file) { | ||
$filesystem->copy("{$base}/${file}", "{$target}/".basename($file)); | ||
$origin = "${repoDir}/${file}"; | ||
$target = "${targetDir}/".basename($file); | ||
|
||
echo "Copying {$origin} to {$target}\n"; | ||
$filesystem->copy($origin, $target); | ||
} |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
|
@@ -50,10 +50,15 @@ public function it_fails_on_invalid(string $format) : void | |
$this->assertEquals( | ||
[ | ||
new Failure( | ||
'Must not be empty', | ||
'Element must not be empty', | ||
6, | ||
$xpath->query('/example:parent/example:child')->item(0) | ||
), | ||
new Failure( | ||
'Attribute must not be empty', | ||
6, | ||
$xpath->query('/example:parent/example:child/@attribute')->item(0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this enough context? I guess the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, since it's retrieved from the document. |
||
), | ||
], | ||
$e->getFailures() | ||
); | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
|
||
<parent xmlns="http://example.com"> | ||
|
||
<child> </child> | ||
<child attribute=" "> </child> | ||
|
||
</parent> |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.