Class: Redshifter::Tasks

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/redshifter/tasks.rb

Instance Method Summary collapse

Instance Method Details

#install_tasksObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/redshifter/tasks.rb', line 5

def install_tasks
  namespace :redshifter do
    desc 'Create or replace an extracted table in Redshift'
    task :replace, [:table_config_key] => :environment do |_task, args|
      table_config = Redshifter.config.tables[args[:table_config_key]]
      table = Redshifter::Table.new(table_config)
      Redshifter::ExtractAndReplaceRedshiftTable.new(table).run
    end

    desc 'Update an extracted table in Redshift'
    task :update, [:table_config_key] => :environment do |_task, args|
      table_config = Redshifter.config.tables[args[:table_config_key]]
      table = Redshifter::Table.new(table_config)
      Redshifter::ExtractAndUpdateRedshiftTable.new(table).run
    end
  end
end