Class: Tipsy::Runners::Generator

Inherits:
Object
  • Object
show all
Includes:
Utils::System
Defined in:
lib/tipsy/runners/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::System

#copy_file, #copy_folder, #copy_tree, #empty_dir?, #enumerate_tree, #excluded?, #excludes=, #log_action, #make_file, #mkdir_p, #normalize_path, #rm_rf, #skip_file?, #skip_path?, #unlink

Constructor Details

#initialize(args, site) ⇒ Generator

Returns a new instance of Generator.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tipsy/runners/generator.rb', line 12

def initialize(args, site)
  @site_name, @site = args.first, site
  @source_path = File.expand_path("../../../templates/site", __FILE__)
  @dest_path   = File.join(Tipsy.root, site_name)
  ensure_destination
  copy_tree(source_path, dest_path)
  
  public_dir = File.join(Tipsy.root, site_name, "public")
  File.mkdir_p(public_dir) unless ::Dir.exists?(public_dir)
  
end

Instance Attribute Details

#dest_pathObject (readonly)

Returns the value of attribute dest_path.



4
5
6
# File 'lib/tipsy/runners/generator.rb', line 4

def dest_path
  @dest_path
end

#siteObject (readonly)

Returns the value of attribute site.



4
5
6
# File 'lib/tipsy/runners/generator.rb', line 4

def site
  @site
end

#site_nameObject (readonly)

Returns the value of attribute site_name.



4
5
6
# File 'lib/tipsy/runners/generator.rb', line 4

def site_name
  @site_name
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



4
5
6
# File 'lib/tipsy/runners/generator.rb', line 4

def source_path
  @source_path
end

Instance Method Details

#excludesObject



8
9
10
# File 'lib/tipsy/runners/generator.rb', line 8

def excludes
  @_excludes ||= ['.svn', '.git', '.gitignore', '.sass-cache', 'config.erb', '.DS_Store']
end