To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / a3 / a3ed448d757e220de4341bd91f2f5821597a92fc.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (1.02 KB)
| 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 |
|
| 8 |
desc "Upgrade authentication tables from ruby-openid 1.x.x to 2.x.x" |
| 9 |
task :upgrade => :environment do |
| 10 |
generate_migration(["upgrade_open_id_authentication_tables", "upgrade_open_id_authentication_tables"]) |
| 11 |
end |
| 12 |
|
| 13 |
def generate_migration(args) |
| 14 |
require 'rails_generator' |
| 15 |
require 'rails_generator/scripts/generate' |
| 16 |
|
| 17 |
if ActiveRecord::Base.connection.supports_migrations? |
| 18 |
Rails::Generator::Scripts::Generate.new.run(args) |
| 19 |
else |
| 20 |
raise "Task unavailable to this database (no migration support)" |
| 21 |
end |
| 22 |
end |
| 23 |
|
| 24 |
desc "Clear the authentication tables" |
| 25 |
task :clear => :environment do |
| 26 |
OpenIdAuthentication::DbStore.cleanup_nonces |
| 27 |
OpenIdAuthentication::DbStore.cleanup_associations |
| 28 |
end |
| 29 |
end |
| 30 |
end |