Sha256: 86524ef61d3cfd533708982be8c812ed321793cf18fb2ffb1347ab2dd98d7ac7
Contents?: true
Size: 919 Bytes
Versions: 4
Compression:
Stored size: 919 Bytes
Contents
require 'fileutils' class ViewGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) argument :actions, type: :array, required: false, default: [], desc: 'The pages to generate' def create_root_directory empty_directory(File.join('app/views', file_name)) if actions.empty? end def create_view_file unless actions.empty? actions.each do |filename| path = File.join('app/views', class_path, file_name, "#{filename}.html.erb") template('view.html.erb', path) end end end def generate_locale_file invoke('locale:view', [name]) if configuration.autoload_view_generator_locale end def generate_test_file framework = configuration.test_framework return if framework.nil? invoke("#{framework}:view", [name]) rescue nil end private def configuration ActiveGenerator::Settings.config end end
Version data entries
4 entries across 4 versions & 1 rubygems