Ticket #11351: plugin_install_from_secure_repository.4.diff
| File plugin_install_from_secure_repository.4.diff, 1.5 kB (added by david.calavera, 4 months ago) |
|---|
-
railties/lib/commands/plugin.rb
old new 288 288 end 289 289 290 290 def rails_env 291 @rails_env || RailsEnvironment.default291 @rails_env ||= RailsEnvironment.default 292 292 end 293 293 end 294 294 … … 893 893 if url =~ /^svn:\/\/.*/ 894 894 `svn ls #{url}`.split("\n").map {|entry| "/#{entry}"} rescue nil 895 895 else 896 open(url ) do |stream|896 open(url, credentials(url)) do |stream| 897 897 links("", stream.read) 898 898 end rescue nil 899 899 end … … 922 922 923 923 def download(link) 924 924 puts "+ #{File.join(@cwd, File.basename(link))}" unless @quiet 925 open(link ) do |stream|925 open(link, credentials(link)) do |stream| 926 926 File.open(File.join(@cwd, File.basename(link)), "wb") do |file| 927 927 file.write(stream.read) 928 928 end … … 938 938 def fetch_dir(url) 939 939 @level += 1 940 940 push_d(File.basename(url)) if @level > 0 941 open(url ) do |stream|941 open(url, credentials(url)) do |stream| 942 942 contents = stream.read 943 943 fetch(links(url, contents)) 944 944 end 945 945 pop_d if @level > 0 946 946 @level -= 1 947 947 end 948 949 def credentials(url) 950 uri = URI.parse(url) 951 raise ArgumentError, 'url is not an HTTP URI' unless uri.is_a?(URI::HTTP) 952 953 uri && uri.user ? 954 {:http_basic_authentication => [URI.unescape(uri.user), URI.unescape(uri.password)]} : {} 955 end 948 956 end 949 957 950 958 Commands::Plugin.parse!