Sha256: 7c14bf1ec8cb90feaafd5738e7054db2536318ca37af0d8c10466f86fd01a06d

Contents?: true

Size: 745 Bytes

Versions: 5

Compression:

Stored size: 745 Bytes

Contents

module Slayer
  module Generators
    class ScaffoldGenerator < NamedBase
      desc "This generator creates a new Slayer::Commands and a corresponding Slayer::Form"

      source_root File.expand_path("../templates", __FILE__)
      check_class_collision suffix: "Command"

      argument :name, type: :string
      argument :fields, :type => :array, :required => false, :desc => "The attributes of the generated form. name:String completed:Boolean"

      def initialize(args, *options) #:nodoc:
        super
        @args = args
      end

      def create_command_files
        generate "slayer:command", "#{file_name}"
      end

      def create_form_files
        generate "slayer:form", "#{@args.join(" ")}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slayer_rails-0.4.0.beta4 lib/generators/scaffold/scaffold_generator.rb
slayer_rails-0.4.0.beta3 lib/generators/scaffold/scaffold_generator.rb
slayer_rails-0.3.3 lib/generators/scaffold/scaffold_generator.rb
slayer_rails-0.3.2 lib/generators/scaffold/scaffold_generator.rb
slayer_rails-0.3.1 lib/generators/scaffold/scaffold_generator.rb