File tree Expand file tree Collapse file tree 3 files changed +38
-29
lines changed
Expand file tree Collapse file tree 3 files changed +38
-29
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ module Gem
1616require_relative "rubygems/deprecate"
1717require_relative "rubygems/errors"
1818require_relative "rubygems/target_rbconfig"
19+ require_relative "rubygems/win_platform"
1920
2021##
2122# RubyGems is the Ruby standard for publishing and managing third party
@@ -113,18 +114,6 @@ module Gem
113114module Gem
114115 RUBYGEMS_DIR = __dir__
115116
116- ##
117- # An Array of Regexps that match windows Ruby platforms.
118-
119- WIN_PATTERNS = [
120- /bccwin/i ,
121- /cygwin/i ,
122- /djgpp/i ,
123- /mingw/i ,
124- /mswin/i ,
125- /wince/i ,
126- ] . freeze
127-
128117 GEM_DEP_FILES = %w[
129118 gem.deps.rb
130119 gems.rb
@@ -160,8 +149,6 @@ module Gem
160149
161150 DEFAULT_SOURCE_DATE_EPOCH = 315_619_200
162151
163- @@win_platform = nil
164-
165152 @configuration = nil
166153 @gemdeps = nil
167154 @loaded_specs = { }
@@ -1091,18 +1078,6 @@ def self.use_paths(home, *paths)
10911078 self . paths = hash
10921079 end
10931080
1094- ##
1095- # Is this a windows platform?
1096-
1097- def self . win_platform?
1098- if @@win_platform . nil?
1099- ruby_platform = RbConfig ::CONFIG [ "host_os" ]
1100- @@win_platform = !WIN_PATTERNS . find { |r | ruby_platform =~ r } . nil?
1101- end
1102-
1103- @@win_platform
1104- end
1105-
11061081 ##
11071082 # Is this a java platform?
11081083
Original file line number Diff line number Diff line change 77
88# rubocop:enable Style/AsciiComments
99
10+ require_relative "win_platform"
1011require_relative "security"
1112require_relative "user_interaction"
1213
@@ -518,10 +519,12 @@ def install_location(filename, destination_dir) # :nodoc:
518519 destination
519520 end
520521
521- def normalize_path ( pathname )
522- if Gem . win_platform?
522+ if Gem . win_platform?
523+ def normalize_path ( pathname ) # :nodoc:
523524 pathname . downcase
524- else
525+ end
526+ else
527+ def normalize_path ( pathname ) # :nodoc:
525528 pathname
526529 end
527530 end
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "rbconfig"
4+
5+ module Gem
6+ ##
7+ # An Array of Regexps that match windows Ruby platforms.
8+
9+ WIN_PATTERNS = [
10+ /bccwin/i ,
11+ /cygwin/i ,
12+ /djgpp/i ,
13+ /mingw/i ,
14+ /mswin/i ,
15+ /wince/i ,
16+ ] . freeze
17+
18+ @@win_platform = nil
19+
20+ ##
21+ # Is this a windows platform?
22+
23+ def self . win_platform?
24+ if @@win_platform . nil?
25+ ruby_platform = RbConfig ::CONFIG [ "host_os" ]
26+ @@win_platform = !WIN_PATTERNS . find { |r | ruby_platform =~ r } . nil?
27+ end
28+
29+ @@win_platform
30+ end
31+ end
You can’t perform that action at this time.
0 commit comments