Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8a936997
Commit
8a936997
authored
Mar 19, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GitHooks scaffold
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
8d2755a2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
0 deletions
+70
-0
app/controllers/projects/git_hooks_controller.rb
app/controllers/projects/git_hooks_controller.rb
+25
-0
app/views/projects/_settings_nav.html.haml
app/views/projects/_settings_nav.html.haml
+4
-0
app/views/projects/git_hooks/index.html.haml
app/views/projects/git_hooks/index.html.haml
+39
-0
config/routes.rb
config/routes.rb
+2
-0
No files found.
app/controllers/projects/git_hooks_controller.rb
0 → 100644
View file @
8a936997
class
Projects::GitHooksController
<
Projects
::
ApplicationController
# Authorize
before_filter
:authorize_admin_project!
respond_to
:html
layout
"project_settings"
def
index
project
.
create_git_hook
unless
project
.
git_hook
@pre_receive_hook
=
project
.
git_hook
end
def
update
@pre_receive_hook
=
project
.
git_hook
@pre_receive_hook
.
update_attributes
(
params
[
:git_hook
])
if
@pre_receive_hook
.
valid?
redirect_to
project_git_hooks_path
(
@project
)
else
render
:index
end
end
end
app/views/projects/_settings_nav.html.haml
View file @
8a936997
...
...
@@ -19,6 +19,10 @@
=
link_to
project_hooks_path
(
@project
)
do
%i
.icon-link
Web Hooks
=
nav_link
(
controller: :git_hooks
)
do
=
link_to
project_git_hooks_path
(
@project
)
do
%i
.icon-upload
Git Hooks
=
nav_link
(
controller: :services
)
do
=
link_to
project_services_path
(
@project
)
do
%i
.icon-cogs
...
...
app/views/projects/git_hooks/index.html.haml
0 → 100644
View file @
8a936997
%h3
.page-title
Pre-receive hook
%p
.light
The first script to run when handling a push from a client is pre-receive hook.
%hr
.clearfix
=
form_for
[
@project
,
@pre_receive_hook
],
html:
{
class:
'form-horizontal'
}
do
|
f
|
-
if
@pre_receive_hook
.
errors
.
any?
.alert.alert-danger
-
@pre_receive_hook
.
errors
.
full_messages
.
each
do
|
msg
|
%p
=
msg
.form-group
=
f
.
label
:deny_delete_tag
,
"Deny tag remove"
,
class:
'control-label'
.col-sm-10
.checkbox
=
f
.
check_box
:deny_delete_tag
%span
.descr
Dont allow users to remove git tags
.form-group
=
f
.
label
:force_push_regex
,
"Force push"
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:force_push_regex
,
class:
"form-control"
%p
.hint
Regular expression for branches to allow force push. Empty - allow force push to any branch
.form-group
=
f
.
label
:delete_branch_regex
,
"Branch removal"
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:delete_branch_regex
,
class:
"form-control"
%p
.hint
Regular expression for branches that can be removed. Empty - allow remove of any branch
.form-group
=
f
.
label
:commit_message_regex
,
"Commit message"
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:commit_message_regex
,
class:
"form-control"
%p
.hint
Commit message must match this regular expression to be pushed. Empty - allow remove of any commit message
.form-actions
=
f
.
submit
"Save git Hook"
,
class:
"btn btn-create"
config/routes.rb
View file @
8a936997
...
...
@@ -291,6 +291,8 @@ Gitlab::Application.routes.draw do
end
end
resources
:git_hooks
,
constraints:
{
id:
/\d+/
}
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
],
constraints:
{
id:
/\d+/
}
do
member
do
get
:test
...
...
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