Class: WebsiteGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/website/website_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_websiteObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/website/website_generator.rb', line 6

def generate_website
  copy_file "template.html.haml", "sites/#{file_name}/app/views/templates/default.html.haml"
  copy_file "style.css", "sites/#{file_name}/public/stylesheets/#{file_name}.css"
  directory "theme", "sites/#{file_name}/public/stylesheets/theme"
  create_file "sites/#{file_name}/public/images/.gitkeep", ""
  create_file "sites/#{file_name}/public/javascripts/#{file_name}.js", "// Website specific scripts"

  template "layout.html.haml", "sites/#{file_name}/app/views/layouts/#{file_name}.html.haml"
  template "config.yml", "sites/#{file_name}/config/website.yml"
  unless ::File.exist? "#{destination_root}/sites/apache-mapping.txt"
    create_file "sites/apache-mapping.txt", "#\n# apache domainname to site mappings\n#\n"
  end
  append_to_file "sites/apache-mapping.txt", domain_names.collect { |domain_name| "#{domain_name}  #{file_name}\n" }.join
  create_folder_link "sites/#{file_name}/public", "public/sites/#{file_name}"
end