summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/commands/cleanup_command.rb11
-rw-r--r--lib/rubygems/commands/setup_command.rb31
-rw-r--r--lib/rubygems/util/licenses.rb37
3 files changed, 65 insertions, 14 deletions
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index db1bf3a794..79c23c840d 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -8,13 +8,20 @@ class Gem::Commands::CleanupCommand < Gem::Command
def initialize
super 'cleanup',
'Clean up old versions of installed gems',
- :force => false, :install_dir => Gem.dir
+ :force => false, :install_dir => Gem.dir,
+ :check_dev => true
add_option('-n', '-d', '--dryrun',
'Do not uninstall gems') do |value, options|
options[:dryrun] = true
end
+ add_option('-D', '--[no-]check-development',
+ 'Check development dependencies while uninstalling',
+ '(default: true)') do |value, options|
+ options[:check_dev] = value
+ end
+
@candidate_gems = nil
@default_gems = []
@full = nil
@@ -138,7 +145,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
end
def uninstall_dep spec
- return unless @full.ok_to_remove?(spec.full_name)
+ return unless @full.ok_to_remove?(spec.full_name, options[:check_dev])
if options[:dryrun] then
say "Dry Run Mode: Would uninstall #{spec.full_name}"
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 93a46d4350..5d1414d102 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -82,11 +82,7 @@ class Gem::Commands::SetupCommand < Gem::Command
add_option '--[no-]regenerate-binstubs',
'Regenerate gem binstubs' do |value, options|
- if value then
- options[:regenerate_binstubs] = true
- else
- options.delete(:regenerate_binstubs)
- end
+ options[:regenerate_binstubs] = value
end
@verbose = nil
@@ -156,7 +152,7 @@ By default, this RubyGems will install gem as:
say "RubyGems #{Gem::VERSION} installed"
- regenerate_binstubs
+ regenerate_binstubs if options[:regenerate_binstubs]
uninstall_old_gemcutter
@@ -357,7 +353,7 @@ By default, this RubyGems will install gem as:
mkdir_p Gem::Specification.default_specifications_dir
# Workaround for non-git environment.
- gemspec = File.read('bundler/bundler.gemspec').gsub(/`git ls-files -z`/, "''")
+ gemspec = File.open('bundler/bundler.gemspec', 'rb'){|f| f.read.gsub(/`git ls-files -z`/, "''") }
File.open('bundler/bundler.gemspec', 'w'){|f| f.write gemspec }
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
@@ -372,13 +368,24 @@ By default, this RubyGems will install gem as:
bundler_spec = Gem::Specification.load(default_spec_path)
- Dir.entries(bundler_spec.gems_dir).
- select {|default_gem| default_gem.start_with?("bundler-") }.
- each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
+ if File.directory? bundler_spec.gems_dir
+ Dir.entries(bundler_spec.gems_dir).
+ select {|default_gem| File.basename(default_gem).match(/^bundler-#{Gem::Version::VERSION_PATTERN}$/) }.
+ each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
+ end
mkdir_p bundler_spec.bin_dir
bundler_spec.executables.each {|e| cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_spec.bin_dir, e) }
+ if Gem.win_platform?
+ require 'rubygems/installer'
+
+ installer = Gem::Installer.for_spec bundler_spec
+ bundler_spec.executables.each do |e|
+ installer.generate_windows_script e, bundler_spec.bin_dir
+ end
+ end
+
say "Bundler #{bundler_spec.version} installed"
end
@@ -442,7 +449,7 @@ By default, this RubyGems will install gem as:
# for installation of bundler as default gems
def template_files
Dir.chdir "bundler/lib" do
- (Dir[File.join('bundler', 'templates', '**', '*')] + Dir[File.join('bundler', 'templates', '**', '.*')]).
+ (Dir[File.join('bundler', 'templates', '**', '{*,.*}')]).
select{|f| !File.directory?(f)}
end
end
@@ -450,7 +457,7 @@ By default, this RubyGems will install gem as:
# for cleanup old bundler files
def template_files_in dir
Dir.chdir dir do
- (Dir[File.join('templates', '**', '*')] + Dir[File.join('templates', '**', '.*')]).
+ (Dir[File.join('templates', '**', '{*,.*}')]).
select{|f| !File.directory?(f)}
end
end
diff --git a/lib/rubygems/util/licenses.rb b/lib/rubygems/util/licenses.rb
index f4a99af39e..96fed282f1 100644
--- a/lib/rubygems/util/licenses.rb
+++ b/lib/rubygems/util/licenses.rb
@@ -48,9 +48,13 @@ class Gem::Licenses
BSD-3-Clause-Attribution
BSD-3-Clause-Clear
BSD-3-Clause-LBNL
+ BSD-3-Clause-No-Nuclear-License
+ BSD-3-Clause-No-Nuclear-License-2014
+ BSD-3-Clause-No-Nuclear-Warranty
BSD-4-Clause
BSD-4-Clause-UC
BSD-Protection
+ BSD-Source-Code
BSL-1.0
Bahyph
Barr
@@ -126,6 +130,7 @@ class Gem::Licenses
Entessa
ErlPL-1.1
Eurosym
+ FSFAP
FSFUL
FSFULLR
FTL
@@ -137,8 +142,18 @@ class Gem::Licenses
GFDL-1.3
GL2PS
GPL-1.0
+ GPL-1.0+
GPL-2.0
+ GPL-2.0+
+ GPL-2.0-with-GCC-exception
+ GPL-2.0-with-autoconf-exception
+ GPL-2.0-with-bison-exception
+ GPL-2.0-with-classpath-exception
+ GPL-2.0-with-font-exception
GPL-3.0
+ GPL-3.0+
+ GPL-3.0-with-GCC-exception
+ GPL-3.0-with-autoconf-exception
Giftware
Glide
Glulxe
@@ -152,14 +167,20 @@ class Gem::Licenses
ISC
ImageMagick
Imlib2
+ Info-ZIP
Intel
Intel-ACPI
Interbase-1.0
JSON
JasPer-2.0
+ LAL-1.2
+ LAL-1.3
LGPL-2.0
+ LGPL-2.0+
LGPL-2.1
+ LGPL-2.1+
LGPL-3.0
+ LGPL-3.0+
LGPLLR
LPL-1.0
LPL-1.02
@@ -170,6 +191,9 @@ class Gem::Licenses
LPPL-1.3c
Latex2e
Leptonica
+ LiLiQ-P-1.1
+ LiLiQ-R-1.1
+ LiLiQ-Rplus-1.1
Libpng
MIT
MIT-CMU
@@ -193,6 +217,7 @@ class Gem::Licenses
NBPL-1.0
NCSA
NGPL
+ NLOD-1.0
NLPL
NOSL
NPL-1.0
@@ -201,11 +226,13 @@ class Gem::Licenses
NRL
NTP
Naumen
+ Net-SNMP
NetCDF
Newsletr
Nokia
Noweb
Nunit
+ OCCT-PL
OCLC-2.0
ODbL-1.0
OFL-1.0
@@ -229,6 +256,7 @@ class Gem::Licenses
OLDAP-2.8
OML
OPL-1.0
+ OSET-PL-2.1
OSL-1.0
OSL-1.1
OSL-2.0
@@ -259,6 +287,7 @@ class Gem::Licenses
SISSL
SISSL-1.2
SMLNJ
+ SMPPL
SNIA
SPL-1.0
SWL
@@ -269,12 +298,16 @@ class Gem::Licenses
Spencer-86
Spencer-94
Spencer-99
+ StandardML-NJ
SugarCRM-1.1.3
TCL
+ TCP-wrappers
TMate
TORQUE-1.1
TOSL
UPL-1.0
+ Unicode-DFS-2015
+ Unicode-DFS-2016
Unicode-TOU
Unlicense
VOSTROM
@@ -282,7 +315,9 @@ class Gem::Licenses
Vim
W3C
W3C-19980720
+ W3C-20150513
WTFPL
+ WXwindows
Watcom-1.0
Wsuipa
X11
@@ -302,8 +337,10 @@ class Gem::Licenses
Zlib
bzip2-1.0.5
bzip2-1.0.6
+ curl
diffmark
dvipdfm
+ eCos-2.0
eGenix
gSOAP-1.3b
gnuplot