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
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
Léo-Paul Géneau
gitlab-ce
Commits
7f50c7f6
Commit
7f50c7f6
authored
Mar 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move project creation to service
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e603da73
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
25 deletions
+24
-25
app/observers/project_observer.rb
app/observers/project_observer.rb
+1
-25
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+23
-0
No files found.
app/observers/project_observer.rb
View file @
7f50c7f6
class
ProjectObserver
<
BaseObserver
def
after_create
(
project
)
project
.
update_column
(
:last_activity_at
,
project
.
created_at
)
return
true
if
project
.
forked?
if
project
.
import?
RepositoryImportWorker
.
perform_in
(
5
.
seconds
,
project
.
id
)
else
GitlabShellWorker
.
perform_async
(
:add_repository
,
project
.
path_with_namespace
)
log_info
(
"
#{
project
.
owner
.
name
}
created a new project
\"
#{
project
.
name_with_namespace
}
\"
"
)
end
if
project
.
wiki_enabled?
begin
# force the creation of a wiki,
GollumWiki
.
new
(
project
,
project
.
owner
).
wiki
rescue
GollumWiki
::
CouldNotCreateWikiError
=>
ex
# Prevent project observer crash
# if failed to create wiki
nil
end
end
end
def
after_update
(
project
)
project
.
send_move_instructions
if
project
.
namespace_id_changed?
project
.
rename_repo
if
project
.
path_changed?
...
...
app/services/projects/create_service.rb
View file @
7f50c7f6
...
...
@@ -58,6 +58,29 @@ module Projects
user:
current_user
)
end
@project
.
update_column
(
:last_activity_at
,
@project
.
created_at
)
if
@project
.
import?
RepositoryImportWorker
.
perform_in
(
5
.
seconds
,
@project
.
id
)
else
GitlabShellWorker
.
perform_async
(
:add_repository
,
@project
.
path_with_namespace
)
end
if
@project
.
wiki_enabled?
begin
# force the creation of a wiki,
GollumWiki
.
new
(
@project
,
@project
.
owner
).
wiki
rescue
GollumWiki
::
CouldNotCreateWikiError
=>
ex
# Prevent project observer crash
# if failed to create wiki
nil
end
end
end
@project
...
...
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