Class: Marv::Project::Templates
- Inherits:
-
Object
- Object
- Marv::Project::Templates
- Defined in:
- lib/marv/project/builder/templates.rb
Instance Method Summary collapse
-
#clean_templates ⇒ Object
Clean Templates.
-
#copy_templates ⇒ Object
Copy templates.
-
#initialize(builder) ⇒ Templates
constructor
Initialize templates builder.
Constructor Details
#initialize(builder) ⇒ Templates
Initialize templates builder
6 7 8 9 10 11 |
# 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 |
Instance Method Details
#clean_templates ⇒ Object
Clean Templates
14 15 16 17 18 19 20 21 22 |
# 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 ⇒ Object
Copy templates
25 26 27 28 29 30 31 32 33 |
# 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 |