From 151648f44f6c53d64f95fb3c2db5bb8d69ee3ab2 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Mon, 15 Apr 2019 15:58:35 -0500 Subject: [PATCH] Working state --- .gitignore | 7 +++++-- helloworld.bash => HelloWorld.bash | 9 ++++++--- helloworld.c => HelloWorld.c | 0 HelloWorld.cs | 6 +++++- HelloWorld.java | 32 ++++++++++++++++++++++++++++++ HelloWorld.php | 29 +++++++++++++++++++++++++++ HelloWorld.pl | 21 ++++++++++++++++++++ HelloWorld.py | 23 +++++++++++++++++++++ Makefile | 30 ++++++++++++++-------------- PKGBUILD | 8 +++++--- helloworld.java | 7 ------- helloworld.php | 4 ---- helloworld.pl | 2 -- helloworld.py | 3 --- tests/test_unit.py | 19 ++++++------------ 15 files changed, 147 insertions(+), 53 deletions(-) rename helloworld.bash => HelloWorld.bash (69%) mode change 100644 => 100755 rename helloworld.c => HelloWorld.c (100%) create mode 100644 HelloWorld.java create mode 100644 HelloWorld.php create mode 100755 HelloWorld.pl create mode 100755 HelloWorld.py delete mode 100644 helloworld.java delete mode 100644 helloworld.php delete mode 100644 helloworld.pl delete mode 100644 helloworld.py diff --git a/.gitignore b/.gitignore index 2d7e745..d690fe7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ -helloworld -helloworld.class +HelloWorld +HelloWorld.class HelloWorld.exe tests/__pycache__/* +*.tar.xz +pkg/ +src/ diff --git a/helloworld.bash b/HelloWorld.bash old mode 100644 new mode 100755 similarity index 69% rename from helloworld.bash rename to HelloWorld.bash index 0de648e..6f42232 --- a/helloworld.bash +++ b/HelloWorld.bash @@ -9,14 +9,17 @@ # # Author: DarkFeather -### +### String to print +export _helloWorld="Hello world!" + + ### Prints 'Hello world!' ### function main() { - printf "Hello world!\n" + printf "$_helloWorld""\n" } ## MAIN -if [ `basename "$0"` == "helloworld.bash" ]; then +if [ `basename "$0"` == "HelloWorld.bash" ]; then main fi diff --git a/helloworld.c b/HelloWorld.c similarity index 100% rename from helloworld.c rename to HelloWorld.c diff --git a/HelloWorld.cs b/HelloWorld.cs index a64f72d..208504b 100644 --- a/HelloWorld.cs +++ b/HelloWorld.cs @@ -13,13 +13,17 @@ using System; namespace AniNIX { + /// This class is used exemplify coding standard in C#. public sealed class HelloWorld { + // String to print + private static String _helloWorld="Hello world!"; + /// /// Print 'Hello world!' /// public static void PrintHelloWorld() { - Console.WriteLine("Hello world!"); + Console.WriteLine(_helloWorld); } /// diff --git a/HelloWorld.java b/HelloWorld.java new file mode 100644 index 0000000..90dbe8a --- /dev/null +++ b/HelloWorld.java @@ -0,0 +1,32 @@ +import java.lang.System; + +/* + * File: helloworld.cs + * + * Description: This file exemplifies printing 'Hello world!' in C#. + * + * Package: AniNIX::Foundation/HelloWorld + * Copyright: WTFPL + * + * Author: DarkFeather + */ + + +/// This class is used exemplify coding standard in C#. +public class HelloWorld { + + // String to print + private static String _helloWorld = "Hello world!"; + + /// + /// Print 'Hello world!' + /// + public static void PrintHelloWorld() { + System.out.println(_helloWorld); + } + + /// MAIN + public static void main(String[] args) { + PrintHelloWorld(); + } +} diff --git a/HelloWorld.php b/HelloWorld.php new file mode 100644 index 0000000..90f1fc5 --- /dev/null +++ b/HelloWorld.php @@ -0,0 +1,29 @@ + + + +### String to print +$helloWorld="Hello world!"; + +### +### Prints 'Hello world!' +### +function PrintHelloWorld() { + global $helloWorld; + echo $helloWorld."\n"; + +} + +### MAIN +if ( basename(__FILE__) == "HelloWorld.php") { + PrintHelloWorld(); +} +?> diff --git a/HelloWorld.pl b/HelloWorld.pl new file mode 100755 index 0000000..18ef3d7 --- /dev/null +++ b/HelloWorld.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +# File: helloworld.pl +# +# Description: This file exemplifies printing 'Hello world!' in perl. +# +# Package: AniNIX::Foundation/HelloWorld +# Copyright: WTFPL +# +# Author: DarkFeather + +### +### Prints 'Hello world!' +### +sub PrintHelloWorld { + print "Hello world!\n" +} + +### MAIN +my ($PROG) = ($0 =~ m|.*/(.*)|) =~ m/(.*)\..*$/; +PrintHelloWorld() if ($0 == "helloworld.pl") diff --git a/HelloWorld.py b/HelloWorld.py new file mode 100755 index 0000000..9481bf1 --- /dev/null +++ b/HelloWorld.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# File: helloworld.bash +# +# Description: This file exemplifies printing 'Hello world!' in bash. +# +# Package: AniNIX::Foundation/HelloWorld +# Copyright: WTFPL +# +# Author: DarkFeather + +### String to print +_helloWorld='Hello world!' + +### +### Prints 'Hello world!' +### +def PrintHelloWorld(): + print(_helloWorld) + +### Main +if __name__ == '__main__': + PrintHelloWorld() diff --git a/Makefile b/Makefile index 6de841a..10e1628 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ pkgdirname != basename `git config remote.origin.url` | sed 's/.git$$//' install: clean mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/ - rsync -avz --exclude=Makefile --exclude=LICENSE --exclude=.git* --exclude=README . * ${pkgdir}/opt/aninix/${pkgdirname}/ + rsync -avzp HelloWorld* ${pkgdir}/opt/aninix/${pkgdirname}/ test: compile python3 -m pytest @@ -20,26 +20,26 @@ reverse: checkperm: @echo Nothing to do. -c: helloworld.c /usr/bin/gcc - gcc -o helloworld helloworld.c +c: HelloWorld.c /usr/bin/gcc + gcc -o HelloWorld HelloWorld.c -java: helloworld.java /usr/bin/java /usr/bin/javac - javac helloworld.java +java: HelloWorld.java /usr/bin/java /usr/bin/javac + javac HelloWorld.java -bash: helloworld.bash /usr/bin/bash - #bash helloworld.bash +bash: HelloWorld.bash /usr/bin/bash + #bash HelloWorld.bash -php: helloworld.php /usr/bin/php - #php helloworld.php +php: HelloWorld.php /usr/bin/php + #php HelloWorld.php -#hack: helloworld.php /usr/bin/hhvm - #hhvm --php helloworld.php +#hack: HelloWorld.php /usr/bin/hhvm + #hhvm --php HelloWorld.php -perl: helloworld.pl /usr/bin/perl - #perl ./helloworld.pl +perl: HelloWorld.pl /usr/bin/perl + #perl ./HelloWorld.pl -python: helloworld.py /usr/bin/python3 - #python3 ./helloworld.py +python: HelloWorld.py /usr/bin/python3 + #python3 ./HelloWorld.py cs: HelloWorld.cs /usr/bin/mono /usr/bin/mcs mcs HelloWorld.cs diff --git a/PKGBUILD b/PKGBUILD index cde05d8..b10a1f2 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Shikoba Kage pkgname=aninix-helloworld -pkgver=0.1.1 +pkgver=0.1.4310ab732341ac3317c9aa706b3058b8e7162486 pkgver() { printf "0.1.""$(git rev-parse HEAD)" } @@ -32,11 +32,13 @@ prepare() { } build() { - make -C .. + git config remote.origin.url } check() { - make -C "${srcdir}/.." test + cd "${srcdir}/.." + chmod a+r "${srcdir}/../pkg" + make test } package() { diff --git a/helloworld.java b/helloworld.java deleted file mode 100644 index 87ada02..0000000 --- a/helloworld.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.System; - -public class helloworld { - public static void main(String[] args) { - System.out.println("Hello world!"); - } -} diff --git a/helloworld.php b/helloworld.php deleted file mode 100644 index 3c6c990..0000000 --- a/helloworld.php +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/helloworld.pl b/helloworld.pl deleted file mode 100644 index be76ec3..0000000 --- a/helloworld.pl +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/perl -print "Hello world!\n" diff --git a/helloworld.py b/helloworld.py deleted file mode 100644 index 945cb23..0000000 --- a/helloworld.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/python3 - -print('Hello world!'); diff --git a/tests/test_unit.py b/tests/test_unit.py index 9b47cb9..1a634f2 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -9,7 +9,7 @@ def CheckOutput(output): def test_c(): print(os.getcwd()) - fh = os.popen("make c &>/dev/null; ./helloworld", mode='r', buffering=-1) + fh = os.popen("make c &>/dev/null; ./HelloWorld", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) @@ -23,42 +23,35 @@ def test_cs(): def test_java(): print(os.getcwd()) - fh = os.popen("make java &>/dev/null; java helloworld", mode='r', buffering=-1) + fh = os.popen("make java &>/dev/null; java HelloWorld", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) def test_bash(): print(os.getcwd()) - fh = os.popen("bash ./helloworld.bash", mode='r', buffering=-1) - output = fh.read() - retcode = fh.close() - assert retcode == None and CheckOutput(output) - -def test_bash(): - print(os.getcwd()) - fh = os.popen("bash ./helloworld.bash", mode='r', buffering=-1) + fh = os.popen("./HelloWorld.bash", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) def test_perl(): print(os.getcwd()) - fh = os.popen("perl ./helloworld.pl", mode='r', buffering=-1) + fh = os.popen("./HelloWorld.pl", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) def test_php(): print(os.getcwd()) - fh = os.popen("php ./helloworld.php", mode='r', buffering=-1) + fh = os.popen("php ./HelloWorld.php", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output) def test_python(): print(os.getcwd()) - fh = os.popen("python3 ./helloworld.py", mode='r', buffering=-1) + fh = os.popen("./HelloWorld.py", mode='r', buffering=-1) output = fh.read() retcode = fh.close() assert retcode == None and CheckOutput(output)