Class: Innkeeper::RakeTaskEnhancer

Inherits:
Object
  • Object
show all
Defined in:
lib/innkeeper/tasks/enhancements.rb

Constant Summary collapse

TASKS =
%w(db:migrate db:rollback db:migrate:up db:migrate:down db:migrate:redo db:seed)

Class Method Summary collapse

Class Method Details

.enhance!Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/innkeeper/tasks/enhancements.rb', line 13

def enhance!
  TASKS.each do |name|
    task = Rake::Task[name]
    task.enhance do
      if should_enhance?
        enhance_task(task)
      end
    end
  end
end

.enhance_task(task) ⇒ Object



28
29
30
# File 'lib/innkeeper/tasks/enhancements.rb', line 28

def enhance_task(task)
  Rake::Task[task.name.sub(/db:/, 'innkeeper:')].invoke
end

.should_enhance?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/innkeeper/tasks/enhancements.rb', line 24

def should_enhance?
  Innkeeper.db_migrate_tenants
end