diff --git a/lib/tasks/tag_clustering.rake b/lib/tasks/tag_clustering.rake index bb024434c1a36f5e1785f9d25870dc20dfb86b9a..efe132700d58dd03089eff973a43ffa729fe66f2 100644 --- a/lib/tasks/tag_clustering.rake +++ b/lib/tasks/tag_clustering.rake @@ -21,13 +21,12 @@ namespace :tag do desc 'Generate tag clusters' task :generate_clusters => [:environment] do # DEBUG = true - graph_path = TagSearchService.file_path+".net" hash = create_hash() + create_pajek_net_graph(hash, graph_path) - # puts "\nCalling infomap with the pajek graph\n\n" if DEBUG - system("infomap --ftree #{graph_path} #{TagSearchService.root_dir}") + infomap_ftree(graph_path, TagSearchService.root_dir) Rails.cache.delete(TagSearchService::CACHE_KEY) end # task @@ -96,4 +95,14 @@ namespace :tag do end end end + + def infomap_ftree(graph_path, out_dir) + # puts "\nCalling infomap with the pajek graph\n\n" if DEBUG + system("infomap --ftree #{graph_path} #{TagSearchService.root_dir}") + if $?.to_s != "0" + puts "-- Error on Infomap call" + puts "-- Make sure you have infomap in your executable path" + exit + end + end end # namespace