Sha256: eec1852d58484a0f786d534e202ec48117044ff82ca2c462cdd199666675ca8c
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
ks_namespace = namespace :ks do desc 'Create the keyspace in config/superstore.yml for the current environment' task create: :environment do begin Superstore::CassandraSchema.create_keyspace Superstore::Base.config[:keyspace], Superstore::Base.config[:keyspace_options] rescue Exception => e if e.message =~ /conflicts/ p "Keyspace #{Superstore::Base.config[:keyspace]} already exists" else raise e end end end task drop: :environment do begin Superstore::CassandraSchema.drop_keyspace Superstore::Base.config[:keyspace] rescue Exception => e if e.message =~ /non existing keyspace/ p "Keyspace #{Superstore::Base.config[:keyspace]} does not exist" else raise e end end end task reset: [:drop, :setup] task setup: [:create, :_load] namespace :structure do task dump: :environment do filename = ENV['SCHEMA'] || "#{Rails.root}/ks/structure.cql" File.open(filename, "w:utf-8") do |file| Superstore::CassandraSchema.dump(file) end end task load: :environment do filename = ENV['SCHEMA'] || "#{Rails.root}/ks/structure.cql" File.open(filename) do |file| Superstore::CassandraSchema.load(file) end end end task :_dump do ks_namespace["structure:dump"].invoke end task :_load do ks_namespace["structure:load"].invoke end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
superstore-1.0.4 | lib/superstore/tasks/ks.rake |
superstore-1.0.3 | lib/superstore/tasks/ks.rake |
superstore-1.0.2 | lib/superstore/tasks/ks.rake |
superstore-1.0.0 | lib/superstore/tasks/ks.rake |