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,7 +21,7 @@ module API
21 attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message] 21 attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message]
22 branch_name = attrs.delete(:branch_name) 22 branch_name = attrs.delete(:branch_name)
23 file_path = attrs.delete(:file_path) 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 if result[:status] == :success 26 if result[:status] == :success
27 status(201) 27 status(201)
@@ -51,7 +51,7 @@ module API @@ -51,7 +51,7 @@ module API
51 attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message] 51 attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message]
52 branch_name = attrs.delete(:branch_name) 52 branch_name = attrs.delete(:branch_name)
53 file_path = attrs.delete(:file_path) 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 if result[:status] == :success 56 if result[:status] == :success
57 status(200) 57 status(200)
@@ -81,7 +81,7 @@ module API @@ -81,7 +81,7 @@ module API
81 attrs = attributes_for_keys [:file_path, :branch_name, :commit_message] 81 attrs = attributes_for_keys [:file_path, :branch_name, :commit_message]
82 branch_name = attrs.delete(:branch_name) 82 branch_name = attrs.delete(:branch_name)
83 file_path = attrs.delete(:file_path) 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 if result[:status] == :success 86 if result[:status] == :success
87 status(200) 87 status(200)
lib/api/projects.rb
@@ -102,7 +102,7 @@ module API @@ -102,7 +102,7 @@ module API
102 :visibility_level, 102 :visibility_level,
103 :import_url] 103 :import_url]
104 attrs = map_public_to_visibility_level(attrs) 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 if @project.saved? 106 if @project.saved?
107 present @project, with: Entities::Project 107 present @project, with: Entities::Project
108 else 108 else
@@ -143,7 +143,7 @@ module API @@ -143,7 +143,7 @@ module API
143 :public, 143 :public,
144 :visibility_level] 144 :visibility_level]
145 attrs = map_public_to_visibility_level(attrs) 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 if @project.saved? 147 if @project.saved?
148 present @project, with: Entities::Project 148 present @project, with: Entities::Project
149 else 149 else
lib/tasks/gitlab/import.rake
@@ -66,7 +66,7 @@ namespace :gitlab do @@ -66,7 +66,7 @@ namespace :gitlab do
66 project_params[:namespace_id] = group.id 66 project_params[:namespace_id] = group.id
67 end 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 if project.valid? 71 if project.valid?
72 puts " * Created #{project.name} (#{repo_path})".green 72 puts " * Created #{project.name} (#{repo_path})".green