Sha256: a33c956df26b68002f559fc3139d3b0d40b3a7331ad5beff19b436efa543d3f1

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

require 'marv/project/builder/engines'
require 'marv/project/builder/assets'
require 'marv/project/builder/functions'
require 'marv/project/builder/templates'

module Marv
  module Project
    class Builder

      attr_accessor :task, :project, :assets, :functions, :templates

      # Initialize project builder
      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

      # Start builder
      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 project to a directory
      def build_to(dir)
        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)
      end

      # Clean build directory
      def clean_directory
        @task.shell.mute do
          @task.remove_dir @project.build_path
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
marv-0.6.5 lib/marv/project/builder.rb
marv-0.6.4 lib/marv/project/builder.rb
marv-0.6.3 lib/marv/project/builder.rb
marv-0.6.2 lib/marv/project/builder.rb
marv-0.6.1 lib/marv/project/builder.rb
marv-0.6.0 lib/marv/project/builder.rb
marv-0.5.0 lib/marv/project/builder.rb