Sha256: c1b82fd24ffbf7b286ad3aa0623326e8cc1162ef49771919e94527ef840b2f33
Contents?: true
Size: 934 Bytes
Versions: 1
Compression:
Stored size: 934 Bytes
Contents
# frozen_string_literal: true 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 return if 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 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.configuration end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_generator-5.0.0 | lib/generators/view/view_generator.rb |