Sha256: e36b8fd15c40739fc98ca141d23ba20c32a01e8140f0efa3dd040a6cbc276b0e
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
#require "rubygems" require "contest" require "hpricot" require "fileutils" ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")) $:.unshift ROOT require "test/commands" class Test::Unit::TestCase include Test::Commands include FileUtils def root(*args) File.expand_path File.join(ROOT, *args) end def tmp_path(*args) root("test", "tmp", *args) end def setup mkdir_p tmp_path rm_f tmp_path(".monk") create_template "default" end def template_path(name = default) tmp_path("templates", name) end def create_template(name, add = "") dir = template_path(name) mkdir_p dir chdir(dir) do unless File.exist? "name" File.open("name", "w") { |f| f << name } raise RuntimeError, "could not initialize git repo" unless system <<-EOS git init -q && git add name 2>/dev/null && git ci -m "created template" -q EOS end end monk("add #{name} #{dir} #{add}") if add dir end def in_template(name, &block) chdir(create_template(name), &block) end def is_template?(path, name) file = File.join path, "name" File.exist?(file) && File.read(file) == name end def monk(args = nil) sh("env MONK_HOME=#{File.join(ROOT, "test", "tmp")} ruby -rubygems #{root "bin/monk"} #{args}") end end
Version data entries
4 entries across 4 versions & 3 rubygems
Version | Path |
---|---|
rkh-monk-0.0.6.1 | test/test_helper.rb |
rkh-monk-0.0.6 | test/test_helper.rb |
rkh-priest-0.0.7 | test/test_helper.rb |
priest-0.0.7 | test/test_helper.rb |