summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-04 20:36:55 -0700
committermo khan <mo@mokhan.ca>2015-02-04 20:36:55 -0700
commit5bb42397569d7f0108178009c0c130128239ab34 (patch)
tree25618c49b01bae816d7b87bb4b10e2efab18f891 /lib
parenta4c55cad877844d8996ac7494ea91a922586a6d0 (diff)
add listen to watch filesystem.
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/scan.rake11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/tasks/scan.rake b/lib/tasks/scan.rake
index e357fd4..f3f60ba 100644
--- a/lib/tasks/scan.rake
+++ b/lib/tasks/scan.rake
@@ -7,10 +7,15 @@ namespace :scan do
Dir['**/**/*'].each do |file|
if File.file?(file)
result = `shasum -a 256 #{file}`
- sha = result.split(' ').first
+ sha, * = result.split(' ')
+ full_path = File.expand_path(file)
- uri = URI("http://localhost:3000/agents/#{agent.id}/files/#{sha}")
- puts [sha, Net::HTTP.get(uri)].inspect
+ url = "http://localhost:3000/agents/#{agent.id}/files/#{sha}"
+ Typhoeus.get(url, body: {
+ payload: {
+ full_path: full_path
+ }
+ })
end
end
end