summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-10 13:34:52 +0000
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-10 13:34:52 +0000
commitff31080b0d5b5e7c99bfe7738aaa2bb1fafe60fb (patch)
tree7eaa0a431db32549d8897bbc911b75b117b27526
parent6a88498bf9175276aaf09976dfd19f312454fc05 (diff)
parentc28af5c6ada34be1b05b7cf8c034949fdb9d5212 (diff)
downloadgitlab-shell-ff31080b0d5b5e7c99bfe7738aaa2bb1fafe60fb.tar.gz
Merge branch 'fix/ruby-2.2-webrick' into 'master'
workaround for webrick issue on ruby 2.2 Workaround that fixes https://gitlab.com/gitlab-org/gitlab-shell/issues/36 See merge request !38
-rw-r--r--.gitlab-ci.yml22
-rw-r--r--spec/httpunix_spec.rb17
2 files changed, 39 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 784e8d5..5f10abf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,5 @@
+image: "ruby:2.2"
+
before_script:
- export PATH=~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
- apt-get update
@@ -6,6 +8,7 @@ before_script:
- cp config.yml.example config.yml
- bundle install
+#ruby 2.2
rspec:
script:
- bundle exec rspec spec
@@ -21,3 +24,22 @@ rubocop:
- ruby
except:
- tags
+
+#ruby 2.1
+rspec:ruby2.1:
+ image: ruby:2.1
+ script:
+ - bundle exec rspec spec
+ tags:
+ - ruby
+ except:
+ - tags
+
+rubocop:ruby2.1:
+ image: ruby:2.1
+ script:
+ - bundle exec rubocop
+ tags:
+ - ruby
+ except:
+ - tags
diff --git a/spec/httpunix_spec.rb b/spec/httpunix_spec.rb
index cd2ede9..0fcff4a 100644
--- a/spec/httpunix_spec.rb
+++ b/spec/httpunix_spec.rb
@@ -24,6 +24,23 @@ class HTTPUNIXServer < WEBrick::HTTPServer
socket.close
@listeners << server
end
+
+ # Workaround:
+ # https://bugs.ruby-lang.org/issues/10956
+ # Affecting Ruby 2.2
+ # Fix for 2.2 is at https://github.com/ruby/ruby/commit/ab0a64e1
+ # However, this doesn't work with 2.1. The following should work for both:
+ def start(&block)
+ @shutdown_pipe = IO.pipe
+ shutdown_pipe = @shutdown_pipe
+ super(&block)
+ end
+
+ def cleanup_shutdown_pipe(shutdown_pipe)
+ @shutdown_pipe = nil
+ return if !shutdown_pipe
+ super(shutdown_pipe)
+ end
end
def tmp_socket_path