From d4a1aabfdcba8d4a81f4344ef59014b1a64c0e54 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Mon, 5 Nov 2018 15:35:32 -0600 Subject: [PATCH] Major overhaul getting started --- .gitignore | 3 + Makefile | 64 ++++++++---------- PKGBUILD | 46 +++++++++++++ README | 1 + README.bzr | 2 - helloworld.bash | 22 +++++- helloworld.c | 27 +++++++- helloworld.cs | 30 ++++++-- helloworld.csharp | 9 --- helloworld.py | 3 + .../test_unit.cpython-37-PYTEST.pyc | Bin 0 -> 1466 bytes tests/test_unit.py | 15 ++++ 12 files changed, 167 insertions(+), 55 deletions(-) create mode 100644 .gitignore create mode 100644 PKGBUILD create mode 100644 README delete mode 100644 README.bzr delete mode 100644 helloworld.csharp create mode 100644 helloworld.py create mode 100644 tests/__pycache__/test_unit.cpython-37-PYTEST.pyc create mode 100644 tests/test_unit.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5c9366 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +./helloworld +./helloworld.class +./helloworld.exe diff --git a/Makefile b/Makefile index eb67588..793e7f6 100644 --- a/Makefile +++ b/Makefile @@ -1,45 +1,13 @@ -INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash - -all: c csharp java bash php hack perl - echo Done; - -compile: - [ -f helloworld.c ] +compile: c cs java bash php perl python install: compile @echo This project cannot be installed. -test: all +test: compile + python3 -m pytest clean: - @echo Nothing to do. - -c: helloworld.c /usr/bin/gcc - gcc -o helloworld helloworld.c - ./helloworld - rm ./helloworld - -java: helloworld.java /usr/bin/java /usr/bin/javac - javac helloworld.java - java helloworld - rm helloworld.class - -bash: helloworld.bash /usr/bin/bash - bash helloworld.bash - -php: helloworld.php /usr/bin/php - php helloworld.php - -hack: helloworld.php /usr/bin/hhvm - hhvm --php helloworld.php - -perl: helloworld.pl /usr/bin/perl - perl ./helloworld.pl - -csharp: helloworld.csharp /usr/bin/mono /usr/bin/mcs - mcs helloworld.csharp - mono helloworld.exe - rm helloworld.exe + cat .gitignore | xargs -n 1 rm -Rf diff: @echo Nothing to do. @@ -49,3 +17,27 @@ reverse: checkperm: @echo Nothing to do. + +c: helloworld.c /usr/bin/gcc + gcc -o helloworld helloworld.c + +java: helloworld.java /usr/bin/java /usr/bin/javac + javac helloworld.java + +bash: helloworld.bash /usr/bin/bash + #bash helloworld.bash + +php: helloworld.php /usr/bin/php + #php helloworld.php + +#hack: helloworld.php /usr/bin/hhvm + #hhvm --php helloworld.php + +perl: helloworld.pl /usr/bin/perl + #perl ./helloworld.pl + +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 new file mode 100644 index 0000000..2876458 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer: Shikoba Kage +pkgname=cryptoworkbench +pkgver=0.1.ac4a8cb406377081eb1c1de2a3abe482508d6f57 +pkgver() { + printf "0.1.""$(git rev-parse HEAD)" +} +pkgrel=1 +epoch= +pkgdesc="AniNIX::CryptoWorkbench \\\\ Simple Cryptography Utility" +arch=("x86_64") +url="https://aninix.net/foundation/CryptoWorkbench" +license=('custom') +groups=() +depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13') +makedepends=('make>=4.2') +checkdepends=() +optdepends=() +provides=('cryptoworkbench') +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +source=() +noextract=() +md5sums=() +validpgpkeys=() + +prepare() { + git pull +} + +build() { + make -C .. +} + +check() { + printf 'quit\n\n' | make -C "${srcdir}/.." test +} + +package() { + export pkgdir="${pkgdir}" + make -C .. install + install -D -m644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/README b/README new file mode 100644 index 0000000..54412a8 --- /dev/null +++ b/README @@ -0,0 +1 @@ +This project is enabled for AniNIX::Foundation. You can check it out remotely with the git package. It is intended to display example source for all of our projects. diff --git a/README.bzr b/README.bzr deleted file mode 100644 index 2be0f40..0000000 --- a/README.bzr +++ /dev/null @@ -1,2 +0,0 @@ -This project is enabled for AniNIX::Bazaar. You can check it out remotely with the bzr package. -Project URL is bzr://bazaar.aninix.net/HelloWorld diff --git a/helloworld.bash b/helloworld.bash index 8d6ea8b..8dc340f 100644 --- a/helloworld.bash +++ b/helloworld.bash @@ -1,2 +1,22 @@ #!/usr/bin/bash -printf "Hello world!\n" + +# File: helloworld.bash +# +# Description: This file exemplifies printing 'Hello world!' in bash. +# +# Package: AniNIX::Foundation/HelloWorld +# Copyright: WTFPL +# +# Author: DarkFeather + +### +### Prints 'Hello world!' +### +function helloWorld() { + printf "Hello world!\n" +} + +## MAIN +if [ `echo "$0" | egrep '(^|/)helloworld.bash'` ]; then + helloWorld +fi diff --git a/helloworld.c b/helloworld.c index f526931..da9f16e 100644 --- a/helloworld.c +++ b/helloworld.c @@ -1,6 +1,27 @@ #include -int main(int argc, char* argv[]) { - printf("Hello world!\n"); - return 0; +/* + * File: helloworld.c + * + * Description: This file exemplifies printing 'Hello world!' in C. + * + * Package: AniNIX::Foundation/HelloWorld + * Copyright: WTFPL + * + * Author: DarkFeather + */ + +static char * message = "Hello world!"; + +/// +/// Prints 'Hello world!' +/// +void HelloWorld() { + printf("%s\n",message); +} + +// MAIN +int main(int argc, char* argv[]) { + HelloWorld(); + return 0; } diff --git a/helloworld.cs b/helloworld.cs index 8f1b297..42a8e3a 100644 --- a/helloworld.cs +++ b/helloworld.cs @@ -1,9 +1,31 @@ using System; +/* + * File: helloworld.cs + * + * Description: This file exemplifies printing 'Hello world!' in C#. + * + * Package: AniNIX::Foundation/HelloWorld + * Copyright: WTFPL + * + * Author: DarkFeather + */ + namespace AniNIX { - class HelloWorld { - public static void Main(string[] args) { - Console.WriteLine("Hello world!"); - } + + public sealed class HelloWorld { + + /// + /// Print 'Hello world!' + /// + public static void PrintHelloWorld() { + Console.WriteLine("Hello world!"); + } + + // Main + public static void Main(string[] args) { + HelloWorld.PrintHelloWorld(); + return; + } } } diff --git a/helloworld.csharp b/helloworld.csharp deleted file mode 100644 index 8f1b297..0000000 --- a/helloworld.csharp +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace AniNIX { - class HelloWorld { - public static void Main(string[] args) { - Console.WriteLine("Hello world!"); - } - } -} diff --git a/helloworld.py b/helloworld.py new file mode 100644 index 0000000..2449cad --- /dev/null +++ b/helloworld.py @@ -0,0 +1,3 @@ +#!/usr/bin/python3 + +print('Hello World!\n'); diff --git a/tests/__pycache__/test_unit.cpython-37-PYTEST.pyc b/tests/__pycache__/test_unit.cpython-37-PYTEST.pyc new file mode 100644 index 0000000000000000000000000000000000000000..627b2d69ec8f0fc335c67649d242b7e00ad99d85 GIT binary patch literal 1466 zcmY*ZPjB2r6rUOYS+Cc-*#rUQ0zm?)ma1&hHZ7G1Dg`1g1f(J=86nHr@g^qTwVClM z&0rrcs)mGes3c{WRbC&ESK7dJ+8DMooQPV$iyka+%K^>53B0_5wspyie$P-E- zeQ$9z!7Xn8W;F!u*(-v^$kM^ePDo>M(%3bt?K9RmwbQt@BfhHKnm(aTr|v*^pHlgt z>MT7Dd_uXattV_{^G?-W`YUqg%AbJuYPO={S4e@DW(>HN?G@$TGxi2)Jl^Gg?PU~l zx3-r3y1PP^weysUYrMyUt9XCvc$JHIO2^O=;sv~aW$}-;sBu-|Uy}tAEc!<7AmiYf zg)F|w;_ECx2DQaERxBexdVI(?>z=74s5XEO>tKbhf5w>Eq;WwO$N||61`Aieb+ia} zMyLAb&BZG!p8tmjmu^oBo~rKgd@@NzHaiLF3wCf2(#6*M*UO8Wq1-+=*w*5HC{;(K z)fo06i!6Ye?JqhSy&Foc-CbPQ+8+G;A1|ftHo(15w%~3kL%%W8AZ$!PXld7bkqyUP z!*2>b>Whs;%2ZS){T}igY(LyoPKi=0#R{q16O?q$u~n4mOxYq$pp5eZo_gMtf4{uY zlNu*NZN?bmJQisw#>KQuM5+S7@$o#%t89j7X3(X&7R%FOo^xXwpX9}HlE<@Tij#_E zf|Ei787qv7z3I+w0hA>&8*+ zi1b`!6^{05OAnga6R*QZ47DS}Wx4WnUS)YZIy(MZ!TN6{Ox50pnCW?*ex!#;24Ei9 L!v6;^^PK+y0vC@7 literal 0 HcmV?d00001 diff --git a/tests/test_unit.py b/tests/test_unit.py new file mode 100644 index 0000000..bc28811 --- /dev/null +++ b/tests/test_unit.py @@ -0,0 +1,15 @@ +import os +import re +import shutil + +def checkOutput(output): + for line in output.split('\n'): + if line == 'Hello world!': return True + return False + +def test_c(): + print(os.getcwd()) + fh = os.popen("./helloworld", mode='r', buffering=-1) + output = fh.read() + retcode = fh.close() + assert retcode == None and checkOutput(output)