• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A CLI tool for downloading from pixiv.net


Commit MetaInfo

Revisão0432d74f851e4bb53d0cfb8aa4c2e4c2f636b918 (tree)
Hora2023-08-07 18:44:33
Autormio <stigma@disr...>
Commitermio

Mensagem de Log

Change version identifier to date+hash

Mudança Sumário

Diff

--- a/dub.sdl
+++ b/dub.sdl
@@ -9,7 +9,7 @@ targetType "executable"
99 versions "GMagick_Static"
1010 libs "GraphicsMagick"
1111
12-
12+preBuildCommands "sh insert_gitversion.sh"
1313
1414 # We have a hard dependency on magickd so we can choose the subConfiguration
1515 dependency "magickd:graphicsmagick_c" \
--- /dev/null
+++ b/insert_gitversion.sh
@@ -0,0 +1,21 @@
1+#!/bin/sh
2+
3+if [ -d ".git" ]
4+then
5+ which git >/dev/null || exit 0
6+
7+ # Keep all but the last two lines
8+ git_version_file="$(head -n -2 source/git_version.d)"
9+ printf "%s\n\n" "$git_version_file" > source/git_version.d
10+
11+
12+ version="$(git show --pretty='%cd %h' --date=format:%Y-%m --no-patch --no-notes HEAD)"
13+ gdate="$(printf '%s' "$version" | cut -d' ' -f1)"
14+ ghash="$(printf '%s' "$version" | cut -d' ' -f2)"
15+ printf 'enum gitDate = "%s";\n' "$gdate" >> source/git_version.d
16+ printf 'enum gitHash = "%s";\n' "$ghash" >> source/git_version.d
17+
18+ printf "[insert_gitversion] Success!\n"
19+fi
20+
21+
--- a/source/app.d
+++ b/source/app.d
@@ -39,6 +39,7 @@ import std.net.curl : CurlException;
3939
4040 import configparser;
4141 import directories;
42+import git_version;
4243
4344 import pixivd.enums;
4445 import pixivd.types;
@@ -64,7 +65,7 @@ FileLogger log;
6465 version(appimage) {
6566 enum ProgramName = "pixiv_down";
6667 }
67-enum PixivDownVersionString = "0.2-dev";
68+enum PixivDownVersionString = gitDate ~ " (" ~ gitHash ~ ")";
6869
6970 /**
7071 * Prompt for the PHPSESSID cookie.
--- /dev/null
+++ b/source/git_version.d
@@ -0,0 +1,20 @@
1+/*
2+ * pixiv_down - CLI-based downloading tool for https://www.pixiv.net.
3+ * Copyright (C) 2023 Mio
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, version 3 of the License.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ * GNU General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU General Public License
15+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
16+ */
17+module git_version;
18+
19+enum gitDate = "2023-07";
20+enum gitHash = "95267e3";