module Bundler::Thor::Actions
def get(source, *args, &block)
end
content.split("\n").first
get "http://gist.github.com/103208" do |content|
get "http://gist.github.com/103208", "doc/README", :http_headers => {"Content-Type" => "application/json"}
get "http://gist.github.com/103208", "doc/README"
==== Examples
:http_headers =>
config
destination
source
==== Parameters
a command injection attack vector.
+get+ relies on open-uri, so passing application user input would provide
the url is yielded and used as location.
destination. If a block is given instead of destination, the content of
Gets the content at the given address and places it at the given relative
def get(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first render = if source =~ %r{^https?\://} require "open-uri" URI.send(:open, source, config.fetch(:http_headers, {})) { |input| input.binmode.read } else source = File.expand_path(find_in_source_paths(source.to_s)) File.open(source) { |input| input.binmode.read } end destination ||= if block_given? block.arity == 1 ? yield(render) : yield else File.basename(source) end create_file destination, render, config end