From 9351e933caba694c8f5ff75124dfb95f5ffd4cf6 Mon Sep 17 00:00:00 2001 From: Artem IG Date: Sun, 9 Oct 2022 00:23:24 +0300 Subject: [PATCH 1/5] updated url and docs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7cfc464..89b62ec 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Download and unpack the Linux version to the current directory in one line. ```bash # install -wget -c https://github.com/rtmigo/exe2dist_dart/releases/download/0.2.2/exe2dist_linux_amd64.tgz -O - | tar -xz +wget -c https://github.com/rtmigo/exe2dist/releases/download/0.2.2/exe2dist_linux_amd64.tgz -O - | tar -xz # run ./exe2dist @@ -35,7 +35,7 @@ wget -c https://github.com/rtmigo/exe2dist_dart/releases/download/0.2.2/exe2dist Same for the newest version instead of the fixed one. ```bash -wget -c https://github.com/rtmigo/exe2dist_dart/releases/latest/download/exe2dist_linux_amd64.tgz -O - | tar -xz +wget -c https://github.com/rtmigo/exe2dist/releases/latest/download/exe2dist_linux_amd64.tgz -O - | tar -xz ``` ## Use From 186d034cd09ba6c8bbace5849eb31fd9482579a2 Mon Sep 17 00:00:00 2001 From: Artem IG Date: Sun, 9 Oct 2022 00:34:00 +0300 Subject: [PATCH 2/5] updated url and docs --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 89b62ec..6101c5e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [exe2dist](https://github.com/rtmigo/exe2dist_dart) #experimental +# [exe2dist](https://github.com/rtmigo/exe2dist) #experimental A CLI tool that packages a binary executable into a redistributable archive. @@ -58,4 +58,3 @@ exe2dist theapp binaries/* distros/ Copyright © 2022 [Artsiom iG](https://github.com/rtmigo). Released under the [MIT License](LICENSE). - From d1296f8a0bcb45141f70f7ed5632f5a7bd118561 Mon Sep 17 00:00:00 2001 From: Artem IG Date: Sun, 9 Oct 2022 00:42:20 +0300 Subject: [PATCH 3/5] docs --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6101c5e..19f3b41 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,21 @@ A CLI tool that packages a binary executable into a redistributable archive. -`dir/native_binary1` ⮕ `myapp_linux_arm64.tgz` +`dir/native_binary1` ⮕ `myapp_linux_arm64.tgz` with `myapp` inside -`dir/native_binary2` ⮕ `myapp_windows_x86-64.zip` +`dir/native_binary2` ⮕ `myapp_windows_amd64.zip` with `myapp.exe` inside * detects the architecture for which the executable is compiled -* sets executable bits (`chmod 755`) -* archives a file to an archive appropriate for the platform +* sets executable bits for *nix binaries (`chmod 755`) +* adds `.exe` extension to Windows executables +* packs the binary to an archive appropriate for the platform I use this tool to automate my CI/CD. Therefore, the functionality is limited to my use cases. -`exe2dist` works on Linux and MacOS. Compressible binaries can be for other -platforms as well. +`exe2dist` runs on Linux and MacOS. It detects + +The executables that are being processed may be for other platforms. ## Install From 28cb6daea33cebc82d2ffb103d6e09a79bff40b8 Mon Sep 17 00:00:00 2001 From: Artem IG Date: Sun, 9 Oct 2022 01:04:41 +0300 Subject: [PATCH 4/5] publish --- README.md | 2 +- bin/exe2dist.dart | 8 +++++--- bin/source/constants.g.dart | 4 ++-- build.sh | 3 ++- publish.sh | 5 +++++ pubspec.yaml | 2 +- script/update_constants.dart | 5 +++++ script/update_readme.dart | 28 ++++++++++++++++++++++++++++ 8 files changed, 49 insertions(+), 8 deletions(-) create mode 100755 publish.sh create mode 100644 script/update_readme.dart diff --git a/README.md b/README.md index 19f3b41..381c536 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Download and unpack the Linux version to the current directory in one line. ```bash # install -wget -c https://github.com/rtmigo/exe2dist/releases/download/0.2.2/exe2dist_linux_amd64.tgz -O - | tar -xz +wget -c https://github.com/rtmigo/exe2dist/releases/download/0.2.3/exe2dist_linux_amd64.tgz -O - | tar -xz # run ./exe2dist diff --git a/bin/exe2dist.dart b/bin/exe2dist.dart index f4995d2..ca64fc4 100644 --- a/bin/exe2dist.dart +++ b/bin/exe2dist.dart @@ -8,13 +8,14 @@ import 'source/constants.g.dart'; Future main(List arguments) async { if (arguments.length != 3) { - print("exe2dist: native binary compression tool"); - print("(c) Artsiom iG "); + print("exe2dist (c) Artsiom iG"); print("version $buildVersion ($buildDate)"); + print("https://github.com/rtmigo/exe2dist#readme"); + print(""); print("Usage:"); - print(" exe2dist "); + print(" exe2dist "); print(""); print("Examples:"); print(" exe2dist theapp myfile.exe distros/"); @@ -28,6 +29,7 @@ Future main(List arguments) async { try { for (final entity in Glob(sourceGlob).listSync()) { + // TODO test glob if (entity.statSync().type == FileSystemEntityType.file) { await binaryToDist( sourceExe: File(entity.path), diff --git a/bin/source/constants.g.dart b/bin/source/constants.g.dart index 3c3a092..377a5db 100644 --- a/bin/source/constants.g.dart +++ b/bin/source/constants.g.dart @@ -1,5 +1,5 @@ // Do not edit. Auto-generated -const buildVersion='0.1.0'; +const buildVersion='0.2.3'; const buildDate='2022-10-08'; const buildOs='linux'; -const buildShortHead='b2b3ccc'; +const buildShortHead='d1296f8'; diff --git a/build.sh b/build.sh index 8ad5c54..1dc3b0b 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,3 @@ dart script/update_constants.dart -dart compile exe bin/exe2dist.dart -o build/exe2dist.exe \ No newline at end of file +dart script/update_readme.dart +#dart compile exe bin/exe2dist.dart -o build/exe2dist.exe \ No newline at end of file diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..d463583 --- /dev/null +++ b/publish.sh @@ -0,0 +1,5 @@ +dart script/update_constants.dart +dart script/update_readme.dart +git add . +git commit -m "publish" --allow-empty +git push \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 1edc998..5ac8abe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: exe2dist description: Binary executable packaging tool. -version: 0.2.2 +version: 0.2.3 environment: sdk: '>=2.18.0 <3.0.0' diff --git a/script/update_constants.dart b/script/update_constants.dart index 59025a5..c13c6d4 100644 --- a/script/update_constants.dart +++ b/script/update_constants.dart @@ -20,4 +20,9 @@ void main() { "const buildDate='${nowDate()}';\n" "const buildOs='${Platform.operatingSystem}';\n" "const buildShortHead='${gitShortHead()}';\n"); + + //final rmd = File("README.md").readAsStringSync(); + //rmd.replaceAll(RegExp("download/[\\d\\.]+/exe2dist"), "download/[\\d\\.]+/exe2dist"); + + // download/0.2.2/exe2dist } \ No newline at end of file diff --git a/script/update_readme.dart b/script/update_readme.dart new file mode 100644 index 0000000..7f64d9e --- /dev/null +++ b/script/update_readme.dart @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: (c) 2022 Artsiom iG +// SPDX-License-Identifier: MIT + + +import 'dart:io'; + +import 'package:yaml/yaml.dart'; + +String nowDate() => DateTime.now().toUtc().toString().substring(0, 10); + +String gitShortHead() => + Process.runSync("git", ["rev-parse", "--short", "HEAD"]) + .stdout.toString().trim(); + +void main() { + final doc = loadYaml(File("pubspec.yaml").readAsStringSync()); + final version = doc["version"]; + + final readmeFile = File("README.md"); + final oldText = readmeFile.readAsStringSync(); + final newText = oldText.replaceAll(RegExp("download/[\\d\\.]+/exe2dist"), "download/$version/exe2dist"); + if (newText!=oldText) { + print("Readme changed"); + readmeFile.writeAsStringSync(newText); + } else { + print("Readme not changed"); + } +} \ No newline at end of file From 2e18ddee33139599996cb1153a2ca96e17c084da Mon Sep 17 00:00:00 2001 From: Artem IG Date: Sun, 9 Oct 2022 01:06:25 +0300 Subject: [PATCH 5/5] publish --- README.md | 2 +- bin/source/constants.g.dart | 2 +- publish.sh | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 381c536..79b05ed 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ A CLI tool that packages a binary executable into a redistributable archive. I use this tool to automate my CI/CD. Therefore, the functionality is limited to my use cases. -`exe2dist` runs on Linux and MacOS. It detects +`exe2dist` runs on Linux and MacOS. The executables that are being processed may be for other platforms. diff --git a/bin/source/constants.g.dart b/bin/source/constants.g.dart index 377a5db..5c8b2e2 100644 --- a/bin/source/constants.g.dart +++ b/bin/source/constants.g.dart @@ -2,4 +2,4 @@ const buildVersion='0.2.3'; const buildDate='2022-10-08'; const buildOs='linux'; -const buildShortHead='d1296f8'; +const buildShortHead='28cb6da'; diff --git a/publish.sh b/publish.sh index d463583..3bc5dd1 100755 --- a/publish.sh +++ b/publish.sh @@ -1,3 +1,6 @@ +#!/bin/bash +set -e && cd "${0%/*}" + dart script/update_constants.dart dart script/update_readme.dart git add .