summaryrefslogtreecommitdiff
path: root/lib/generators/nifty/layout/layout_generator.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
commitb80bd744ad873f6fc43018bc4bfb90677de167bd (patch)
tree072c4b0e33d442528555b82c415f5e7a1712b2b0 /lib/generators/nifty/layout/layout_generator.rb
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
Diffstat (limited to 'lib/generators/nifty/layout/layout_generator.rb')
-rw-r--r--lib/generators/nifty/layout/layout_generator.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/generators/nifty/layout/layout_generator.rb b/lib/generators/nifty/layout/layout_generator.rb
new file mode 100644
index 0000000..fb7f9f4
--- /dev/null
+++ b/lib/generators/nifty/layout/layout_generator.rb
@@ -0,0 +1,29 @@
+require 'generators/nifty'
+
+module Nifty
+ module Generators
+ class LayoutGenerator < Base
+ argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'
+
+ class_option :haml, :desc => 'Generate HAML for view, and SASS for stylesheet.', :type => :boolean, :default => true
+
+ def create_layout
+ if options.haml?
+ template 'layout.html.haml', "app/views/layouts/#{file_name}.html.haml"
+ copy_file 'stylesheet.sass', "public/stylesheets/sass/#{file_name}.sass"
+ else
+ template 'layout.html.erb', "app/views/layouts/#{file_name}.html.erb"
+ copy_file 'stylesheet.css', "public/stylesheets/#{file_name}.css"
+ end
+ copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
+ copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
+ end
+
+ private
+
+ def file_name
+ layout_name.underscore
+ end
+ end
+ end
+end