Skip to content

Commit

Permalink
do filetree conversion on this project ...
Browse files Browse the repository at this point in the history
  • Loading branch information
dalehenrich committed Oct 11, 2020
1 parent e0710c5 commit 0c80847
Show file tree
Hide file tree
Showing 26 changed files with 257 additions and 1 deletion.
3 changes: 3 additions & 0 deletions filetree/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packageExtension" : ".package",
"Metadata" : "false" }
4 changes: 4 additions & 0 deletions filetree/BaselineOfT2F2TConversion.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
2 changes: 2 additions & 0 deletions filetree/BaselineOfT2F2TConversion.package/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
4 changes: 4 additions & 0 deletions filetree/T2F2T-Conversion-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Rowan-based scripts for converting package repositories from Tonel to Filetree and Filetree to Tonel format .

See project readme (https://github.com/GsDevKit/T2F2T-Conversion#t2f2t-conversion) and shell script man page (https://github.com/GsDevKit/T2F2T-Conversion/blob/master/docs/man.txt) for additional details.

test "quoted strings" in a comment
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
_projectName
^ 'T2F2T-Conversion'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
command-line
executeCommandLine
| stdout |
stdout := GsFile stdout.
self new processCommandLine: GsFile stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
filetree/tonel commands
_copyPackagesFrom: sourceProject to: targetProject
sourceProject
readPackageNamesBlock: [ :packageName |
"read all of the packages"
true ].
targetProject packagesRoot ensureCreateDirectory.
targetProject packages: sourceProject packages.
targetProject exportPackages
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
create command
_createProject: projectName packageConvention: packageConvention root: root t2f2tDir: t2f2tDir packageDir: packageDir componentName: componentName format: format
| project resolvedProject |
project := (Rowan newProjectNamed: projectName)
packageConvention: packageConvention;
packageFormat: format;
diskUrl: 'file://' , root pathString;
projectSpecFile: t2f2tDir , '/' , format , '.ston';
specName: format;
componentsPath: t2f2tDir , '/components';
packagesPath: packageDir;
projectsPath: t2f2tDir , '/projects';
specsPath: t2f2tDir , '/specs';
projectSpecPath: t2f2tDir;
projectSpecName: format;
yourself.

project addTopLevelComponentNamed: componentName.

resolvedProject := project resolve.
Rowan projectTools createV2
createResolvedProjectRepository: resolvedProject repository.
resolvedProject
exportProjectSpecification;
exportProjects;
exportComponents;
exportLoadSpecification
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
_manPagePath
^ 'docs/man.txt'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private
_message: message to: stdout
stdout
lf;
nextPutAll: message;
nextPutAll: '. See help (t2t2t.sh --help) for details';
lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
filetree/tonel commands
convertTo: targetFormat packagesUsing: t2f2tPath stdout: stdout
| t2f2tRoot tonelProject filetreeProject targetProject sourceProject |
t2f2tRoot := t2f2tPath asFileReference.
t2f2tRoot exists
ifFalse: [
^ self
error:
'The t2f2t metadata directory ' , t2f2tRoot printString , ' does not exist.'
to: stdout ].
tonelProject := Rowan
projectFromUrl: 'file://' , (t2f2tRoot / 'specs' / 'tonel.ston') pathString.
filetreeProject := Rowan
projectFromUrl: 'file://' , (t2f2tRoot / 'specs' / 'filetree.ston') pathString.
targetFormat = 'tonel'
ifTrue: [
targetProject := tonelProject.
sourceProject := filetreeProject ]
ifFalse: [
targetFormat = 'filetree'
ifTrue: [
targetProject := filetreeProject.
sourceProject := tonelProject ]
ifFalse: [
self
error:
'unknown format ' , targetFormat printString , '. Should be [ tonel | filetree]'
to: stdout ] ].
self _copyPackagesFrom: sourceProject to: targetProject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
filetree/tonel commands
convertToFiletreePackagesUsing: t2f2tPath stdout: stdout
^ self convertTo: 'filetree' packagesUsing: t2f2tPath stdout: stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
filetree/tonel commands
convertToTonelPackagesUsing: t2f2tPath stdout: stdout
^ self convertTo: 'tonel' packagesUsing: t2f2tPath stdout: stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
create command
createForProject: projectRootPath t2f2t: t2f2tDir tonel: tonelPackageDir filetree: filetreePackageDir projectName: projectName componentName: componentName packageConvention: packageConvention stdout: stdout
| projectRoot t2f2tRoot |
projectRoot := projectRootPath asFileReference.
projectRoot exists
ifFalse: [
^ self
error:
'The project directory ' , projectRootPath printString , ' does not exist.'
to: stdout ].
t2f2tRoot := projectRoot.

(projectRoot / tonelPackageDir) ensureCreateDirectory.
self
_createProject: projectName
packageConvention: packageConvention
root: t2f2tRoot
t2f2tDir: t2f2tDir
packageDir: tonelPackageDir
componentName: componentName
format: 'tonel'.

(projectRoot / filetreePackageDir) ensureCreateDirectory.
self
_createProject: projectName
packageConvention: packageConvention
root: t2f2tRoot
t2f2tDir: t2f2tDir
packageDir: filetreePackageDir
componentName: componentName
format: 'filetree'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
create command
createForProject: projectRootPath t2f2t: t2f2tDir tonel: tonelPackageDir filetree: filePackageDir stdout: stdout
^ self
createForProject: projectRootPath
t2f2t: t2f2tDir
tonel: tonelPackageDir
filetree: filePackageDir
projectName: 't2f2tMeta'
componentName: 'Core'
packageConvention: 'Monticello'
stdout: stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
debug: object
debug := object
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
debug
^ debug ifNil: [ false ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error handling
error: errorMessage to: stdout
self debug
ifTrue: [ ^ super error: errorMessage ].
self _message: errorMessage to: stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
command-line support
processCommandLine: stdout
| args scriptArgStart command commandArgs argIndex argsSize |
args := System commandLineArguments.
scriptArgStart := args indexOf: '--'.
commandArgs := {}.
command := nil.
scriptArgStart = 0
ifTrue: [
^ self
error:
'topaz solo launched without '' -- '', so it is not possible to process command line arguments'
to: stdout ].

argIndex := scriptArgStart + 1. "arg after initial --"
argsSize := args size.
[ argIndex <= argsSize ]
whileTrue: [
| arg |
arg := args at: argIndex.
argIndex := argIndex + 1.
arg = '--help' | (arg = '-h')
ifTrue: [ ^ self usageMessage: stdout ].
command
ifNil: [
(#('create' 'filetree' 'tonel' '--debug') includes: arg)
ifFalse: [
^ self
error:
'UNKNOWN command ' , arg printString
, '. Command should be one of [create | filetree | tonel ]'
to: stdout ].
arg = '--debug'
ifTrue: [ self debug: true ]
ifFalse: [ command := arg ] ]
ifNotNil: [ commandArgs add: arg ] ].
command = 'create'
ifTrue: [
commandArgs size ~= 4
ifTrue: [
^ self
error:
'expected 4 positional arguments for create command (project-root, t2f2t-data-dir, tonel-pkg-dir, and filetree-pkg-dir), got '
, commandArgs size printString
to: stdout ].
^ self
createForProject: (commandArgs at: 1)
t2f2t: (commandArgs at: 2)
tonel: (commandArgs at: 3)
filetree: (commandArgs at: 4)
stdout: stdout ].
commandArgs size ~= 1
ifTrue: [
^ self
error:
'expected 1 positional arguments for ' , command
, ' command (t2f2t-data-dir), got ' , commandArgs size printString
to: stdout ].

command = 'filetree'
ifTrue: [ ^ self convertToFiletreePackagesUsing: (commandArgs at: 1) stdout: stdout ].
command = 'tonel'
ifTrue: [ ^ self convertToTonelPackagesUsing: (commandArgs at: 1) stdout: stdout ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
command-line support
usageMessage: stdout
| root read |
root := (Rowan projectNamed: self class _projectName) repositoryRoot.
read := ReadStreamPortable on: (root / self _manPagePath) contents.
[ read atEnd ]
whileFalse: [
stdout
nextPutAll: read nextLine;
lf ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "T2F2T-Conversion-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"debug" ],
"name" : "T2F2TConversion",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
2 changes: 2 additions & 0 deletions filetree/T2F2T-Conversion-Core.package/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
4 changes: 4 additions & 0 deletions filetree/properties.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
#format : 'filetree',
#convention : 'RowanHybrid'
}
2 changes: 1 addition & 1 deletion rowan/filetree.ston
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ RwProjectSpecificationV2 {
#specName : 'filetree',
#projectSpecPath : 'rowan',
#componentsPath : 'rowan/components',
#packagesPath : 'tonel',
#packagesPath : 'filetree',
#projectsPath : 'rowan/projects',
#specsPath : 'rowan/specs',
#packageFormat : 'filetree',
Expand Down
3 changes: 3 additions & 0 deletions tonel/T2F2T-Conversion-Core/T2F2TConversion.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Rowan-based scripts for converting package repositories from Tonel to Filetree and Filetree to Tonel format .
See project readme (https://github.com/GsDevKit/T2F2T-Conversion#t2f2t-conversion) and shell script man page (https://github.com/GsDevKit/T2F2T-Conversion/blob/master/docs/man.txt) for additional details.
test ""quoted strings"" in a comment
"
Class {
#name : 'T2F2TConversion',
Expand Down Expand Up @@ -30,6 +32,7 @@ T2F2TConversion >> _copyPackagesFrom: sourceProject to: targetProject [
readPackageNamesBlock: [ :packageName |
"read all of the packages"
true ].
targetProject packagesRoot ensureCreateDirectory.
targetProject packages: sourceProject packages.
targetProject exportPackages
]
Expand Down

0 comments on commit 0c80847

Please sign in to comment.