Class: Userq::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/userq/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#do_migrationObject

Setup and create the migration



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/userq/install_generator.rb', line 6

def do_migration
    migration_exists = Dir["db/migrate/*_create_user_queues.rb"].count > 0

    if migration_exists and installing?
      puts "UserQ is already installed. Maybe a 'rake db:migrate' command might help?"
      return
    end

    create_migration

    puts "Success! UserQ is installed. You can now use it in your application." if installing?
    puts "UserQ has already been uninstalled. Remember the 'user_queue' table needs to be manually destroyed." if destroying? and migration_exists == false
    puts "Success! UserQ is uninstalled. The table 'userq_queue' needs to be destroyed manually to complete removal." if destroying? and migration_exists
end