Skip to content

Commit

Permalink
Renamed #canBeRun as #canBeExecuted to be more consistent.
Browse files Browse the repository at this point in the history
Created a deprecation to ease migration of users.
  • Loading branch information
juliendelplanque committed Aug 10, 2019
1 parent 813cda2 commit 152e6a7
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/BaselineOfCommander2/BaselineOfCommander2.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ BaselineOfCommander2 >> baseline: spec [
spec for: #common do: [
spec
package: 'Commander2';
package: 'Commander2-Deprecations' with: [ spec requires: #('Commander2') ];
package: 'Commander2-Tests' ]
]
7 changes: 7 additions & 0 deletions src/Commander2-Deprecations/CmAbstractCommand.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #CmAbstractCommand }

{ #category : #'*Commander2-Deprecations' }
CmAbstractCommand >> canBeRun [
self deprecated: 'Use #canBeExecuted instead.' transformWith: '`@receiver canBeRun' -> '`@receiver canBeExecuted'.
^ self canBeExecuted
]
1 change: 1 addition & 0 deletions src/Commander2-Deprecations/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Commander2-Deprecations' }
6 changes: 3 additions & 3 deletions src/Commander2-Tests/CmCommandTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ CmCommandTest >> testBasicName [
]

{ #category : #test }
CmCommandTest >> testCanBeRun [
CmCommandTest >> testCanBeExecuted [
command context: 0. "Need to set context before because the command expects it."
self deny: command canBeRun.
self deny: command canBeExecuted.

command context: 42.
self assert: command canBeRun.
self assert: command canBeExecuted.
]

{ #category : #test }
Expand Down
2 changes: 1 addition & 1 deletion src/Commander2-Tests/CmFakeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Class {
}

{ #category : #testing }
CmFakeCommand >> canBeRun [
CmFakeCommand >> canBeExecuted [
^ self context = 42
]

Expand Down
2 changes: 1 addition & 1 deletion src/Commander2/CmAbstractCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CmAbstractCommand >> acceptVisitor: aCmCommandOrGroup [
]

{ #category : #testing }
CmAbstractCommand >> canBeRun [
CmAbstractCommand >> canBeExecuted [
"This hook allows the command decide if it can be run with the context it holds or not.
It should return a boolean.
"
Expand Down
4 changes: 2 additions & 2 deletions src/Commander2/CmBlockCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ CmBlockCommand >> block: anObject [
]

{ #category : #testing }
CmBlockCommand >> canBeRun [
CmBlockCommand >> canBeExecuted [
self hasContext "When no context is set, we consider the command to be runnable. So we call super."
ifFalse: [ ^ super canBeRun ].
ifFalse: [ ^ super canBeExecuted ].

^ self canBeRunBlock value: self context
]
Expand Down
2 changes: 1 addition & 1 deletion src/Commander2/CmCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CmCommand class >> runWith: anObject [
]

{ #category : #testing }
CmCommand >> canBeRun [
CmCommand >> canBeExecuted [
"See my super class comment for this method.
By default I return true.
"
Expand Down
4 changes: 2 additions & 2 deletions src/Commander2/CmCommandDecorator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ CmCommandDecorator >> basicName: aString [
]

{ #category : #testing }
CmCommandDecorator >> canBeRun [
CmCommandDecorator >> canBeExecuted [
"This hook allows the command decide if it can be run with the context it holds or not.
It should return a boolean.
"
^ self decoratedCommand canBeRun
^ self decoratedCommand canBeExecuted
]

{ #category : #accessing }
Expand Down

0 comments on commit 152e6a7

Please sign in to comment.