lib/cloud_crowd/action.rb in documentcloud-cloud-crowd-0.1.1 vs lib/cloud_crowd/action.rb in documentcloud-cloud-crowd-0.2.0
- old
+ new
@@ -36,20 +36,22 @@
raise NotImplementedError.new("CloudCrowd::Actions must override 'process' with their own processing code.")
end
# Download a file to the specified path.
def download(url, path)
- URI.parse(url) # Sanity check.
`curl -s "#{url}" > "#{path}"`
+ return path
+ # The previous implementation is below, and, although it would be
+ # wonderful not to shell out, RestClient wasn't handling URLs with encoded
+ # entities (%20, for example), and doesn't let you download to a given
+ # location. Getting a RestClient patch in would be ideal.
+ #
# if url.match(FILE_URL)
# FileUtils.cp(url.sub(FILE_URL, ''), path)
# else
- # # An alternative would be shelling out: `curl -s "#{url}" > "#{path}"`
- # puts url
# resp = RestClient::Request.execute(:url => url, :method => :get, :raw_response => true)
# FileUtils.mv resp.file.path, path
# end
- path
end
# Takes a local filesystem path, saves the file to S3, and returns the
# public (or authenticated) url on S3 where the file can be accessed.
def save(file_path)
\ No newline at end of file