From 9077c09f6c44ba9b5c508eca7bd7432904364897 Mon Sep 17 00:00:00 2001 From: Dale Henrichs Date: Fri, 18 Oct 2019 16:53:25 -0700 Subject: [PATCH] Issue #261: take care of shebang when writing out tonel format classes --- .../GdkL_CopyScriptClasses.class.st | 16 +++++++++++----- .../instance/main.st | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/shared/repos/GsDevKit_launcher/rowan/scripts/gsdevkit_launcher-Scripts/GdkL_CopyScriptClasses.class.st b/shared/repos/GsDevKit_launcher/rowan/scripts/gsdevkit_launcher-Scripts/GdkL_CopyScriptClasses.class.st index 5c3f418d..ff09d30d 100755 --- a/shared/repos/GsDevKit_launcher/rowan/scripts/gsdevkit_launcher-Scripts/GdkL_CopyScriptClasses.class.st +++ b/shared/repos/GsDevKit_launcher/rowan/scripts/gsdevkit_launcher-Scripts/GdkL_CopyScriptClasses.class.st @@ -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 ]. diff --git a/shared/repos/GsDevKit_launcher/rowan/src/gsdevkit_launcher-Scripts.package/GdkL_CopyScriptClasses.class/instance/main.st b/shared/repos/GsDevKit_launcher/rowan/src/gsdevkit_launcher-Scripts.package/GdkL_CopyScriptClasses.class/instance/main.st index 28cc92ae..8899b830 100644 --- a/shared/repos/GsDevKit_launcher/rowan/src/gsdevkit_launcher-Scripts.package/GdkL_CopyScriptClasses.class/instance/main.st +++ b/shared/repos/GsDevKit_launcher/rowan/src/gsdevkit_launcher-Scripts.package/GdkL_CopyScriptClasses.class/instance/main.st @@ -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 ].