edit-gitlab-yml 471 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/env ruby
require 'erb'
require 'etc'

def main(file_path, template)
  File.open(file_path, 'w') { |f| f.puts template.result(binding) }
end

def env_or_default(key, default)
  ENV[key] || default
end

raw_template = File.read(File.join(__dir__, 'templates', 'gitlab.yml.erb'))
TEMPLATE = ERB.new(raw_template)
GDK_ROOT = Dir.pwd
GIT_BIN = `which git`

file_name = ARGV.first

abort "no file name as argument found" unless file_name

main(ARGV.first, TEMPLATE)