lib/rubygems/commands/inabox_command.rb in geminabox-0.3.0 vs lib/rubygems/commands/inabox_command.rb in geminabox-0.3.1

- old
+ new

@@ -31,14 +31,14 @@ setup send_gem end def setup - @gemfile = if options[:args].size == 0 - find_gem + if options[:args].size == 0 + @gemfiles = [find_gem] else - get_one_gem_name + @gemfiles = get_all_gem_names end configure unless geminabox_host end def find_gem @@ -54,19 +54,21 @@ # sanitize printed URL if a password is present url = URI.parse(geminabox_host) url_for_presentation = url.clone url_for_presentation.password = '***' if url_for_presentation.password - say "Pushing #{File.split(@gemfile).last} to #{url_for_presentation}..." + @gemfiles.each do |gemfile| + say "Pushing #{File.basename(gemfile)} to #{url_for_presentation}..." - File.open(@gemfile, "rb") do |file| - request_body, request_headers = Multipart::MultipartPost.new.prepare_query("file" => file) + File.open(gemfile, "rb") do |file| + request_body, request_headers = Multipart::MultipartPost.new.prepare_query("file" => file) - proxy.start(url.host, url.port) {|con| - req = Net::HTTP::Post.new('/upload', request_headers) - req.basic_auth(url.user, url.password) if url.user - handle_response(con.request(req, request_body)) - } + proxy.start(url.host, url.port) {|con| + req = Net::HTTP::Post.new('/upload', request_headers) + req.basic_auth(url.user, url.password) if url.user + handle_response(con.request(req, request_body)) + } + end end end def proxy if proxy_info = ENV['http_proxy'] || ENV['HTTP_PROXY'] and uri = URI.parse(proxy_info)