diff options
| author | mo khan <mo@mokhan.ca> | 2015-02-03 22:39:13 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-02-03 22:39:13 -0700 |
| commit | 904b0ac69166a9ac8ac0c30e3c2b758fde040bbd (patch) | |
| tree | 9b29b8527617d301cb64bd97d44fc5b0338d1a86 /lib/tasks | |
| parent | 5b4c048230302c4f692d011c747bb5c4da72e856 (diff) | |
add scan task to blast a bunch of queries against the server.
Diffstat (limited to 'lib/tasks')
| -rw-r--r-- | lib/tasks/scan.rake | 17 |
1 files changed, 17 insertions, 0 deletions
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 |
