Sha256: ce6609b27462afafb19cd90d853f0ff8e7120fdd9bc759a54ac1819d561a55ab

Contents?: true

Size: 917 Bytes

Versions: 80

Compression:

Stored size: 917 Bytes

Contents

module Noodall
  class NodeGenerator < 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/nodes/#{file_name}.html.erb"
      template "admin_template.html.erb", "app/views/admin/nodes/_#{file_name}.html.erb"
      template "factory.rb", "spec/factories/#{file_name}.rb" if options.factory?
    end

  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
noodall-ui-0.4.11 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.10 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.9 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.8 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.7 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.3.20 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.10 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.9 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.8 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.7 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.6 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.5 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.4 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.3 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.2 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.6 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.5.0.pre.1 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.3.19 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.5 lib/generators/noodall/node/node_generator.rb
noodall-ui-0.4.4 lib/generators/noodall/node/node_generator.rb