Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add suffix Query for all queries #378

Closed
dionisiydk opened this issue Dec 9, 2018 · 2 comments
Closed

add suffix Query for all queries #378

dionisiydk opened this issue Dec 9, 2018 · 2 comments
Labels

Comments

@dionisiydk
Copy link
Collaborator

dionisiydk commented Dec 9, 2018

Let's finish @Ducasse refactoring to make all queries named with suffix Query together with their tests.
Following script performs change:

toRename := ClyQuery allSubclasses reject: [ :each | each name includesSubstring: 'Query' ].

toRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each; newName: (each name, 'Query') asSymbol.
	c execute	 ].

testsToRename := toRename collect: [ :each | (each name withoutSuffix: 'Query'), 'Tests' ] thenSelect: [ :each | (self environment at: each asSymbol ifAbsent: [ nil ]) notNil ].

testsToRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each asClass; newName: ((each withoutSuffix: 'Tests'), 'QueryTests') asSymbol.
	c execute	 ].
@Ducasse
Copy link
Contributor

Ducasse commented Dec 10, 2018

TX

dionisiydk added a commit to dionisiydk/Calypso that referenced this issue Jan 4, 2019
- all queries are renamed to have suffix Query
- all queriy tests are rename accordingly
pharo-ide#407:
- all tests with singular suffix Test instead of Tests
dionisiydk added a commit to dionisiydk/Calypso that referenced this issue Jan 10, 2019
- all queries are renamed to have suffix Query
- all queriy tests are rename accordingly

Changes are done with following script:
```Smalltalk
toRename := ClyQuery allSubclasses reject: [ :each | each name includesSubstring: 'Query' ].

toRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each; newName: (each name, 'Query') asSymbol.
	c execute	 ].

testsToRename := toRename collect: [ :each | (each name withoutSuffix: 'Query'), 'Tests' ] thenSelect: [ :each | (self environment at: each asSymbol ifAbsent: [ nil ]) notNil ].

testsToRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each asClass; newName: ((each withoutSuffix: 'Tests'), 'QueryTest') asSymbol.
	c execute	 ].
```

pharo-ide#407:
- all tests are renamed to have singular suffix Test instead of Tests

Changes are done with following script:
```Smalltalk
allTests := TestCase allSubclasses select: [ :each | each package name beginsWith: 'Calypso' ].

toRename := allTests select: [ :each | each name endsWith: 'Tests' ].
"toRename collect: [ :each | each name allButLast ]."

toRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each; newName: (each name allButLast) asSymbol.
	c execute	 ].
```
dionisiydk added a commit to dionisiydk/Calypso that referenced this issue Jan 10, 2019
- all queries are renamed to have suffix Query
- all queriy tests are rename accordingly

Changes are done with following script:
```Smalltalk
toRename := ClyQuery allSubclasses reject: [ :each | each name includesSubstring: 'Query' ].

toRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each; newName: (each name, 'Query') asSymbol.
	c execute	 ].

testsToRename := toRename collect: [ :each | (each name withoutSuffix: 'Query'), 'Tests' ] thenSelect: [ :each | (self environment at: each asSymbol ifAbsent: [ nil ]) notNil ].

testsToRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each asClass; newName: ((each withoutSuffix: 'Tests'), 'QueryTest') asSymbol.
	c execute	 ].
```

pharo-ide#407:
- all tests are renamed to have singular suffix Test instead of Tests

Changes are done with following script:
```Smalltalk
allTests := TestCase allSubclasses select: [ :each | each package name beginsWith: 'Calypso' ].

toRename := allTests select: [ :each | each name endsWith: 'Tests' ].
"toRename collect: [ :each | each name allButLast ]."

toRename do: [ :each | | c |
	c := SycRenameClassCommand new targetClass: each; newName: (each name allButLast) asSymbol.
	c execute	 ].
```
@dionisiydk
Copy link
Collaborator Author

It's done now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants