Sha256: d655f52643b696ccf434ff7cc6a13ee02b908f44f975c03a7c5be1368905e103

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

require 'rake'

namespace :ddb do
  desc 'Create a DynamoDB table'
  task :create => :environment do
    raise "expected usage: rake ddb:create CLASS=User" unless ENV['CLASS']
    options = {}
    options.merge!(:table_name => ENV['TABLE']) if ENV['TABLE']
    ENV['CLASS'].constantize.dynamo_table.create(options)
  end

  desc 'Resize a DynamoDB table read/write provision'
  task :resize => :environment do
    raise "expected usage: rake ddb:resize CLASS=User" unless ENV['CLASS']
    options = {}
    options.merge!(:table_name => ENV['TABLE']) if ENV['TABLE']
    options.merge!(:read_capacity_units => ENV['READ'].to_i) if ENV['READ']
    options.merge!(:write_capacity_units => ENV['WRITE'].to_i) if ENV['WRITE']
    ENV['CLASS'].constantize.dynamo_table.resize(options)
  end

  task :destroy => :environment do
    raise "expected usage: rake ddb:destroy CLASS=User" unless ENV['CLASS']
    options = {}
    options.merge!(:table_name => ENV['TABLE']) if ENV['TABLE']
    ENV['CLASS'].constantize.dynamo_table.delete(options)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
toy-dynamo-0.0.8 lib/toy/dynamo/tasks.rb
toy-dynamo-0.0.7 lib/toy/dynamo/tasks.rb
toy-dynamo-0.0.6 lib/toy/dynamo/tasks.rb
toy-dynamo-0.0.5 lib/toy/dynamo/tasks.rb
toy-dynamo-0.0.4 lib/toy/dynamo/tasks.rb