Commit e88ec0a4 authored by Stan Hu's avatar Stan Hu

Put redis library in lib/vendor/ and adjust LOAD_PATH

parent 729470d3
......@@ -8,4 +8,3 @@ coverage/
.bundle
tags
.bundle/
*.orig
......@@ -964,7 +964,7 @@ AllCops:
- 'bin/**/*'
- 'lib/backup/**/*'
- 'lib/tasks/**/*'
- 'lib/vendor/**/*'
- 'lib/email_validator.rb'
- 'lib/gitlab/upgrader.rb'
- 'lib/gitlab/seeder.rb'
- 'lib/vendor/**/*'
REDIS_RB_VERSION=v3.3.0
REDIS_RB_TMP_DIR := $(shell mktemp -d)
REDIS_RB_VENDOR_DIR=lib/vendor
REDIS_RB_VENDOR_DIR=lib/vendor/redis
PWD=`pwd`
all:
update-redis:
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 {} \;
rm -rf $(REDIS_RB_VENDOR_DIR)
git clone -b $(REDIS_RB_VERSION) https://github.com/redis/redis-rb.git $(REDIS_RB_VENDOR_DIR)
rm -rf $(REDIS_RB_VENDOR_DIR)/.git
.PHONY=update-redis
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'vendor/redis/lib')))
require 'yaml'
class GitlabConfig
......
require 'net/http'
require 'openssl'
require 'json'
require 'redis'
require_relative 'gitlab_config'
require_relative 'gitlab_logger'
require_relative 'gitlab_access'
require_relative 'httpunix'
require_relative 'vendor/redis'
class GitlabNet
class ApiUnreachableError < StandardError; end
......
require "monitor"
require_relative "redis/errors"
require "redis/errors"
class Redis
......@@ -2766,8 +2766,8 @@ private
end
require_relative "redis/version"
require_relative "redis/connection"
require_relative "redis/client"
require_relative "redis/pipeline"
require_relative "redis/subscribe"
require "redis/version"
require "redis/connection"
require "redis/client"
require "redis/pipeline"
require "redis/subscribe"
require_relative "errors"
require "redis/errors"
require "socket"
require "cgi"
......@@ -478,7 +478,7 @@ class Redis
if driver.kind_of?(String)
begin
require_relative "connection/#{driver}"
require "redis/connection/#{driver}"
driver = Connection.const_get(driver.capitalize)
rescue LoadError, NameError
raise RuntimeError, "Cannot load driver #{driver.inspect}"
......
require_relative "connection/registry"
require "redis/connection/registry"
# If a connection driver was required before this file, the array
# Redis::Connection.drivers will contain one or more classes. The last driver
......@@ -6,4 +6,4 @@ require_relative "connection/registry"
# the plain Ruby driver as our default. Another driver can be required at a
# later point in time, causing it to be the last element of the #drivers array
# and therefore be chosen by default.
require_relative "connection/ruby" if Redis::Connection.drivers.empty?
require "redis/connection/ruby" if Redis::Connection.drivers.empty?
\ No newline at end of file
require_relative "registry"
require_relative "../errors"
require "redis/connection/registry"
require "redis/errors"
require "hiredis/connection"
require "timeout"
......
require_relative "registry"
require_relative "command_helper"
require_relative "../errors"
require "redis/connection/registry"
require "redis/connection/command_helper"
require "redis/errors"
require "socket"
require "timeout"
......
require_relative "command_helper"
require_relative "registry"
require_relative "../errors"
require "redis/connection/command_helper"
require "redis/connection/registry"
require "redis/errors"
require "em-synchrony"
require "hiredis/reader"
......
require_relative "hash_ring"
require "redis/hash_ring"
class Redis
class Distributed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment