File tree 2 files changed +22
-3
lines changed
2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ def authenticate
83
83
end
84
84
85
85
86
+ def get_enumerator
87
+ if RUBY_VERSION == '1.8.7'
88
+ Enumerable ::Enumerator
89
+ else
90
+ Enumerator
91
+ end
92
+ end
93
+
94
+
86
95
def service_rpc
87
96
input = read_body
88
97
@@ -101,7 +110,7 @@ def service_rpc
101
110
pipe . write ( input )
102
111
while !pipe . eof?
103
112
block = pipe . read ( )
104
- self . response_body = Enumerator . new do |y |
113
+ self . response_body = get_enumerator . new do |y |
105
114
y << block . to_s
106
115
end
107
116
end
@@ -147,7 +156,7 @@ def get_info_refs
147
156
hdr_nocache
148
157
149
158
if Rails ::VERSION ::MAJOR >= 3
150
- self . response_body = Enumerator . new do |y |
159
+ self . response_body = get_enumerator . new do |y |
151
160
y << pkt_write ( "# service=git-#{ service_name } \n " )
152
161
y << pkt_flush
153
162
y << refs
Original file line number Diff line number Diff line change 1
1
include ActionView ::Helpers ::TextHelper
2
2
3
+
4
+
3
5
class GitoliteHooksController < ApplicationController
4
6
5
7
skip_before_filter :verify_authenticity_token , :check_if_login_required , :except => :test
@@ -13,6 +15,14 @@ def stub
13
15
render ( :code => 404 )
14
16
end
15
17
18
+ def get_enumerator
19
+ if RUBY_VERSION == '1.8.7'
20
+ Enumerable ::Enumerator
21
+ else
22
+ Enumerator
23
+ end
24
+ end
25
+
16
26
def post_receive
17
27
if not @repository . extra . validate_encoded_time ( params [ :clear_time ] , params [ :encoded_time ] )
18
28
render ( :text => "The hook key provided is not valid. Please let your server admin know about it" )
@@ -25,7 +35,7 @@ def post_receive
25
35
if Rails ::VERSION ::MAJOR >= 3
26
36
self . response . headers [ "Content-Type" ] = "text/plain;"
27
37
28
- self . response_body = Enumerator . new do |y |
38
+ self . response_body = get_enumerator . new do |y |
29
39
# Fetch commits from the repository
30
40
GitHosting . logger . info "[GitHosting] Fetching changesets for '#{ @project . identifier } ' repository"
31
41
y << "Fetching changesets for '#{ @project . identifier } ' repository ... "
You can’t perform that action at this time.
0 commit comments