Sha256: 789a313f0ccbe541053484714f5c42266e36d14b853220b6cf5d46de6fc0fedd

Contents?: true

Size: 911 Bytes

Versions: 5

Compression:

Stored size: 911 Bytes

Contents

require 'rails/generators/named_base'
require 'refinery/extension_generation'

module Refinery
  class EngineGenerator < Rails::Generators::NamedBase
    source_root Pathname.new(File.expand_path('../templates', __FILE__))

    include Refinery::ExtensionGeneration

    class_option :skip_frontend, :type => :boolean, :default => false, :required => false, :desc => 'Generate extension without frontend'

    def skip_frontend?
      options[:skip_frontend]
    end

    def generate
      sanity_check!

      evaluate_templates!

      merge_locales!

      append_extension_to_gemfile!

      finalize_extension!
    end

  protected

    def reject_file_with_skip_frontend?(file)
      (skip_frontend? && (file.to_s.include?('app') && file.to_s.scan(/admin|models|mailers/).empty?)) ||
        reject_file_without_skip_frontend?(file)
    end
    alias_method_chain :reject_file?, :skip_frontend
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-core-2.0.4 lib/generators/refinery/engine/engine_generator.rb
refinerycms-core-2.0.3 lib/generators/refinery/engine/engine_generator.rb
refinerycms-core-2.0.2 lib/generators/refinery/engine/engine_generator.rb
refinerycms-core-2.0.1 lib/generators/refinery/engine/engine_generator.rb
refinerycms-core-2.0.0 lib/generators/refinery/engine/engine_generator.rb