Skip to content

Commit

Permalink
Refactor and fix SquotCodeMapper and subclasses
Browse files Browse the repository at this point in the history
* Move common code to superclass
* While cleaning the package directory, keep metadata files
  • Loading branch information
MariusDoe committed Oct 6, 2024
1 parent 36bdc1f commit 6a711e5
Show file tree
Hide file tree
Showing 29 changed files with 77 additions and 71 deletions.
7 changes: 0 additions & 7 deletions src/Squot.package/.squot-contents

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
paths
mapperThatMaps: aPath
^ self allMappers
detect: [:mapper | mapper mappedPathPatterns anySatisfy: [:each | each matches: aPath]]
detect: [:mapper | mapper maps: aPath]
ifNone: [nil]
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"isUnmappedPath:" : "mad 7/3/2024 15:30",
"lastImageHashForMigration" : "mad 11/29/2023 15:11",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"mapperThatMaps:" : "mad 10/4/2024 15:36",
"mapperThatMaps:" : "mad 10/4/2024 19:40",
"mappers" : "mad 6/1/2023 22:35",
"mappers:" : "mad 3/19/2024 21:25",
"mappersOfKind:" : "mad 9/20/2023 17:29",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changes-operations
cleanDirectory: aReference
aReference ensureDirectory.
aReference children do: [:each |
(SquotMetadataMapper new maps: each path)
ifFalse: [each deleteAll]].
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
snapshot-creation
expectedReadErrorsOnMissingSnapshot
^ DirectoryDoesNotExist
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
snapshot-creation
loadSnapshotFrom: aFilesystem
self subclassResponsibility.
^ [(self readerOn: (self packageDirectoryIn: aFilesystem)) version snapshot]
on: self expectedReadErrorsOnMissingSnapshot
do: [^ MCSnapshot empty]
3 changes: 3 additions & 0 deletions src/Squot.package/SquotCodeMapper.class/instance/readerOn..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
snapshot-creation
readerOn: aReference
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
changes-operations
serialize: aSnapshot into: aFileSystem
self subclassResponsibility.
| directory |
directory := self packageDirectoryIn: aFileSystem.
aSnapshot definitions
ifEmpty: [directory deleteAll]
ifNotEmpty: [
self cleanDirectory: directory.
self write: aSnapshot with: (self writerOn: directory)].
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes-operations
write: aSnapshot with: writerObject
self subclassResponsibility.
3 changes: 3 additions & 0 deletions src/Squot.package/SquotCodeMapper.class/instance/writerOn..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes-operations
writerOn: aReference
self subclassResponsibility.
12 changes: 9 additions & 3 deletions src/Squot.package/SquotCodeMapper.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@
"changeSetFromFSCommit:toImage:" : "mad 9/6/2023 19:03",
"changeSetFromImage:toFSCommit:" : "mad 9/6/2023 19:03",
"changeSetFromSnapshot:toSnapshot:" : "mad 10/16/2023 17:20",
"cleanDirectory:" : "mad 10/4/2024 19:40",
"encodingName" : "mad 4/18/2024 18:11",
"expectedReadErrorsOnMissingSnapshot" : "mad 10/4/2024 19:56",
"hash" : "mad 9/13/2023 18:28",
"hexHashIn:" : "mad 10/1/2024 23:00",
"initialize" : "mad 4/25/2023 19:41",
"loadSnapshotFrom:" : "mad 10/16/2023 17:22",
"loadSnapshotFrom:" : "mad 10/4/2024 19:59",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"mergeCommit:into:withBase:" : "mad 10/2/2024 00:31",
"operationFrom:to:" : "mad 8/13/2024 17:52",
"package" : "mad 4/21/2023 23:34",
"package:" : "mad 4/22/2023 00:09",
"packageDirectoryIn:" : "mad 10/4/2024 19:58",
"packagePath" : "mad 4/29/2024 22:20",
"path" : "mad 4/21/2023 23:35",
"path:" : "mad 4/22/2023 00:09",
"pathWithPackage" : "mad 11/14/2023 18:57",
"printDescriptionOn:" : "mad 10/2/2024 20:12",
"serialize:into:" : "mad 10/16/2023 17:24",
"workingCopySnapshot" : "mad 4/25/2023 18:30" } }
"readerOn:" : "mad 10/4/2024 19:58",
"serialize:into:" : "mad 10/4/2024 20:02",
"workingCopySnapshot" : "mad 4/25/2023 18:30",
"write:with:" : "mad 10/4/2024 20:02",
"writerOn:" : "mad 10/4/2024 20:03" } }

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
snapshot-creation
readerOn: aReference
^ (self readerClass on: aReference)
fileUtils: (self fileUtilsOn: aReference);
packageDirectory: aReference pathString;
yourself

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes-operations
write: aSnapshot with: aWriter
aWriter writeDefinitions: aSnapshot definitions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
changes-operations
writerIn: aFileSystem
| directory repository fileUtils fileTreeWriter |
directory := self packageDirectoryIn: aFileSystem.
directory ensureDirectory.
writerOn: aReference
| repository fileUtils fileTreeWriter |
repository := SquotMockMCRepository new
directory: directory;
directory: aReference;
yourself.
fileUtils := self fileUtilsOn: directory.
fileUtils := self fileUtilsOn: aReference.
fileTreeWriter := (self fileTreeWriterClass on: repository)
directory: (SquotPathUtilities asString: directory path);
directory: (SquotPathUtilities asString: aReference path);
fileUtils: fileUtils;
initializePackageFileDirectoryCache;
yourself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"instance" : {
"fileTreeWriterClass" : "mad 4/18/2024 17:41",
"fileUtilsOn:" : "mad 4/18/2024 17:44",
"loadSnapshotFrom:" : "mad 4/18/2024 17:45",
"packageDirectoryIn:" : "mad 4/10/2024 19:46",
"packagePath" : "mad 11/14/2023 18:58",
"readerClass" : "mad 10/16/2023 19:50",
"readerIn:" : "mad 10/16/2023 19:56",
"serialize:into:" : "mad 5/23/2024 18:01",
"readerOn:" : "mad 10/4/2024 19:52",
"write:with:" : "mad 10/4/2024 20:03",
"writerClass" : "mad 4/10/2024 18:17",
"writerIn:" : "mad 4/29/2024 22:17" } }
"writerOn:" : "mad 10/4/2024 19:48" } }
3 changes: 3 additions & 0 deletions src/Squot.package/SquotMapper.class/instance/maps..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
maps: aPath
^ self mappedPathPatterns anySatisfy: [:each | each matches: aPath]
1 change: 1 addition & 0 deletions src/Squot.package/SquotMapper.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"isTracked:" : "mad 9/30/2024 15:01",
"isUntracked" : "mad 9/30/2024 15:41",
"mappedPathPatterns" : "mad 10/4/2024 15:33",
"maps:" : "mad 10/4/2024 19:40",
"mergeCommit:into:withBase:" : "mad 9/6/2023 12:52",
"printDescriptionOn:" : "mad 10/2/2024 20:07",
"printOn:" : "mad 10/2/2024 20:07",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
snapshot-creation
expectedReadErrorsOnMissingSnapshot
^ super expectedReadErrorsOnMissingSnapshot, TonelParseError

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
snapshot-creation
readerOn: aReference
^ TonelReader
on: aReference parent
fileName: self package name

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes-operations
write: aSnapshot with: aWriter
aWriter writeSnapshot: aSnapshot.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
changes-operations
writerIn: aFileSystem
writerOn: aReference
| writer |
writer := TonelWriter on: (aFileSystem referenceTo: self path).
writer := TonelWriter on: aReference.
writer packageName: self package name.
writer currentPackageProperties
at: TonelWriter squeakChangestamp put: self writeTimestamps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"encodingName" : "mad 4/18/2024 18:11",
"packageNameFromPackagePath:" : "mad 10/4/2024 16:29" },
"instance" : {
"loadSnapshotFrom:" : "mad 10/16/2023 19:52",
"expectedReadErrorsOnMissingSnapshot" : "mad 10/4/2024 19:56",
"packagePath" : "mad 4/29/2024 22:20",
"readerIn:" : "mad 10/16/2023 20:35",
"serialize:into:" : "mad 4/15/2024 20:46",
"readerOn:" : "mad 10/4/2024 19:55",
"write:with:" : "mad 10/4/2024 20:03",
"writeTimestamps" : "mad 9/26/2023 15:24",
"writeTimestamps:" : "mad 9/26/2023 15:24",
"writerIn:" : "mad 4/15/2024 20:46" } }
"writerOn:" : "mad 10/4/2024 19:47" } }

0 comments on commit 6a711e5

Please sign in to comment.