Commit 76b9fbad authored by Niklaus Giger's avatar Niklaus Giger
Browse files

[21759] Cosmetic improvement to update_changelog

parent 69062c11
Pipeline #22690 passed with stages
in 4 minutes and 13 seconds
......@@ -2,6 +2,8 @@
require 'bundler/inline'
puts "It may take some time for bundler/inline to install the dependencies"
$argv_copy = ARGV.clone
gemfile do
source 'https://rubygems.org'
gem 'optimist'
......@@ -189,7 +191,7 @@ def read_issue(id = 5760)
@nr_loaded ||= 0
unless ENV['REDMINE_MEDEXIS_API']
puts "Environment variable REDMINE_MEDEXIS_API must be specified to read an issue from the Medelexis Redmine"
raise "Missing REDMINE_MEDEXIS_API variable"
raise "Missing REDMINE_MEDEXIS_API variable. Get it from https://redmine.medelexis.ch/my/api_key"
end
if (ti = @ticket_cache[id])
ti.last_api_fetch ||= Date.today
......@@ -200,7 +202,7 @@ def read_issue(id = 5760)
end
issue = Issue.new
issue.last_api_fetch = Date.today
content = open("#{ISSUE_URL}/#{id}.xml",
content = URI.open("#{ISSUE_URL}/#{id}.xml",
"User-Agent" => "Ruby/#{RUBY_VERSION}",
"X-Redmine-API-Key" => "#{ENV['REDMINE_MEDEXIS_API']}"
).read
......@@ -309,7 +311,7 @@ def emit_history(filename, from = nil, to = nil)
walk = @history
filename += "-#{from.sub(/(release|origin)\//,'')}-#{to.sub(/(origin|release)\//,'')}" if from && to
File.open(filename, 'w+') do |ausgabe|
ausgabe.puts "# Generated by #{File.basename(__FILE__)} on #{Time.now.strftime(DATE_FORMAT)}"
ausgabe.puts "# Generated by #{File.basename(__FILE__)} #{$argv_copy} on #{Time.now.strftime(DATE_FORMAT)}".gsub("[", '').gsub("]", '').gsub('"','')
ausgabe.puts "# similar to git log --date=iso --pretty=format:'%H %ad %an %s' release/3.0.25..release/3.1.0"
if from && to
emit_changes(ausgabe, from, to)
......
# Helper script for Niklaus to be able to work under NixOS
{ pkgs ? import <nixpkgs> {} }:
let mvn = pkgs.maven.override { jdk = pkgs.openjdk8; };
in pkgs.mkShell {
buildInputs = [ mvn pkgs.jq pkgs.adoptopenjdk-hotspot-bin-8 pkgs.ruby pkgs.rubyPackages.rugged];
}
# Tested with the following commands after calling nix-shell
# mvn -V clean verify -Dtycho.localArtifacts=ignore -DskipTests
# ./ch.elexis.core.releng/update_changelog.rb --force-tag=release/3.8 --with-tickets
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment