-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
- 9.0.4.0
- 9.0.3.0
- 9.0.1.0
- 9.0.0.0
- 9.0.0.0.rc2
- 9.0.0.0.rc1
- 1.7.27
- 1.7.26
- 1.7.25
- 1.7.24
- 1.7.23
- 1.7.22
- 1.7.21
- 1.7.20.1
- 1.7.20
Showing
146 changed files
with
8,540 additions
and
2,248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
require 'rubygems/command' | ||
|
||
class Gem::Commands::MirrorCommand < Gem::Command | ||
def initialize | ||
super('mirror', 'Mirror all gem files (requires rubygems-mirror)') | ||
begin | ||
Gem::Specification.find_by_name('rubygems-mirror').activate | ||
rescue Gem::LoadError | ||
# no-op | ||
unless defined? Gem::Commands::MirrorCommand | ||
class Gem::Commands::MirrorCommand < Gem::Command | ||
def initialize | ||
super('mirror', 'Mirror all gem files (requires rubygems-mirror)') | ||
begin | ||
Gem::Specification.find_by_name('rubygems-mirror').activate | ||
rescue Gem::LoadError | ||
# no-op | ||
end | ||
end | ||
end | ||
|
||
def description # :nodoc: | ||
<<-EOF | ||
def description # :nodoc: | ||
<<-EOF | ||
The mirror command has been moved to the rubygems-mirror gem. | ||
EOF | ||
end | ||
EOF | ||
end | ||
|
||
def execute | ||
alert_error "Install the rubygems-mirror gem for the mirror command" | ||
end | ||
def execute | ||
alert_error "Install the rubygems-mirror gem for the mirror command" | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
require 'English' | ||
require 'rubygems/command' | ||
require 'rubygems/version_option' | ||
require 'rubygems/util' | ||
|
||
class Gem::Commands::OpenCommand < Gem::Command | ||
|
||
include Gem::VersionOption | ||
|
||
def initialize | ||
super 'open', 'Open gem sources in editor' | ||
|
||
add_option('-e', '--editor EDITOR', String, | ||
"Opens gem sources in EDITOR") do |editor, options| | ||
options[:editor] = editor || get_env_editor | ||
end | ||
end | ||
|
||
def arguments # :nodoc: | ||
"GEMNAME name of gem to open in editor" | ||
end | ||
|
||
def defaults_str # :nodoc: | ||
"-e #{get_env_editor}" | ||
end | ||
|
||
def description # :nodoc: | ||
<<-EOF | ||
The open command opens gem in editor and changes current path | ||
to gem's source directory. Editor can be specified with -e option, | ||
otherwise rubygems will look for editor in $EDITOR, $VISUAL and | ||
$GEM_EDITOR variables. | ||
EOF | ||
end | ||
|
||
def usage # :nodoc: | ||
"#{program_name} GEMNAME [-e EDITOR]" | ||
end | ||
|
||
def get_env_editor | ||
ENV['GEM_EDITOR'] || | ||
ENV['VISUAL'] || | ||
ENV['EDITOR'] || | ||
'vi' | ||
end | ||
|
||
def execute | ||
@version = options[:version] || Gem::Requirement.default | ||
@editor = options[:editor] || get_env_editor | ||
|
||
found = open_gem(get_one_gem_name) | ||
|
||
terminate_interaction 1 unless found | ||
end | ||
|
||
def open_gem name | ||
spec = spec_for name | ||
return false unless spec | ||
|
||
open_editor(spec.full_gem_path) | ||
end | ||
|
||
def open_editor path | ||
Dir.chdir(path) do | ||
system(*@editor.split(/\s+/) + [path]) | ||
end | ||
end | ||
|
||
def spec_for name | ||
spec = Gem::Specification.find_all_by_name(name, @version).last | ||
|
||
return spec if spec | ||
|
||
say "Unable to find gem '#{name}'" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
109 changes: 0 additions & 109 deletions
109
lib/ruby/shared/rubygems/dependency_resolver/activation_request.rb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
lib/ruby/shared/rubygems/dependency_resolver/api_specification.rb
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
lib/ruby/shared/rubygems/dependency_resolver/composed_set.rb
This file was deleted.
Oops, something went wrong.
85 changes: 0 additions & 85 deletions
85
lib/ruby/shared/rubygems/dependency_resolver/dependency_conflict.rb
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
lib/ruby/shared/rubygems/dependency_resolver/dependency_request.rb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
60 changes: 0 additions & 60 deletions
60
lib/ruby/shared/rubygems/dependency_resolver/index_specification.rb
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
lib/ruby/shared/rubygems/dependency_resolver/installed_specification.rb
This file was deleted.
Oops, something went wrong.
154 changes: 0 additions & 154 deletions
154
lib/ruby/shared/rubygems/dependency_resolver/installer_set.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## | ||
# Raised when there is an error while building extensions. | ||
|
||
class Gem::Ext::BuildError < Gem::InstallError | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## | ||
# The primary source of gems is a file on disk, including all usages | ||
# internal to rubygems. | ||
# | ||
# This is a private class, do not depend on it directly. Instead, pass a path | ||
# object to `Gem::Package.new`. | ||
|
||
class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all | ||
|
||
attr_reader :path | ||
|
||
def initialize path | ||
@path = path | ||
end | ||
|
||
def start | ||
@start ||= File.read path, 20 | ||
end | ||
|
||
def present? | ||
File.exist? path | ||
end | ||
|
||
def with_write_io &block | ||
open path, 'wb', &block | ||
end | ||
|
||
def with_read_io &block | ||
open path, 'rb', &block | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## | ||
# Supports reading and writing gems from/to a generic IO object. This is | ||
# useful for other applications built on top of rubygems, such as | ||
# rubygems.org. | ||
# | ||
# This is a private class, do not depend on it directly. Instead, pass an IO | ||
# object to `Gem::Package.new`. | ||
|
||
class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all | ||
|
||
attr_reader :io | ||
|
||
def initialize io | ||
@io = io | ||
end | ||
|
||
def start | ||
@start ||= begin | ||
if io.pos > 0 | ||
raise Gem::Package::Error, "Cannot read start unless IO is at start" | ||
end | ||
|
||
value = io.read 20 | ||
io.rewind | ||
value | ||
end | ||
end | ||
|
||
def present? | ||
true | ||
end | ||
|
||
def with_read_io | ||
yield io | ||
end | ||
|
||
def with_write_io | ||
yield io | ||
end | ||
|
||
def path | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Gem::Package::Source # :nodoc: | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# This exists just to satify bugs in marshal'd gemspecs that | ||
# This exists just to satisfy bugs in marshal'd gemspecs that | ||
# contain a reference to YAML::PrivateType. We prune these out | ||
# in Specification._load, but if we don't have the constant, Marshal | ||
# blows up. | ||
|
||
module Psych # :nodoc: | ||
class PrivateType | ||
class PrivateType # :nodoc: | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
require 'thread' | ||
|
||
class Gem::Request::ConnectionPools # :nodoc: | ||
|
||
@client = Net::HTTP | ||
|
||
class << self | ||
attr_accessor :client | ||
end | ||
|
||
def initialize proxy_uri, cert_files | ||
@proxy_uri = proxy_uri | ||
@cert_files = cert_files | ||
@pools = {} | ||
@pool_mutex = Mutex.new | ||
end | ||
|
||
def pool_for uri | ||
http_args = net_http_args(uri, @proxy_uri) | ||
key = http_args + [https?(uri)] | ||
@pool_mutex.synchronize do | ||
@pools[key] ||= | ||
if https? uri then | ||
Gem::Request::HTTPSPool.new(http_args, @cert_files, @proxy_uri) | ||
else | ||
Gem::Request::HTTPPool.new(http_args, @cert_files, @proxy_uri) | ||
end | ||
end | ||
end | ||
|
||
def close_all | ||
@pools.each_value {|pool| pool.close_all} | ||
end | ||
|
||
private | ||
|
||
## | ||
# Returns list of no_proxy entries (if any) from the environment | ||
|
||
def get_no_proxy_from_env | ||
env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY'] | ||
|
||
return [] if env_no_proxy.nil? or env_no_proxy.empty? | ||
|
||
env_no_proxy.split(/\s*,\s*/) | ||
end | ||
|
||
def https? uri | ||
uri.scheme.downcase == 'https' | ||
end | ||
|
||
def no_proxy? host, env_no_proxy | ||
host = host.downcase | ||
|
||
env_no_proxy.any? do |pattern| | ||
pattern = pattern.downcase | ||
|
||
host[-pattern.length, pattern.length] == pattern or | ||
(pattern.start_with? '.' and pattern[1..-1] == host) | ||
end | ||
end | ||
|
||
def net_http_args uri, proxy_uri | ||
net_http_args = [uri.host, uri.port] | ||
|
||
no_proxy = get_no_proxy_from_env | ||
|
||
if proxy_uri and not no_proxy?(uri.host, no_proxy) then | ||
net_http_args + [ | ||
proxy_uri.host, | ||
proxy_uri.port, | ||
Gem::UriFormatter.new(proxy_uri.user).unescape, | ||
Gem::UriFormatter.new(proxy_uri.password).unescape, | ||
] | ||
elsif no_proxy? uri.host, no_proxy then | ||
net_http_args + [nil, nil] | ||
else | ||
net_http_args | ||
end | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## | ||
# A connection "pool" that only manages one connection for now. Provides | ||
# thread safe `checkout` and `checkin` methods. The pool consists of one | ||
# connection that corresponds to `http_args`. This class is private, do not | ||
# use it. | ||
|
||
class Gem::Request::HTTPPool # :nodoc: | ||
attr_reader :cert_files, :proxy_uri | ||
|
||
def initialize http_args, cert_files, proxy_uri | ||
@http_args = http_args | ||
@cert_files = cert_files | ||
@proxy_uri = proxy_uri | ||
@queue = SizedQueue.new 1 | ||
@queue << nil | ||
end | ||
|
||
def checkout | ||
@queue.pop || make_connection | ||
end | ||
|
||
def checkin connection | ||
@queue.push connection | ||
end | ||
|
||
def close_all | ||
until @queue.empty? | ||
if connection = @queue.pop(true) and connection.started? | ||
connection.finish | ||
end | ||
end | ||
@queue.push(nil) | ||
end | ||
|
||
private | ||
|
||
def make_connection | ||
setup_connection Gem::Request::ConnectionPools.client.new(*@http_args) | ||
end | ||
|
||
def setup_connection connection | ||
connection.start | ||
connection | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Gem::Request::HTTPSPool < Gem::Request::HTTPPool # :nodoc: | ||
private | ||
|
||
def setup_connection connection | ||
Gem::Request.configure_connection_for_https(connection, @cert_files) | ||
super | ||
end | ||
end | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
784 changes: 773 additions & 11 deletions
784
lib/ruby/shared/rubygems/request_set/gem_dependency_api.rb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
## | ||
# Parses a gem.deps.rb.lock file and constructs a LockSet containing the | ||
# dependencies found inside. If the lock file is missing no LockSet is | ||
# constructed. | ||
|
||
class Gem::RequestSet::Lockfile | ||
## | ||
# Raised when a lockfile cannot be parsed | ||
|
||
class ParseError < Gem::Exception | ||
|
||
## | ||
# The column where the error was encountered | ||
|
||
attr_reader :column | ||
|
||
## | ||
# The line where the error was encountered | ||
|
||
attr_reader :line | ||
|
||
## | ||
# The location of the lock file | ||
|
||
attr_reader :path | ||
|
||
## | ||
# Raises a ParseError with the given +message+ which was encountered at a | ||
# +line+ and +column+ while parsing. | ||
|
||
def initialize message, column, line, path | ||
@line = line | ||
@column = column | ||
@path = path | ||
super "#{message} (at line #{line} column #{column})" | ||
end | ||
end | ||
|
||
## | ||
# Creates a new Lockfile for the given +request_set+ and +gem_deps_file+ | ||
# location. | ||
|
||
def self.build request_set, gem_deps_file, dependencies = nil | ||
request_set.resolve | ||
dependencies ||= requests_to_deps request_set.sorted_requests | ||
new request_set, gem_deps_file, dependencies | ||
end | ||
|
||
def self.requests_to_deps requests # :nodoc: | ||
deps = {} | ||
|
||
requests.each do |request| | ||
spec = request.spec | ||
name = request.name | ||
requirement = request.request.dependency.requirement | ||
|
||
deps[name] = if [Gem::Resolver::VendorSpecification, | ||
Gem::Resolver::GitSpecification].include? spec.class then | ||
Gem::Requirement.source_set | ||
else | ||
requirement | ||
end | ||
end | ||
|
||
deps | ||
end | ||
|
||
## | ||
# The platforms for this Lockfile | ||
|
||
attr_reader :platforms | ||
|
||
def initialize request_set, gem_deps_file, dependencies | ||
@set = request_set | ||
@dependencies = dependencies | ||
@gem_deps_file = File.expand_path(gem_deps_file) | ||
@gem_deps_dir = File.dirname(@gem_deps_file) | ||
|
||
@gem_deps_file.untaint unless gem_deps_file.tainted? | ||
|
||
@platforms = [] | ||
end | ||
|
||
def add_DEPENDENCIES out # :nodoc: | ||
out << "DEPENDENCIES" | ||
|
||
out.concat @dependencies.sort_by { |name,| name }.map { |name, requirement| | ||
" #{name}#{requirement.for_lockfile}" | ||
} | ||
|
||
out << nil | ||
end | ||
|
||
def add_GEM out, spec_groups # :nodoc: | ||
return if spec_groups.empty? | ||
|
||
source_groups = spec_groups.values.flatten.group_by do |request| | ||
request.spec.source.uri | ||
end | ||
|
||
source_groups.sort_by { |group,| group.to_s }.map do |group, requests| | ||
out << "GEM" | ||
out << " remote: #{group}" | ||
out << " specs:" | ||
|
||
requests.sort_by { |request| request.name }.each do |request| | ||
next if request.spec.name == 'bundler' | ||
platform = "-#{request.spec.platform}" unless | ||
Gem::Platform::RUBY == request.spec.platform | ||
|
||
out << " #{request.name} (#{request.version}#{platform})" | ||
|
||
request.full_spec.dependencies.sort.each do |dependency| | ||
next if dependency.type == :development | ||
|
||
requirement = dependency.requirement | ||
out << " #{dependency.name}#{requirement.for_lockfile}" | ||
end | ||
end | ||
out << nil | ||
end | ||
end | ||
|
||
def add_GIT out, git_requests | ||
return if git_requests.empty? | ||
|
||
by_repository_revision = git_requests.group_by do |request| | ||
source = request.spec.source | ||
[source.repository, source.rev_parse] | ||
end | ||
|
||
out << "GIT" | ||
by_repository_revision.each do |(repository, revision), requests| | ||
out << " remote: #{repository}" | ||
out << " revision: #{revision}" | ||
out << " specs:" | ||
|
||
requests.sort_by { |request| request.name }.each do |request| | ||
out << " #{request.name} (#{request.version})" | ||
|
||
dependencies = request.spec.dependencies.sort_by { |dep| dep.name } | ||
dependencies.each do |dep| | ||
out << " #{dep.name}#{dep.requirement.for_lockfile}" | ||
end | ||
end | ||
end | ||
|
||
out << nil | ||
end | ||
|
||
def relative_path_from dest, base # :nodoc: | ||
dest = File.expand_path(dest) | ||
base = File.expand_path(base) | ||
|
||
if dest.index(base) == 0 then | ||
offset = dest[base.size+1..-1] | ||
|
||
return '.' unless offset | ||
|
||
offset | ||
else | ||
dest | ||
end | ||
end | ||
|
||
def add_PATH out, path_requests # :nodoc: | ||
return if path_requests.empty? | ||
|
||
out << "PATH" | ||
path_requests.each do |request| | ||
directory = File.expand_path(request.spec.source.uri) | ||
|
||
out << " remote: #{relative_path_from directory, @gem_deps_dir}" | ||
out << " specs:" | ||
out << " #{request.name} (#{request.version})" | ||
end | ||
|
||
out << nil | ||
end | ||
|
||
def add_PLATFORMS out # :nodoc: | ||
out << "PLATFORMS" | ||
|
||
platforms = requests.map { |request| request.spec.platform }.uniq | ||
|
||
platforms = platforms.sort_by { |platform| platform.to_s } | ||
|
||
platforms.sort.each do |platform| | ||
out << " #{platform}" | ||
end | ||
|
||
out << nil | ||
end | ||
|
||
def spec_groups | ||
requests.group_by { |request| request.spec.class } | ||
end | ||
|
||
## | ||
# The contents of the lock file. | ||
|
||
def to_s | ||
out = [] | ||
|
||
groups = spec_groups | ||
|
||
add_PATH out, groups.delete(Gem::Resolver::VendorSpecification) { [] } | ||
|
||
add_GIT out, groups.delete(Gem::Resolver::GitSpecification) { [] } | ||
|
||
add_GEM out, groups | ||
|
||
add_PLATFORMS out | ||
|
||
add_DEPENDENCIES out | ||
|
||
out.join "\n" | ||
end | ||
|
||
## | ||
# Writes the lock file alongside the gem dependencies file | ||
|
||
def write | ||
content = to_s | ||
|
||
open "#{@gem_deps_file}.lock", 'w' do |io| | ||
io.write content | ||
end | ||
end | ||
|
||
private | ||
|
||
def requests | ||
@set.sorted_requests | ||
end | ||
end | ||
|
||
require 'rubygems/request_set/lockfile/tokenizer' |
Oops, something went wrong.