Sha256: ef6b53c4bf43e3ed223215de9ce3e9fdb09731baf907b74a394e2403b4ac093f

Contents?: true

Size: 982 Bytes

Versions: 4

Compression:

Stored size: 982 Bytes

Contents

# This module prepare the Cupper project with the
#   defaults files and dirs. All the files created are
#   just samples and must to be changed by the user
require 'cupper/entity'

module Cupper
  class Structure
    include Entity
    def initialize(name,dest_path, erb_file = nil, type = nil)
      super(name, dest_path, erb_file, type)
    end
  end

  class Project
    attr_reader :name
    attr_reader :dir

    def initialize(project_name, directory = nil)
      @name = project_name
      @dir = directory.nil? ? Dir.getwd : directory
      @subdirs = [
        'cookbooks'
      ]
      @files = [
        'CupperFile'
      ]
    end

    def create
      # Root project directory
      struct = Structure.new(@name, @dir, nil, Entity::DIR)
      struct.create

      @subdirs.zip(@files).each do |dir, file|
        Structure.new(dir, "#{@dir}/#{@name}", nil, Entity::DIR).create
        Structure.new(file, "#{@dir}/#{@name}", file).create
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cupper-0.1.3 lib/cupper/project.rb
cupper-0.1.2 lib/cupper/project.rb
cupper-0.1.1 lib/cupper/project.rb
cupper-0.1.0 lib/cupper/project.rb