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

Version Path
noodall-ui-0.5.15 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.14 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.13 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.12 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.11 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.4.11 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.4.10 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.10 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.9 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.4.9 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.8 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.4.8 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.4.7 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.7 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.6 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.5 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.4 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.3 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.2 lib/generators/noodall/component/component_generator.rb
noodall-ui-0.5.1 lib/generators/noodall/component/component_generator.rb