rails_generators/theme/theme_generator.rb in web-app-theme-0.5.2 vs rails_generators/theme/theme_generator.rb in web-app-theme-0.5.3
- old
+ new
@@ -1,11 +1,12 @@
class ThemeGenerator < Rails::Generator::Base
default_options :app_name => 'Web App',
:layout_type => :administration,
:theme => :default,
- :no_layout => false
+ :no_layout => false,
+ :engine => :erb
def initialize(runtime_args, runtime_options = {})
super
@name = @args.first || (options[:layout_type].to_s == "sign" ? "sign" : "application")
end
@@ -16,11 +17,11 @@
m.directory("public/images/web-app-theme")
%w(cross key tick application_edit).each do |icon|
m.file("../../../images/icons/#{icon}.png", "public/images/web-app-theme/#{icon}.png")
end
m.directory("public/stylesheets/themes/#{options[:theme]}/")
- m.template("view_layout_#{options[:layout_type]}.html.erb", File.join("app/views/layouts", "#{@name}.html.erb")) unless options[:no_layout]
+ m.template("view_layout_#{options[:layout_type]}.html.#{options[:engine]}", File.join("app/views/layouts", "#{@name}.html.#{options[:engine]}")) unless options[:no_layout]
m.template("../../../stylesheets/base.css", File.join("public/stylesheets", "web_app_theme.css"))
m.template("web_app_theme_override.css", File.join("public/stylesheets", "web_app_theme_override.css"))
m.template("../../../stylesheets/themes/#{options[:theme]}/style.css", File.join("public/stylesheets/themes/#{options[:theme]}", "style.css"))
end
end
@@ -36,8 +37,9 @@
opt.separator 'Options:'
opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
opt.on("--type=layout_type", String, "Specify the layout type") { |v| options[:layout_type] = v }
opt.on("--theme=theme", String, "Specify the theme") { |v| options[:theme] = v }
opt.on("--no-layout", "Don't create layout") { |v| options[:no_layout] = true }
+ opt.on("--engine=haml", "Use HAML instead of ERB template engine") { |v| options[:engine] = v }
end
end