Sha256: 5756f3af5b12c24acebbbaa8307518b849bca6e42fcb86c9a7d9ec52678f0b98

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
require 'generators/goma/helpers/helpers'
require 'generators/test_unit/goma/scaffold/scaffold_generator'

module Goma
  module Generators
    class ScaffoldControllerGenerator < Rails::Generators::ScaffoldControllerGenerator
      include Helpers
      source_root File.expand_path('../templates', __FILE__)

      class_option :controller_type, required: true
      class_option :resource_name

      # TODO
      # jbuilder templates are not implemented yet. Therefore, set default to false.
      class_option :jbuilder, default: false

      def create_controller_files
        template "#{options[:controller_type]}_controller.rb", File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
      end

      hook_for :template_engine, in: 'goma'
      hook_for :test_framework, as: 'goma:scaffold'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
goma-0.0.1.rc3 lib/generators/goma/scaffold_controller/scaffold_controller_generator.rb