Sha256: 56d6cbef47d4ce64cd834854d9323da76aaff792c2bc7d40d45d734893bb19d3
Contents?: true
Size: 656 Bytes
Versions: 22
Compression:
Stored size: 656 Bytes
Contents
module Cms module Generators class TemplateGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) class_option :mobile, :type => :boolean, :default => false, :desc => "mobile?" def create_template if mobile? subdir = 'mobile' else subdir = 'templates' end template_dir = "app/views/layouts/#{subdir}" template 'template.erb', File.join(template_dir, "#{template_name}.html.erb") end private def mobile? options[:mobile] end def template_name file_name end end end end
Version data entries
22 entries across 22 versions & 2 rubygems