Permalink
Browse files

Add override generator for theme (layout and stylesheet).

  • Loading branch information...
jasoncodes committed Jun 12, 2011
1 parent 829a2c6 commit 10c5831871c1133926798fd611769b047a655db8
Showing with 10 additions and 1 deletion.
  1. +9 −1 lib/generators/postmarkdown/override_generator.rb
  2. +1 −0 readme.md
@@ -6,9 +6,10 @@ class OverrideGenerator < Rails::Generators::Base
class_option :views, :type => :boolean, :group => :override, :desc => 'Override all Post views'
class_option :model, :type => :boolean, :group => :override, :desc => 'Override the Post model'
class_option :controller, :type => :boolean, :group => :override, :desc => 'Override the Posts controller'
+ class_option :theme, :type => :boolean, :group => :override, :desc => 'Override the layout and stylesheet'
def check_class_options
- if options.views.blank? && options.model.blank? && options.controller.blank?
+ if options.views.blank? && options.model.blank? && options.controller.blank? && options.theme.blank?
exec 'rails g postmarkdown:override --help'
exit
end
@@ -31,5 +32,12 @@ def override_controller
copy_file 'controllers/posts_controller.rb', 'app/controllers/posts_controller.rb'
end
end
+
+ def override_theme
+ if options.theme
+ directory 'views/layouts', 'views/layouts'
+ directory '../public/stylesheets', 'public/stylesheets'
+ end
+ end
end
end
View
@@ -52,6 +52,7 @@ The easiest way to customize the Postmarkdown functionality or appearance is by
$ rails generate postmarkdown:override --controller # overrides `app/controllers/posts_controller.rb`
$ rails generate postmarkdown:override --model # overrides `app/models/post.rb`
$ rails generate postmarkdown:override --views # overrides all files in directory `app/views/posts/`
+ $ rails generate postmarkdown:override --theme # overrides the layout and stylesheet
## RSS Feed

0 comments on commit 10c5831

Please sign in to comment.