Sha256: 3876b0776975606fb5059d418c0c00dc594aa78ea9b6b8eb978704b348e0e09a
Contents?: true
Size: 1.25 KB
Versions: 22
Compression:
Stored size: 1.25 KB
Contents
require 'generators/mustache' require 'rails/generators/named_base' class Mustache module Generators class ControllerGenerator < ::Rails::Generators::NamedBase extend TemplatePath argument :actions, :type => :array, :default => [], :banner => "action action" def create_view_files model_path = File.join(class_path, file_name) base_mustache_view_path = File.join("app/views", model_path) empty_directory base_mustache_view_path base_mustache_template_path = File.join("app/templates", model_path) empty_directory base_mustache_template_path actions.each do |action| @action = action mustache_view_path = File.join(base_mustache_view_path, "#{action}.rb") mustache_template_path = File.join(base_mustache_template_path, "#{action}.html.mustache") template "view.rb.erb", mustache_view_path template "view.html.mustache.erb", mustache_template_path end end protected def handler :haml end end end end
Version data entries
22 entries across 22 versions & 2 rubygems