Sha256: 3e1d2e7562ffa588d593eef2e5de486090eea60673dbc8d583f6d0a67b85ab5e
Contents?: true
Size: 932 Bytes
Versions: 94
Compression:
Stored size: 932 Bytes
Contents
module Noodall class ComponentGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" #check_class_collision class_option :root, :type => :boolean, :default => false, :desc => "Can be a root node" class_option :factory, :type => :boolean, :default => true, :desc => "Include Factory Girl factory" class_option :parent, :type => :string, :desc => "The parent class for the generated model" def create_node_files template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") template "template.html.erb", "app/views/components/_#{file_name}.html.erb" template "admin_template.html.erb", "app/views/admin/components/_#{file_name}.html.erb" template "factory.rb", "spec/factories/#{file_name}.rb" if options.factory? end end end
Version data entries
94 entries across 94 versions & 1 rubygems