Sha256: 0b251364a9ab8e57e0edd2ab6fdae8d4f6045f5e8811d15b32cb68d1b3c8bbdf

Contents?: true

Size: 712 Bytes

Versions: 61

Compression:

Stored size: 712 Bytes

Contents

module Brightcontent
  module Generators
    class ResourceGenerator < Rails::Generators::NamedBase
      source_root File.expand_path("../templates", __FILE__)

      desc "Creates Brightcontent controller, route and empty views dir"

      def generate_controller
        template "brightcontent_controller.rb", "app/controllers/brightcontent/#{@name.pluralize.underscore}_controller.rb"
      end

      def generate_views_directory
        empty_directory "app/views/brightcontent/#{name.pluralize.underscore}"
      end

      def add_route
        inject_into_file 'config/routes.rb', "\n    resources :#{name.pluralize.underscore}", { :after => "brightcontent_resources do" }
      end

    end
  end
end

Version data entries

61 entries across 61 versions & 2 rubygems

Version Path
brightcontent-core-2.0.0.alpha2 lib/generators/brightcontent/resource_generator.rb