Skip to content

Commit

Permalink
Merge pull request #60 from pharo-vcs/59-import-fails-on-method-exten…
Browse files Browse the repository at this point in the history
…sion

59-import-fails-on-method-extension
  • Loading branch information
estebanlm authored Jan 6, 2019
2 parents 7695b52 + d6ea569 commit d4c6161
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
private
createDefaultOrganizationFrom: aMCClassDefinition
^ MCOrganizationDefinition categories: { aMCClassDefinition category }
createDefaultOrganizationFrom: aCollection
"answers a default organisation for the cases where there are none"

"simplest case, I answer the clas definition"
snapshot definitions
detect: #isClassDefinition
ifFound: [ :each | ^ each category ].

^ self createDefaultOrganizationFromDefinition: (snapshot definitions
detect: #isMethodDefinition
ifNone: [ self error: 'cannot determine package name from empty snapshot' ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
createDefaultOrganizationFromDefinition: aMethodDefinition

^ MCOrganizationDefinition categories: (self packageNameForMethodDefinition: aMethodDefinition)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
private
packageNameForMethodDefinition: aMethodDefinition
| category |

self assert: aMethodDefinition category first = $*.
category := aMethodDefinition category allButFirst.
^(MCWorkingCopy allManagers
detect: ((category allSatisfy: #isLowercase)
ifTrue: [[: wc| category beginsWith: wc packageName asLowercase]]
ifFalse: [[: wc| category beginsWith: wc packageName]])) packageName
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ writeSnapshot: aSnapshot
It has to be just one but well..."
self writePackage: (snapshot definitions
detect: #isOrganizationDefinition
ifFound: [ :each | each ]
ifNone: [ self createDefaultOrganizationFrom: (snapshot definitions detect: #isClassDefinition) ]).
ifNone: [ self createDefaultOrganizationFrom: snapshot definitions ]).
"now export classes"
(snapshot definitions
select: #isClassDefinition)
Expand Down

0 comments on commit d4c6161

Please sign in to comment.