Improving command line wrapper.
This commit is contained in:
parent
cf919bdaf6
commit
46e5f25e76
@ -13,7 +13,8 @@ Class {
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'local',
|
||||
'remote'
|
||||
'remote',
|
||||
'repository'
|
||||
],
|
||||
#classInstVars : [
|
||||
'executable'
|
||||
@ -32,6 +33,15 @@ FossilRepo class >> executable: aPathString [
|
||||
executable := aPathString
|
||||
]
|
||||
|
||||
{ #category : #'instance creation' }
|
||||
FossilRepo class >> local: aFilePath repository: aFossilFilePath [
|
||||
|
||||
^ self new
|
||||
local: aFilePath;
|
||||
repository: aFossilFilePath;
|
||||
yourself
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo class >> locateExecutable [
|
||||
Smalltalk os isWindows ifTrue: [ ^ self ].
|
||||
@ -43,18 +53,6 @@ FossilRepo class >> locateExecutable [
|
||||
^ outString allButLast ]
|
||||
]
|
||||
|
||||
{ #category : #operation }
|
||||
FossilRepo >> add2: aFileRealitvePath [
|
||||
|
||||
OSSUnixSubprocess new
|
||||
command: 'fossil';
|
||||
arguments: { 'add' . aFileRealitvePath };
|
||||
workingDirectory: self localFolderName2;
|
||||
redirectStdout;
|
||||
redirectStderr;
|
||||
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,
|
||||
@ -62,7 +60,7 @@ FossilRepo >> add: fileRelativePath [
|
||||
|
||||
OSSUnixSubprocess new
|
||||
command: self class locateExecutable;
|
||||
workingDirectory: self localFolderName;
|
||||
workingDirectory: self localRoot;
|
||||
arguments: { 'add' . fileRelativePath };
|
||||
redirectStdout;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
@ -103,7 +101,7 @@ FossilRepo >> command: aCommandArgument [
|
||||
OSSUnixSubprocess new
|
||||
command: 'fossil';
|
||||
arguments: { aCommandArgument };
|
||||
workingDirectory: self localFolderName2;
|
||||
workingDirectory: self localRoot;
|
||||
redirectStdout;
|
||||
redirectStderr;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
@ -117,7 +115,7 @@ FossilRepo >> commit: message [
|
||||
OSSUnixSubprocess new
|
||||
command: self class locateExecutable;
|
||||
arguments: { 'commit' . '--no-warnings' . '-m' . message };
|
||||
workingDirectory: self localFolderName;
|
||||
workingDirectory: self localRoot;
|
||||
redirectStdout;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
]
|
||||
@ -138,7 +136,7 @@ FossilRepo >> commit: message withEnabledWarnings: aBoolean [
|
||||
warningCommand.
|
||||
'-m'.
|
||||
message};
|
||||
workingDirectory: self localFolderName;
|
||||
workingDirectory: self localRoot;
|
||||
redirectStdout;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
]
|
||||
@ -165,7 +163,7 @@ FossilRepo >> fossilUv: anArgument arg2: aSecondArgument [
|
||||
OSSUnixSubprocess new
|
||||
command: 'fossil';
|
||||
arguments: { 'uv' . anArgument . aSecondArgument };
|
||||
workingDirectory: self localFolderName2;
|
||||
workingDirectory: self localRoot;
|
||||
redirectStdout;
|
||||
redirectStderr;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
@ -215,7 +213,7 @@ FossilRepo >> init: absolutePathString [
|
||||
OSSUnixSubprocess new
|
||||
command: self class locateExecutable;
|
||||
arguments: { 'init' . absolutePathString };
|
||||
workingDirectory: self localFolderName;
|
||||
workingDirectory: self localRoot;
|
||||
redirectStdout;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
]
|
||||
@ -275,15 +273,11 @@ FossilRepo >> local: aLocalFilePath [
|
||||
local := aLocalFilePath
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
FossilRepo >> localFolderName [
|
||||
^ self local parent fullName
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> localFolderName2 [
|
||||
FossilRepo >> localRoot [
|
||||
|
||||
^ self local fullName
|
||||
local ifNotNil: [ ^ self local fullName ].
|
||||
^((self status lines detect: [ :line | line beginsWith: 'local-root:' ]) splitOn: ':') second trimmed
|
||||
]
|
||||
|
||||
{ #category : #authentication }
|
||||
@ -324,6 +318,18 @@ FossilRepo >> remote: anUrlString [
|
||||
remote := anUrlString asUrl
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> repository [
|
||||
|
||||
^ repository
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> repository: aFossilRepoFile [
|
||||
|
||||
^ repository := aFossilRepoFile fullName
|
||||
]
|
||||
|
||||
{ #category : #utilities }
|
||||
FossilRepo >> sanitize: aFileNameWithRelativePath [
|
||||
"I dicern if my argument concerns to a versioned or an unversioned file,
|
||||
@ -334,33 +340,16 @@ FossilRepo >> sanitize: aFileNameWithRelativePath [
|
||||
ifTrue: [ ^ (aFileNameWithRelativePath copyFrom: 4 to: aFileNameWithRelativePath size) ]
|
||||
]
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
FossilRepo >> status [
|
||||
OSSUnixSubprocess new
|
||||
command: '/usr/bin/fossil';
|
||||
arguments: #('status');
|
||||
workingDirectory: self localFolderName;
|
||||
redirectStdout;
|
||||
redirectStderr;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> status2 [
|
||||
FossilRepo >> status [
|
||||
|
||||
^ self command: 'status'.
|
||||
^ self command: 'status'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> update [
|
||||
|
||||
OSSUnixSubprocess new
|
||||
command: 'fossil';
|
||||
arguments: #('update');
|
||||
workingDirectory: self localFolderName2;
|
||||
redirectStdout;
|
||||
redirectStderr;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
^ self command: 'update'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user