Module: Migrake::DSL

Defined in:
lib/migrake/dsl.rb

Instance Method Summary collapse

Instance Method Details

#migrake(tasks) ⇒ Object

Public: Define the rake tasks required to run migrake. This defines the following tasks:

- A task to ensure we can use whatever is defined as `Migrake.store`.
- A `migrake:ready` task to bootstrap new environments by writing all
  the tasks to the store.
- The `migrake` task, that will run any tasks not run before.

tasks - A Set of tasks to be run.

Returns nothing.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/migrake/dsl.rb', line 14

def migrake(tasks)
  namespace :migrake do
    task :check_store do
      Migrake.store.prepare
    end

    desc "Tell migrake that all defined tasks have already been run"
    task ready: :check_store do
      Migrake.store.write(tasks)
    end
  end

  desc "Run the tasks defined by migrake"
  task migrake: "migrake:check_store" do
    Migrake.run(tasks, Migrake.store)
  end
end