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.6.0 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.5.1 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.5.0 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.6 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.5 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.4 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.3 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.2 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.1 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.4.0 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.3.4 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.3.3 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.3.2 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.3.1 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.3.0 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.2.2 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.2.1 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.2.0 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.1.5 lib/generators/brightcontent/resource_generator.rb
brightcontent-core-2.1.4 lib/generators/brightcontent/resource_generator.rb