Sha256: 3d7f6ec120d66d2d4ca39b3234370c2945cba24bb53e6182e4b5e5b5f6078fbb
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'rails/generators/base' module phcpress module Generators module ViewPathTemplates extend ActiveSupport::Concern included do class_option :views, aliases: "-v", type: :array, desc: "Select specific view directories to generate (layouts, phcpress)" public_task :copy_views end # module ClassMethods # def hide! # Rails::Generators.hide_namespace self.namespace # end # end def copy_views if options[:views] options[:views].each do |directory| view_directory directory.to_sym end else view_directory :layouts view_directory :phcpress end end protected def view_directory(name, _target_path = nil) directory name.to_s, _target_path || "#{target_path}/#{name}" do |content| content end end def target_path @target_path ||= "app/views" end end class SharedViewsGenerator < Rails::Generators::Base include ViewPathTemplates source_root File.expand_path("../../../../app/views", __FILE__) desc "Copies phcpress views to your application." hide! end class ViewsGenerator < Rails::Generators::Base desc "Copies phcpress views to your application." invoke SharedViewsGenerator end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phcpress-0.1.9b | lib/generators/views_generator.rb |
phcpress-0.1.5b | lib/generators/views_generator.rb |