You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

open_id_authentication_tasks.rake 1.0KB

123456789101112131415161718192021222324252627282930
  1. namespace :open_id_authentication do
  2. namespace :db do
  3. desc "Creates authentication tables for use with OpenIdAuthentication"
  4. task :create => :environment do
  5. generate_migration(["open_id_authentication_tables", "add_open_id_authentication_tables"])
  6. end
  7. desc "Upgrade authentication tables from ruby-openid 1.x.x to 2.x.x"
  8. task :upgrade => :environment do
  9. generate_migration(["upgrade_open_id_authentication_tables", "upgrade_open_id_authentication_tables"])
  10. end
  11. def generate_migration(args)
  12. require 'rails_generator'
  13. require 'rails_generator/scripts/generate'
  14. if ActiveRecord::Base.connection.supports_migrations?
  15. Rails::Generator::Scripts::Generate.new.run(args)
  16. else
  17. raise "Task unavailable to this database (no migration support)"
  18. end
  19. end
  20. desc "Clear the authentication tables"
  21. task :clear => :environment do
  22. OpenIdAuthentication::DbStore.cleanup_nonces
  23. OpenIdAuthentication::DbStore.cleanup_associations
  24. end
  25. end
  26. end