mygame/install_mygame.rb

require 'rbconfig'
require 'fileutils'
require 'optparse'

dlldir = nil
option = { :noop => false, :verbose => true }

ARGV.options do |opt|
  opt.on('--dlldir DIR'){|dir| dlldir = dir}
  opt.on('--no-harm'){ option[:noop] = true }
  opt.on('--quiet'){ option[:verbose] = false }

  opt.parse!
end

dlldir   ||= Config::CONFIG["bindir"]
sitelibdir = Config::CONFIG["sitelibdir"]
datadir    = Config::CONFIG["datadir"]
mygame_sitelibdir = File.join(sitelibdir, 'mygame')
mygame_datadir    = File.join(datadir, 'mygame')

FileUtils.mkpath(sitelibdir, option)
FileUtils.mkpath(mygame_sitelibdir, option)
FileUtils.mkpath(datadir, option)
FileUtils.mkpath(mygame_datadir, option)

Dir.glob("lib/*.rb"){|fname| FileUtils.install(fname, sitelibdir, option)}
Dir.glob("lib/mygame/*.rb"){|fname| FileUtils.install(fname, mygame_sitelibdir, option)}
Dir.glob("fonts/*.ttf"){|fname| FileUtils.install(fname, mygame_datadir, option)}