Sha256: 65b454bbe70096a6d82b3628fbe762dbaf904cdba9f2fb3c53336cb6fe17a387

Contents?: true

Size: 1.12 KB

Versions: 23

Compression:

Stored size: 1.12 KB

Contents

module Riveter
  module Generators
    class EnquiryGenerator < ::Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      class_option :enquiry_controller, :type => :boolean, :default => true
      hook_for :enquiry_controller, :type => :boolean

      class_option :query, :type => :boolean, :default => true
      hook_for :query, :type => :boolean

      class_option :query_filter, :type => :boolean, :default => true
      hook_for :query_filter, :type => :boolean

      check_class_collision :suffix => 'Enquiry'

      argument :filter_attributes,
               :type => :array,
               :default => [],
               :banner => "[attribute[:type[:required]] attribute[:type[:required]]]"

      def create_enquiry_file
        template 'enquiry.rb', File.join('app/enquiries', class_path, "#{file_name}_enquiry.rb")
      end

      def create_module_file
        return if regular_class_path.empty?
        template 'module.rb', File.join('app/enquiries', "#{class_path.join('/')}.rb") if behavior == :invoke
      end

      hook_for :test_framework, :as => :enquiry
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
riveter-0.8.3 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.8.2 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.8.1 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.8.0 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.7.0 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.6.0 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.3.0 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.2.1 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.2.0 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.1.1 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.15 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.14 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.13 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.12 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.11 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.10 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.9 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.8 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.7 lib/generators/riveter/enquiry/enquiry_generator.rb
riveter-0.0.6 lib/generators/riveter/enquiry/enquiry_generator.rb