diff --git a/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersion.st b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersion.st index d10ac7d9a..ff7ec0a5e 100644 --- a/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersion.st +++ b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersion.st @@ -1,5 +1,8 @@ accessing installedVersion - ^ ((self project version spec repositorySpecs collect: #createRepository) - detect: [:each | each projectPath = GSSelfUpdater fullRepositoryName]) - projectVersion \ No newline at end of file + (self project version spec repositorySpecs collect: #createRepository) do: [:each | + (self installedVersionFromRepository: each) ifNotNil: [:version | ^ version]]. + self error: + 'Please install git-s via git, either using a Metacello GitHub repository + or by cloning git-s using a git client (e. g. using a GitHub action).' + withoutLineEndings withBlanksCondensed. \ No newline at end of file diff --git a/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromDirectoryRepository..st b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromDirectoryRepository..st new file mode 100644 index 000000000..c43b909a2 --- /dev/null +++ b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromDirectoryRepository..st @@ -0,0 +1,10 @@ +accessing +installedVersionFromDirectoryRepository: anMCRepository + | current | + (anMCRepository isKindOf: MCDirectoryRepository) ifFalse: [^ nil]. + current := anMCRepository directory asFSReference. + [current isRoot] whileFalse: [ | repository | + repository := GitRepository uninitializedOn: current. + repository exists ifTrue: [^ repository unitOfWork headRef]. + current := current parent]. + ^ nil \ No newline at end of file diff --git a/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromGitHubRepository..st b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromGitHubRepository..st new file mode 100644 index 000000000..2e2594198 --- /dev/null +++ b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromGitHubRepository..st @@ -0,0 +1,5 @@ +accessing +installedVersionFromGitHubRepository: anMCRepository + (anMCRepository isKindOf: MCFetchGithubRepository) ifFalse: [^ nil]. + anMCRepository projectPath = GSSelfUpdater fullRepositoryName ifFalse: [^ nil]. + ^ anMCRepository projectVersion \ No newline at end of file diff --git a/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromRepository..st b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromRepository..st new file mode 100644 index 000000000..f7e033fed --- /dev/null +++ b/src/BaselineOfGitS.package/BaselineOfGitS.class/instance/installedVersionFromRepository..st @@ -0,0 +1,5 @@ +accessing +installedVersionFromRepository: each + (self installedVersionFromGitHubRepository: each) ifNotNil: [:version | ^ version]. + (self installedVersionFromDirectoryRepository: each) ifNotNil: [:version | ^ version]. + ^ nil \ No newline at end of file diff --git a/src/BaselineOfGitS.package/BaselineOfGitS.class/methodProperties.json b/src/BaselineOfGitS.package/BaselineOfGitS.class/methodProperties.json index 7a1e6b54c..821d092f4 100644 --- a/src/BaselineOfGitS.package/BaselineOfGitS.class/methodProperties.json +++ b/src/BaselineOfGitS.package/BaselineOfGitS.class/methodProperties.json @@ -3,6 +3,9 @@ }, "instance" : { "baseline:" : "mad 10/9/2024 22:23", - "installedVersion" : "mad 10/9/2024 21:00", + "installedVersion" : "mad 10/24/2024 14:25", + "installedVersionFromDirectoryRepository:" : "mad 10/24/2024 14:59", + "installedVersionFromGitHubRepository:" : "mad 10/24/2024 14:27", + "installedVersionFromRepository:" : "mad 10/24/2024 14:26", "postLoad" : "mad 10/9/2024 19:35", "projectClass" : "jr 5/4/2017 17:25" } } diff --git a/src/FileSystem-Git.package/GitRepository.class/class/uninitializedOn..st b/src/FileSystem-Git.package/GitRepository.class/class/uninitializedOn..st new file mode 100644 index 000000000..23682ba09 --- /dev/null +++ b/src/FileSystem-Git.package/GitRepository.class/class/uninitializedOn..st @@ -0,0 +1,3 @@ +instance creation +uninitializedOn: aReference + ^ self basicNew basicInitializeOn: aReference asFileReference \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitRepository.class/instance/basicInitializeOn..st b/src/FileSystem-Git.package/GitRepository.class/instance/basicInitializeOn..st new file mode 100644 index 000000000..b794d699a --- /dev/null +++ b/src/FileSystem-Git.package/GitRepository.class/instance/basicInitializeOn..st @@ -0,0 +1,4 @@ +initialize-release +basicInitializeOn: anFSReference + reference := anFSReference. + self initializeCache. \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitRepository.class/instance/initializeOn..st b/src/FileSystem-Git.package/GitRepository.class/instance/initializeOn..st index a0d8e2ee2..a5799daeb 100644 --- a/src/FileSystem-Git.package/GitRepository.class/instance/initializeOn..st +++ b/src/FileSystem-Git.package/GitRepository.class/instance/initializeOn..st @@ -1,5 +1,5 @@ initialize-release initializeOn: anFSReference - reference := anFSReference. - self initializeCache. - self gitInitialize \ No newline at end of file + self + basicInitializeOn: anFSReference; + gitInitialize. \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitRepository.class/methodProperties.json b/src/FileSystem-Git.package/GitRepository.class/methodProperties.json index de2fb3cc4..71ccd7a36 100644 --- a/src/FileSystem-Git.package/GitRepository.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitRepository.class/methodProperties.json @@ -3,11 +3,13 @@ "initialize" : "jr 6/3/2017 12:07", "memory" : "DamienCassou 2/26/2013 15:53", "new" : "MaxLeske 8/11/2011 22:15", - "on:" : "CamilloBruni 8/30/2012 13:58" }, + "on:" : "CamilloBruni 8/30/2012 13:58", + "uninitializedOn:" : "mad 10/24/2024 14:41" }, "instance" : { "=" : "CamilloBruni 7/20/2011 13:07", "addRemote:" : "jr 12/1/2018 23:35", "baseDir" : "CamilloBruni 7/15/2011 15:40", + "basicInitializeOn:" : "mad 10/24/2024 14:39", "configAt:ifAbsent:" : "jr 2/23/2020 21:29", "configFile" : "jr 12/13/2016 17:45", "configPartsFromSectionLabel:" : "jr 4/13/2017 23:04", @@ -26,7 +28,7 @@ "headsDir" : "CamilloBruni 8/9/2011 17:41", "initializeCache" : "jr 3/10/2020 21:22", "initializeHEAD" : "CamilloBruni 9/2/2012 11:47", - "initializeOn:" : "jr 3/22/2017 15:12", + "initializeOn:" : "mad 10/24/2024 14:39", "isInitialized" : "CamilloBruni 9/2/2012 11:33", "nameOf:in:" : "jr 11/23/2016 18:22", "newUnitOfWork" : "jr 4/20/2020 21:21", diff --git a/src/GitS-Core.package/GSSelfUpdater.class/class/getShaOfVersion..st b/src/GitS-Core.package/GSSelfUpdater.class/class/getShaOfVersion..st index d1b8abea5..7f85bb878 100644 --- a/src/GitS-Core.package/GSSelfUpdater.class/class/getShaOfVersion..st +++ b/src/GitS-Core.package/GSSelfUpdater.class/class/getShaOfVersion..st @@ -1,3 +1,9 @@ requests getShaOfVersion: aString - ^ (WebClient httpGet: (self githubApiUrlForVersion: aString)) content parseAsJson at: 'sha' \ No newline at end of file + | response json | + response := WebClient httpGet: (self githubApiUrlForVersion: aString). + json := response content parseAsJson. + response code = 200 ifFalse: [ + ^ self error: ('Error while trying to resolve git-s version {1}: {2}' + format: {aString printString. json at: 'message'})]. + ^ json at: 'sha' \ No newline at end of file diff --git a/src/GitS-Core.package/GSSelfUpdater.class/methodProperties.json b/src/GitS-Core.package/GSSelfUpdater.class/methodProperties.json index c42bbc60c..3a4df31a8 100644 --- a/src/GitS-Core.package/GSSelfUpdater.class/methodProperties.json +++ b/src/GitS-Core.package/GSSelfUpdater.class/methodProperties.json @@ -5,7 +5,7 @@ "branchName:" : "mad 11/4/2024 13:02", "checkForNewVersion" : "mad 10/25/2024 11:32", "fullRepositoryName" : "mad 10/9/2024 16:33", - "getShaOfVersion:" : "mad 10/9/2024 18:39", + "getShaOfVersion:" : "mad 10/24/2024 15:07", "githubApiUrlForVersion:" : "mad 10/9/2024 18:38", "installScriptForInstalledVersion" : "mad 10/9/2024 16:51", "installScriptForVersion:" : "mad 10/9/2024 16:50",