Sha256: c73588a9e77c36450e2a31450d165ed6c6277ed5560d7a11118ba92d17ae029d

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require "rails/generators/migration"

require "generators/typus/assets_generator"
require "generators/typus/config_generator"
require "generators/typus/controller_generator"
require "generators/typus/initializers_generator"

module Typus
  module Generators
    class TypusGenerator < Rails::Generators::Base

      include Rails::Generators::Migration

      source_root File.expand_path("../../templates", __FILE__)

      namespace "typus"

      desc <<-DESC
Description:
  This generator creates required files to enable an admin panel which allows
  trusted users to edit structured content.

  To enable session authentication run `rails g typus:migration`.

      DESC

      def generate_initializers
        Typus::Generators::InitializersGenerator.new.invoke_all
      end

      def generate_assets
        Typus::Generators::AssetsGenerator.new.invoke_all
      end

      def generate_controllers
        Typus.application_models.each do |model|
          Typus::Generators::ControllerGenerator.new([model.pluralize]).invoke_all
        end
      end

      def generate_config
        Typus::Generators::ConfigGenerator.new.invoke_all
      end

      protected

      def resource
        @resource
      end

      def sidebar
        @sidebar
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
typus-3.0.10 lib/generators/typus/typus_generator.rb
typus-3.0.9 lib/generators/typus/typus_generator.rb
typus-3.0.8 lib/generators/typus/typus_generator.rb
typus-3.0.7 lib/generators/typus/typus_generator.rb