Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • oss/utilities/documentation-manager
1 result
Show changes
Commits on Source (20)
......@@ -2,6 +2,7 @@
<configuration default="false" name="go build gitlab.schukai.com/oss/utilities/documentation-manager" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
<module name="documentation-manager" />
<working_directory value="$PROJECT_DIR$/" />
<parameters value="version" />
<EXTENSION ID="com.fapiko.jetbrains.plugins.better_direnv.runconfigs.GolandRunConfigurationExtension">
<option name="DIRENV_ENABLED" value="false" />
<option name="DIRENV_TRUSTED" value="false" />
......
......@@ -176,6 +176,9 @@ fi
git --no-pager log --decorate=short --pretty=oneline
gitVersion=$(version print --git)
echo '{ "version": "''${gitVersion}" }' > version.json
git add version.json
git commit -m "Update version to ''${gitVersion}"
for file in $(exa "''${project_root}"dist/*); do
......
......@@ -15,39 +15,9 @@
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1689431009,
"narHash": "sha256-hPgQCRWP5q/Xc4qOIP3c2krR9nQua78+t9EDiuey5nc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "af8279f65fe71ce5a448408034a8c06e2b4b2c66",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"versionTool": "versionTool"
}
},
"versionTool": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"narHash": "sha256-jzixQKFFW4oxO0S4GYqbkFCXzhBd6com6Z9+MtVKakU=",
"type": "tarball",
"url": "https://gitlab.schukai.com/oss/utilities/version/-/archive/0.5.0/version-0.5.0.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://gitlab.schukai.com/oss/utilities/version/-/archive/0.5.0/version-0.5.0.tar.gz"
"nixpkgs": "nixpkgs"
}
}
},
......
{
description = "docman is a document management tool";
# Nixpkgs / NixOS version to use.
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
versionTool.url = "https://gitlab.schukai.com/oss/utilities/version/-/archive/0.5.0/version-0.5.0.tar.gz";
nixpkgs.url = "nixpkgs/nixos-23.05";
};
outputs = { self, nixpkgs, versionTool, ... }:
outputs = { self, nixpkgs, ... }:
let
# to work with older version of flakes
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
rootPath = ./.;
# System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
pkgs = import nixpkgs { system = "x86_64-linux"; };
# versionTool = pkgs.fetchzip {
# url = "https://gitlab.schukai.com/oss/utilities/version/-/archive/0.5.0/version-0.5.0.tar.gz";
# # You'll need to provide the correct hash here.
# sha256 = "sha256-jzixQKFFW4oxO0S4GYqbkFCXzhBd6com6Z9+MtVKakU=";
# };
in {
in
{
# Provide some binary packages for selected system types.
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
version = "${versionTool}/bin/version print --git"; # assuming this gives you version
build = "${versionTool}/bin/version build"; # assuming this gives you build
in
{
pkgs = nixpkgsFor.${system};
in {
docman = pkgs.buildGoModule {
name = "docman";
# In 'nix develop', we don't need a copy of the source tree
# in the Nix store.
version = "${self.ref}";
src = ././source;
# This hash locks the dependencies of this package. It is
# necessary because of how Go requires network access to resolve
# VCS. See https://www.tweag.io/blog/2021-03-04-gomod2nix/ for
# details. Normally one can build with a fake sha256 and rely on native Go
# mechanisms to tell you what the hash should be or determine what
# it should be "out-of-band" with other tooling (eg. gomod2nix).
# To begin with it is recommended to set this, but one must
# remeber to bump this hash when your dependencies change.
#vendorSha256 = pkgs.lib.fakeSha256;
#vendorSha256 = "sha256-XdB+u94Rqsb29jVs4miyOq1NEYaVJHWFXg6QebFJzNQ=";
vendorSha256 = "sha256-81IBG8H1jsYKD+tmFeCpAWFdz6cuQDt9r+FV56xboBU=";
# "-X release.version=$version -X release.build=$(due --iso-8601 | tr -d "-" )"
ldflags = [
"-s"
"-w"
"-X release.version=1"
"-X release.build=2"
"-X 'gitlab.schukai.com/oss/utilities/documentation-manager/release.version=${self.ref}' -X 'gitlab.schukai.com/oss/utilities/documentation-manager/release.build=${self.lastModified}'"
];
buildInputs = [ versionTool.defaultPackage.${system} ];
meta = with nixpkgs.legacyPackages.${system}.lib; {
description = "docman is a document management tool";
......@@ -84,7 +47,6 @@
};
});
# Add dependencies that are only needed for development
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
......@@ -95,9 +57,7 @@
};
});
# The default package for 'nix build'. This makes sense if the
# flake provides only one package or there is a clear "main"
# package.
defaultPackage = forAllSystems (system: self.packages.${system}.docman);
};
}
package command
type CommandsStruct struct {
ConfigPath string `long:"config" short:"c" description:"Path to configuration file"`
Release ReleaseCommand `command:"release" description:"Release commands"`
ConfigPath string `long:"config" short:"c" description:"Path to configuration file"`
Verbose bool `long:"verbose" short:"v" description:"Verbose output"`
Version struct {
} `command:"version" description:"Prints the version" call:"PrintReleaseInfo"`
}
//
//type Definition struct {
// Verbose bool `short:"v" long:"verbose" description:"Show verbose debug information"`
// ConfigurationPath string `short:"c" long:"config" description:"Path to the configuration file"`
// Version struct {
// } `command:"version" description:"Prints the version" call:"PrintVersion"`
// Document struct {
// } `command:"document" description:"Document related commands"`
// Server struct {
// } `command:"server" description:"Server related commands"`
//}
......@@ -16,7 +16,7 @@ var helpInfo = "\nYou can use the --help flag to get more information about the
func Execute() {
instance := xflags.New(os.Args[0], CommandsStruct{})
instance = xflags.New(os.Args[0], CommandsStruct{})
if instance.HasErrors() {
for _, msg := range instance.Errors() {
error2.PrintError(msg.Error())
......
......@@ -3,66 +3,3 @@ package config
func checkConstraints() bool {
return true
}
// func sanitizeMessageEndpoint() {
// //e := Instance.Client.Endpoints.Messages
// //
// //u, err := url.ParseRequestURI(e)
// //error2.CheckError(err)
// //
// //if u.Scheme != "ws" {
// // u.Scheme = "ws"
// //}
// //
// //if u.Host == "" {
// // u.Host = Instance.Server.Host
// // if u.Host == "" {
// // error2.PrintErrorAndExit("Invalid message endpoint: " + e)
// // }
// //}
// //
// //Instance.Client.Endpoints.Messages = u.String()
//
// }
//
// func sanitizeConfigEndpoint() {
// //e := Instance.Client.Endpoints.Config
// //
// //u, err := url.ParseRequestURI(e)
// //error2.CheckError(err)
// //
// //if u.Scheme != "http" {
// // u.Scheme = "http"
// //}
// //
// //if u.Host == "" {
// // u.Host = Instance.Server.Host
// // if u.Host == "" {
// // error2.PrintErrorAndExit("Invalid config endpoint: " + e)
// // }
// //}
// //
// //Instance.Client.Endpoints.Config = u.String()
//
// cfg := Instance.Config()
//
// e := cfg.Client.Endpoints.Config
//
// u, err := url.ParseRequestURI(e)
// error2.CheckError(err)
//
// if strings.HasPrefix(u.Scheme, "http") {
// u.Scheme = "http"
// }
//
// if u.Host == "" {
// u.Host = cfg.Server.Host
// if u.Host == "" {
// error2.PrintErrorAndExit("Invalid message endpoint: " + e)
// }
// }
//
// cfg.Client.Endpoints.Config = u.String()
// Instance.SetConfig(cfg)
//
// }
......@@ -3,8 +3,5 @@ package config
type Settings map[string]interface{}
type AppConfig struct {
Database struct {
// user:pass@tcp(127.0.0.1:3306)/alvine_platform?charset=utf8mb4&parseTime=True&loc=Local
DSN string `env:"DATABASE_DSN" yaml:"DSN"`
} `yaml:"Database"`
Verbose bool `env:"DATABASE_DSN" yaml:"DSN"`
}
......@@ -58,7 +58,7 @@ func SetUp(cfgPath string) {
//preparation.OnChange(once)
preparation.Import()
if preparation.HasErrors() {
if preparation.HasErrors() && Instance.Config().Verbose {
for _, msg := range preparation.Errors() {
error2.PrintError(msg.Error())
}
......
......@@ -4,10 +4,6 @@ package main
import "gitlab.schukai.com/oss/utilities/documentation-manager/command"
//var (
// settings *xflags.Settings[commands.Definition]
//)
func main() {
command.Execute()
......
......@@ -23,11 +23,7 @@ func TestMaskCodeBlocks(t *testing.T) {
for _, table := range tables {
//p, _ := os.Getwd()
_, p, _, _ := runtime.Caller(0)
// p = filepath.Dir(p) // go to parent directory
//p = filepath.Dir(p) // go to parent directory
//p = filepath.Dir(p) // go to parent directory
p = filepath.Dir(p) // go to parent directory
p = filepath.Join(p, table.input)
......