aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/package.rb2
-rw-r--r--lib/rubygems/remote_fetcher.rb4
-rw-r--r--lib/rubygems/source.rb2
-rw-r--r--lib/rubygems/specification.rb21
-rw-r--r--lib/rubygems/test_utilities.rb4
6 files changed, 19 insertions, 16 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index a7bc959965..89305705af 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -187,7 +187,7 @@ module Gem
path = path.dup.untaint
if path == "-"
- here = Dir.pwd
+ here = Dir.pwd.untaint
start = here
begin
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 1769af061b..910f835602 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -220,8 +220,8 @@ class Gem::Package
Gem.load_yaml
require 'rubygems/security'
- @spec.validate unless skip_validation
@spec.mark_version
+ @spec.validate unless skip_validation
setup_signer
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 4bb2e3604f..cc3d3cf860 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -294,7 +294,7 @@ class Gem::RemoteFetcher
# Downloads +uri+ to +path+ if necessary. If no path is given, it just
# passes the data.
- def cache_update_path(uri, path = nil)
+ def cache_update_path uri, path = nil, update = true
mtime = path && File.stat(path).mtime rescue nil
if mtime && Net::HTTPNotModified === fetch_path(uri, mtime, true)
@@ -302,7 +302,7 @@ class Gem::RemoteFetcher
else
data = fetch_path(uri)
- if path
+ if update and path then
open(path, 'wb') do |io|
io.write data
end
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index c85a2cf660..96d57870e2 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -122,7 +122,7 @@ class Gem::Source
FileUtils.mkdir_p cache_dir if update_cache?
- spec_dump = fetcher.cache_update_path(spec_path, local_file)
+ spec_dump = fetcher.cache_update_path spec_path, local_file, update_cache?
begin
Gem::NameTuple.from_list Marshal.load(spec_dump)
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 23393f2025..ad87e997a4 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1283,7 +1283,11 @@ class Gem::Specification
def base_dir
return Gem.dir unless loaded_from
- @base_dir ||= File.dirname File.dirname loaded_from
+ @base_dir ||= if default_gem? then
+ File.dirname File.dirname File.dirname loaded_from
+ else
+ File.dirname File.dirname loaded_from
+ end
end
##
@@ -2486,17 +2490,17 @@ class Gem::Specification
# Checks to see if the files to be packaged are world-readable.
def validate_permissions
+ return if Gem.win_platform?
+
files.each do |file|
- next if File.stat(file).world_readable?
+ next if File.stat(file).mode & 0444 == 0444
alert_warning "#{file} is not world-readable"
end
- unless Gem.win_platform?
- executables.each do |name|
- exec = File.join @bindir, name
- next if File.stat(exec).executable?
- alert_warning "#{exec} is not executable"
- end
+ executables.each do |name|
+ exec = File.join @bindir, name
+ next if File.stat(exec).executable?
+ alert_warning "#{exec} is not executable"
end
end
@@ -2562,7 +2566,6 @@ class Gem::Specification
# deprecate :has_rdoc=, :none, 2011, 10
# deprecate :default_executable, :none, 2011, 10
# deprecate :default_executable=, :none, 2011, 10
- # deprecate :spec_name, :spec_file, 2011, 10
# deprecate :file_name, :cache_file, 2011, 10
# deprecate :full_gem_path, :cache_file, 2011, 10
end
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index bd5f2134be..dc0d93e6c2 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -63,9 +63,9 @@ class Gem::FakeFetcher
end
end
- def cache_update_path uri, path = nil
+ def cache_update_path uri, path = nil, update = true
if data = fetch_path(uri)
- open(path, 'wb') { |io| io.write data } if path
+ open(path, 'wb') { |io| io.write data } if path and update
data
else
Gem.read_binary(path) if path