#!/usr/bin/env ruby # Executable to add a new site into the tracking data repository # This is useful as a self-correction mechanism to flag out unique website in a constant way require "wmap" def print_usage puts "Program to add an entry into the local data repository. Usage: wadd [site]" end puts Wmap.banner print_usage Log_dir=File.dirname(__FILE__)+'/../logs/' Wmap.wlog("Execute the command: wadd #{ARGV[0]}","wadd",Log_dir+"wmap.log") st=Wmap::SiteTracker.instance abort "Incorrect program argument!" unless ARGV.length==1 # Evaluate the argument and update the data store accordingly if st.is_site?(ARGV[0]) st.add(ARGV[0]) st.save! st=nil else abort "Unknown argument format: #{ARGV[0]}" end