{"id":16073209,"url":"https://github.com/rolfschmidt/zammad-scripts","last_synced_at":"2025-04-12T23:51:17.719Z","repository":{"id":191133521,"uuid":"683991577","full_name":"rolfschmidt/zammad-scripts","owner":"rolfschmidt","description":"Contains some helper scripts for my packages tutorial https://community.zammad.org/t/packages-tutorial/12079","archived":false,"fork":false,"pushed_at":"2024-01-19T13:13:30.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T17:56:51.345Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rolfschmidt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-08-28T08:10:12.000Z","updated_at":"2024-09-19T15:52:53.000Z","dependencies_parsed_at":"2024-01-19T13:52:32.778Z","dependency_job_id":"8cd29653-923f-4029-ae56-f0dec8aa0dd6","html_url":"https://github.com/rolfschmidt/zammad-scripts","commit_stats":null,"previous_names":["rolfschmidt/zammad-packages-tutorial"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolfschmidt%2Fzammad-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolfschmidt%2Fzammad-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolfschmidt%2Fzammad-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolfschmidt%2Fzammad-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rolfschmidt","download_url":"https://codeload.github.com/rolfschmidt/zammad-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647252,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T08:04:52.428Z","updated_at":"2025-04-12T23:51:17.671Z","avatar_url":"https://github.com/rolfschmidt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zammad Scripts\n\nHere you will find a couple ruby scripts which can be helpful to get the first steps in for the package creation in zammad.\n\n## Requirements\n\nOnly the current ruby version of zammad is required:\n\nhttps://github.com/zammad/zammad/blob/develop/Gemfile#L6\n\nThere are no dependencies.\n\n## Setup\n\nTo setup the scripts I would recommend you to clone the repository in your home directory (e.g. my home directory is /home/ubuntu-rs):\n\n```bash\nubuntu-rs@ubuntu-rs:/opt/zammad$ cd ~\nubuntu-rs@ubuntu-rs:~$ git clone git@github.com:rolfschmidt/zammad-scripts.git\n```\n\nThen you need to setup the git aliases.\n\n```bash\nubuntu-rs@ubuntu-rs:~$ vi ~/.gitconfig\n\n[user]\n        name = xxx\n        email = xxx@xxx.com\n\n[alias]\n\nzammad-new-szpm = !ruby /home/ubuntu-rs/zammad-scripts/zammad_new_szpm.rb $(pwd)\nzammad-update-szpm = !ruby /home/ubuntu-rs/zammad-scripts/zammad_update_szpm.rb $(pwd)\nzammad-create-zpm = !ruby /home/ubuntu-rs/zammad-scripts/zammad_create_zpm.rb $(pwd) $1\nzammad-migration = !ruby /home/ubuntu-rs/zammad-scripts/zammad_migration.rb $(pwd) $1\n```\n\n## Setup a new project\n\n1. To create a new project you should always create a directory in the following format:\n\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad$ mkdir Example-NewProject\nubuntu-rs@ubuntu-rs:/workspace/git_zammad$ cd Example-NewProject\n```\n\nExample is in this case our vendor of the package and NewProject is the package name. It is important to use came case here.\n\n2. Initialize your git\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ git init\n```\n\n3. Add the template for a new zammad package module:\n\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ git zammad-new-szpm\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ cat example-new_project.szpm\n{\n  \"name\": \"Example-NewProject\",\n  \"version\": \"1.0.0\",\n  \"vendor\": \"Example GmbH\",\n  \"license\": \"GNU AFFERO GENERAL PUBLIC LICENSE\",\n  \"url\": \"http://example.com/\",\n  \"files\": []\n}\n```\n\n## Commands\n\n### New source zammad package module\n\nThis will create an new source file which is needed to a create a package.\n\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ git zammad-new-szpm\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ cat example-new_project.szpm\n{\n  \"name\": \"Example-NewProject\",\n  \"version\": \"1.0.0\",\n  \"vendor\": \"Example GmbH\",\n  \"license\": \"GNU AFFERO GENERAL PUBLIC LICENSE\",\n  \"url\": \"http://example.com/\",\n  \"files\": []\n}\n```\n\n### Add migration\n\nThis will create a new migration for the package\n\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ git zammad-migration CreateBase\ncreate migration /workspace/git_zammad/Example-NewProject/db/addon/example_new_project/20230908080759_create_base.rb...\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ cat db/addon/example_new_project/20230908080759_create_base.rb\nclass CreateBase \u003c ActiveRecord::Migration[4.2]\n  def self.up\n  end\n\n  def self.down\n  end\nend\n```\n\n### Update file list\n\nThis will update the file list for the `*.szpm` file.\n\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ git zammad-update-szpm\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ cat example-new_project.szpm\n{\n  \"name\": \"Example-NewProject\",\n  \"version\": \"1.0.0\",\n  \"vendor\": \"Example GmbH\",\n  \"license\": \"GNU AFFERO GENERAL PUBLIC LICENSE\",\n  \"url\": \"http://example.com/\",\n  \"files\": [\n    {\n      \"location\": \"db/addon/example_new_project/20230908080759_create_base.rb\",\n      \"permission\": 644\n    }\n  ]\n}\n```\n\n### Create a zammad package\n\nThis will create a final package which is installable by zammad.\n\n```bash\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ git zammad-create-zpm 1.0.0\ncreate zpm /workspace/git_zammad/Example-NewProject/example-new_project-1.0.0.zpm...\nubuntu-rs@ubuntu-rs:/workspace/git_zammad/Example-NewProject$ cat example-new_project-1.0.0.zpm\n{\n  \"name\": \"Example-NewProject\",\n  \"version\": \"1.0.0\",\n  \"vendor\": \"Example GmbH\",\n  \"license\": \"GNU AFFERO GENERAL PUBLIC LICENSE\",\n  \"url\": \"http://example.com/\",\n  \"files\": [\n    {\n      \"location\": \"db/addon/example_new_project/20230908080759_create_base.rb\",\n      \"permission\": 644,\n      \"encode\": \"base64\",\n      \"content\": \"Y2xhc3MgQ3JlYXRlQmFzZSA8IEFjdGl2ZVJlY29yZDo6TWlncmF0aW9uWzQu\\nMl0KICBkZWYgc2VsZi51cAogIGVuZAoKICBkZWYgc2VsZi5kb3duCiAgZW5k\\nCmVuZAo=\"\n    }\n  ]\n}\n```\n\n## Optional Settings\n\nYou can modify the default data of the new SZPM with ENVs. Just add the following exports to your `~/.bashrc`:\n\n```bash\nexport ZAMMAD_SCRIPTS_VENDOR=\"Your name\"\nexport ZAMMAD_SCRIPTS_URL=\"https://github.com/yourname\"\nexport ZAMMAD_SCRIPTS_LICENSE=\"GNU AFFERO GENERAL PUBLIC LICENSE\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolfschmidt%2Fzammad-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frolfschmidt%2Fzammad-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolfschmidt%2Fzammad-scripts/lists"}