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
iv
gitlab-ce
Commits
efa10c81
Commit
efa10c81
authored
Jan 16, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace context with service in lib
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
4a1654ed
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
lib/api/files.rb
lib/api/files.rb
+3
-3
lib/api/projects.rb
lib/api/projects.rb
+2
-2
lib/tasks/gitlab/import.rake
lib/tasks/gitlab/import.rake
+1
-1
No files found.
lib/api/files.rb
View file @
efa10c81
...
@@ -21,7 +21,7 @@ module API
...
@@ -21,7 +21,7 @@ module API
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
branch_name
=
attrs
.
delete
(
:branch_name
)
branch_name
=
attrs
.
delete
(
:branch_name
)
file_path
=
attrs
.
delete
(
:file_path
)
file_path
=
attrs
.
delete
(
:file_path
)
result
=
::
Files
::
Create
Context
.
new
(
user_project
,
current_user
,
attrs
,
branch_name
,
file_path
).
execute
result
=
::
Files
::
Create
Service
.
new
(
user_project
,
current_user
,
attrs
,
branch_name
,
file_path
).
execute
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
status
(
201
)
status
(
201
)
...
@@ -51,7 +51,7 @@ module API
...
@@ -51,7 +51,7 @@ module API
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
branch_name
=
attrs
.
delete
(
:branch_name
)
branch_name
=
attrs
.
delete
(
:branch_name
)
file_path
=
attrs
.
delete
(
:file_path
)
file_path
=
attrs
.
delete
(
:file_path
)
result
=
::
Files
::
Update
Context
.
new
(
user_project
,
current_user
,
attrs
,
branch_name
,
file_path
).
execute
result
=
::
Files
::
Update
Service
.
new
(
user_project
,
current_user
,
attrs
,
branch_name
,
file_path
).
execute
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
status
(
200
)
status
(
200
)
...
@@ -81,7 +81,7 @@ module API
...
@@ -81,7 +81,7 @@ module API
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:commit_message
]
branch_name
=
attrs
.
delete
(
:branch_name
)
branch_name
=
attrs
.
delete
(
:branch_name
)
file_path
=
attrs
.
delete
(
:file_path
)
file_path
=
attrs
.
delete
(
:file_path
)
result
=
::
Files
::
Delete
Context
.
new
(
user_project
,
current_user
,
attrs
,
branch_name
,
file_path
).
execute
result
=
::
Files
::
Delete
Service
.
new
(
user_project
,
current_user
,
attrs
,
branch_name
,
file_path
).
execute
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
status
(
200
)
status
(
200
)
...
...
lib/api/projects.rb
View file @
efa10c81
...
@@ -102,7 +102,7 @@ module API
...
@@ -102,7 +102,7 @@ module API
:visibility_level
,
:visibility_level
,
:import_url
]
:import_url
]
attrs
=
map_public_to_visibility_level
(
attrs
)
attrs
=
map_public_to_visibility_level
(
attrs
)
@project
=
::
Projects
::
Create
Context
.
new
(
current_user
,
attrs
).
execute
@project
=
::
Projects
::
Create
Service
.
new
(
current_user
,
attrs
).
execute
if
@project
.
saved?
if
@project
.
saved?
present
@project
,
with:
Entities
::
Project
present
@project
,
with:
Entities
::
Project
else
else
...
@@ -143,7 +143,7 @@ module API
...
@@ -143,7 +143,7 @@ module API
:public
,
:public
,
:visibility_level
]
:visibility_level
]
attrs
=
map_public_to_visibility_level
(
attrs
)
attrs
=
map_public_to_visibility_level
(
attrs
)
@project
=
::
Projects
::
Create
Context
.
new
(
user
,
attrs
).
execute
@project
=
::
Projects
::
Create
Service
.
new
(
user
,
attrs
).
execute
if
@project
.
saved?
if
@project
.
saved?
present
@project
,
with:
Entities
::
Project
present
@project
,
with:
Entities
::
Project
else
else
...
...
lib/tasks/gitlab/import.rake
View file @
efa10c81
...
@@ -66,7 +66,7 @@ namespace :gitlab do
...
@@ -66,7 +66,7 @@ namespace :gitlab do
project_params
[
:namespace_id
]
=
group
.
id
project_params
[
:namespace_id
]
=
group
.
id
end
end
project
=
Projects
::
Create
Context
.
new
(
user
,
project_params
).
execute
project
=
Projects
::
Create
Service
.
new
(
user
,
project_params
).
execute
if
project
.
valid?
if
project
.
valid?
puts
" * Created
#{
project
.
name
}
(
#{
repo_path
}
)"
.
green
puts
" * Created
#{
project
.
name
}
(
#{
repo_path
}
)"
.
green
...
...
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