@@ -57,7 +57,7 @@ def initialize
5757 end
5858
5959 add_option ( "-i" , "--install-dir DIR" ,
60- "Gem repository to get binstubs and plugins installed " ) do |value , options |
60+ "Gem repository to get gems restored " ) do |value , options |
6161 options [ :install_dir ] = File . expand_path ( value )
6262 end
6363
@@ -103,21 +103,25 @@ def usage # :nodoc:
103103 end
104104
105105 def execute
106+ install_dir = options [ :install_dir ]
107+
108+ specification_record = install_dir ? Gem ::SpecificationRecord . from_path ( install_dir ) : Gem ::Specification . specification_record
109+
106110 specs = if options [ :all ]
107- Gem :: Specification . map
111+ specification_record . map
108112
109113 # `--extensions` must be explicitly given to pristine only gems
110114 # with extensions.
111115 elsif options [ :extensions_set ] &&
112116 options [ :extensions ] && options [ :args ] . empty?
113- Gem :: Specification . select do |spec |
117+ specification_record . select do |spec |
114118 spec . extensions && !spec . extensions . empty?
115119 end
116120 elsif options [ :only_missing_extensions ]
117- Gem :: Specification . select ( &:missing_extensions? )
121+ specification_record . select ( &:missing_extensions? )
118122 else
119123 get_all_gem_names . sort . map do |gem_name |
120- Gem :: Specification . find_all_by_name ( gem_name , options [ :version ] ) . reverse
124+ specification_record . find_all_by_name ( gem_name , options [ :version ] ) . reverse
121125 end . flatten
122126 end
123127
@@ -176,7 +180,6 @@ def execute
176180 end
177181
178182 bin_dir = options [ :bin_dir ] if options [ :bin_dir ]
179- install_dir = options [ :install_dir ] if options [ :install_dir ]
180183
181184 installer_options = {
182185 wrappers : true ,
0 commit comments