Skip to content

Commit

Permalink
Issue #261: take care of shebang when writing out tonel format classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dalehenrich committed Oct 18, 2019
1 parent 3d9d0d7 commit 9077c09
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,35 @@ GdkL_CopyScriptClasses >> _projectDefinitionForUrl: rowanSpecUrl [

{ #category : 'main' }
GdkL_CopyScriptClasses >> main [
| projectDefinition_filetree projectDefinition_tonel packageName sourcePackageDef targetPackageDef |
| shebang needsShebangProperty projectDefinition_filetree projectDefinition_tonel packageName sourcePackageDef targetPackageDef |

args isEmpty ifTrue: [ self error: 'Expected to find at least one class name on command line ' ].

projectDefinition_filetree := self _projectDefinitionForUrl: 'file:$GS_HOME/shared/repos/GsDevKit_launcher/rowan/specs/gsdevkit_launcher_filetree.ston'.
projectDefinition_tonel := self _projectDefinitionForUrl: 'file:$GS_HOME/shared/repos/GsDevKit_launcher/rowan/specs/gsdevkit_launcher_tonel.ston'.

self halt.

packageName := 'gsdevkit_launcher-Scripts'.
needsShebangProperty := false.
shebang := '/usr/bin/env gsdevkit_launcher'.

write = 'filetree'
ifTrue: [
sourcePackageDef := projectDefinition_tonel packageNamed: packageName.
targetPackageDef := projectDefinition_filetree packageNamed: packageName ]
ifFalse: [
targetPackageDef := projectDefinition_tonel packageNamed: packageName.
sourcePackageDef := projectDefinition_filetree packageNamed: packageName ].
sourcePackageDef := projectDefinition_filetree packageNamed: packageName.
needsShebangProperty := true ].

args do: [:className |
| classDef |
targetPackageDef
removeClassNamed: className
ifAbsent: [ "No need to remove the class definition if is not present" ].
targetPackageDef addClassDefinition: (sourcePackageDef classDefinitionNamed: className) ].
classDef := sourcePackageDef classDefinitionNamed: className.
needsShebangProperty
ifTrue: [ classDef shebang: shebang ].
targetPackageDef addClassDefinition: classDef ].

write = 'filetree'
ifTrue: [ projectDefinition_filetree exportPackages ].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
main
main
| projectDefinition_filetree projectDefinition_tonel packageName sourcePackageDef targetPackageDef |
| shebang needsShebangProperty projectDefinition_filetree projectDefinition_tonel packageName sourcePackageDef targetPackageDef |

args isEmpty ifTrue: [ self error: 'Expected to find at least one class name on command line ' ].

projectDefinition_filetree := self _projectDefinitionForUrl: 'file:$GS_HOME/shared/repos/GsDevKit_launcher/rowan/specs/gsdevkit_launcher_filetree.ston'.
projectDefinition_tonel := self _projectDefinitionForUrl: 'file:$GS_HOME/shared/repos/GsDevKit_launcher/rowan/specs/gsdevkit_launcher_tonel.ston'.

self halt.

packageName := 'gsdevkit_launcher-Scripts'.
needsShebangProperty := false.
shebang := '/usr/bin/env gsdevkit_launcher'.

write = 'filetree'
ifTrue: [
sourcePackageDef := projectDefinition_tonel packageNamed: packageName.
targetPackageDef := projectDefinition_filetree packageNamed: packageName ]
ifFalse: [
targetPackageDef := projectDefinition_tonel packageNamed: packageName.
sourcePackageDef := projectDefinition_filetree packageNamed: packageName ].
sourcePackageDef := projectDefinition_filetree packageNamed: packageName.
needsShebangProperty := true ].

args do: [:className |
| classDef |
targetPackageDef
removeClassNamed: className
ifAbsent: [ "No need to remove the class definition if is not present" ].
targetPackageDef addClassDefinition: (sourcePackageDef classDefinitionNamed: className) ].
classDef := sourcePackageDef classDefinitionNamed: className.
needsShebangProperty
ifTrue: [ classDef shebang: shebang ].
targetPackageDef addClassDefinition: classDef ].

write = 'filetree'
ifTrue: [ projectDefinition_filetree exportPackages ].
Expand Down

0 comments on commit 9077c09

Please sign in to comment.