Initial commit
This commit is contained in:
18
bin/init_config
Normal file
18
bin/init_config
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'erb'
|
||||
require 'pathname'
|
||||
require 'fileutils'
|
||||
|
||||
src_root = Pathname.new(File.expand_path('../../config/templates', __FILE__))
|
||||
dest_root = Pathname.new(File.expand_path('../../config', __FILE__))
|
||||
|
||||
Dir[src_root.join('**/*.erb').to_s].each do |f|
|
||||
dest = dest_root.join(Pathname.new(f).relative_path_from(src_root)).sub(/\.erb\z/, '')
|
||||
FileUtils.mkpath(dest.dirname)
|
||||
puts "Copy #{f} -> #{dest}"
|
||||
File.write(dest, ERB.new(File.read(f)).result.strip)
|
||||
end
|
||||
Reference in New Issue
Block a user