Class: Marv::Project::Builder
- Inherits:
-
Object
- Object
- Marv::Project::Builder
- Defined in:
- lib/marv/project/builder.rb
Instance Attribute Summary collapse
-
#assets ⇒ Object
Returns the value of attribute assets.
-
#functions ⇒ Object
Returns the value of attribute functions.
-
#project ⇒ Object
Returns the value of attribute project.
-
#task ⇒ Object
Returns the value of attribute task.
-
#templates ⇒ Object
Returns the value of attribute templates.
Instance Method Summary collapse
-
#build_project ⇒ Object
Start builder.
-
#build_to(dir) ⇒ Object
Build project to a directory.
-
#clean_directory ⇒ Object
Clean build directory.
-
#initialize(project) ⇒ Builder
constructor
Initialize project builder.
Constructor Details
#initialize(project) ⇒ Builder
Initialize project builder
13 14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#assets ⇒ Object
Returns the value of attribute assets.
10 11 12 |
# File 'lib/marv/project/builder.rb', line 10 def assets @assets end |
#functions ⇒ Object
Returns the value of attribute functions.
10 11 12 |
# File 'lib/marv/project/builder.rb', line 10 def functions @functions end |
#project ⇒ Object
Returns the value of attribute project.
10 11 12 |
# File 'lib/marv/project/builder.rb', line 10 def project @project end |
#task ⇒ Object
Returns the value of attribute task.
10 11 12 |
# File 'lib/marv/project/builder.rb', line 10 def task @task end |
#templates ⇒ Object
Returns the value of attribute templates.
10 11 12 |
# File 'lib/marv/project/builder.rb', line 10 def templates @templates end |
Instance Method Details
#build_project ⇒ Object
Start builder
23 24 25 26 27 28 29 30 31 32 33 34 |
# 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) ⇒ Object
Build project to a directory
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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.(dir) end # Copy files from .watch/build directory @task.directory @project.build_path, ::File.(dir) rescue Exception => e @task.say_error "There was an error while building the project:", e., false abort end end |
#clean_directory ⇒ Object
Clean build directory
55 56 57 58 59 |
# File 'lib/marv/project/builder.rb', line 55 def clean_directory @task.shell.mute do @task.remove_dir @project.build_path end end |