Sha256: d89fa831136e26dddf402aa5c041a20cf568d9abeddf5b827ff4c4ba0573a20b

Contents?: true

Size: 714 Bytes

Versions: 5

Compression:

Stored size: 714 Bytes

Contents

module Chili
  module EngineExtensions
    def self.extended(base)
      base.rake_tasks do
        next if self.is_a?(Rails::Application)
        next unless has_migrations?

        namespace railtie_name do
          namespace :db do
            desc "Copy and migrate migrations from #{railtie_name}"
            task :migrate do
              Rake::Task["#{railtie_name}:install:migrations"].invoke
              Rake::Task["db:migrate"].invoke
            end
          end
        end
      end
    end

    def automount!(path = nil)
      engine = self
      path ||= 'chili/' + engine.parent.to_s.underscore
      Rails.application.routes.draw do
        mount engine => path
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chili-4.0.1 lib/chili/engine_extensions.rb
chili-4.0.0 lib/chili/engine_extensions.rb
chili-3.1.1 lib/chili/engine_extensions.rb
chili-3.1.0 lib/chili/engine_extensions.rb
chili-3.0.0 lib/chili/engine_extensions.rb