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

Migrate to Tonel V3 #1766

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 11 additions & 10 deletions Iceberg-ArchitecturalRules/IceLibgitRuleBreakerRepository.class.st
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
Class {
#name : #IceLibgitRuleBreakerRepository,
#superclass : #IceLibgitRepository,
#category : 'Iceberg-ArchitecturalRules'
#name : 'IceLibgitRuleBreakerRepository',
#superclass : 'IceLibgitRepository',
#category : 'Iceberg-ArchitecturalRules',
#package : 'Iceberg-ArchitecturalRules'
}

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testDefinedRepositoryAccessor [

<repositoryHandleAccessor>
^ handle
]

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testMethodAccessHandleDirectly [

^ handle allBranches
]

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testMethodAccessHandleDirectlyWithErrorHandler [

self handleLibgitError: [handle allBranches]
]

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testMethodAccessHandleThroughAccessor [

^ self testDefinedRepositoryAccessor allBranches
]

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testMethodAccessHandleThroughAccessorWithErrorHandler [

self handleLibgitError: [ self testDefinedRepositoryAccessor allBranches]
]

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testMethodNotBreakingRule [

^ 1+1
]

{ #category : #tests }
{ #category : 'tests' }
IceLibgitRuleBreakerRepository >> testNonDefinedRepositoryAccessor [

^ handle
Expand Down
17 changes: 9 additions & 8 deletions Iceberg-ArchitecturalRules/IceShouldHandleLibgitErrors.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ Otherwise, libgit errors may be thrown to the user and produce ugly effects. E.g
- Libgit errors are criptyc and can only be understood by reading the message text...
"
Class {
#name : #IceShouldHandleLibgitErrors,
#superclass : #ReAbstractRule,
#category : #'Iceberg-ArchitecturalRules'
#name : 'IceShouldHandleLibgitErrors',
#superclass : 'ReAbstractRule',
#category : 'Iceberg-ArchitecturalRules',
#package : 'Iceberg-ArchitecturalRules'
}

{ #category : #'testing-interest' }
{ #category : 'testing-interest' }
IceShouldHandleLibgitErrors class >> checksNode [

^ true
]

{ #category : #running }
{ #category : 'running' }
IceShouldHandleLibgitErrors >> check: aNode forCritiquesDo: aBlock [

"Detect strange case where method node is nil"
Expand All @@ -44,21 +45,21 @@ IceShouldHandleLibgitErrors >> check: aNode forCritiquesDo: aBlock [
ifFalse: [ aBlock cull: (self critiqueFor: aNode) ]
]

{ #category : #accessing }
{ #category : 'accessing' }
IceShouldHandleLibgitErrors >> group [

^ 'Architectural'
]

{ #category : #accessing }
{ #category : 'accessing' }
IceShouldHandleLibgitErrors >> libgitRepositoryHandleAccessorsForClass: aClass [

^ aClass allMethods
select:
[ :m | m pragmas anySatisfy: [ :p | p selector = IceLibgitRepository libgitRepositoryHandleAccessorPragmaSelector ] ]
]

{ #category : #accessing }
{ #category : 'accessing' }
IceShouldHandleLibgitErrors >> name [

^ 'Should manage errors when doing a libgit call'
Expand Down
25 changes: 13 additions & 12 deletions Iceberg-ArchitecturalRules/IceShouldHandleLibgitErrorsTest.class.st
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Class {
#name : #IceShouldHandleLibgitErrorsTest,
#superclass : #TestCase,
#category : 'Iceberg-ArchitecturalRules'
#name : 'IceShouldHandleLibgitErrorsTest',
#superclass : 'TestCase',
#category : 'Iceberg-ArchitecturalRules',
#package : 'Iceberg-ArchitecturalRules'
}

{ #category : #rules }
{ #category : 'rules' }
IceShouldHandleLibgitErrorsTest class >> libgitRepositoryHandleAccessors [
self shouldBeImplemented.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> check: aRule on: aMethod [

| lintRule |
Expand All @@ -18,7 +19,7 @@ IceShouldHandleLibgitErrorsTest >> check: aRule on: aMethod [
^ lintRule result smallLintCritics
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testDefinedRepositoryAccessorDoesNotBreakRule [

| critiques |
Expand All @@ -27,7 +28,7 @@ IceShouldHandleLibgitErrorsTest >> testDefinedRepositoryAccessorDoesNotBreakRule
self assert: critiques isEmpty.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testDirectHandleAccessWithErrorChecking [

| critiques |
Expand All @@ -36,7 +37,7 @@ IceShouldHandleLibgitErrorsTest >> testDirectHandleAccessWithErrorChecking [
self assert: critiques isEmpty.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testDirectHandleAccessWithoutErrorChecking [

| critiques |
Expand All @@ -45,7 +46,7 @@ IceShouldHandleLibgitErrorsTest >> testDirectHandleAccessWithoutErrorChecking [
self assert: critiques notEmpty.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testHandleAccessThroughAllowedAccessorWithErrorChecking [

| critiques |
Expand All @@ -54,7 +55,7 @@ IceShouldHandleLibgitErrorsTest >> testHandleAccessThroughAllowedAccessorWithErr
self assert: critiques isEmpty.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testHandleAccessThroughAllowedAccessorWithoutErrorChecking [

| critiques |
Expand All @@ -63,7 +64,7 @@ IceShouldHandleLibgitErrorsTest >> testHandleAccessThroughAllowedAccessorWithout
self assert: critiques notEmpty.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testMethodNotBreakingRuleYieldsNoCritiques [

| critiques |
Expand All @@ -72,7 +73,7 @@ IceShouldHandleLibgitErrorsTest >> testMethodNotBreakingRuleYieldsNoCritiques [
self assert: critiques isEmpty.
]

{ #category : #tests }
{ #category : 'tests' }
IceShouldHandleLibgitErrorsTest >> testNonDefinedRepositoryAccessorBreaksRule [

| critiques |
Expand Down
2 changes: 1 addition & 1 deletion Iceberg-ArchitecturalRules/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'Iceberg-ArchitecturalRules' }
Package { #name : 'Iceberg-ArchitecturalRules' }
26 changes: 14 additions & 12 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeFileUtils.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
Emulates other 'file utils' classes by reading from a git repository (its blob, not a working copy'). Allows for reading any tree (from any commit) in the repository.
"
Class {
#name : #IceLibgitFiletreeFileUtils,
#superclass : #Object,
#category : #'Iceberg-Libgit-Filetree-Utilities'
#name : 'IceLibgitFiletreeFileUtils',
#superclass : 'Object',
#category : 'Iceberg-Libgit-Filetree-Utilities',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Utilities'
}

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> deleteAll: aTreeBuilder [
^ aTreeBuilder deleteAll
]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> directoryExists: aLGitTreeEntry [
^ aLGitTreeEntry type = LGitObjectTypeEnum git_obj_tree
]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> directoryFromEntry: treeEntry [
^ treeEntry object
]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> directoryFromPath: aString relativeTo: aCommitOrTree [
^ aCommitOrTree
entryByPath: aString
Expand All @@ -31,27 +33,27 @@ IceLibgitFiletreeFileUtils class >> directoryFromPath: aString relativeTo: aComm

]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> directoryName: anEntry [
^ anEntry filename
]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> fileName: anEntry [
^ anEntry filename
]

{ #category : #accessing }
{ #category : 'accessing' }
IceLibgitFiletreeFileUtils class >> pathNameDelimiter [
^ $/
]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> readStreamFor: fileName in: tree do: aBlock [
(tree entryByPath: fileName) readStreamDo: aBlock
]

{ #category : #utilities }
{ #category : 'utilities' }
IceLibgitFiletreeFileUtils class >> writeStreamFor: fileName in: directory do: aBlock [
directory addEntryNamed: fileName withContents: (String streamContents: aBlock).
]
28 changes: 15 additions & 13 deletions Iceberg-Libgit-Filetree/IceLibgitFiletreeLog.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,54 @@
I'm a tool to ask the full history of a method (based on filetree file format).
"
Class {
#name : #IceLibgitFiletreeLog,
#superclass : #IceLog,
#category : #'Iceberg-Libgit-Filetree-Log'
#name : 'IceLibgitFiletreeLog',
#superclass : 'IceLog',
#category : 'Iceberg-Libgit-Filetree-Log',
#package : 'Iceberg-Libgit-Filetree',
#tag : 'Log'
}

{ #category : #testing }
{ #category : 'testing' }
IceLibgitFiletreeLog class >> isAvailableFor: aRepository [
^ aRepository writerClass id = #filetree
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> basepathOf: aPath [
^ aPath
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> cypressClassOrTraitName: aMethod [
^ aMethod origin instanceSide name, (self cypressMethodClassExtension: aMethod)

]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> cypressMethodClassExtension: aMethod [
aMethod isExtension ifTrue: [ ^ '.extension' ].
aMethod origin isTrait ifTrue: [ ^ '.trait' ].
^ '.class'
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> cypressMethodName: aMethod [
^ (MCFileTreeStCypressWriter fileNameForSelector: aMethod selector asString), '.st'
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> cypressMethodSideName: aMethod [
^ aMethod origin isClassSide
ifTrue: [ 'class' ]
ifFalse: [ 'instance' ]
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> cypressPackageName: aPackage [
^ aPackage name, '.package'
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> definitionFor: aMethod path: aPath commit: aCommit [
^ ((IceLibgitFiletreeLogReader fileName: aPath on: aCommit)
package: aMethod package mcPackage;
Expand All @@ -66,7 +68,7 @@ IceLibgitFiletreeLog >> definitionFor: aMethod path: aPath commit: aCommit [
source: '' ]
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> fileNameForMethod: aMethod [
| path |

Expand All @@ -83,7 +85,7 @@ IceLibgitFiletreeLog >> fileNameForMethod: aMethod [
path asStringOn: stream delimiter: '/' ]
]

{ #category : #private }
{ #category : 'private' }
IceLibgitFiletreeLog >> toFileName: aMethod [
^ self fileNameForMethod: aMethod
]
Loading