Class: Rake::Migrations::Migrator
- Inherits:
-
Object
- Object
- Rake::Migrations::Migrator
- Defined in:
- lib/rake/migrations/migrator.rb
Instance Attribute Summary collapse
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Class Method Summary collapse
- .config ⇒ Object
-
.get_task_migrations ⇒ Object
tasks to run every time + tasks that haven’t been run yet.
- .invoke(task) ⇒ Object
- .manifest ⇒ Object
- .run_task_migrations ⇒ Object
Instance Method Summary collapse
-
#initialize(task) ⇒ Migrator
constructor
A new instance of Migrator.
- #invoke ⇒ Object
- #manifest ⇒ Object
Constructor Details
#initialize(task) ⇒ Migrator
Returns a new instance of Migrator.
30 31 32 |
# File 'lib/rake/migrations/migrator.rb', line 30 def initialize(task) @task = task end |
Instance Attribute Details
#task ⇒ Object (readonly)
Returns the value of attribute task.
28 29 30 |
# File 'lib/rake/migrations/migrator.rb', line 28 def task @task end |
Class Method Details
.config ⇒ Object
20 21 22 |
# File 'lib/rake/migrations/migrator.rb', line 20 def self.config @config ||= Rake::Migrations::Configuration.load end |
.get_task_migrations ⇒ Object
tasks to run every time + tasks that haven’t been run yet
10 11 12 13 14 |
# File 'lib/rake/migrations/migrator.rb', line 10 def self.get_task_migrations config.tasks.select do |task| task.run_every_time? || manifest.tasks.exclude?(task) end end |
.invoke(task) ⇒ Object
24 25 26 |
# File 'lib/rake/migrations/migrator.rb', line 24 def self.invoke(task) new(task).invoke end |
.manifest ⇒ Object
16 17 18 |
# File 'lib/rake/migrations/migrator.rb', line 16 def self.manifest @manifest ||= Rake::Migrations::Manifest.load end |
.run_task_migrations ⇒ Object
3 4 5 6 7 |
# File 'lib/rake/migrations/migrator.rb', line 3 def self.run_task_migrations get_task_migrations.each do |task| invoke task end end |
Instance Method Details
#invoke ⇒ Object
34 35 36 37 38 |
# File 'lib/rake/migrations/migrator.rb', line 34 def invoke with_handler do Rake::Task[task.command].invoke end end |
#manifest ⇒ Object
40 41 42 |
# File 'lib/rake/migrations/migrator.rb', line 40 def manifest self.class.manifest end |