From fbb20aba5339daa4b494636e49a09f0ef2279672 Mon Sep 17 00:00:00 2001 From: ThomasTJdev Date: Sun, 26 Apr 2020 08:05:36 +0200 Subject: [PATCH 1/4] Nimble file to follow nimble standard --- nmqtt.nimble | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nmqtt.nimble b/nmqtt.nimble index 2956927..ca4238a 100644 --- a/nmqtt.nimble +++ b/nmqtt.nimble @@ -1,14 +1,13 @@ # Package -version = "1.0.0" +version = "1.0.1" author = "zevv & ThomasTJdev" description = "Native MQTT library and binaries for publishing, subscribing and broker" license = "MIT" -srcDir = "src" +bin = @["nmqtt/nmqtt", "nmqtt/nmqtt_password", "nmqtt/nmqtt_pub", "nmqtt/nmqtt_sub"] binDir = "bin" installFiles = @["nmqtt.nim"] installDirs = @["config"] -bin = @["nmqtt", "nmqtt_password", "nmqtt_pub", "nmqtt_sub"] - +skipDirs = @["tests", "nmqtt"] # Dependencies requires "nim >= 1.0.6" @@ -19,7 +18,7 @@ from strutils import format task test, "Runs the test suite.": - exec "nimble c -y -r test/tester" + exec "nimble c -y -r tests/tester" after install: @@ -53,7 +52,7 @@ Access the nim-libary with an import statement in your code: BINARIES: -Access the binaries directly with. For help append `--help`. +Access the binaries directly with the commands below. For help append `--help`. nmqtt nmqtt_password From 31bbcee196adc474c52959d989819c340816cf1e Mon Sep 17 00:00:00 2001 From: ThomasTJdev Date: Sun, 26 Apr 2020 08:06:28 +0200 Subject: [PATCH 2/4] Rename test/ -> tests/ --- {test => tests}/connection.nim | 0 {test => tests}/ping.nim | 0 {test => tests}/publish.nim | 0 {test => tests}/publish_qos.nim | 0 {test => tests}/publish_retained.nim | 0 {test => tests}/subscribe.nim | 0 {test => tests}/tester.nim | 2 +- {test => tests}/tester.nim.cfg | 0 test/utils.nim => tests/tools.nim | 0 {test => tests}/unsubscribe.nim | 0 {test => tests}/willmsg.nim | 0 11 files changed, 1 insertion(+), 1 deletion(-) rename {test => tests}/connection.nim (100%) rename {test => tests}/ping.nim (100%) rename {test => tests}/publish.nim (100%) rename {test => tests}/publish_qos.nim (100%) rename {test => tests}/publish_retained.nim (100%) rename {test => tests}/subscribe.nim (100%) rename {test => tests}/tester.nim (99%) rename {test => tests}/tester.nim.cfg (100%) rename test/utils.nim => tests/tools.nim (100%) rename {test => tests}/unsubscribe.nim (100%) rename {test => tests}/willmsg.nim (100%) diff --git a/test/connection.nim b/tests/connection.nim similarity index 100% rename from test/connection.nim rename to tests/connection.nim diff --git a/test/ping.nim b/tests/ping.nim similarity index 100% rename from test/ping.nim rename to tests/ping.nim diff --git a/test/publish.nim b/tests/publish.nim similarity index 100% rename from test/publish.nim rename to tests/publish.nim diff --git a/test/publish_qos.nim b/tests/publish_qos.nim similarity index 100% rename from test/publish_qos.nim rename to tests/publish_qos.nim diff --git a/test/publish_retained.nim b/tests/publish_retained.nim similarity index 100% rename from test/publish_retained.nim rename to tests/publish_retained.nim diff --git a/test/subscribe.nim b/tests/subscribe.nim similarity index 100% rename from test/subscribe.nim rename to tests/subscribe.nim diff --git a/test/tester.nim b/tests/tester.nim similarity index 99% rename from test/tester.nim rename to tests/tester.nim index 5471b72..755c184 100644 --- a/test/tester.nim +++ b/tests/tester.nim @@ -56,7 +56,7 @@ include "unsubscribe.nim" include "publish.nim" include "publish_qos.nim" include "ping.nim" -include "utils.nim" +include "tools.nim" include "willmsg.nim" # Contains retained msgs include "publish_retained.nim" # Contains retained msgs # diff --git a/test/tester.nim.cfg b/tests/tester.nim.cfg similarity index 100% rename from test/tester.nim.cfg rename to tests/tester.nim.cfg diff --git a/test/utils.nim b/tests/tools.nim similarity index 100% rename from test/utils.nim rename to tests/tools.nim diff --git a/test/unsubscribe.nim b/tests/unsubscribe.nim similarity index 100% rename from test/unsubscribe.nim rename to tests/unsubscribe.nim diff --git a/test/willmsg.nim b/tests/willmsg.nim similarity index 100% rename from test/willmsg.nim rename to tests/willmsg.nim From c3d1f4cbc1f39998e001f7d90e22afe87f965ef4 Mon Sep 17 00:00:00 2001 From: ThomasTJdev Date: Sun, 26 Apr 2020 08:08:43 +0200 Subject: [PATCH 3/4] Nimble: src/ -> nmqtt/ + move nmqtt.nim to top-level --- {src/config => config}/nmqtt.conf | 0 src/nmqtt.nim => nmqtt.nim | 6 +++--- {src => nmqtt}/config.nims | 0 nmqtt/nmqtt.nim | 1 + {src => nmqtt}/nmqtt.nim.cfg | 0 {src => nmqtt}/nmqtt_password.nim | 0 {src => nmqtt}/nmqtt_pub.nim | 2 +- {src => nmqtt}/nmqtt_sub.nim | 2 +- {src => nmqtt}/utils/broker.nim | 0 {src => nmqtt}/utils/passwords.nim | 0 {src => nmqtt}/utils/version.nim | 2 +- 11 files changed, 7 insertions(+), 6 deletions(-) rename {src/config => config}/nmqtt.conf (100%) rename src/nmqtt.nim => nmqtt.nim (99%) rename {src => nmqtt}/config.nims (100%) create mode 100644 nmqtt/nmqtt.nim rename {src => nmqtt}/nmqtt.nim.cfg (100%) rename {src => nmqtt}/nmqtt_password.nim (100%) rename {src => nmqtt}/nmqtt_pub.nim (99%) rename {src => nmqtt}/nmqtt_sub.nim (99%) rename {src => nmqtt}/utils/broker.nim (100%) rename {src => nmqtt}/utils/passwords.nim (100%) rename {src => nmqtt}/utils/version.nim (78%) diff --git a/src/config/nmqtt.conf b/config/nmqtt.conf similarity index 100% rename from src/config/nmqtt.conf rename to config/nmqtt.conf diff --git a/src/nmqtt.nim b/nmqtt.nim similarity index 99% rename from src/nmqtt.nim rename to nmqtt.nim index e1884c5..3754288 100644 --- a/src/nmqtt.nim +++ b/nmqtt.nim @@ -15,8 +15,8 @@ when defined(broker): sequtils, times, random, - utils/passwords, - utils/version + nmqtt/utils/passwords, + nmqtt/utils/version from parsecfg import loadConfig, getSectionValue from os import fileExists @@ -1191,4 +1191,4 @@ proc msgQueue*(ctx: MqttCtx): int = when defined(broker): - include "utils/broker.nim" \ No newline at end of file + include "nmqtt/utils/broker.nim" \ No newline at end of file diff --git a/src/config.nims b/nmqtt/config.nims similarity index 100% rename from src/config.nims rename to nmqtt/config.nims diff --git a/nmqtt/nmqtt.nim b/nmqtt/nmqtt.nim new file mode 100644 index 0000000..f98b318 --- /dev/null +++ b/nmqtt/nmqtt.nim @@ -0,0 +1 @@ +include "../nmqtt.nim" \ No newline at end of file diff --git a/src/nmqtt.nim.cfg b/nmqtt/nmqtt.nim.cfg similarity index 100% rename from src/nmqtt.nim.cfg rename to nmqtt/nmqtt.nim.cfg diff --git a/src/nmqtt_password.nim b/nmqtt/nmqtt_password.nim similarity index 100% rename from src/nmqtt_password.nim rename to nmqtt/nmqtt_password.nim diff --git a/src/nmqtt_pub.nim b/nmqtt/nmqtt_pub.nim similarity index 99% rename from src/nmqtt_pub.nim rename to nmqtt/nmqtt_pub.nim index a775a03..16f0a65 100644 --- a/src/nmqtt_pub.nim +++ b/nmqtt/nmqtt_pub.nim @@ -4,7 +4,7 @@ from os import getCurrentProcessId import utils/version -include "nmqtt.nim" +include "../nmqtt.nim" proc handler() {.noconv.} = diff --git a/src/nmqtt_sub.nim b/nmqtt/nmqtt_sub.nim similarity index 99% rename from src/nmqtt_sub.nim rename to nmqtt/nmqtt_sub.nim index c47371f..a529df6 100644 --- a/src/nmqtt_sub.nim +++ b/nmqtt/nmqtt_sub.nim @@ -5,7 +5,7 @@ from strutils import split import utils/version -include "nmqtt.nim" +include "../nmqtt.nim" let ctx = newMqttCtx("nmqttsub-" & $getCurrentProcessId()) diff --git a/src/utils/broker.nim b/nmqtt/utils/broker.nim similarity index 100% rename from src/utils/broker.nim rename to nmqtt/utils/broker.nim diff --git a/src/utils/passwords.nim b/nmqtt/utils/passwords.nim similarity index 100% rename from src/utils/passwords.nim rename to nmqtt/utils/passwords.nim diff --git a/src/utils/version.nim b/nmqtt/utils/version.nim similarity index 78% rename from src/utils/version.nim rename to nmqtt/utils/version.nim index 18ec85d..e53d409 100644 --- a/src/utils/version.nim +++ b/nmqtt/utils/version.nim @@ -3,7 +3,7 @@ from strutils import replace, splitLines, split, contains from os import `/` macro nimbleVersion(): void = - let n = staticRead(currentSourcePath().replace("/src/utils/version.nim") / "nmqtt.nimble") + let n = staticRead(currentSourcePath().replace("/nmqtt/utils/version.nim") / "nmqtt.nimble") var v: string for line in n.splitLines: let l = split(line, " = ") From bc28b10237841e57f3779a9b45211b669aec1386 Mon Sep 17 00:00:00 2001 From: ThomasTJdev Date: Sun, 26 Apr 2020 08:08:53 +0200 Subject: [PATCH 4/4] Update gitignore --- .gitignore | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 4f8bb54..e0ac4d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -test/tester -nmqtt -nmqtt_password -nmqtt_pub -nmqtt_sub \ No newline at end of file +tests/tester +bin \ No newline at end of file