Sha256: 9069c556e0265c8700a8aee0adcf94e6be688216c3fd160f606f02316476bd3d

Contents?: true

Size: 931 Bytes

Versions: 2

Compression:

Stored size: 931 Bytes

Contents

require 'refinerycms-base'

module Refinery
  module <%= class_name.pluralize %><%= 'Engine' if plural_name == singular_name %>

    class << self
      attr_accessor :root
      def root
        @root ||= Pathname.new(File.expand_path('../../', __FILE__))
      end
    end

    class Engine < Rails::Engine
      initializer "static assets" do |app|
        app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
      end

      config.after_initialize do
        Refinery::Plugin.register do |plugin|
          plugin.name = "<%= class_name.pluralize.underscore.downcase %>"
          plugin.pathname = root
          plugin.activity = {
            :class => <%= class_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? and title.name != 'title' %>,
            :title => '<%= title.name %>'<% end %>
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-generators-1.0.4 lib/generators/refinery_engine/templates/lib/refinerycms-plural_name.rb
refinerycms-generators-1.0.3 lib/generators/refinery_engine/templates/lib/refinerycms-plural_name.rb