Class: ThemesOnRails::Generators::ThemeGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/themes_on_rails/theme_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_layout_fileObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/themes_on_rails/theme_generator.rb', line 23

def copy_layout_file
  template_engine = Rails.configuration.app_generators.rails[:template_engine]
  if template_engine == :liquid
    template "layout.html.liquid", "#{theme_views_layout}/#{theme_name}.liquid"
  elsif template_engine == :haml
    template "layout.html.haml", "#{theme_views_layout}/#{theme_name}.html.haml"
  else
    template "layout.html.erb", "#{theme_views_layout}/#{theme_name}.html.erb"
  end
end

#copy_manifest_filesObject



18
19
20
21
# File 'lib/generators/themes_on_rails/theme_generator.rb', line 18

def copy_manifest_files
  copy_file       "all.js", "#{theme_javascripts_directory}/all.js"
  copy_file       "all.css", "#{theme_stylesheets_directory}/all.css"
end

#create_theme_directoryObject



8
9
10
11
12
13
14
15
16
# File 'lib/generators/themes_on_rails/theme_generator.rb', line 8

def create_theme_directory
  empty_directory theme_views_layout
  empty_directory theme_images_directory
  empty_directory theme_javascripts_directory
  empty_directory theme_stylesheets_directory
  empty_directory theme_locales_directory
  create_file     "#{theme_images_directory}/.gitkeep", nil
  create_file     "#{theme_locales_directory}/.gitkeep", nil
end