Commit efa10c819d133407041bc9e89b4d2a43e64552fd

Authored by Dmitriy Zaporozhets
1 parent 4a1654ed

Replace context with service in lib

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
lib/api/files.rb
... ... @@ -21,7 +21,7 @@ module API
21 21 attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message]
22 22 branch_name = attrs.delete(:branch_name)
23 23 file_path = attrs.delete(:file_path)
24   - result = ::Files::CreateContext.new(user_project, current_user, attrs, branch_name, file_path).execute
  24 + result = ::Files::CreateService.new(user_project, current_user, attrs, branch_name, file_path).execute
25 25  
26 26 if result[:status] == :success
27 27 status(201)
... ... @@ -51,7 +51,7 @@ module API
51 51 attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message]
52 52 branch_name = attrs.delete(:branch_name)
53 53 file_path = attrs.delete(:file_path)
54   - result = ::Files::UpdateContext.new(user_project, current_user, attrs, branch_name, file_path).execute
  54 + result = ::Files::UpdateService.new(user_project, current_user, attrs, branch_name, file_path).execute
55 55  
56 56 if result[:status] == :success
57 57 status(200)
... ... @@ -81,7 +81,7 @@ module API
81 81 attrs = attributes_for_keys [:file_path, :branch_name, :commit_message]
82 82 branch_name = attrs.delete(:branch_name)
83 83 file_path = attrs.delete(:file_path)
84   - result = ::Files::DeleteContext.new(user_project, current_user, attrs, branch_name, file_path).execute
  84 + result = ::Files::DeleteService.new(user_project, current_user, attrs, branch_name, file_path).execute
85 85  
86 86 if result[:status] == :success
87 87 status(200)
... ...
lib/api/projects.rb
... ... @@ -102,7 +102,7 @@ module API
102 102 :visibility_level,
103 103 :import_url]
104 104 attrs = map_public_to_visibility_level(attrs)
105   - @project = ::Projects::CreateContext.new(current_user, attrs).execute
  105 + @project = ::Projects::CreateService.new(current_user, attrs).execute
106 106 if @project.saved?
107 107 present @project, with: Entities::Project
108 108 else
... ... @@ -143,7 +143,7 @@ module API
143 143 :public,
144 144 :visibility_level]
145 145 attrs = map_public_to_visibility_level(attrs)
146   - @project = ::Projects::CreateContext.new(user, attrs).execute
  146 + @project = ::Projects::CreateService.new(user, attrs).execute
147 147 if @project.saved?
148 148 present @project, with: Entities::Project
149 149 else
... ...
lib/tasks/gitlab/import.rake
... ... @@ -66,7 +66,7 @@ namespace :gitlab do
66 66 project_params[:namespace_id] = group.id
67 67 end
68 68  
69   - project = Projects::CreateContext.new(user, project_params).execute
  69 + project = Projects::CreateService.new(user, project_params).execute
70 70  
71 71 if project.valid?
72 72 puts " * Created #{project.name} (#{repo_path})".green
... ...