summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-05-11 12:18:40 -0700
committerStan Hu <stanhu@gmail.com>2016-05-12 07:00:19 -0500
commitd8f3b9bce912b9c50e13ea71ae7185aad6f71b91 (patch)
tree2011662a009a0753e015674570ccbf3cc9e3e2ee /Makefile
parentb99bc5d422bced155ddb69b83858b5b3600f5bac (diff)
downloadgitlab-shell-d8f3b9bce912b9c50e13ea71ae7185aad6f71b91.tar.gz
Add redis-rb as a vendored library
`make update-redis` will clone the library and adjust the paths properly
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c1dde95
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+REDIS_RB_VERSION=v3.3.0
+REDIS_RB_TMP_DIR := $(shell mktemp -d)
+REDIS_RB_VENDOR_DIR=lib/vendor
+PWD=`pwd`
+
+all:
+
+update-redis:
+ cd lib
+ git clone https://github.com/redis/redis-rb.git $(REDIS_RB_TMP_DIR)
+ cd $(REDIS_RB_TMP_DIR); git checkout $(REDIS_RB_VERSION)
+ cd $(PWD)
+ mkdir -p $(REDIS_RB_VENDOR_DIR)
+ cp -r $(REDIS_RB_TMP_DIR)/lib/* $(REDIS_RB_VENDOR_DIR)
+ # Adjust all 'require redis/' paths to relative paths
+ sed -i.orig -e 's/require "redis/require_relative "redis/g' $(REDIS_RB_VENDOR_DIR)/redis.rb
+ find $(REDIS_RB_VENDOR_DIR)/redis -name \*.rb -maxdepth 1 -exec sed -i.orig -e "s/require \"redis\//require_relative \"/g" {} \;
+ find $(REDIS_RB_VENDOR_DIR)/redis/connection -name \*.rb -maxdepth 1 -exec sed -i.orig -e 's/require "redis\/connection\//require_relative "/g' *.rb {} \;
+ find $(REDIS_RB_VENDOR_DIR)/redis/connection -name \*.rb -maxdepth 1 -exec sed -i.orig -e 's/require "redis\//require_relative "..\//g' *.rb {} \;
+
+.PHONY=update-redis