Sha256: 805b5773362772a8bec050648946c1f5ae9eed8842d4e4dd975479cd3478a7a4

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby
# Executable to bulk add sites into the tracking data repository
require "wmap"

def print_usage
	puts "Program to add sites from a file into local data repository. Usage: wadds [file_sites]"
end

puts Wmap.banner
print_usage
abort "Incorrect program argument!" unless File.exist?(ARGV[0])

if ARGV.length == 1
	# Log the command entry
	Log_dir = File.dirname(__FILE__)+'/../logs/'
elsif ARGV.length == 2
	# Log to the instance running directory
	Log_dir = File.dirname(__FILE__)+'/../logs/' + ARGV[1]
end
Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
Wmap.wlog("Execute the command: wadds #{ARGV[0]}","wadds",Log_dir+"wmap.log")

if ARGV.length == 1
	puts puts "Invoke the SiteTracker."
	st=Wmap::SiteTracker.instance
	st.verbose=false
elsif ARGV.length == 2
	puts puts "Invoke the SiteTracker."
	st=Wmap::SiteTracker.instance
	st.verbose=false
	st.data_dir=ARGV[1]
else
	aborts "Error firing up SiteTracker instance!"
end

# Evaluate the argument and update the data store accordingly
sites=st.file_2_list(ARGV[0]).map { |x| st.url_2_site(x) }
if sites.length > 0
	news=st.adds(sites)
	puts news
	st.save! if news.length>0
	st=nil
else
	st=nil
	abort "No site entry found in file: #{ARGV[0]}. Please check your file format to ensure one site per line."
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
wmap-2.6.9 bin/wadds
wmap-2.6.8 bin/wadds
wmap-2.6.7 bin/wadds
wmap-2.6.6 bin/wadds
wmap-2.6.5 bin/wadds
wmap-2.6.4 bin/wadds
wmap-2.6.3 bin/wadds
wmap-2.6.2 bin/wadds
wmap-2.6.1 bin/wadds
wmap-2.6.0 bin/wadds
wmap-2.5.9 bin/wadds
wmap-2.5.8 bin/wadds
wmap-2.5.7 bin/wadds
wmap-2.5.6 bin/wadds
wmap-2.5.5 bin/wadds
wmap-2.5.4 bin/wadds
wmap-2.5.2 bin/wadds
wmap-2.5.1 bin/wadds
wmap-2.5.0 bin/wadds
wmap-2.4.9 bin/wadds