Supporting executable detection and repo initialization.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2020-02-19 21:31:31 +00:00
parent 90ad65b589
commit cf6243340c
1 changed files with 41 additions and 4 deletions

View File

@ -15,16 +15,40 @@ Class {
'local',
'remote'
],
#classInstVars : [
'executable'
],
#category : #Fossil
}
{ #category : #'as yet unclassified' }
{ #category : #accessing }
FossilRepo class >> executable [
^ executable ifNil: [ executable := self locateExecutable ]
]
{ #category : #accessing }
FossilRepo class >> executable: aPathString [
"I define where the Fossil package is installed in this operative system."
executable := aPathString
]
{ #category : #accessing }
FossilRepo class >> locateExecutable [
Smalltalk os isWindows ifTrue: [ ^ self ].
OSSUnixSubprocess new
command: 'which';
arguments: #('fossil') ;
redirectStdout;
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
]
{ #category : #operation }
FossilRepo >> add: fileRelativePath [
"I add a file to the working Fossil repository, given that both, the file and the repositor,
share the same root directory/folder."
OSSUnixSubprocess new
command: '/usr/bin/fossil';
command: self class locateExecutable;
arguments: { 'add' . fileRelativePath };
workingDirectory: self localFolderName;
redirectStdout;
@ -60,13 +84,13 @@ FossilRepo >> checkinsFor: relativeFilePath [
^ payload at: 'checkins'
]
{ #category : #'as yet unclassified' }
{ #category : #operation }
FossilRepo >> commit: message [
"I add a file to the working Fossil repository, given that both, the file and the repositor,
share the same root directory/folder."
OSSUnixSubprocess new
command: '/usr/bin/fossil';
command: self class locateExecutable;
arguments: { 'commit' . '--no-warnings' . '-m' . message };
workingDirectory: self localFolderName;
redirectStdout;
@ -118,6 +142,19 @@ FossilRepo >> getPageContentsFor: anEmbeddedDocUrl [
^ (ZnEasy get: anEmbeddedDocUrl, '?mimetype=text/plain') contents.
]
{ #category : #operation }
FossilRepo >> init: absolutePathString [
"I add a file to the working Fossil repository, given that both, the file and the repositor,
share the same root directory/folder."
Smalltalk os isWindows ifTrue: [ ^ self ].
OSSUnixSubprocess new
command: self class locateExecutable;
arguments: { 'init' . absolutePathString };
workingDirectory: self localFolderName;
redirectStdout;
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
]
{ #category : #utilities }
FossilRepo >> isUnversioned: aFileNameWithRelativePath [