Sha256: 370c2bb7ce008c66b2252764bb69566d337e410e4529b95918cb1a0b909ccc87

Contents?: true

Size: 740 Bytes

Versions: 4

Compression:

Stored size: 740 Bytes

Contents

require 'neo4j/migration'

namespace :neo4j do
  desc "Run a script against the database to perform system-wide changes"
  task :migrate, [:task_name, :subtask] => :environment do |_, args|
    migration_task = args[:task_name]
    task_name_constant = migration_task.split('_').map { |word| word.capitalize }.join('')
    begin
    migration_class = "Neo4j::Migration::#{task_name_constant}".constantize
    rescue NameError
      load File.join(Rails.root.join('db', 'neo4j-migrate'), "#{migration_task}.rb")
      migration_class = "#{task_name_constant}".constantize
    end
    migration = migration_class.new

    subtask = args[:subtask]
    if subtask
      migration.send(subtask)
    else
      migration.migrate
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neo4j-3.0.1 lib/neo4j/tasks/migration.rake
neo4j-3.0.0 lib/neo4j/tasks/migration.rake
neo4j-3.0.0.rc.5 lib/neo4j/tasks/migration.rake
neo4j-3.0.0.rc.4 lib/neo4j/tasks/migration.rake