Class: RefineryThemeGenerator

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

Instance Method Summary collapse

Instance Method Details

#generateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/refinery_theme/refinery_theme_generator.rb', line 5

def generate
  copy_file "stylesheets/application.css", "themes/#{theme_name}/stylesheets/application.css"
  copy_file "stylesheets/formatting.css", "themes/#{theme_name}/stylesheets/formatting.css"
  copy_file "stylesheets/home.css", "themes/#{theme_name}/stylesheets/home.css"

  copy_file "views/layouts/application.html.erb", "themes/#{theme_name}/views/layouts/application.html.erb"

  copy_file "views/pages/show.html.erb", "themes/#{theme_name}/views/pages/show.html.erb"
  copy_file "views/pages/home.html.erb", "themes/#{theme_name}/views/pages/home.html.erb"

  copy_file "javascripts/application.js", "themes/#{theme_name}/javascripts/application.js"

  if RefinerySetting.get(:theme).nil?
    RefinerySetting.set(:theme, theme_name)
    puts "NOTE: \"theme\" setting created and set to #{theme_name}"
  else
    puts 'NOTE: If you want this new theme to be the current theme used, set the "theme" setting in the Refinery backend to the name of this theme.' unless RAILS_ENV == "test"
  end
end