class Marv::Project::Templates

Public Class Methods

new(builder) click to toggle source

Initialize templates builder

# File lib/marv/project/builder/templates.rb, line 6
def initialize(builder)
  @builder = builder
  @task = builder.task
  @project = builder.project
  @config = builder.project.config
end

Public Instance Methods

clean_templates() click to toggle source

Clean Templates

# File lib/marv/project/builder/templates.rb, line 14
def clean_templates
  @task.shell.mute do
    ::Dir.glob(::File.join(@project.build_path, '*.php')).each do |file|
      unless file.include?('functions.php') || file.include?(::File.basename(@project.plugin_file))
        @task.remove_file file
      end
    end
  end
end
copy_templates() click to toggle source

Copy templates

# File lib/marv/project/builder/templates.rb, line 25
def copy_templates
  @task.shell.mute do
    ::Dir.glob(::File.join(@project.templates_path, '**', '*')).each do |file|
      target = ::File.join(@project.build_path, ::File.basename(file))

      @task.copy_file file, target, :force => true unless ::File.directory?(file)
    end
  end
end