Addon build updates

This commit is contained in:
Darren Clarke 2023-05-17 08:16:41 +00:00
parent 0190ccdfd3
commit d5bd58ac3e
5 changed files with 25 additions and 16 deletions

View file

@ -1,15 +1,10 @@
# frozen_string_literal: true
base_path = '/opt/zammad/contrib/link/addons'
packages = Dir.glob("#{base_path}/*")
puts "Available packages: #{packages}"
puts "Installed packages: #{Package.all.map(&:version)}"
packages = Dir.glob('/opt/zammad/contrib/link/addons/*')
packages.each do |package|
puts "Installing #{package} package..."
Package.install(file: package, reinstall: true)
Package.install(file: package)
rescue StandardError => e
puts "Error #{e.message}"
puts e.message
end

View file

@ -1,6 +1,8 @@
#!/usr/bin/env node
import { promises as fs } from "fs";
import { promisify } from "util";
import glob from "glob";
import path from "path";
import os from "os";
@ -17,7 +19,7 @@ const packageFile = async (actualPath: string): Promise<any> => {
encode: "base64",
content,
};
}
};
const packageFiles = async () => {
const packagedFiles: any[] = [];
@ -39,7 +41,7 @@ const packageFiles = async () => {
await processDir("./src/");
return packagedFiles;
}
};
export const createZPM = async ({ name, displayName, version }: Record<string, string>) => {
const files = await packageFiles();
@ -52,16 +54,28 @@ export const createZPM = async ({ name, displayName, version }: Record<string, s
buildhost: os.hostname(),
builddate: new Date().toISOString(),
files
}
};
const pkg = JSON.stringify(skeleton, null, 2);
try {
const gs = promisify(glob);
const files = await gs(`../../docker/zammad/addons/${name}-v*.zpm`);
for (const file of files) {
await fs.unlink(file);
console.log(`${file} was deleted`);
}
} catch (err) {
console.error(err);
}
await fs.writeFile(`../../docker/zammad/addons/${name}-v${version}.zpm`, pkg, 'utf-8');
}
};
const main = async () => {
const packageJSON = JSON.parse(await fs.readFile("./package.json", "utf-8"));
const { name, displayName, version } = packageJSON;
console.log(`Building addon ${displayName} v${version}`);
await createZPM({ name, displayName, version });
}
};
main();

View file

@ -1,7 +1,7 @@
{
"name": "zammad-addon-pgp",
"displayName": "PGP",
"version": "2.0.2",
"version": "2.0.0",
"description": "Adds PGP integration into [Zammad](https://zammad.org) via [Sequoia](https://sequoia-pgp.org).",
"scripts": {
"build": "node ../../node_modules/zammad-addon-common/dist/build.js",

View file

@ -584,7 +584,7 @@ class App.UiElement.ApplicationAction
options: {
'no': __('Do not sign email')
'discard': __('Sign email (if not possible, discard notification)')
'always': __('Sign daha email (if not possible, send notification anyway)')
'always': __('Sign email (if not possible, send notification anyway)')
}
value: meta.sign
translate: true

View file

@ -8,7 +8,7 @@
<hr>
<h2><%- @T('Default Behavior') %></h2>
<p>Choose the default behavior of the PGP integration on per group basis. If signing or encrypting is not possible, the setting has no effect. Agents call always manually alter the behavior for each article.</p>
<p>Choose the default behavior of the PGP integration on per group basis. If signing or encrypting is not possible, the setting has no effect. Agents can always manually alter the behavior for each article.</p>
<div class="settings-entry settings-entry--stretched js-groupList"></div>
<div class="btn btn--primary js-updateGroup"><%- @T('Update') %></div>
</form>