tonel icon indicating copy to clipboard operation
tonel copied to clipboard

Export of a snapshot with method extensions only fails

Open pavel-krivanek opened this issue 7 years ago • 4 comments

The package Moose-TestResources-KGB-P11FullReferee contains only the method extensions. The method TonelWriter>>#writeSnapshot: does following:

self writePackage: (snapshot definitions 
		detect: #isOrganizationDefinition
		ifFound: [ :each | each ]
		ifNone: [ self createDefaultOrganizationFrom: (snapshot definitions detect: #isClassDefinition) ]).

The snapshot does contain no organization nor class definition (it contains only 3 method definitions) so the code fails.

pavel-krivanek avatar Feb 27 '18 16:02 pavel-krivanek

I've considered fixing this by looking at the extension name, however that is not good because

  • the capitalization can be different (which would result in multiple packages/directories on Linux and different behavior on Windows)
  • the extension name can be actually a compound of "packageName-protocolName"

The only place where the package name is still available (in case of all methods being extension methods), is the MCVersionInfo... so maybe

TonelWriter>>writeVersion: aVersion
	packageName := aVersion package name.
	self writeSnapshot: aVersion snapshot

but this won't work either if someone tries to use writeSnapshot: directly...

peteruhnak avatar Oct 07 '18 15:10 peteruhnak

@pavel-krivanek btw if you've encountered this problem with Git-Migration, then it is fixed (Git-Migration now adds the necessary definition before fileout). But obviously this needs to be fixed in Tonel too.

peteruhnak avatar Oct 07 '18 15:10 peteruhnak

related to #59

estebanlm avatar Jan 16 '19 11:01 estebanlm

@peteruhnak not, it was not related to Git-Migration.

pavel-krivanek avatar Jan 16 '19 11:01 pavel-krivanek