Skip to content

Little tool to ease exporting code from Pharo to VA Smalltalk

License

Notifications You must be signed in to change notification settings

instantiations/pharo-to-vast

Repository files navigation

Pharo2VA

Facilitating code export from Pharo to VAST Platform (VA Smalltalk)
Explore the docs »

Report a defect | Request feature

GitHub release Build Status Build Status Windows Coverage Status

Little tool to ease exporting code from Pharo to VA Smalltalk

This is an exporter from Pharo source code to Instantiations VA Smalltalk. This exporter can reject explicit classes, extension methods, methods, and generates the resulting Monticello files (.mcz) into a user specified direcotry.

By default, the exporter will also take care of re-write the Pharo's literal Array that use curly brackets with a way that would work in VA Smalltalk.

License

  • The code is licensed under MIT.
  • The documentation is licensed under CC BY-SA 4.0.

Quick Start

Installation

To load the project in a Pharo image, or declare it as a dependency of your own project follow this instructions.

Example

Below is an example when porting STON to VA:

Pharo2VA
	exporter
		directory: FileSystem disk workingDirectory / 'exports';
		packagesNames: {'STON-Core' . 'STON-Tests'};
		methodsBlacklist:
			{(Text class >> #fromSton:).
			(STONWriterTests >> #testMimeType).
			(STONWriteReadTests >> #testFileSystemSupport).
			(STONWriteReadTests >> #testMimeTypes).
			(STONWriteReadTests >> #testTextAndRunArray).
			(STONReaderTests >> #testMimeType).
			(STONReaderTests >> #testWideSymbol).
			(STONReaderTests >> #testClassWithUnderscore).
			(STONReaderTests >> #testURL).
			(STONWriterTests >> #testURL)};
		addToBlacklistAllExtensionsOf:
			{RunArray.
			FileReference.
			SmallDictionary.
			ZnMimeType.
			ZnUrl.
			Path.
			OrderedDictionary};
		classesBlackList: {STONFileReference};
		export

Before evaluating above code, be sure to have those packages 'STON-Core' and 'STON-Tests' loaded into your image (for the tool it doesn't matter how you load them).

Evaluating that code will end up creating one .mcz file (Monticello file) per exported packaged (#packagesNames:), under the specified directory (#directory:). As you can see, there are ways to exclude methods (#methodsBlacklist:), extension methods from classes (#addToBlacklistAllExtensionsOf), and even full classes (#classesBlackList:).

Converting literal arrays

VA Smalltalk do not have the same array notation for {} as Pharo has. But do not worry this exporter export this {'A'} in this order (Array new: 1) at: 1 put: 'A'.

Importing on VA

To import in VA, you can use the Monticello Importer feature.

Right now the tool always exports the packages into .mcz and so you must use Monticello Importer in VA to import. However, as soon as Tonel is supported on VA, this tool would be able to write into Tonel instead of .mcz.

Acknowledgments

  • Pharo2VA was influenced by a subset of the Pharo2VW project. There are parts which we even copied and adapted them like the AST literal Array converter . Other parts, we took them as inspiration.
  • Github repository layout was generated with Ba-St Github-setup project.
  • Thanks Gabriel Cotelli for the help on setting up Travis CI and Coveralls integration.

Contributing

Check the Contribution Guidelines