Sha256: 0484391b2ec4e89c25c22d32bb2c02f48bd24b5d70aa2973007d63b9f349348d

Contents?: true

Size: 1 KB

Versions: 12

Compression:

Stored size: 1 KB

Contents

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sprout-0.5.0 lib/template.rb
sprout-0.5.10 lib/template.rb
sprout-0.3.35 lib/template.rb
sprout-0.5.13 lib/template.rb
sprout-0.5.11 lib/template.rb
sprout-0.3.36 lib/template.rb
sprout-0.5.15 lib/template.rb
sprout-0.5.19 lib/template.rb
sprout-0.5.29 lib/template.rb
sprout-0.5.25 lib/template.rb
sprout-0.5.9 lib/template.rb
sprout-0.5.23 lib/template.rb