Skip to content

Commit 6b2d9ed

Browse files
committed
Handle preperly comments in middle of lines in gems/bundled_gems
1 parent 428937a commit 6b2d9ed

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

common.mk

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,12 +1539,14 @@ prepare-gems: $(HAVE_BASERUBY:yes=update-gems) $(HAVE_BASERUBY:yes=extract-gems)
15391539
extract-gems: $(HAVE_BASERUBY:yes=update-gems) $(HAVE_BASERUBY:yes=outdate-bundled-gems)
15401540
update-gems: $(HAVE_BASERUBY:yes=outdate-bundled-gems)
15411541

1542+
split_option = -F"\s+|\#.*"
1543+
15421544
update-gems$(sequential): PHONY
15431545
$(ECHO) Downloading bundled gem files...
15441546
$(Q) $(BASERUBY) -C "$(srcdir)" \
1545-
-I./tool -rdownloader -answ \
1547+
-I./tool -rdownloader $(split_option) -answ \
15461548
-e 'gem, ver = *$$F' \
1547-
-e 'next if !ver or /^#/=~gem' \
1549+
-e 'next if !ver' \
15481550
-e 'old = Dir.glob("gems/#{gem}-*.gem")' \
15491551
-e 'gem = "#{gem}-#{ver}.gem"' \
15501552
-e 'Downloader::RubyGems.download(gem, "gems", nil) and' \
@@ -1556,10 +1558,10 @@ update-gems$(sequential): PHONY
15561558
extract-gems$(sequential): PHONY
15571559
$(ECHO) Extracting bundled gem files...
15581560
$(Q) $(BASERUBY) -C "$(srcdir)" \
1559-
-Itool/lib -rfileutils -rbundled_gem -answ \
1561+
-Itool/lib -rfileutils -rbundled_gem $(split_option) -answ \
15601562
-e 'BEGIN {d = ".bundle/gems"}' \
15611563
-e 'gem, ver, _, rev = *$$F' \
1562-
-e 'next if !ver or /^#/=~gem' \
1564+
-e 'next if !ver' \
15631565
-e 'g = "#{gem}-#{ver}"' \
15641566
-e 'unless File.directory?("#{d}/#{g}")' \
15651567
-e 'if rev and File.exist?(gs = "gems/src/#{gem}/#{gem}.gemspec")' \
@@ -1623,7 +1625,7 @@ yes-install-for-test-bundled-gems: yes-update-default-gemspecs
16231625
test-bundled-gems-fetch: yes-test-bundled-gems-fetch
16241626
yes-test-bundled-gems-fetch: clone-bundled-gems-src
16251627
clone-bundled-gems-src: PHONY
1626-
$(Q) $(BASERUBY) -C $(srcdir)/gems ../tool/fetch-bundled_gems.rb BUNDLED_GEMS="$(BUNDLED_GEMS)" src bundled_gems
1628+
$(Q) $(BASERUBY) -C $(srcdir) tool/fetch-bundled_gems.rb BUNDLED_GEMS="$(BUNDLED_GEMS)" gems/src gems/bundled_gems
16271629
no-test-bundled-gems-fetch:
16281630

16291631
test-bundled-gems-prepare: $(TEST_RUNNABLE)-test-bundled-gems-prepare

defs/gmake.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ HELP_EXTRA_TASKS = \
309309
# 4. "gem x.y.z URL" -> "gem-x.y.z"
310310
bundled-gems := $(shell sed \
311311
-e 's/[ ][ ]*/ /g' \
312-
-e 's/^ //;/\#/d;s/ *$$//;/^$$/d' \
312+
-e 's/^ //;s/\#.*//;s/ *$$//;/^$$/d' \
313313
$(if $(filter yes,$(HAVE_GIT)), \
314314
-e 's/^\(.*\) \(.*\) \(.*\) \(.*\)/\1|\2|\4|\3/' \
315315
) \

tool/fetch-bundled_gems.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!ruby -an
1+
#!ruby -alnF\s+|#.*
22
BEGIN {
33
require 'fileutils'
44
require_relative 'lib/colorize'
@@ -21,7 +21,6 @@
2121
n, v, u, r = $F
2222

2323
next unless n
24-
next if n =~ /^#/
2524
next if bundled_gems&.all? {|pat| !File.fnmatch?(pat, n)}
2625

2726
unless File.exist?("#{n}/.git")

tool/outdate-bundled-gems.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def each_directory
115115
curdir = !srcdir.base || File.identical?(srcdir.base, ".") ? srcdir : Removal.new
116116

117117
bundled = File.readlines("#{srcdir.base}gems/bundled_gems").
118-
grep(/^(\w\S+)\s+\S+(?:\s+\S+\s+(\S+))?/) {$~.captures}.to_h rescue nil
118+
grep(/^(\w[^\#\s]+)\s+[^\#\s]+(?:\s+[^\#\s]+\s+([^\#\s]+))?/) {$~.captures}.to_h rescue nil
119119

120120
srcdir.glob(".bundle/gems/*/") do |dir|
121121
base = File.basename(dir)

tool/test-bundled-gems.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
ruby = ENV['RUBY'] || RbConfig.ruby
2626
failed = []
2727
File.foreach("#{gem_dir}/bundled_gems") do |line|
28-
next if /^\s*(?:#|$)/ =~ line
29-
gem = line.split.first
28+
next unless gem = line[/^[^\s\#]+/]
3029
next unless bundled_gems.empty? || bundled_gems.split(",").include?(gem)
3130
next unless File.directory?("#{gem_dir}/src/#{gem}/test")
3231

tool/update-bundled_gems.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!ruby -pla
1+
#!ruby -alpF\s+|#.*
22
BEGIN {
33
require 'rubygems'
44
date = nil
@@ -9,7 +9,7 @@
99
END {
1010
output.print date.strftime("latest_date=%F") if date
1111
}
12-
unless /^[^#]/ !~ (gem = $F[0])
12+
if gem = $F[0]
1313
ver = Gem::Version.new($F[1])
1414
(gem, src), = Gem::SpecFetcher.fetcher.detect(:latest) {|s|
1515
s.platform == "ruby" && s.name == gem

0 commit comments

Comments
 (0)