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