def create(*catalog_roots)
      fs = [@db_filepath, @db_log_filepath, @config_filepath]
      fs.each do |f|
        FileUtils.rm(f) if File.exist?(f)
      end

      if File.exist? @config_filepath
        raise SimpleCatalogerError, "cannot create already existent catalog '#{@name}'"
      end
      @config = {
          :roots   => catalog_roots,
          :ignore  => %w{sub subtitles images},
          :version => DirCat::VERSION
      }
      write_config

      #
      # migrate db
      #
      # TODO: drop tables!
      ActiveRecord::Base.establish_connection(@active_record_config)
      ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : false
      migration_dir = File.join(File.dirname(__FILE__), %w{migration})
      unless Dir.exist? migration_dir
        raise "migration dir '#{migration_dir}' not exists"
      end
      ActiveRecord::Migrator.migrate(migration_dir, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
      require_models
    end
def create(*catalog_roots)
      fs = [@db_filepath, @db_log_filepath, @config_filepath]
      fs.each do |f|
        FileUtils.rm(f) if File.exist?(f)
      end

      if File.exist? @config_filepath
        raise SimpleCatalogerError, "cannot create already existent catalog '#{@name}'"
      end
      @config = {
          :roots   => catalog_roots,
          :ignore  => %w{sub subtitles images},
          :version => DirCat::VERSION
      }
      write_config

      #
      # migrate db
      #
      # TODO: drop tables!
      ActiveRecord::Base.establish_connection(@active_record_config)
      ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : false
      migration_dir = File.join(File.dirname(__FILE__), %w{migration})
      unless Dir.exist? migration_dir
        raise "migration dir '#{migration_dir}' not exists"
      end
      ActiveRecord::Migrator.migrate(migration_dir, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
      require_models
    end
Create a new catalog
 @param array of directories