Skip to content

Commit

Permalink
Add GitDirectoryAssetLoader and GitMCRepositoryAssetLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Jun 12, 2024
1 parent 82fce16 commit 3eed649
Show file tree
Hide file tree
Showing 27 changed files with 137 additions and 3 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
newWithName: aString on: anFSReference
^ (self newWithName: aString)
directory: anFSReference;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
assetAt: aPath
^ self assetsCache at: aPath ifAbsentPut: [self readAsset: aPath]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
assetFSPaths
^ self mappers keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
assetsCache: aDictionary
assetsCache := aDictionary.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
assetsCache
^ assetsCache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
directory: anFSReference
directory := anFSReference
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
directory
^ directory
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialize-release
initialize
super initialize.
self assetsCache: Dictionary new.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mapperAt: aPath
^ self mappers at: aPath ifAbsent: [nil]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
mappers
^ mappersCache ifNil: [mappersCache := self readMappers].
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
readAsset: aPath
"Ideally, we could use SquotAssetMapper>>loadVersionFrom: here, but that takes a FileSystem
that is rooted at the repository root. We can't easily provide that, since the asset is stored on
disk and the disk FileSystem is not rooted at the repository root."
^ self readStreamOn: aPath do: [:stream | ((self mapperAt: aPath) ifNil: [^ nil]) readVersionFrom: stream]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
accessing
readMappers
"Ideally, we could use SquotMappersMapper>>loadMappersFromFileSystem: here, but that takes a FileSystem
that is rooted at the repository root. We can't easily provide that, since the asset is stored on
disk and the disk FileSystem is not rooted at the repository root."
^ Dictionary newFrom:
(((self readStreamOn: SquotMappersMapper path do: [:stream | STON fromStream: stream])
select: [:each | each isKindOf: SquotAssetMapper])
collect: [:each | each path -> each])
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
readStreamOn: aPath do: aBlock
^ (self directory resolve: (aPath relativeTo: FSPath root)) readStreamDo: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"class" : {
"newWithName:on:" : "mad 6/12/2024 15:37" },
"instance" : {
"assetAt:" : "mad 6/12/2024 15:32",
"assetFSPaths" : "mad 6/12/2024 15:36",
"assetsCache" : "mad 6/12/2024 15:54",
"assetsCache:" : "mad 6/12/2024 15:54",
"directory" : "mad 6/12/2024 15:48",
"directory:" : "mad 6/12/2024 15:48",
"initialize" : "mad 6/12/2024 15:54",
"mapperAt:" : "mad 6/12/2024 15:35",
"mappers" : "mad 6/12/2024 15:33",
"readAsset:" : "mad 6/12/2024 16:30",
"readMappers" : "mad 6/12/2024 16:31",
"readStreamOn:do:" : "mad 6/12/2024 16:21" } }
16 changes: 16 additions & 0 deletions src/Squot.package/GitDirectoryAssetLoader.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category" : "Squot-Mapper-Asset",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"directory",
"mappersCache",
"assetsCache" ],
"name" : "GitDirectoryAssetLoader",
"pools" : [
],
"super" : "GitNamedAssetLoader",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
newWithName: aString on: aRepository
^ (self newWithName: aString)
repository: aRepository;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
as yet unclassified
scanFor: aString ifAbsent: aBlock
| repository |
repository := MCRepositoryGroup default repositories
detect: [:each |
(each isKindOf: MCFilesystemFetchOnlyRepository)
and: [each projectPath endsWith: '/', aString]]
ifNone: [^ aBlock value].
^ self newWithName: aString on: repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
directory
self directory: (self repository
projectDirectoryFrom: self repository projectPath
version: self repository projectVersion) asFSReference.
^ super directory
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
repository: anMCFilesystemFetchOnlyRepository
repository := anMCFilesystemFetchOnlyRepository
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
repository
^ repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"class" : {
"newWithName:on:" : "mad 6/12/2024 15:49",
"scanFor:ifAbsent:" : "mad 6/12/2024 15:49" },
"instance" : {
"directory" : "mad 6/12/2024 16:03",
"repository" : "mad 6/12/2024 15:53",
"repository:" : "mad 6/12/2024 15:53" } }
14 changes: 14 additions & 0 deletions src/Squot.package/GitMCRepositoryAssetLoader.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Squot-Mapper-Asset",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"repository" ],
"name" : "GitMCRepositoryAssetLoader",
"pools" : [
],
"super" : "GitDirectoryAssetLoader",
"type" : "normal" }
3 changes: 3 additions & 0 deletions src/Squot.package/SquotMappersMapper.class/class/path.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
path
^ FSPath / '.squot-materialize'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
path
^ FSPath / '.squot-materialize'
^ self class path
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
},
"path" : "mad 6/12/2024 15:29" },
"instance" : {
"addToSar:" : "mad 1/8/2024 20:54",
"canBeRemoved" : "mad 2/20/2024 15:42",
Expand All @@ -21,5 +21,5 @@
"mappedPaths" : "mad 10/21/2023 22:52",
"mergeCommit:into:withBase:" : "mad 2/20/2024 15:11",
"mergeCommit:into:withBase:in:" : "mad 2/20/2024 15:17",
"path" : "mad 9/20/2023 11:53",
"path" : "mad 6/12/2024 15:29",
"referenceIn:" : "mad 9/20/2023 11:54" } }

0 comments on commit 3eed649

Please sign in to comment.