Sha256: 1b69f211af3560f36fb949d7b222e543cbfc96a4683cb0ae0c1cdb820f481392
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'dynamoid' require 'dynamoid/tasks/database' MODELS = File.join(Rails.root, "app/models") Dir[ File.join(MODELS, "*.rb") ].sort.each { |file| require file } namespace :dynamoid do desc "Creates DynamoDB tables, one for each of your Dynamoid models - does not modify pre-existing tables" task :create_tables => :environment do tables = Dynamoid::Tasks::Database.create_tables result = tables[:created].map{ |c| "#{c} created" } + tables[:existing].map{ |e| "#{e} already exists" } result.sort.each{ |r| puts r } end desc 'Tests if the DynamoDB instance can be contacted using your configuration' task :ping => :environment do success = false failure_reason = nil begin Dynamoid::Tasks::Database.ping success = true rescue Exception => e failure_reason = e.message end msg = "Connection to DynamoDB #{success ? 'OK' : 'FAILED'}" msg << if Dynamoid.config.endpoint " at local endpoint '#{Dynamoid.config.endpoint}'" else ' at remote AWS endpoint' end if not success msg << ", reason being '#{failure_reason}'" end puts msg end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dynamoid-1.3.1 | lib/dynamoid/tasks/database.rake |