#!/usr/bin/env ruby # frozen_string_literal: true # NOTE: you may need change file permissions # chmod +x hooks/update-version exit 1 if ARGV.empty? version = ARGV[0] version = version[1..-1] # revoke 'v' character, e.g. v0.1.1 becomes 0.1.1 namespaces = %w[KExt Github] indent = 0 output = ['# frozen_string_literal: true', ''] namespaces.each do |namespace| output.push "#{' ' * indent}module #{namespace}" indent += 1 end output.push "#{' ' * indent}VERSION = \'#{version}'" indent -= 1 namespaces.each do output.push "#{' ' * indent}end" indent -= 1 end output.push('') printf "%-25