Sha256: 5b3e5bc1c369de4ab8ee854102e03e9220da3b21ff640026221b633980523d3f

Contents?: true

Size: 1.32 KB

Versions: 12

Compression:

Stored size: 1.32 KB

Contents

# 
#  project.rb
#  bolt
#  
#  Created by Ben McRedmond on 2010-01-08.
#  Copyright 2010 Ben McRedmond. All rights reserved.
# 

require 'bolt/base'

module Bolt
  class Project < Base
    
    def initialize
      @default_directories = [$config.pages, $config.views, $config.lib, $config.resources] 
      @default_files = {$config.config => "default_files/config.yml", "#{$config.views}/application.haml" => "default_files/application.haml", "#{$config.views}/home.haml" => "default_files/home.haml", "#{$config.pages}/home.rb" => "default_files/home.rb"}
    end

    # Creates all nessecary directories and files for a new Bolt Project
    def run
      create_directory_structure
      create_files
    end
    
    private
    # Creates all the default directories using either defaults 
    # specified in lib/bolt.rb or by options on the command line
    def create_directory_structure
      create_directory($config.base_dir, :base_dir => true) unless File.directory?($config.base_dir)
      @default_directories.each {|directory| create_directory(directory)}
    end    
    
    # Creates all the default files using either defaults specified
    # in lib/bolt.rb or by options on the command line
    def create_files
      @default_files.each {|file, template| create_file(file, :copy_from => $BOLT_BASE + template)}
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
benofsky-bolt-0.4.8 lib/bolt/project.rb
benofsky-bolt-0.4.7 lib/bolt/project.rb
benofsky-bolt-0.4.5 lib/bolt/project.rb
benofsky-bolt-0.4.4 lib/bolt/project.rb
benofsky-bolt-0.4.3 lib/bolt/project.rb
benofsky-bolt-0.4.2 lib/bolt/project.rb
benofsky-bolt-0.4.1 lib/bolt/project.rb
benofsky-bolt-0.4 lib/bolt/project.rb
benofsky-bolt-0.3.3 lib/bolt/project.rb
benofsky-bolt-0.3.2 lib/bolt/project.rb
benofsky-bolt-0.3.1 lib/bolt/project.rb
benofsky-bolt-0.3.0 lib/bolt/project.rb