module PatternPark require 'find' class Template < Sprout def type return 'template' end def execute if(target) proj_path = File.join(Sprout.project_path, target.project_path) from = target.install_path to = proj_path FileUtils.makedirs(to) TemplateResolver.instance.copy_files(from, to, render) # This code will change the Sprout.project path # to the first rakefile found in the template # I'm not convinced this is a good idea - # seems like other utils may need to know about # the structure of a project, but most of them # need to load the nearest rakefile and use # the paths identified in them.... Find.find(proj_path) do |path| Sprout.default_rakefiles.each do |rakefile| if(File.basename(path) == rakefile) Sprout.project_path = File.dirname(path) end end end end super end end end