Sha256: 2d06167219ca0061980fd7d626c25693614337c3e7987147c3b74306b129856f
Contents?: true
Size: 897 Bytes
Versions: 1
Compression:
Stored size: 897 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'.freeze, file_name)) if actions.empty? end def create_view_file unless actions.empty? actions.each do |filename| template('view.html.erb'.freeze, File.join('app/views'.freeze, class_path, file_name, "#{filename}.html.erb")) end end end def generate_locale_file invoke('locale:view'.freeze, [name]) if ActiveGenerator.configuration.autoload_view_generator_locale end def generate_test_file unless ActiveGenerator.configuration.test_framework.nil? invoke("#{ActiveGenerator.configuration.test_framework}:view", [name]) rescue nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_generator-2.3.0 | lib/generators/view/view_generator.rb |