[feature] Enhance dev-tools:sync to merge and normalize .gitignore entries#21
Merged
[feature] Enhance dev-tools:sync to merge and normalize .gitignore entries#21
Conversation
- Add GitIgnore namespace with Reader, Classifier, Merger, Writer classes - Reader reads .gitignore entries from both package and project - Classifier classifies entries as directories or files - Merger merges, deduplicates, and sorts entries - Writer writes normalized .gitignore file - SyncCommand now syncs .gitignore entries automatically - Entries are sorted: directories first, then files, alphabetical within each group - Transform magic strings into private constants in Classifier Implements: #12
e78bbda to
2674281
Compare
… .gitignore management - Added GitIgnoreInterface to define the contract for .gitignore files. - Implemented Merger and MergerInterface for merging and deduplicating .gitignore entries. - Created Reader and ReaderInterface for reading .gitignore files. - Developed Writer and WriterInterface for writing .gitignore files. - Updated existing classes to utilize the new interfaces and improve functionality. - Added tests for GitIgnore, Merger, Reader, and Writer to ensure correct behavior. - Enhanced command tests to cover new GitIgnoreCommand functionality. Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
…nore files Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
GitIgnorenamespace with dedicated classes for .gitignore synchronization:Reader: reads .gitignore entries from both package and projectClassifier: classifies entries as directories or filesMerger: merges, deduplicates, and sorts entriesWriter: writes normalized .gitignore fileSyncCommandto orchestrate .gitignore synchronizationChanges
src/GitIgnore/Reader.php- reads .gitignore entriessrc/GitIgnore/Classifier.php- classifies entries as directory/filesrc/GitIgnore/Merger.php- merges and sorts entriessrc/GitIgnore/Writer.php- writes normalized outputSyncCommandto callsyncGitIgnore()methodsrc/Command/GitIgnoreCommand.php- standalone command for .gitignore operationsgitignorecommandArchitecture
The implementation follows the acceptance criteria requirements:
Example
If dev-tools has:
.idea/ .vscode/ vendor/ .DS_Store *.cacheAnd project has:
tmp/ vendor/ composer.lockThe synced result will be:
.idea/ tmp/ vendor/ .vscode/ *.cache .DS_Store composer.lockNew Command
The
gitignorecommand can be used standalone:Testing
All tests pass (125 tests, 306 assertions) with 85.89% code coverage.
Closes #12