From 904b0ac69166a9ac8ac0c30e3c2b758fde040bbd Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 3 Feb 2015 22:39:13 -0700 Subject: add scan task to blast a bunch of queries against the server. --- lib/tasks/scan.rake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/tasks/scan.rake (limited to 'lib/tasks') diff --git a/lib/tasks/scan.rake b/lib/tasks/scan.rake new file mode 100644 index 0000000..e357fd4 --- /dev/null +++ b/lib/tasks/scan.rake @@ -0,0 +1,17 @@ +namespace :scan do + desc "scan all files" + task dir: :environment do + require 'net/http' + + agent = Agent.first + Dir['**/**/*'].each do |file| + if File.file?(file) + result = `shasum -a 256 #{file}` + sha = result.split(' ').first + + uri = URI("http://localhost:3000/agents/#{agent.id}/files/#{sha}") + puts [sha, Net::HTTP.get(uri)].inspect + end + end + end +end -- cgit v1.2.3