Class: Richcss::Generators::Template

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/richcss/generators.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



12
13
14
# File 'lib/richcss/generators.rb', line 12

def self.source_root
  File.dirname(__FILE__) + "/generator"
end

Instance Method Details

#create_css_filesObject



30
31
32
33
34
35
36
37
38
# File 'lib/richcss/generators.rb', line 30

def create_css_files
  @boxFiles.each do |filename|
    create_file "box/#{filename}#{@extension}" unless File.file?("box/#{filename}#{@extension}")
  end 

  @elementFiles.each do |filename|
    create_file "elements/#{filename}#{@extension}" unless File.file?("elements/#{filename}#{@extension}")
  end
end

#create_foldersObject



24
25
26
27
28
# File 'lib/richcss/generators.rb', line 24

def create_folders
  @groups.each do |g|
    empty_directory("#{g}") unless Dir.exists?("#{g}")
  end
end

#create_partfileObject



40
41
42
# File 'lib/richcss/generators.rb', line 40

def create_partfile
  create_file "parts/Partfile" unless File.file?("parts/Partfile")
end

#initObject



16
17
18
19
20
21
22
# File 'lib/richcss/generators.rb', line 16

def init
  @groups = ['box', 'elements', 'parts']
  @boxFiles = ['blocks', 'main', 'positioning']
  @elementFiles = ['button', 'colors', 'features', 'fonts', 'images', 'inputs', 'lists']
  @partFiles = ['Partfile']
  @extension = "." + arguments[0];
end