Sha256: 2e05c8ba2139d9c93879f458f60b6b83ae5fbb6d88d3f5968cb1a3a264dbfb87

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

class RefineryThemeGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)
  argument :theme_name, :type => :string

  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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-theming-1.0.1 lib/generators/refinery_theme/refinery_theme_generator.rb
refinerycms-theming-1.0.0 lib/generators/refinery_theme/refinery_theme_generator.rb
refinerycms-theming-0.9.9.2 lib/generators/refinery_theme/refinery_theme_generator.rb
refinerycms-theming-0.9.9.1 lib/generators/refinery_theme/refinery_theme_generator.rb