├── README.md ├── build ├── as3shebang.1.md ├── asc.jar ├── linux │ └── control.in ├── macintosh │ └── control.in ├── template.html └── windows │ └── control.in ├── lib-abc └── redtamarin.abc ├── lib-swc └── redtamarin.swc ├── make_deb_mac32 ├── make_deb_mac64 ├── make_deb_nix32 ├── make_deb_nix64 ├── make_deb_win32 ├── make_deb_win64 ├── make_readme ├── projectormake.abc └── src ├── as3shebang.as └── version.properties /README.md: -------------------------------------------------------------------------------- 1 | as3shebang – The ActionScript 3.0 Interpreter 2 | ============================================= 3 | 4 | **as3shebang** is an executable program based on the RedTamarin runtime. 5 | 6 | It allows you to run uncompiled ActionScript 3.0 source code 7 | as an executable shell script. 8 | 9 | The executable is totally independent of any other installed runtimes, 10 | and so can be installed with Redtamarin runtimes in parallel or without them. 11 | 12 | 13 | Install 14 | ------- 15 | 16 | Download the package for your operating system 17 | 18 | - **Windows** 19 | `as3shebang_1.0.0_win32.deb` for 32-bit systems 20 | `as3shebang_1.0.0_win64.deb` for 64-bit systems 21 | - **Mac OS X** 22 | `as3shebang_1.0.0_darwin-i386.deb` for 32-bit systems 23 | `as3shebang_1.0.0_darwin-amd64.deb` for 64-bit systems 24 | - **Linux** 25 | `as3shebang_1.0.0_i386.deb` for 32-bit systems 26 | `as3shebang_1.0.0_amd64.deb` for 64-bit systems 27 | 28 | 29 | ### Windows Install 30 | 31 | You will need a POSIX environment setup 32 | and may have to install `redtamarin-setup.bat` first 33 | see [Redtamarin Windows Environment Setup][RWES] 34 | 35 | install 36 | `$ wpkg -i as3shebang_1.0.0_win64.deb` 37 | 38 | 39 | ### Mac OS X Install 40 | 41 | You need the command-line tool `dpkg` installed 42 | either use [MacPorts][MACPORTS] `$ port install dpkg` 43 | or [Brew][BREW] `$ brew install dpkg` 44 | 45 | install 46 | `$ sudo dpkg -i as3shebang_1.0.0_darwin-amd64.deb` 47 | 48 | If you receive some errors because of gnutar not found, 49 | you can force the install with 50 | `$ sudo dpkg --force-all -i as3shebang_1.0.0_darwin-amd64.deb` 51 | 52 | 53 | ### Linux Install 54 | 55 | `$ sudo dpkg -i as3shebang_1.0.0_amd64.deb` 56 | 57 | 58 | 59 | Example 60 | ------- 61 | 62 | Create a script 63 | `$ touch test` 64 | 65 | Make it executable 66 | `$ chmod +x test` 67 | 68 | Edit the script 69 | `$ nano test` 70 | 71 | Starts the script with the shebang line 72 | ```as3 73 | #!/usr/bin/as3shebang 74 | 75 | // Use AS3 to write some shell scripts :) 76 | import shell.Program; 77 | import shell.Runtime; 78 | 79 | trace( "hello world" ); 80 | 81 | trace( " Program.type = " + Program.type ); 82 | trace( "Program.filename = " + Program.filename ); 83 | trace( "startupDirectory = " + Program.startupDirectory ); 84 | trace( " Program args = " + Program.argv ); 85 | trace( "" ); 86 | trace( "Redtamarin v" + Runtime.version + " " + (Runtime.is64bit() ? "64-bit": "32-bit" ) ); 87 | ``` 88 | 89 | Run the script 90 | `$ ./test` 91 | `$ ./test a b c` 92 | 93 | 94 | [RWES]: https://github.com/Corsaair/redtamarin/wiki/RedtamarinWindowsEnvironmentSetup 95 | [MACPORTS]: https://www.macports.org/ 96 | [BREW]: http://brew.sh/ 97 | -------------------------------------------------------------------------------- /build/as3shebang.1.md: -------------------------------------------------------------------------------- 1 | % AS3SHEBANG(1) as3shebang-1.0 | As3shebang Documentation 2 | % Zwetan Kjukov (zwetan (at) gmail (dot) com) 3 | % 2nd February 2016 4 | 5 | NAME 6 | ==== 7 | 8 | as3shebang – The ActionScript 3.0 Interpreter 9 | 10 | 11 | SYNOPSIS 12 | ======== 13 | 14 | **as3shebang** [file] 15 | 16 | 17 | DESCRIPTION 18 | =========== 19 | 20 | **as3shebang** is an executable program based on the RedTamarin runtime. 21 | 22 | It allows you to run uncompiled ActionScript 3.0 source code 23 | as an executable shell script. 24 | 25 | The executable is totally independent of any other installed runtimes, 26 | and so can be installed with Redtamarin runtimes in parallel or without them. 27 | 28 | OPTIONS 29 | ------- 30 | 31 | There are no command-line options to the as3shebang executable. 32 | 33 | IMPORTANT 34 | --------- 35 | 36 | When running as a shell script the Redtamarin runtime change some 37 | basic default behaviours. 38 | 39 | **shebang line** 40 | your script HAVE TO define a first line 41 | `#!/usr/bin/as3shebang` 42 | 43 | **Program.filename** 44 | will resolve to the shell script path 45 | not to the as3shebang executable path 46 | eg. "/usr/bin/as3shebang" 47 | 48 | **Program.type** 49 | will be updated to ShellType.SCRIPT 50 | eg. the string "script" 51 | 52 | **Some limitations** 53 | because the script is evaluated at runtime 54 | and not compiled, we do not support all AS3 features 55 | 56 | 57 | EXAMPLES 58 | ======== 59 | 60 | Create a simple test script 61 | `$ touch test` 62 | 63 | Edit it 64 | `$ nano test` 65 | ``` 66 | #!/usr/bin/as3shebang 67 | 68 | trace( "hello world" ); 69 | ``` 70 | 71 | Make the script executable 72 | `$ chmod +x test` 73 | 74 | Run the shell script 75 | `$ ./test` 76 | 77 | TIPS 78 | ==== 79 | 80 | How do you know if your program is running as a shell script? 81 | ```as3 82 | #!/usr/bin/as3shebang 83 | import shell.*; 84 | 85 | if( Program.type == ShellType.SCRIPT ) 86 | { 87 | trace( "I'm a shell script" ); 88 | } 89 | ``` 90 | 91 | 92 | ERRORS 93 | ====== 94 | 95 | **as3shebang** is compiled with the redshell debug debugger, 96 | if your shell script contain errors you will obtain a stacktrace. 97 | 98 | Example: 99 | ```as3 100 | #!/usr/bin/as3shebang 101 | 102 | trace( "UNKNOWN = " + UNKNOWN ); 103 | ``` 104 | 105 | Will output 106 | ``` 107 | ReferenceError: Error #1065: Variable UNKNOWN is not defined. 108 | at global$init()[:2] 109 | at shell::Runtime$/eval() 110 | at global$init() 111 | ``` 112 | 113 | 114 | BUGS 115 | ==== 116 | 117 | See GitHub Issues: https://github.com/Corsaair/as3shebang/issues 118 | 119 | 120 | SEE ALSO 121 | ======== 122 | 123 | As3shebang Wiki: https://github.com/Corsaair/as3shebang/wiki 124 | Shebang (Unix): https://en.wikipedia.org/wiki/Shebang_(Unix) 125 | -------------------------------------------------------------------------------- /build/asc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Corsaair/as3shebang/aeebd09c2623d634d0ed486d925da1409db8e7b6/build/asc.jar -------------------------------------------------------------------------------- /build/linux/control.in: -------------------------------------------------------------------------------- 1 | Package: as3shebang 2 | Version: VERSION 3 | Section: interpreters 4 | Priority: optional 5 | Architecture: ARCHITECTURE 6 | Installed-Size: INSTALLED_SIZE 7 | Depends: libc6 (>= 2.14) 8 | Maintainer: Zwetan Kjukov 9 | Description: The ActionScript 3.0 Interpreter 10 | As3shebang is an executable program based on the RedTamarin runtime. 11 | . 12 | It allows you to run uncompiled ActionScript 3.0 source code 13 | as an executable shell script. 14 | -------------------------------------------------------------------------------- /build/macintosh/control.in: -------------------------------------------------------------------------------- 1 | Package: as3shebang 2 | Version: VERSION 3 | Section: interpreters 4 | Priority: optional 5 | Architecture: ARCHITECTURE 6 | Installed-Size: INSTALLED_SIZE 7 | Depends: 8 | Maintainer: Zwetan Kjukov 9 | Description: The ActionScript 3.0 Interpreter 10 | As3shebang is an executable program based on the RedTamarin runtime. 11 | . 12 | It allows you to run uncompiled ActionScript 3.0 source code 13 | as an executable shell script. 14 | -------------------------------------------------------------------------------- /build/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | $title$ 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 147 | 148 | 149 | 150 | 151 | 152 | 153 |
154 | 155 |
156 | 157 | 158 | 159 | $body$ 160 | 161 |
162 | 163 | 164 |
165 | 166 | 168 |
169 | 170 | 171 | 172 | 173 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 220 | 221 | 222 | 223 | -------------------------------------------------------------------------------- /build/windows/control.in: -------------------------------------------------------------------------------- 1 | Package: as3shebang 2 | Version: VERSION 3 | Section: interpreters 4 | Priority: optional 5 | Architecture: ARCHITECTURE 6 | Installed-Size: INSTALLED_SIZE 7 | Depends: 8 | Maintainer: Zwetan Kjukov 9 | Description: The ActionScript 3.0 Interpreter 10 | As3shebang is an executable program based on the RedTamarin runtime. 11 | . 12 | It allows you to run uncompiled ActionScript 3.0 source code 13 | as an executable shell script. 14 | -------------------------------------------------------------------------------- /lib-abc/redtamarin.abc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Corsaair/as3shebang/aeebd09c2623d634d0ed486d925da1409db8e7b6/lib-abc/redtamarin.abc -------------------------------------------------------------------------------- /lib-swc/redtamarin.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Corsaair/as3shebang/aeebd09c2623d634d0ed486d925da1409db8e7b6/lib-swc/redtamarin.swc -------------------------------------------------------------------------------- /make_deb_mac32: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dependencies: 4 | # dpkg-deb 5 | # fakeroot 6 | # gzip 7 | # pandoc 8 | 9 | RELEASE=bin-release 10 | ARCHITECTURE=darwin-i386 11 | DEBVER=1.0.0 12 | BASE=as3shebang_${DEBVER}_${ARCHITECTURE} 13 | ROOTDIR=$RELEASE/$BASE 14 | 15 | rm -Rf $RELEASE 16 | mkdir -p $ROOTDIR 17 | 18 | DIST=`pwd`/$ROOTDIR 19 | DEST=$DIST/usr 20 | 21 | mkdir -p $DEST/bin 22 | mkdir -p $DEST/share/man/man1 23 | 24 | find $DIST -type d | xargs chmod 755 25 | 26 | # make abc 27 | java -jar build/asc.jar -AS3 -optimize -import lib-abc/redtamarin.abc src/as3shebang.as 28 | mv src/as3shebang.abc bin-release/ 29 | 30 | # make projector 31 | ./redshell_dd_nix64 projectormake.abc -- -o bin-release/as3shebang redshell_dd_mac32 bin-release/as3shebang.abc -- -Dlanguage en 32 | 33 | cp $RELEASE/as3shebang $DEST/bin/ 34 | sudo chmod 755 $DEST/bin/as3shebang 35 | sudo chown root:root $DEST/bin/as3shebang 36 | 37 | # make man 38 | pandoc build/as3shebang.1.md -s -t man -o bin-release/as3shebang.1 39 | 40 | cp $RELEASE/as3shebang.1 $DEST/share/man/man1/as3shebang.1 41 | gzip -9 $DEST/share/man/man1/as3shebang.1 42 | sudo chmod 644 $DEST/share/man/man1/as3shebang.1.gz 43 | sudo chown root:root $DEST/share/man/man1/as3shebang.1.gz 44 | 45 | INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') 46 | mkdir $DIST/DEBIAN 47 | 48 | perl -pe "s/VERSION/$DEBVER/" build/macintosh/control.in | \ 49 | perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ 50 | perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ 51 | > $DIST/DEBIAN/control 52 | 53 | fakeroot dpkg-deb --build $DIST 54 | -------------------------------------------------------------------------------- /make_deb_mac64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dependencies: 4 | # dpkg-deb 5 | # fakeroot 6 | # gzip 7 | # pandoc 8 | 9 | RELEASE=bin-release 10 | ARCHITECTURE=darwin-amd64 11 | DEBVER=1.0.0 12 | BASE=as3shebang_${DEBVER}_${ARCHITECTURE} 13 | ROOTDIR=$RELEASE/$BASE 14 | 15 | rm -Rf $RELEASE 16 | mkdir -p $ROOTDIR 17 | 18 | DIST=`pwd`/$ROOTDIR 19 | DEST=$DIST/usr 20 | 21 | mkdir -p $DEST/bin 22 | mkdir -p $DEST/share/man/man1 23 | 24 | find $DIST -type d | xargs chmod 755 25 | 26 | # make abc 27 | java -jar build/asc.jar -AS3 -optimize -import lib-abc/redtamarin.abc src/as3shebang.as 28 | mv src/as3shebang.abc bin-release/ 29 | 30 | # make projector 31 | ./redshell_dd_nix64 projectormake.abc -- -o bin-release/as3shebang redshell_dd_mac64 bin-release/as3shebang.abc -- -Dlanguage en 32 | 33 | cp $RELEASE/as3shebang $DEST/bin/ 34 | sudo chmod 755 $DEST/bin/as3shebang 35 | sudo chown root:root $DEST/bin/as3shebang 36 | 37 | # make man 38 | pandoc build/as3shebang.1.md -s -t man -o bin-release/as3shebang.1 39 | 40 | cp $RELEASE/as3shebang.1 $DEST/share/man/man1/as3shebang.1 41 | gzip -9 $DEST/share/man/man1/as3shebang.1 42 | sudo chmod 644 $DEST/share/man/man1/as3shebang.1.gz 43 | sudo chown root:root $DEST/share/man/man1/as3shebang.1.gz 44 | 45 | INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') 46 | mkdir $DIST/DEBIAN 47 | 48 | perl -pe "s/VERSION/$DEBVER/" build/macintosh/control.in | \ 49 | perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ 50 | perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ 51 | > $DIST/DEBIAN/control 52 | 53 | fakeroot dpkg-deb --build $DIST 54 | -------------------------------------------------------------------------------- /make_deb_nix32: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dependencies: 4 | # dpkg-deb 5 | # fakeroot 6 | # gzip 7 | # pandoc 8 | 9 | RELEASE=bin-release 10 | ARCHITECTURE=i386 11 | DEBVER=1.0.0 12 | BASE=as3shebang_${DEBVER}_${ARCHITECTURE} 13 | ROOTDIR=$RELEASE/$BASE 14 | 15 | rm -Rf $RELEASE 16 | mkdir -p $ROOTDIR 17 | 18 | DIST=`pwd`/$ROOTDIR 19 | DEST=$DIST/usr 20 | 21 | mkdir -p $DEST/bin 22 | mkdir -p $DEST/share/man/man1 23 | 24 | find $DIST -type d | xargs chmod 755 25 | 26 | # make abc 27 | java -jar build/asc.jar -AS3 -optimize -import lib-abc/redtamarin.abc src/as3shebang.as 28 | mv src/as3shebang.abc bin-release/ 29 | 30 | # make projector 31 | ./redshell_dd_nix32 projectormake.abc -- -o bin-release/as3shebang redshell_dd_nix32 bin-release/as3shebang.abc -- -Dlanguage en 32 | 33 | cp $RELEASE/as3shebang $DEST/bin/ 34 | sudo chmod 755 $DEST/bin/as3shebang 35 | sudo chown root:root $DEST/bin/as3shebang 36 | 37 | # make man 38 | pandoc build/as3shebang.1.md -s -t man -o bin-release/as3shebang.1 39 | 40 | cp $RELEASE/as3shebang.1 $DEST/share/man/man1/as3shebang.1 41 | gzip -9 $DEST/share/man/man1/as3shebang.1 42 | sudo chmod 644 $DEST/share/man/man1/as3shebang.1.gz 43 | sudo chown root:root $DEST/share/man/man1/as3shebang.1.gz 44 | 45 | INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') 46 | mkdir $DIST/DEBIAN 47 | 48 | perl -pe "s/VERSION/$DEBVER/" build/linux/control.in | \ 49 | perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ 50 | perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ 51 | > $DIST/DEBIAN/control 52 | 53 | fakeroot dpkg-deb --build $DIST 54 | -------------------------------------------------------------------------------- /make_deb_nix64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dependencies: 4 | # dpkg-deb 5 | # fakeroot 6 | # gzip 7 | # pandoc 8 | 9 | RELEASE=bin-release 10 | ARCHITECTURE=amd64 11 | DEBVER=1.0.0 12 | BASE=as3shebang_${DEBVER}_${ARCHITECTURE} 13 | ROOTDIR=$RELEASE/$BASE 14 | 15 | rm -Rf $RELEASE 16 | mkdir -p $ROOTDIR 17 | 18 | DIST=`pwd`/$ROOTDIR 19 | DEST=$DIST/usr 20 | 21 | mkdir -p $DEST/bin 22 | mkdir -p $DEST/share/man/man1 23 | 24 | find $DIST -type d | xargs chmod 755 25 | 26 | # make abc 27 | java -jar build/asc.jar -AS3 -optimize -import lib-abc/redtamarin.abc src/as3shebang.as 28 | mv src/as3shebang.abc bin-release/ 29 | 30 | # make projector 31 | ./redshell_dd_nix64 projectormake.abc -- -o bin-release/as3shebang redshell_dd_nix64 bin-release/as3shebang.abc -- -Dlanguage en 32 | 33 | cp $RELEASE/as3shebang $DEST/bin/ 34 | sudo chmod 755 $DEST/bin/as3shebang 35 | sudo chown root:root $DEST/bin/as3shebang 36 | 37 | # make man 38 | pandoc build/as3shebang.1.md -s -t man -o bin-release/as3shebang.1 39 | 40 | cp $RELEASE/as3shebang.1 $DEST/share/man/man1/as3shebang.1 41 | gzip -9 $DEST/share/man/man1/as3shebang.1 42 | sudo chmod 644 $DEST/share/man/man1/as3shebang.1.gz 43 | sudo chown root:root $DEST/share/man/man1/as3shebang.1.gz 44 | 45 | INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') 46 | mkdir $DIST/DEBIAN 47 | 48 | perl -pe "s/VERSION/$DEBVER/" build/linux/control.in | \ 49 | perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ 50 | perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ 51 | > $DIST/DEBIAN/control 52 | 53 | fakeroot dpkg-deb --build $DIST 54 | -------------------------------------------------------------------------------- /make_deb_win32: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dependencies: 4 | # wpkg 5 | # gzip 6 | # pandoc 7 | 8 | RELEASE=bin-release 9 | ARCHITECTURE=win32 10 | DEBVER=1.0.0 11 | BASE=as3shebang_${DEBVER}_${ARCHITECTURE} 12 | ROOTDIR=$RELEASE/$BASE 13 | 14 | rm -Rf $RELEASE 15 | mkdir -p $ROOTDIR 16 | 17 | DIST=`pwd`/$ROOTDIR 18 | DEST=$DIST/usr 19 | 20 | # note: 21 | # for Cygwin 22 | # /usr/bin -> /bin 23 | # /usr/lib -> /lib 24 | mkdir -p $DIST/bin 25 | mkdir -p $DEST/share/man/man1 26 | 27 | chmod 775 $DIST 28 | find $DIST -type d | xargs chmod -R 755 29 | 30 | # make abc 31 | java -jar build/asc.jar -AS3 -optimize -import lib-abc/redtamarin.abc src/as3shebang.as 32 | mv src/as3shebang.abc bin-release/ 33 | 34 | # make projector 35 | ./redshell_dd_win32.exe projectormake.abc -- -o bin-release/as3shebang.exe redshell_dd_win32.exe bin-release/as3shebang.abc -- -Dlanguage en 36 | 37 | cp $RELEASE/as3shebang.exe $DIST/bin/ 38 | chmod 755 $DIST/bin/as3shebang.exe 39 | # no ownership under Cygwin 40 | # chown root:root $DIST/bin/as3shebang.exe 41 | 42 | # make man 43 | pandoc build/as3shebang.1.md -s -t man -o bin-release/as3shebang.1 44 | 45 | cp $RELEASE/as3shebang.1 $DEST/share/man/man1/as3shebang.1 46 | gzip -9 $DEST/share/man/man1/as3shebang.1 47 | chmod 644 $DEST/share/man/man1/as3shebang.1.gz 48 | # no ownership under Cygwin 49 | # chown root:root $DEST/share/man/man1/as3shebang.1.gz 50 | 51 | INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') 52 | mkdir $DIST/DEBIAN 53 | 54 | perl -pe "s/VERSION/$DEBVER/" build/windows/control.in | \ 55 | perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ 56 | perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ 57 | > $DIST/DEBIAN/control 58 | 59 | # note: 60 | # for Wpkg 61 | # we need to build the deb package 62 | # from the current /bin-release directory 63 | # eg. wpkg -b something_1.0.0_win64 64 | # this wpkg -b /bin-release/something_1.0.0_win64 will not work 65 | cd $RELEASE 66 | wpkg --build $BASE 67 | -------------------------------------------------------------------------------- /make_deb_win64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dependencies: 4 | # wpkg 5 | # gzip 6 | # pandoc 7 | 8 | RELEASE=bin-release 9 | ARCHITECTURE=win64 10 | DEBVER=1.0.0 11 | BASE=as3shebang_${DEBVER}_${ARCHITECTURE} 12 | ROOTDIR=$RELEASE/$BASE 13 | 14 | rm -Rf $RELEASE 15 | mkdir -p $ROOTDIR 16 | 17 | DIST=`pwd`/$ROOTDIR 18 | DEST=$DIST/usr 19 | 20 | # note: 21 | # for Cygwin 22 | # /usr/bin -> /bin 23 | # /usr/lib -> /lib 24 | mkdir -p $DIST/bin 25 | mkdir -p $DEST/share/man/man1 26 | 27 | chmod 775 $DIST 28 | find $DIST -type d | xargs chmod -R 755 29 | 30 | # make abc 31 | java -jar build/asc.jar -AS3 -optimize -import lib-abc/redtamarin.abc src/as3shebang.as 32 | mv src/as3shebang.abc bin-release/ 33 | 34 | # make projector 35 | ./redshell_dd_win64.exe projectormake.abc -- -o bin-release/as3shebang.exe redshell_dd_win64.exe bin-release/as3shebang.abc -- -Dlanguage en 36 | 37 | cp $RELEASE/as3shebang.exe $DIST/bin/ 38 | chmod 755 $DIST/bin/as3shebang.exe 39 | # no ownership under Cygwin 40 | # chown root:root $DIST/bin/as3shebang.exe 41 | 42 | # make man 43 | pandoc build/as3shebang.1.md -s -t man -o bin-release/as3shebang.1 44 | 45 | cp $RELEASE/as3shebang.1 $DEST/share/man/man1/as3shebang.1 46 | gzip -9 $DEST/share/man/man1/as3shebang.1 47 | chmod 644 $DEST/share/man/man1/as3shebang.1.gz 48 | # no ownership under Cygwin 49 | # chown root:root $DEST/share/man/man1/as3shebang.1.gz 50 | 51 | INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') 52 | mkdir $DIST/DEBIAN 53 | 54 | perl -pe "s/VERSION/$DEBVER/" build/windows/control.in | \ 55 | perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ 56 | perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ 57 | > $DIST/DEBIAN/control 58 | 59 | # note: 60 | # for Wpkg 61 | # we need to build the deb package 62 | # from the current /bin-release directory 63 | # eg. wpkg -b something_1.0.0_win64 64 | # this wpkg -b /bin-release/something_1.0.0_win64 will not work 65 | cd $RELEASE 66 | wpkg --build $BASE 67 | -------------------------------------------------------------------------------- /make_readme: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | pandoc --variable=title:README --template=build/template.html -r markdown_github README.md -o README.html -------------------------------------------------------------------------------- /projectormake.abc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Corsaair/as3shebang/aeebd09c2623d634d0ed486d925da1409db8e7b6/projectormake.abc -------------------------------------------------------------------------------- /src/as3shebang.as: -------------------------------------------------------------------------------- 1 | 2 | /* as3shebang: 3 | command-line utility to run AS3 scripts as executable shell scripts 4 | 5 | install: 6 | copy the as3shebang executable into /usr/bin 7 | 8 | usage: 9 | 1. create a script file 10 | $ touch myscript.as 11 | 12 | 2. make it executable 13 | $ chmod +x myscript.as 14 | 15 | 3. as first line of your script define the shebang line 16 | $ nano myscript.as 17 | -------- 18 | #!/usr/bin/as3shebang 19 | trace( "hello world" ); 20 | -------- 21 | 22 | 4. run 23 | $ ./myscript.as 24 | */ 25 | 26 | import shell.Program; 27 | import shell.Runtime; 28 | import shell.ShellType; 29 | import shell.FileSystem; 30 | import C.stdlib.*; 31 | 32 | //DEBUG 33 | /* 34 | trace( "A:" ); 35 | trace( "filename = " + Program.filename ); 36 | trace( " argv = " + Program.argv ); 37 | trace( " type = " + Program.type ); 38 | trace( "" ); 39 | */ 40 | 41 | if( Program.argv.length == 0 ) 42 | { 43 | trace( "[as3shebang 1.0] no script arguments found" ); 44 | exit( EXIT_FAILURE ); 45 | } 46 | 47 | 48 | var scriptname:String = Program.argv.shift(); 49 | Program.AVM2::_filename = scriptname; 50 | Program.AVM2::_type = ShellType.SCRIPT; 51 | 52 | if( (scriptname == undefined) || (scriptname == null) || (scriptname == "") 53 | || !FileSystem.exists( scriptname ) ) 54 | { 55 | trace( "[as3shebang 1.0] script \"" + scriptname + "\" not found" ); 56 | exit( EXIT_FAILURE ); 57 | } 58 | 59 | var script:String = FileSystem.read( scriptname ); 60 | var shebangline:String = ""; 61 | var source:String = ""; 62 | 63 | //DEBUG 64 | /* 65 | trace( "B:" ); 66 | trace( "filename = " + Program.filename ); 67 | trace( " argv = " + Program.argv ); 68 | trace( " type = " + Program.type ); 69 | trace( "" ); 70 | */ 71 | 72 | if( script.indexOf( "#!" ) == 0 ) 73 | { 74 | source = script.substring( script.indexOf( "\n" ) + 1 ); 75 | } 76 | else 77 | { 78 | trace( "[as3shebang 1.0] no shebang found" ); 79 | exit( EXIT_FAILURE ); 80 | } 81 | 82 | try 83 | { 84 | Runtime.eval( source ); 85 | } 86 | catch( e:Error ) 87 | { 88 | trace( e.getStackTrace() ); 89 | exit( EXIT_FAILURE ); 90 | } 91 | 92 | exit( EXIT_SUCCESS ); 93 | -------------------------------------------------------------------------------- /src/version.properties: -------------------------------------------------------------------------------- 1 | 2 | version.major=1 3 | version.minor=0 4 | version.patch=0 5 | --------------------------------------------------------------------------------