Permalink
Browse files

Fix the get action to support HTTP remote sources.

As of commit dd072c9 the get action fails to retrieve remote sources. This is due to the File.binread method operating on File which only works with locally mounted file systems. Prior to this commit the get action used Open-URI to access the source which allowed it to be either local to the system or a remote http file.

This commit restores the use of Open-URI and also aims to maintain the binary mode reading support of the aforementioned commit.

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 199fbeb commit ab812a9cddb280296c44cb72f6fb1d8ba8c38947 @geoffgarside geoffgarside committed with josevalim Feb 18, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/thor/actions/file_manipulation.rb
@@ -48,7 +48,7 @@ def copy_file(source, destination=nil, config={}, &block)
#
def get(source, destination=nil, config={}, &block)
source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ /^http\:\/\//
- render = File.binread(source)
+ render = open(source).binmode.read
destination ||= if block_given?
block.arity == 1 ? block.call(render) : block.call

0 comments on commit ab812a9

Please sign in to comment.