Update and extract for each gem

This commit is contained in:
Nobuyoshi Nakada 2020-03-13 15:31:21 +09:00
Родитель 0cd7be99e9
Коммит 88f4ebac83
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4BC7D6DF58D8DF60
3 изменённых файлов: 31 добавлений и 5 удалений

Просмотреть файл

@ -1276,7 +1276,7 @@ update-config_files: PHONY
refresh-gems: update-bundled_gems prepare-gems
prepare-gems: update-gems extract-gems
update-gems: PHONY
update-gems$(gnumake:yes=-nongnumake): PHONY
$(ECHO) Downloading bundled gem files...
$(Q) $(BASERUBY) -C "$(srcdir)" \
-I./tool -rdownloader -answ \
@ -1289,7 +1289,7 @@ update-gems: PHONY
-e 'FileUtils.rm_rf(old.map{'"|n|"'n.chomp(".gem")})' \
gems/bundled_gems
extract-gems: PHONY
extract-gems$(gnumake:yes=-nongnumake): PHONY
$(ECHO) Extracting bundled gem files...
$(Q) $(RUNRUBY) -C "$(srcdir)" \
-Itool -rgem-unpack -answ \

Просмотреть файл

@ -1,6 +1,5 @@
# -*- mode: makefile-gmake; indent-tabs-mode: t -*-
gnumake = yes
override gnumake_recursive := $(if $(findstring n,$(firstword $(MFLAGS))),,+)
override mflags := $(filter-out -j%,$(MFLAGS))
MSPECOPT += $(if $(filter -j%,$(MFLAGS)),-j)
@ -243,9 +242,34 @@ HELP_EXTRA_TASKS = \
" update-github: merge master branch and push it to Pull Request [PR=1234]" \
""
ifneq ($(filter refresh-gems prepare-gems,$(MAKECMDGOALS)),)
extract-gems: update-gems
endif
BUNDLED_GEMS := $(shell sed 's/[ ][ ]*/-/;s/[ ].*//' $(srcdir)/gems/bundled_gems)
update-gems: | $(patsubst %,gems/%.gem,$(BUNDLED_GEMS))
gems/%.gem:
$(ECHO) Downloading bundled gem $*...
$(Q) $(BASERUBY) -C "$(srcdir)" \
-I./tool -rdownloader \
-e 'gem = "$(@F)"' \
-e 'old = Dir.glob("gems/"+gem.sub(/-[^-]*$$/, "-*.gem"))' \
-e 'Downloader::RubyGems.download(gem, "gems", nil) and' \
-e '(old.delete("gems/#{gem}"); !old.empty?) and' \
-e 'File.unlink(*old) and' \
-e 'FileUtils.rm_rf(old.map{'"|n|"'n.chomp(".gem")})'
extract-gems: | $(patsubst %,.bundle/gems/%,$(BUNDLED_GEMS))
.bundle/gems/%: gems/%.gem | .bundle/gems
$(ECHO) Extracting bundle gem $*...
$(Q) $(RUNRUBY) -C "$(srcdir)" \
-Itool -rgem-unpack \
-e 'Gem.unpack("gems/$(@F).gem", ".bundle/gems")'
$(srcdir)/.bundle/gems:
$(MAKEDIRS) $@
ifneq ($(filter update-bundled_gems refresh-gems,$(MAKECMDGOALS)),)
update-gems: update-bundled_gems
endif

Просмотреть файл

@ -1,3 +1,5 @@
gnumake = yes
include Makefile
ifeq ($(HAVE_BASERUBY),yes)