class Marv::Project::Builder
Attributes
assets[RW]
functions[RW]
project[RW]
task[RW]
templates[RW]
Public Class Methods
new(project)
click to toggle source
Initialize project builder
# File lib/marv/project/builder.rb, line 13 def initialize(project) @project = project @task = project.task @config = project.config @assets = Marv::Project::Assets.new(self) @functions = Marv::Project::Functions.new(self) @templates = Marv::Project::Templates.new(self) end
Public Instance Methods
build_project()
click to toggle source
Start builder
# File lib/marv/project/builder.rb, line 23 def build_project clean_directory @functions.copy_folders @templates.copy_templates @functions.copy_functions @functions.copy_includes @assets.copy_images @assets.build_assets end
build_to(dir)
click to toggle source
Build project to a directory
# File lib/marv/project/builder.rb, line 37 def build_to(dir) @task.say_warning "This will build project #{@project.project_id} in directory #{dir}." begin build_project # Remove build directory @task.shell.mute do @task.remove_dir ::File.expand_path(dir) end # Copy files from .watch/build directory @task.directory @project.build_path, ::File.expand_path(dir) rescue Exception => e @task.say_error "There was an error while building the project:", e.message, false abort end end
clean_directory()
click to toggle source
Clean build directory
# File lib/marv/project/builder.rb, line 55 def clean_directory @task.shell.mute do @task.remove_dir @project.build_path end end