Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-shell
Commits
6c8c9ff5
Commit
6c8c9ff5
authored
Nov 08, 2013
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bypass shell and use stdlib JSON for GitlabUpdate
parent
e6802540
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
lib/gitlab_config.rb
lib/gitlab_config.rb
+3
-3
lib/gitlab_update.rb
lib/gitlab_update.rb
+4
-2
No files found.
lib/gitlab_config.rb
View file @
6c8c9ff5
...
@@ -48,12 +48,12 @@ class GitlabConfig
...
@@ -48,12 +48,12 @@ class GitlabConfig
if
redis
.
empty?
if
redis
.
empty?
# Default to old method of connecting to redis
# Default to old method of connecting to redis
# for users that haven't updated their configuration
# for users that haven't updated their configuration
"env -i redis-cli"
%W(env -i redis-cli)
else
else
if
redis
.
has_key?
(
"socket"
)
if
redis
.
has_key?
(
"socket"
)
"
#{
redis
[
'bin'
]
}
-s
#{
redis
[
'socket'
]
}
"
%W(
#{
redis
[
'bin'
]
}
-s
#{
redis
[
'socket'
]
}
)
else
else
"
#{
redis
[
'bin'
]
}
-h
#{
redis
[
'host'
]
}
-p
#{
redis
[
'port'
]
}
"
%W(
#{
redis
[
'bin'
]
}
-h
#{
redis
[
'host'
]
}
-p
#{
redis
[
'port'
]
}
)
end
end
end
end
end
end
...
...
lib/gitlab_update.rb
View file @
6c8c9ff5
require_relative
'gitlab_init'
require_relative
'gitlab_init'
require_relative
'gitlab_net'
require_relative
'gitlab_net'
require
'json'
class
GitlabUpdate
class
GitlabUpdate
attr_reader
:config
attr_reader
:config
...
@@ -53,7 +54,8 @@ class GitlabUpdate
...
@@ -53,7 +54,8 @@ class GitlabUpdate
end
end
def
update_redis
def
update_redis
command
=
"
#{
config
.
redis_command
}
rpush '
#{
config
.
redis_namespace
}
:queue:post_receive' '{
\"
class
\"
:
\"
PostReceive
\"
,
\"
args
\"
:[
\"
#{
@repo_path
}
\"
,
\"
#{
@oldrev
}
\"
,
\"
#{
@newrev
}
\"
,
\"
#{
@refname
}
\"
,
\"
#{
@key_id
}
\"
]}' > /dev/null 2>&1"
queue
=
"
#{
config
.
redis_namespace
}
:queue:post_receive"
system
(
command
)
msg
=
JSON
.
dump
({
'class'
=>
'PostReceive'
,
'args'
=>
[
@repo_path
,
@oldrev
,
@newrev
,
@refname
,
@key_id
]})
system
(
*
config
.
redis_command
,
'rpush'
,
queue
,
msg
,
err:
'/dev/null'
,
out:
'/dev/null'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment