Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1219 from tsigo/ruby19_hashes

Fully embrace Ruby 1.9 hash syntax
  • Loading branch information...
commit ac525a74ee2862d0012a443059954288d4634acd 2 parents 1413c23 + 42d3295
@randx randx authored
Showing with 1,448 additions and 1,448 deletions.
  1. +5 −5 app/contexts/commit_load.rb
  2. +3 −3 app/contexts/issues_bulk_update_context.rb
  3. +3 −3 app/controllers/admin/projects_controller.rb
  4. +1 −1  app/controllers/admin/users_controller.rb
  5. +7 −7 app/controllers/application_controller.rb
  6. +5 −5 app/controllers/commits_controller.rb
  7. +2 −2 app/controllers/dashboard_controller.rb
  8. +1 −1  app/controllers/deploy_keys_controller.rb
  9. +1 −1  app/controllers/hooks_controller.rb
  10. +14 −14 app/controllers/issues_controller.rb
  11. +1 −1  app/controllers/keys_controller.rb
  12. +9 −9 app/controllers/merge_requests_controller.rb
  13. +3 −3 app/controllers/milestones_controller.rb
  14. +3 −3 app/controllers/notes_controller.rb
  15. +1 −1  app/controllers/profile_controller.rb
  16. +5 −5 app/controllers/projects_controller.rb
  17. +2 −2 app/controllers/protected_branches_controller.rb
  18. +7 −7 app/controllers/refs_controller.rb
  19. +2 −2 app/controllers/search_controller.rb
  20. +8 −8 app/controllers/snippets_controller.rb
  21. +2 −2 app/controllers/team_members_controller.rb
  22. +8 −8 app/controllers/wikis_controller.rb
  23. +1 −1  app/decorators/application_decorator.rb
  24. +1 −1  app/decorators/event_decorator.rb
  25. +3 −3 app/decorators/tree_decorator.rb
  26. +15 −15 app/helpers/application_helper.rb
  27. +10 −10 app/helpers/gitlab_markdown_helper.rb
  28. +2 −2 app/helpers/issues_helper.rb
  29. +6 −6 app/helpers/merge_requests_helper.rb
  30. +2 −2 app/helpers/tab_helper.rb
  31. +10 −10 app/mailers/notify.rb
  32. +6 −6 app/models/commit.rb
  33. +6 −6 app/models/event.rb
  34. +1 −1  app/models/issue.rb
  35. +6 −6 app/models/key.rb
  36. +10 −10 app/models/merge_request.rb
  37. +1 −1  app/models/milestone.rb
  38. +19 −19 app/models/note.rb
  39. +36 −36 app/models/project.rb
  40. +10 −10 app/models/snippet.rb
  41. +1 −1  app/models/tree.rb
  42. +36 −36 app/models/user.rb
  43. +5 −5 app/models/users_project.rb
  44. +3 −3 app/models/wiki.rb
  45. +10 −10 app/observers/activity_observer.rb
  46. +1 −1  app/observers/mailer_observer.rb
  47. +2 −2 app/roles/account.rb
  48. +13 −13 app/roles/authority.rb
  49. +14 −14 app/roles/issue_commonality.rb
  50. +5 −5 app/roles/project_push.rb
  51. +1 −1  app/roles/ssh_key.rb
  52. +2 −2 app/roles/team.rb
  53. +2 −2 app/uploaders/attachment_uploader.rb
  54. +4 −4 app/views/admin/dashboard/index.html.haml
  55. +6 −6 app/views/admin/hooks/index.html.haml
  56. +6 −6 app/views/admin/projects/_form.html.haml
  57. +1 −1  app/views/admin/projects/edit.html.haml
  58. +8 −8 app/views/admin/projects/index.html.haml
  59. +1 −1  app/views/admin/projects/new.html.haml
  60. +10 −10 app/views/admin/projects/show.html.haml
  61. +1 −1  app/views/admin/resque/show.html.haml
  62. +4 −4 app/views/admin/team_members/_form.html.haml
  63. +10 −10 app/views/admin/users/_form.html.haml
  64. +17 −17 app/views/admin/users/index.html.haml
  65. +11 −11 app/views/admin/users/show.html.haml
  66. +4 −4 app/views/commits/_commit.html.haml
  67. +3 −3 app/views/commits/_commit_box.html.haml
  68. +4 −4 app/views/commits/_diff_head.html.haml
  69. +8 −8 app/views/commits/_diffs.html.haml
  70. +8 −8 app/views/commits/_head.html.haml
  71. +7 −7 app/views/commits/_text_file.html.haml
  72. +5 −5 app/views/commits/compare.html.haml
  73. +3 −3 app/views/commits/index.html.haml
  74. +1 −1  app/views/commits/index.js.haml
  75. +2 −2 app/views/commits/show.html.haml
  76. +9 −9 app/views/dashboard/index.html.haml
  77. +2 −2 app/views/dashboard/issues.html.haml
  78. +2 −2 app/views/dashboard/merge_requests.html.haml
  79. +4 −4 app/views/deploy_keys/_form.html.haml
  80. +2 −2 app/views/deploy_keys/_show.html.haml
  81. +2 −2 app/views/deploy_keys/index.html.haml
  82. +1 −1  app/views/deploy_keys/show.html.haml
  83. +6 −6 app/views/devise/passwords/edit.html.haml
  84. +1 −1  app/views/errors/access_denied.html.haml
  85. +3 −3 app/views/events/_commit.html.haml
  86. +3 −3 app/views/events/_event.html.haml
  87. +2 −2 app/views/events/_event_issue.html.haml
  88. +4 −4 app/views/events/_event_last_push.html.haml
  89. +2 −2 app/views/events/_event_merge_request.html.haml
  90. +5 −5 app/views/events/_event_push.html.haml
  91. +4 −4 app/views/help/api.html.haml
  92. +6 −6 app/views/hooks/index.html.haml
  93. +11 −11 app/views/issues/_form.html.haml
  94. +6 −6 app/views/issues/_head.html.haml
  95. +2 −2 app/views/issues/_issues.html.haml
  96. +8 −8 app/views/issues/_show.html.haml
  97. +1 −1  app/views/issues/create.js.haml
  98. +22 −22 app/views/issues/index.html.haml
  99. +7 −7 app/views/issues/show.html.haml
  100. +1 −1  app/views/kaminari/admin/_first_page.html.haml
  101. +1 −1  app/views/kaminari/admin/_last_page.html.haml
  102. +1 −1  app/views/kaminari/admin/_next_page.html.haml
  103. +2 −2 app/views/kaminari/admin/_page.html.haml
  104. +2 −2 app/views/kaminari/admin/_prev_page.html.haml
  105. +1 −1  app/views/kaminari/gitlab/_first_page.html.haml
  106. +1 −1  app/views/kaminari/gitlab/_last_page.html.haml
  107. +1 −1  app/views/kaminari/gitlab/_next_page.html.haml
  108. +2 −2 app/views/kaminari/gitlab/_page.html.haml
  109. +1 −1  app/views/kaminari/gitlab/_prev_page.html.haml
  110. +3 −3 app/views/keys/_form.html.haml
  111. +1 −1  app/views/keys/_show.html.haml
  112. +1 −1  app/views/keys/create.js.haml
  113. +3 −3 app/views/keys/index.html.haml
  114. +1 −1  app/views/keys/show.html.haml
  115. +6 −6 app/views/layouts/_app_menu.html.haml
  116. +1 −1  app/views/layouts/_flash.html.haml
  117. +4 −4 app/views/layouts/_head.html.haml
  118. +8 −8 app/views/layouts/_head_panel.html.haml
  119. +9 −9 app/views/layouts/_project_menu.html.haml
  120. +9 −9 app/views/layouts/admin.html.haml
  121. +4 −4 app/views/layouts/application.html.haml
  122. +2 −2 app/views/layouts/devise_layout.html.haml
  123. +3 −3 app/views/layouts/error.html.haml
  124. +14 −14 app/views/layouts/notify.html.haml
  125. +8 −8 app/views/layouts/profile.html.haml
  126. +4 −4 app/views/layouts/project.html.haml
  127. +10 −10 app/views/merge_requests/_form.html.haml
  128. +1 −1  app/views/merge_requests/_head.html.haml
  129. +3 −3 app/views/merge_requests/_merge_request.html.haml
  130. +4 −4 app/views/merge_requests/_show.html.haml
  131. +1 −1  app/views/merge_requests/branch_from.js.haml
  132. +1 −1  app/views/merge_requests/branch_to.js.haml
  133. +1 −1  app/views/merge_requests/commits.js.haml
  134. +1 −1  app/views/merge_requests/diffs.js.haml
  135. +10 −10 app/views/merge_requests/index.html.haml
  136. +1 −1  app/views/merge_requests/show.js.haml
  137. +3 −3 app/views/merge_requests/show/_commits.html.haml
  138. +2 −2 app/views/merge_requests/show/_diffs.html.haml
  139. +1 −1  app/views/merge_requests/show/_how_to_merge.html.haml
  140. +8 −8 app/views/merge_requests/show/_mr_accept.html.haml
  141. +2 −2 app/views/merge_requests/show/_mr_box.html.haml
  142. +3 −3 app/views/merge_requests/show/_mr_title.html.haml
  143. +11 −11 app/views/milestones/_form.html.haml
  144. +5 −5 app/views/milestones/_milestone.html.haml
  145. +6 −6 app/views/milestones/index.html.haml
  146. +6 −6 app/views/milestones/show.html.haml
  147. +1 −1  app/views/notes/_create_common.js.haml
  148. +2 −2 app/views/notes/_create_line.js.haml
  149. +6 −6 app/views/notes/_form.html.haml
  150. +3 −3 app/views/notes/_load.js.haml
  151. +1 −1  app/views/notes/_notes_list.html.haml
  152. +6 −6 app/views/notes/_per_line_form.html.haml
  153. +2 −2 app/views/notes/_per_line_show.html.haml
  154. +2 −2 app/views/notes/_reply_button.html.haml
  155. +4 −4 app/views/notes/_show.html.haml
  156. +2 −2 app/views/notes/create.js.haml
  157. +10 −10 app/views/notify/new_issue_email.html.haml
  158. +11 −11 app/views/notify/new_merge_request_email.html.haml
  159. +13 −13 app/views/notify/new_user_email.html.haml
  160. +15 −15 app/views/notify/note_commit_email.html.haml
  161. +15 −15 app/views/notify/note_issue_email.html.haml
  162. +15 −15 app/views/notify/note_merge_request_email.html.haml
  163. +15 −15 app/views/notify/note_wall_email.html.haml
  164. +15 −15 app/views/notify/note_wiki_email.html.haml
  165. +10 −10 app/views/notify/reassigned_issue_email.html.haml
  166. +10 −10 app/views/notify/reassigned_merge_request_email.html.haml
  167. +5 −5 app/views/profile/design.html.haml
  168. +2 −2 app/views/profile/password.html.haml
  169. +17 −17 app/views/profile/show.html.haml
  170. +4 −4 app/views/profile/token.html.haml
  171. +8 −8 app/views/projects/_form.html.haml
  172. +5 −5 app/views/projects/_new_form.html.haml
  173. +12 −12 app/views/projects/_project_head.html.haml
  174. +2 −2 app/views/projects/_refs.html.haml
  175. +3 −3 app/views/projects/_show.html.haml
  176. +1 −1  app/views/projects/_team.html.haml
  177. +1 −1  app/views/projects/create.js.haml
  178. +2 −2 app/views/projects/empty.html.haml
  179. +2 −2 app/views/projects/files.html.haml
  180. +7 −7 app/views/projects/show.html.haml
  181. +3 −3 app/views/projects/team.html.haml
  182. +1 −1  app/views/projects/tree.js.haml
  183. +1 −1  app/views/projects/update.js.haml
  184. +1 −1  app/views/projects/wall.html.haml
  185. +7 −7 app/views/protected_branches/index.html.haml
  186. +3 −3 app/views/refs/_head.html.haml
  187. +3 −3 app/views/refs/_submodule_item.html.haml
  188. +9 −9 app/views/refs/_tree.html.haml
  189. +1 −1  app/views/refs/_tree_commit.html.haml
  190. +7 −7 app/views/refs/_tree_file.html.haml
  191. +3 −3 app/views/refs/_tree_item.html.haml
  192. +6 −6 app/views/refs/blame.html.haml
  193. +1 −1  app/views/refs/logs_tree.js.haml
  194. +1 −1  app/views/refs/tree.html.haml
  195. +1 −1  app/views/refs/tree.js.haml
  196. +6 −6 app/views/repositories/_branch.html.haml
  197. +3 −3 app/views/repositories/_branches_head.html.haml
  198. +3 −3 app/views/repositories/_feed.html.haml
  199. +1 −1  app/views/repositories/branches.html.haml
  200. +1 −1  app/views/repositories/show.html.haml
  201. +4 −4 app/views/repositories/tags.html.haml
  202. +5 −5 app/views/search/show.html.haml
  203. +7 −7 app/views/snippets/_form.html.haml
  204. +2 −2 app/views/snippets/_snippet.html.haml
  205. +2 −2 app/views/snippets/index.html.haml
  206. +4 −4 app/views/snippets/show.html.haml
  207. +5 −5 app/views/team_members/_form.html.haml
  208. +7 −7 app/views/team_members/_show.html.haml
  209. +6 −6 app/views/team_members/show.html.haml
  210. +4 −4 app/views/wikis/_form.html.haml
  211. +1 −1  app/views/wikis/history.html.haml
  212. +1 −1  app/views/wikis/pages.html.haml
  213. +5 −5 app/views/wikis/show.html.haml
  214. +1 −1  lib/api.rb
  215. +6 −6 lib/api/entities.rb
  216. +16 −16 lib/api/issues.rb
  217. +16 −16 lib/api/projects.rb
  218. +3 −3 lib/api/users.rb
  219. +2 −2 lib/file_size_validator.rb
  220. +1 −1  lib/gitlab/encode.rb
  221. +1 −1  lib/graph_commit.rb
  222. +2 −2 lib/redcarpet/render/gitlab_html.rb
  223. +4 −4 spec/api/issues_spec.rb
  224. +4 −4 spec/api/projects_spec.rb
  225. +50 −50 spec/helpers/gitlab_flavored_markdown_spec.rb
  226. +13 −13 spec/mailers/notify_spec.rb
  227. +4 −4 spec/models/activity_observer_spec.rb
  228. +15 −15 spec/models/event_spec.rb
  229. +8 −8 spec/models/issue_observer_spec.rb
  230. +16 −16 spec/models/issue_spec.rb
  231. +8 −8 spec/models/merge_request_spec.rb
  232. +4 −4 spec/models/milestone_spec.rb
  233. +17 −17 spec/models/note_spec.rb
  234. +1 −1  spec/models/project_hooks_spec.rb
  235. +4 −4 spec/models/project_security_spec.rb
  236. +10 −10 spec/models/project_spec.rb
  237. +2 −2 spec/models/protected_branch_spec.rb
  238. +1 −1  spec/models/system_hook_spec.rb
  239. +7 −7 spec/models/user_spec.rb
  240. +3 −3 spec/requests/admin/admin_hooks_spec.rb
  241. +8 −8 spec/requests/admin/admin_projects_spec.rb
  242. +8 −8 spec/requests/admin/admin_users_spec.rb
  243. +17 −17 spec/requests/atom/dashboard_issues_spec.rb
  244. +3 −3 spec/requests/atom/dashboard_spec.rb
  245. +10 −10 spec/requests/atom/issues_spec.rb
  246. +40 −40 spec/requests/gitlab_flavored_markdown_spec.rb
  247. +3 −3 spec/requests/hooks_spec.rb
  248. +15 −15 spec/requests/issues_spec.rb
  249. +4 −4 spec/requests/projects_deploy_keys_spec.rb
  250. +4 −4 spec/requests/projects_spec.rb
  251. +1 −1  spec/requests/search_spec.rb
  252. +3 −3 spec/requests/security/project_access_spec.rb
  253. +10 −10 spec/requests/snippets_spec.rb
  254. +3 −3 spec/spec_helper.rb
  255. +9 −9 spec/support/login.rb
  256. +1 −1  spec/workers/post_receive_spec.rb
View
10 app/contexts/commit_load.rb
@@ -1,11 +1,11 @@
class CommitLoad < BaseContext
def execute
result = {
- :commit => nil,
- :suppress_diff => false,
- :line_notes => [],
- :notes_count => 0,
- :note => nil
+ commit: nil,
+ suppress_diff: false,
+ line_notes: [],
+ notes_count: 0,
+ note: nil
}
commit = project.commit(params[:id])
View
6 app/contexts/issues_bulk_update_context.rb
@@ -12,12 +12,12 @@ def execute
opts[:assignee_id] = assignee_id if assignee_id.present?
opts[:closed] = (status == "closed") if status.present?
- issues = Issue.where(:id => issues_ids).all
+ issues = Issue.where(id: issues_ids).all
issues = issues.select { |issue| can?(current_user, :modify_issue, issue) }
issues.each { |issue| issue.update_attributes(opts) }
{
- :count => issues.count,
- :success => !issues.count.zero?
+ count: issues.count,
+ success: !issues.count.zero?
}
end
end
View
6 app/controllers/admin/projects_controller.rb
@@ -2,7 +2,7 @@ class Admin::ProjectsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
- before_filter :admin_project, :only => [:edit, :show, :update, :destroy, :team_update]
+ before_filter :admin_project, only: [:edit, :show, :update, :destroy, :team_update]
def index
@admin_projects = Project.scoped
@@ -36,7 +36,7 @@ def create
if @admin_project.save
redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
else
- render :action => "new"
+ render action: "new"
end
end
@@ -50,7 +50,7 @@ def update
if @admin_project.update_attributes(params[:project])
redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
else
- render :action => "edit"
+ render action: "edit"
end
end
View
2  app/controllers/admin/users_controller.rb
@@ -34,7 +34,7 @@ def team_update
def new
- @admin_user = User.new(:projects_limit => Gitlab.config.default_projects_limit)
+ @admin_user = User.new(projects_limit: Gitlab.config.default_projects_limit)
end
def edit
View
14 app/controllers/application_controller.rb
@@ -11,15 +11,15 @@ class ApplicationController < ActionController::Base
helper_method :abilities, :can?
rescue_from Gitlab::Gitolite::AccessDenied do |exception|
- render "errors/gitolite", :layout => "error"
+ render "errors/gitolite", layout: "error"
end
rescue_from Encoding::CompatibilityError do |exception|
- render "errors/encoding", :layout => "error", :status => 404
+ render "errors/encoding", layout: "error", status: 404
end
rescue_from ActiveRecord::RecordNotFound do |exception|
- render "errors/not_found", :layout => "error", :status => 404
+ render "errors/not_found", layout: "error", status: 404
end
layout :layout_by_resource
@@ -97,15 +97,15 @@ def authorize_code_access!
end
def access_denied!
- render "errors/access_denied", :layout => "error", :status => 404
+ render "errors/access_denied", layout: "error", status: 404
end
def not_found!
- render "errors/not_found", :layout => "error", :status => 404
+ render "errors/not_found", layout: "error", status: 404
end
def git_not_found!
- render "errors/git_not_found", :layout => "error", :status => 404
+ render "errors/git_not_found", layout: "error", status: 404
end
def method_missing(method_sym, *arguments, &block)
@@ -127,7 +127,7 @@ def load_refs
end
def render_404
- render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404"
+ render file: File.join(Rails.root, "public", "404"), layout: false, status: "404"
end
def require_non_empty_project
View
10 app/controllers/commits_controller.rb
@@ -9,7 +9,7 @@ class CommitsController < ApplicationController
before_filter :authorize_read_project!
before_filter :authorize_code_access!
before_filter :require_non_empty_project
- before_filter :load_refs, :only => :index # load @branch, @tag & @ref
+ before_filter :load_refs, only: :index # load @branch, @tag & @ref
before_filter :render_full_content
def index
@@ -22,7 +22,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.js
- format.atom { render :layout => false }
+ format.atom { render layout: false }
end
end
@@ -61,9 +61,9 @@ def patch
send_data(
@commit.to_patch,
- :type => "text/plain",
- :disposition => 'attachment',
- :filename => (@commit.id.to_s + ".patch")
+ type: "text/plain",
+ disposition: 'attachment',
+ filename: (@commit.id.to_s + ".patch")
)
end
end
View
4 app/controllers/dashboard_controller.rb
@@ -9,7 +9,7 @@ def index
respond_to do |format|
format.html
format.js
- format.atom { render :layout => false }
+ format.atom { render layout: false }
end
end
@@ -28,7 +28,7 @@ def issues
respond_to do |format|
format.html
- format.atom { render :layout => false }
+ format.atom { render layout: false }
end
end
end
View
2  app/controllers/deploy_keys_controller.rb
@@ -40,7 +40,7 @@ def destroy
respond_to do |format|
format.html { redirect_to project_deploy_keys_url }
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
end
View
2  app/controllers/hooks_controller.rb
@@ -6,7 +6,7 @@ class HooksController < ApplicationController
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
- before_filter :authorize_admin_project!, :only => [:new, :create, :destroy]
+ before_filter :authorize_admin_project!, only: [:new, :create, :destroy]
respond_to :html
View
28 app/controllers/issues_controller.rb
@@ -2,7 +2,7 @@ class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
- before_filter :issue, :only => [:edit, :update, :destroy, :show]
+ before_filter :issue, only: [:edit, :update, :destroy, :show]
helper_method :issues_filter
layout "project"
@@ -14,13 +14,13 @@ class IssuesController < ApplicationController
before_filter :authorize_read_issue!
# Allow write(create) issue
- before_filter :authorize_write_issue!, :only => [:new, :create]
+ before_filter :authorize_write_issue!, only: [:new, :create]
# Allow modify issue
- before_filter :authorize_modify_issue!, :only => [:close, :edit, :update]
+ before_filter :authorize_modify_issue!, only: [:close, :edit, :update]
# Allow destroy issue
- before_filter :authorize_admin_issue!, :only => [:destroy]
+ before_filter :authorize_admin_issue!, only: [:destroy]
respond_to :js, :html
@@ -32,7 +32,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.js
- format.atom { render :layout => false }
+ format.atom { render layout: false }
end
end
@@ -46,7 +46,7 @@ def edit
end
def show
- @note = @project.notes.new(:noteable => @issue)
+ @note = @project.notes.new(noteable: @issue)
respond_to do |format|
format.html
@@ -66,7 +66,7 @@ def create
end
def update
- @issue.update_attributes(params[:issue].merge(:author_id_of_changes => current_user.id))
+ @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))
respond_to do |format|
format.js
@@ -87,20 +87,20 @@ def destroy
respond_to do |format|
format.html { redirect_to project_issues_path }
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
def sort
return render_404 unless can?(current_user, :admin_issue, @project)
- @issues = @project.issues.where(:id => params['issue'])
+ @issues = @project.issues.where(id: params['issue'])
@issues.each do |issue|
issue.position = params['issue'].index(issue.id.to_s) + 1
issue.save
end
- render :nothing => true
+ render nothing: true
end
def search
@@ -110,12 +110,12 @@ def search
@issues = @issues.where("title LIKE ?", "%#{terms}%") unless terms.blank?
@issues = @issues.page(params[:page]).per(100)
- render :partial => 'issues'
+ render partial: 'issues'
end
def bulk_update
result = IssuesBulkUpdateContext.new(project, current_user, params).execute
- redirect_to :back, :notice => "#{result[:count]} issues updated"
+ redirect_to :back, notice: "#{result[:count]} issues updated"
end
protected
@@ -144,8 +144,8 @@ def issues_filtered
else @project.issues.opened
end
- @issues = @issues.where(:assignee_id => params[:assignee_id]) if params[:assignee_id].present?
- @issues = @issues.where(:milestone_id => params[:milestone_id]) if params[:milestone_id].present?
+ @issues = @issues.where(assignee_id: params[:assignee_id]) if params[:assignee_id].present?
+ @issues = @issues.where(milestone_id: params[:milestone_id]) if params[:milestone_id].present?
@issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
@issues = @issues.includes(:author, :project).order("updated_at")
@issues
View
2  app/controllers/keys_controller.rb
@@ -29,7 +29,7 @@ def destroy
respond_to do |format|
format.html { redirect_to keys_url }
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
end
View
18 app/controllers/merge_requests_controller.rb
@@ -2,9 +2,9 @@ class MergeRequestsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
- before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw]
- before_filter :validates_merge_request, :only => [:show, :diffs, :raw]
- before_filter :define_show_vars, :only => [:show, :diffs]
+ before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :raw]
+ before_filter :validates_merge_request, only: [:show, :diffs, :raw]
+ before_filter :define_show_vars, only: [:show, :diffs]
layout "project"
# Authorize
@@ -14,13 +14,13 @@ class MergeRequestsController < ApplicationController
before_filter :authorize_read_merge_request!
# Allow write(create) merge_request
- before_filter :authorize_write_merge_request!, :only => [:new, :create]
+ before_filter :authorize_write_merge_request!, only: [:new, :create]
# Allow modify merge_request
- before_filter :authorize_modify_merge_request!, :only => [:close, :edit, :update, :sort]
+ before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort]
# Allow destroy merge_request
- before_filter :authorize_admin_merge_request!, :only => [:destroy]
+ before_filter :authorize_admin_merge_request!, only: [:destroy]
def index
@@ -66,7 +66,7 @@ def create
end
def update
- if @merge_request.update_attributes(params[:merge_request].merge(:author_id_of_changes => current_user.id))
+ if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id))
@merge_request.reload_code
@merge_request.mark_as_unchecked
redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.'
@@ -79,7 +79,7 @@ def automerge_check
if @merge_request.unchecked?
@merge_request.check_if_can_be_merged
end
- render :json => {:state => @merge_request.human_state}
+ render json: {state: @merge_request.human_state}
end
def automerge
@@ -138,7 +138,7 @@ def validates_merge_request
def define_show_vars
# Build a note object for comment form
- @note = @project.notes.new(:noteable => @merge_request)
+ @note = @project.notes.new(noteable: @merge_request)
# Get commits from repository
# or from cache if already merged
View
6 app/controllers/milestones_controller.rb
@@ -2,7 +2,7 @@ class MilestonesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
- before_filter :milestone, :only => [:edit, :update, :destroy, :show]
+ before_filter :milestone, only: [:edit, :update, :destroy, :show]
layout "project"
# Authorize
@@ -12,7 +12,7 @@ class MilestonesController < ApplicationController
before_filter :authorize_read_milestone!
# Allow admin milestone
- before_filter :authorize_admin_milestone!, :except => [:index, :show]
+ before_filter :authorize_admin_milestone!, except: [:index, :show]
respond_to :html
@@ -77,7 +77,7 @@ def destroy
respond_to do |format|
format.html { redirect_to project_milestones_path }
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
View
6 app/controllers/notes_controller.rb
@@ -5,7 +5,7 @@ class NotesController < ApplicationController
before_filter :add_project_abilities
before_filter :authorize_read_note!
- before_filter :authorize_write_note!, :only => [:create]
+ before_filter :authorize_write_note!, only: [:create]
respond_to :js
@@ -29,12 +29,12 @@ def destroy
@note.destroy
respond_to do |format|
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
def preview
- render :text => view_context.markdown(params[:note])
+ render text: view_context.markdown(params[:note])
end
protected
View
2  app/controllers/profile_controller.rb
@@ -26,7 +26,7 @@ def password_update
flash[:notice] = "Password was successfully updated. Please login with it"
redirect_to new_user_session_path
else
- render :action => "password"
+ render action: "password"
end
end
View
10 app/controllers/projects_controller.rb
@@ -1,14 +1,14 @@
require File.join(Rails.root, 'lib', 'graph_commit')
class ProjectsController < ApplicationController
- before_filter :project, :except => [:index, :new, :create]
+ before_filter :project, except: [:index, :new, :create]
layout :determine_layout
# Authorize
before_filter :add_project_abilities
- before_filter :authorize_read_project!, :except => [:index, :new, :create]
- before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
- before_filter :require_non_empty_project, :only => [:blob, :tree, :graph]
+ before_filter :authorize_read_project!, except: [:index, :new, :create]
+ before_filter :authorize_admin_project!, only: [:edit, :update, :destroy]
+ before_filter :require_non_empty_project, only: [:blob, :tree, :graph]
def new
@project = Project.new
@@ -35,7 +35,7 @@ def create
def update
respond_to do |format|
if project.update_attributes(params[:project])
- format.html { redirect_to edit_project_path(project), :notice => 'Project was successfully updated.' }
+ format.html { redirect_to edit_project_path(project), notice: 'Project was successfully updated.' }
format.js
else
format.html { render action: "edit" }
View
4 app/controllers/protected_branches_controller.rb
@@ -6,7 +6,7 @@ class ProtectedBranchesController < ApplicationController
before_filter :authorize_read_project!
before_filter :require_non_empty_project
- before_filter :authorize_admin_project!, :only => [:destroy, :create]
+ before_filter :authorize_admin_project!, only: [:destroy, :create]
before_filter :render_full_content
layout "project"
@@ -26,7 +26,7 @@ def destroy
respond_to do |format|
format.html { redirect_to project_protected_branches_path }
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
end
View
14 app/controllers/refs_controller.rb
@@ -9,7 +9,7 @@ class RefsController < ApplicationController
before_filter :require_non_empty_project
before_filter :ref
- before_filter :define_tree_vars, :only => [:tree, :blob, :blame, :logs_tree]
+ before_filter :define_tree_vars, only: [:tree, :blob, :blame, :logs_tree]
before_filter :render_full_content
layout "project"
@@ -20,7 +20,7 @@ def switch
new_path = if params[:destination] == "tree"
tree_project_ref_path(@project, params[:ref])
else
- project_commits_path(@project, :ref => params[:ref])
+ project_commits_path(@project, ref: params[:ref])
end
redirect_to new_path
@@ -53,8 +53,8 @@ def logs_tree
last_commit = @project.commits(@commit.id, file, 1).last
last_commit = CommitDecorator.decorate(last_commit)
{
- :file_name => content.name,
- :commit => last_commit
+ file_name: content.name,
+ commit: last_commit
}
end
end
@@ -70,9 +70,9 @@ def blob
send_data(
@tree.data,
- :type => mime_type,
- :disposition => 'inline',
- :filename => @tree.name
+ type: mime_type,
+ disposition: 'inline',
+ filename: @tree.name
)
else
head(404)
View
4 app/controllers/search_controller.rb
@@ -8,8 +8,8 @@ def show
if query.present?
@projects = current_user.projects.search(query).limit(10)
- @merge_requests = MergeRequest.where(:project_id => current_user.project_ids).search(query).limit(10)
- @issues = Issue.where(:project_id => current_user.project_ids).search(query).limit(10)
+ @merge_requests = MergeRequest.where(project_id: current_user.project_ids).search(query).limit(10)
+ @issues = Issue.where(project_id: current_user.project_ids).search(query).limit(10)
end
end
end
View
16 app/controllers/snippets_controller.rb
@@ -1,7 +1,7 @@
class SnippetsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
- before_filter :snippet, :only => [:show, :edit, :destroy, :update, :raw]
+ before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw]
layout "project"
# Authorize
@@ -11,13 +11,13 @@ class SnippetsController < ApplicationController
before_filter :authorize_read_snippet!
# Allow write(create) snippet
- before_filter :authorize_write_snippet!, :only => [:new, :create]
+ before_filter :authorize_write_snippet!, only: [:new, :create]
# Allow modify snippet
- before_filter :authorize_modify_snippet!, :only => [:edit, :update]
+ before_filter :authorize_modify_snippet!, only: [:edit, :update]
# Allow destroy snippet
- before_filter :authorize_admin_snippet!, :only => [:destroy]
+ before_filter :authorize_admin_snippet!, only: [:destroy]
respond_to :html
@@ -55,7 +55,7 @@ def update
end
def show
- @note = @project.notes.new(:noteable => @snippet)
+ @note = @project.notes.new(noteable: @snippet)
render_full_content
end
@@ -70,9 +70,9 @@ def destroy
def raw
send_data(
@snippet.content,
- :type => "text/plain",
- :disposition => 'inline',
- :filename => @snippet.file_name
+ type: "text/plain",
+ disposition: 'inline',
+ filename: @snippet.file_name
)
end
View
4 app/controllers/team_members_controller.rb
@@ -5,7 +5,7 @@ class TeamMembersController < ApplicationController
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
- before_filter :authorize_admin_project!, :except => [:show]
+ before_filter :authorize_admin_project!, except: [:show]
def show
@team_member = project.users_projects.find(params[:id])
@@ -41,7 +41,7 @@ def destroy
respond_to do |format|
format.html { redirect_to team_project_path(@project) }
- format.js { render :nothing => true }
+ format.js { render nothing: true }
end
end
end
View
16 app/controllers/wikis_controller.rb
@@ -2,8 +2,8 @@ class WikisController < ApplicationController
before_filter :project
before_filter :add_project_abilities
before_filter :authorize_read_wiki!
- before_filter :authorize_write_wiki!, :only => [:edit, :create, :history]
- before_filter :authorize_admin_wiki!, :only => :destroy
+ before_filter :authorize_write_wiki!, only: [:edit, :create, :history]
+ before_filter :authorize_admin_wiki!, only: :destroy
layout "project"
def pages
@@ -14,16 +14,16 @@ def show
if params[:old_page_id]
@wiki = @project.wikis.find(params[:old_page_id])
else
- @wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last
+ @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
end
- @note = @project.notes.new(:noteable => @wiki)
+ @note = @project.notes.new(noteable: @wiki)
if @wiki
render 'show'
else
if can?(current_user, :write_wiki, @project)
- @wiki = @project.wikis.new(:slug => params[:id])
+ @wiki = @project.wikis.new(slug: params[:id])
render 'edit'
else
render 'empty'
@@ -32,7 +32,7 @@ def show
end
def edit
- @wiki = @project.wikis.where(:slug => params[:id]).order("created_at").last
+ @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
@wiki = Wiki.regenerate_from @wiki
end
@@ -50,11 +50,11 @@ def create
end
def history
- @wikis = @project.wikis.where(:slug => params[:id]).order("created_at")
+ @wikis = @project.wikis.where(slug: params[:id]).order("created_at")
end
def destroy
- @wikis = @project.wikis.where(:slug => params[:id]).delete_all
+ @wikis = @project.wikis.where(slug: params[:id]).delete_all
respond_to do |format|
format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" }
View
2  app/decorators/application_decorator.rb
@@ -15,7 +15,7 @@ class ApplicationDecorator < Drapper::Base
#
# def formatted_timestamp(time)
# h.content_tag :span, time.strftime("%a %m/%d/%y"),
- # :class => 'timestamp'
+ # class: 'timestamp'
# end
#
# def created_at
View
2  app/decorators/event_decorator.rb
@@ -19,7 +19,7 @@ def feed_url
elsif self.merge_request?
h.project_merge_request_url(self.project, self.merge_request)
elsif self.push?
- h.project_commits_url(self.project, :ref => self.ref_name)
+ h.project_commits_url(self.project, ref: self.ref_name)
end
end
end
View
6 app/decorators/tree_decorator.rb
@@ -8,14 +8,14 @@ def breadcrumbs(max_links = 2)
#parts = parts[0...-1] if is_blob?
- yield(h.link_to("..", "#", :remote => :true)) if parts.count > max_links
+ yield(h.link_to("..", "#", remote: :true)) if parts.count > max_links
parts.each do |part|
part_path = File.join(part_path, part) unless part_path.empty?
part_path = part if part_path.empty?
next unless parts.last(2).include?(part) if parts.count > max_links
- yield(h.link_to(h.truncate(part, :length => 40), h.tree_file_project_ref_path(project, ref, :path => part_path), :remote => :true))
+ yield(h.link_to(h.truncate(part, length: 40), h.tree_file_project_ref_path(project, ref, path: part_path), remote: :true))
end
end
end
@@ -30,7 +30,7 @@ def up_dir_path
end
def history_path
- h.project_commits_path(project, :path => path, :ref => ref)
+ h.project_commits_path(project, path: path, ref: ref)
end
def mb_size
View
30 app/helpers/application_helper.rb
@@ -43,23 +43,23 @@ def grouped_options_refs(destination = :tree)
end
def search_autocomplete_source
- projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
+ projects = current_user.projects.map{ |p| { label: p.name, url: project_path(p) } }
default_nav = [
- { :label => "Profile", :url => profile_path },
- { :label => "Keys", :url => keys_path },
- { :label => "Dashboard", :url => root_path },
- { :label => "Admin", :url => admin_root_path }
+ { label: "Profile", url: profile_path },
+ { label: "Keys", url: keys_path },
+ { label: "Dashboard", url: root_path },
+ { label: "Admin", url: admin_root_path }
]
project_nav = []
if @project && !@project.new_record?
project_nav = [
- { :label => "#{@project.name} / Issues", :url => project_issues_path(@project) },
- { :label => "#{@project.name} / Wall", :url => wall_project_path(@project) },
- { :label => "#{@project.name} / Tree", :url => tree_project_ref_path(@project, @project.root_ref) },
- { :label => "#{@project.name} / Commits", :url => project_commits_path(@project) },
- { :label => "#{@project.name} / Team", :url => team_project_path(@project) }
+ { label: "#{@project.name} / Issues", url: project_issues_path(@project) },
+ { label: "#{@project.name} / Wall", url: wall_project_path(@project) },
+ { label: "#{@project.name} / Tree", url: tree_project_ref_path(@project, @project.root_ref) },
+ { label: "#{@project.name} / Commits", url: project_commits_path(@project) },
+ { label: "#{@project.name} / Team", url: team_project_path(@project) }
]
end
@@ -89,7 +89,7 @@ def tab_class(tab_key)
when :wall; wall_tab?
when :wiki; controller.controller_name == "wikis"
when :issues; issues_tab?
- when :network; current_page?(:controller => "projects", :action => "graph", :id => @project)
+ when :network; current_page?(controller: "projects", action: "graph", id: @project)
when :merge_requests; controller.controller_name == "merge_requests"
# Dashboard Area
@@ -100,10 +100,10 @@ def tab_class(tab_key)
when :root; current_page?(dashboard_path) || current_page?(root_path)
# Profile Area
- when :profile; current_page?(:controller => "profile", :action => :show)
- when :password; current_page?(:controller => "profile", :action => :password)
- when :token; current_page?(:controller => "profile", :action => :token)
- when :design; current_page?(:controller => "profile", :action => :design)
+ when :profile; current_page?(controller: "profile", action: :show)
+ when :password; current_page?(controller: "profile", action: :password)
+ when :token; current_page?(controller: "profile", action: :token)
+ when :design; current_page?(controller: "profile", action: :design)
when :ssh_keys; controller.controller_name == "keys"
# Admin Area
View
20 app/helpers/gitlab_markdown_helper.rb
@@ -28,32 +28,32 @@ def gfm(text, html_options = {})
# team member: @foo
when /^@/
- user = @project.users.where(:name => user_name).first
- member = @project.users_projects.where(:user_id => user).first if user
- link_to("@#{user_name}", project_team_member_path(@project, member), html_options.merge(:class => "gfm gfm-team_member #{html_options[:class]}")) if member
+ user = @project.users.where(name: user_name).first
+ member = @project.users_projects.where(user_id: user).first if user
+ link_to("@#{user_name}", project_team_member_path(@project, member), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member
# issue: #123
when /^#/
# avoid HTML entities
unless prefix.try(:end_with?, "&") && suffix.try(:start_with?, ";")
- issue = @project.issues.where(:id => issue_id).first
- link_to("##{issue_id}", project_issue_path(@project, issue), html_options.merge(:title => "Issue: #{issue.title}", :class => "gfm gfm-issue #{html_options[:class]}")) if issue
+ issue = @project.issues.where(id: issue_id).first
+ link_to("##{issue_id}", project_issue_path(@project, issue), html_options.merge(title: "Issue: #{issue.title}", class: "gfm gfm-issue #{html_options[:class]}")) if issue
end
# merge request: !123
when /^!/
- merge_request = @project.merge_requests.where(:id => merge_request_id).first
- link_to("!#{merge_request_id}", project_merge_request_path(@project, merge_request), html_options.merge(:title => "Merge Request: #{merge_request.title}", :class => "gfm gfm-merge_request #{html_options[:class]}")) if merge_request
+ merge_request = @project.merge_requests.where(id: merge_request_id).first
+ link_to("!#{merge_request_id}", project_merge_request_path(@project, merge_request), html_options.merge(title: "Merge Request: #{merge_request.title}", class: "gfm gfm-merge_request #{html_options[:class]}")) if merge_request
# snippet: $123
when /^\$/
- snippet = @project.snippets.where(:id => snippet_id).first
- link_to("$#{snippet_id}", project_snippet_path(@project, snippet), html_options.merge(:title => "Snippet: #{snippet.title}", :class => "gfm gfm-snippet #{html_options[:class]}")) if snippet
+ snippet = @project.snippets.where(id: snippet_id).first
+ link_to("$#{snippet_id}", project_snippet_path(@project, snippet), html_options.merge(title: "Snippet: #{snippet.title}", class: "gfm gfm-snippet #{html_options[:class]}")) if snippet
# commit: 123456...
when /^\h/
commit = @project.commit(commit_id)
- link_to(commit_id, project_commit_path(@project, :id => commit.id), html_options.merge(:title => "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", :class => "gfm gfm-commit #{html_options[:class]}")) if commit
+ link_to(commit_id, project_commit_path(@project, id: commit.id), html_options.merge(title: "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", class: "gfm gfm-commit #{html_options[:class]}")) if commit
end # case
View
4 app/helpers/issues_helper.rb
@@ -9,7 +9,7 @@ def link_to_issue_assignee(issue)
tm = project.team_member_by_id(issue.assignee_id)
if tm
- link_to issue.assignee_name, project_team_member_path(project, tm), :class => "author_link"
+ link_to issue.assignee_name, project_team_member_path(project, tm), class: "author_link"
else
issue.assignee_name
end
@@ -20,7 +20,7 @@ def link_to_issue_author(issue)
tm = project.team_member_by_id(issue.author_id)
if tm
- link_to issue.author_name, project_team_member_path(project, tm), :class => "author_link"
+ link_to issue.author_name, project_team_member_path(project, tm), class: "author_link"
else
issue.author_name
end
View
12 app/helpers/merge_requests_helper.rb
@@ -4,7 +4,7 @@ def link_to_merge_request_assignee(merge_request)
tm = project.team_member_by_id(merge_request.assignee_id)
if tm
- link_to merge_request.assignee_name, project_team_member_path(project, tm), :class => "author_link"
+ link_to merge_request.assignee_name, project_team_member_path(project, tm), class: "author_link"
else
merge_request.assignee_name
end
@@ -15,7 +15,7 @@ def link_to_merge_request_author(merge_request)
tm = project.team_member_by_id(merge_request.author_id)
if tm
- link_to merge_request.author_name, project_team_member_path(project, tm), :class => "author_link"
+ link_to merge_request.author_name, project_team_member_path(project, tm), class: "author_link"
else
merge_request.author_name
end
@@ -24,10 +24,10 @@ def link_to_merge_request_author(merge_request)
def new_mr_path_from_push_event(event)
new_project_merge_request_path(
event.project,
- :merge_request => {
- :source_branch => event.branch_name,
- :target_branch => event.project.root_ref,
- :title => event.branch_name.titleize
+ merge_request: {
+ source_branch: event.branch_name,
+ target_branch: event.project.root_ref,
+ title: event.branch_name.titleize
}
)
end
View
4 app/helpers/tab_helper.rb
@@ -4,12 +4,12 @@ def issues_tab?
end
def wall_tab?
- current_page?(:controller => "projects", :action => "wall", :id => @project)
+ current_page?(controller: "projects", action: "wall", id: @project)
end
def project_tab_class
[:show, :files, :team, :edit, :update].each do |action|
- return "current" if current_page?(:controller => "projects", :action => action, :id => @project)
+ return "current" if current_page?(controller: "projects", action: action, id: @project)
end
if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
View
20 app/mailers/notify.rb
@@ -12,20 +12,20 @@ class Notify < ActionMailer::Base
def new_user_email(user_id, password)
@user = User.find(user_id)
@password = password
- mail(:to => @user.email, :subject => "gitlab | Account was created for you")
+ mail(to: @user.email, subject: "gitlab | Account was created for you")
end
def new_issue_email(issue_id)
@issue = Issue.find(issue_id)
@project = @issue.project
- mail(:to => @issue.assignee_email, :subject => "gitlab | new issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
+ mail(to: @issue.assignee_email, subject: "gitlab | new issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
end
def note_wall_email(recipient_id, note_id)
recipient = User.find(recipient_id)
@note = Note.find(note_id)
@project = @note.project
- mail(:to => recipient.email, :subject => "gitlab | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | #{@project.name}")
end
def note_commit_email(recipient_id, note_id)
@@ -34,7 +34,7 @@ def note_commit_email(recipient_id, note_id)
@commit = @note.target
@commit = CommitDecorator.decorate(@commit)
@project = @note.project
- mail(:to => recipient.email, :subject => "gitlab | note for commit #{@commit.short_id} | #{@commit.title} | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | note for commit #{@commit.short_id} | #{@commit.title} | #{@project.name}")
end
def note_merge_request_email(recipient_id, note_id)
@@ -42,7 +42,7 @@ def note_merge_request_email(recipient_id, note_id)
@note = Note.find(note_id)
@merge_request = @note.noteable
@project = @note.project
- mail(:to => recipient.email, :subject => "gitlab | note for merge request !#{@merge_request.id} | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | note for merge request !#{@merge_request.id} | #{@project.name}")
end
def note_issue_email(recipient_id, note_id)
@@ -50,7 +50,7 @@ def note_issue_email(recipient_id, note_id)
@note = Note.find(note_id)
@issue = @note.noteable
@project = @note.project
- mail(:to => recipient.email, :subject => "gitlab | note for issue ##{@issue.id} | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | note for issue ##{@issue.id} | #{@project.name}")
end
def note_wiki_email(recipient_id, note_id)
@@ -58,13 +58,13 @@ def note_wiki_email(recipient_id, note_id)
@note = Note.find(note_id)
@wiki = @note.noteable
@project = @note.project
- mail(:to => recipient.email, :subject => "gitlab | note for wiki | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | note for wiki | #{@project.name}")
end
def new_merge_request_email(merge_request_id)
@merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project
- mail(:to => @merge_request.assignee_email, :subject => "gitlab | new merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
+ mail(to: @merge_request.assignee_email, subject: "gitlab | new merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
end
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
@@ -72,7 +72,7 @@ def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assi
@merge_request = MergeRequest.find(merge_request_id)
@previous_assignee ||= User.find(previous_assignee_id)
@project = @merge_request.project
- mail(:to => recipient.email, :subject => "gitlab | changed merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | changed merge request !#{@merge_request.id} | #{@merge_request.title} | #{@project.name}")
end
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
@@ -80,6 +80,6 @@ def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
@issue = Issue.find(issue_id)
@previous_assignee ||= User.find(previous_assignee_id)
@project = @issue.project
- mail(:to => recipient.email, :subject => "gitlab | changed issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
+ mail(to: recipient.email, subject: "gitlab | changed issue ##{@issue.id} | #{@issue.title} | #{@project.name}")
end
end
View
12 app/models/commit.rb
@@ -20,7 +20,7 @@ class Commit
:tree,
:id,
:to_patch,
- :to => :commit
+ to: :commit
class << self
@@ -57,7 +57,7 @@ def commits_with_refs(repo, n = 20)
def commits_since(repo, date)
commits = repo.heads.map do |h|
- repo.log(h.name, nil, :since => date).each { |c| Commit.new(c, h) }
+ repo.log(h.name, nil, since: date).each { |c| Commit.new(c, h) }
end.flatten.uniq { |c| c.id }
commits.sort! do |x, y|
@@ -69,7 +69,7 @@ def commits_since(repo, date)
def commits(repo, ref, path = nil, limit = nil, offset = nil)
if path
- repo.log(ref, path, :max_count => limit, :skip => offset)
+ repo.log(ref, path, max_count: limit, skip: offset)
elsif limit && offset
repo.commits(ref, limit, offset)
else
@@ -86,9 +86,9 @@ def compare(project, from, to)
last = project.commit(from.try(:strip))
result = {
- :commits => [],
- :diffs => [],
- :commit => nil
+ commits: [],
+ diffs: [],
+ commit: nil
}
if first && last
View
12 app/models/event.rb
@@ -12,13 +12,13 @@ class Event < ActiveRecord::Base
Merged = 7
belongs_to :project
- belongs_to :target, :polymorphic => true
+ belongs_to :target, polymorphic: true
# For Hash only
serialize :data
scope :recent, order("created_at DESC")
- scope :code_push, where(:action => Pushed)
+ scope :code_push, where(action: Pushed)
def self.determine_action(record)
if [Issue, MergeRequest].include? record.class
@@ -29,7 +29,7 @@ def self.determine_action(record)
end
def self.recent_for_user user
- where(:project_id => user.projects.map(&:id)).recent
+ where(project_id: user.projects.map(&:id)).recent
end
# Next events currently enabled for system
@@ -106,9 +106,9 @@ def action_name
end
end
- delegate :name, :email, :to => :author, :prefix => true, :allow_nil => true
- delegate :title, :to => :issue, :prefix => true, :allow_nil => true
- delegate :title, :to => :merge_request, :prefix => true, :allow_nil => true
+ delegate :name, :email, to: :author, prefix: true, allow_nil: true
+ delegate :title, to: :issue, prefix: true, allow_nil: true
+ delegate :title, to: :merge_request, prefix: true, allow_nil: true
end
# == Schema Information
#
View
2  app/models/issue.rb
@@ -7,7 +7,7 @@ class Issue < ActiveRecord::Base
belongs_to :milestone
validates :description,
- :length => { :within => 0..2000 }
+ length: { within: 0..2000 }
acts_as_list
View
12 app/models/key.rb
@@ -6,16 +6,16 @@ class Key < ActiveRecord::Base
belongs_to :project
validates :title,
- :presence => true,
- :length => { :within => 0..255 }
+ presence: true,
+ length: { within: 0..255 }
validates :key,
- :presence => true,
- :length => { :within => 0..5000 }
+ presence: true,
+ length: { within: 0..5000 }
before_save :set_identifier
before_validation :strip_white_space
- delegate :name, :email, :to => :user, :prefix => true
+ delegate :name, :email, to: :user, prefix: true
validate :unique_key
def strip_white_space
@@ -23,7 +23,7 @@ def strip_white_space
end
def unique_key
- query = Key.where(:key => key)
+ query = Key.where(key: key)
query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
if (query.count > 0)
errors.add :key, 'already exist.'
View
20 app/models/merge_request.rb
@@ -20,7 +20,7 @@ class MergeRequest < ActiveRecord::Base
validate :validate_branches
def self.find_all_by_branch(branch_name)
- where("source_branch like :branch or target_branch like :branch", :branch => branch_name)
+ where("source_branch like :branch or target_branch like :branch", branch: branch_name)
end
def human_state
@@ -48,7 +48,7 @@ def unchecked?
end
def mark_as_unchecked
- self.update_attributes(:state => UNCHECKED)
+ self.update_attributes(state: UNCHECKED)
end
def can_be_merged?
@@ -101,11 +101,11 @@ def merged?
end
def merge_event
- self.project.events.where(:target_id => self.id, :target_type => "MergeRequest", :action => Event::Merged).last
+ self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Merged).last
end
def closed_event
- self.project.events.where(:target_id => self.id, :target_type => "MergeRequest", :action => Event::Closed).last
+ self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Closed).last
end
def commits
@@ -128,7 +128,7 @@ def mark_as_merged!
end
def mark_as_unmergable
- self.update_attributes :state => CANNOT_BE_MERGED
+ self.update_attributes state: CANNOT_BE_MERGED
end
def reloaded_commits
@@ -150,11 +150,11 @@ def unmerged_commits
def merge!(user_id)
self.mark_as_merged!
Event.create(
- :project => self.project,
- :action => Event::Merged,
- :target_id => self.id,
- :target_type => "MergeRequest",
- :author_id => user_id
+ project: self.project,
+ action: Event::Merged,
+ target_id: self.id,
+ target_type: "MergeRequest",
+ author_id: user_id
)
end
View
2  app/models/milestone.rb
@@ -24,7 +24,7 @@ def self.active
end
def participants
- User.where(:id => issues.map(&:assignee_id))
+ User.where(id: issues.map(&:assignee_id))
end
def percent_complete
View
38 app/models/note.rb
@@ -3,18 +3,18 @@
class Note < ActiveRecord::Base
belongs_to :project
- belongs_to :noteable, :polymorphic => true
+ belongs_to :noteable, polymorphic: true
belongs_to :author,
- :class_name => "User"
+ class_name: "User"
delegate :name,
- :to => :project,
- :prefix => true
+ to: :project,
+ prefix: true
delegate :name,
:email,
- :to => :author,
- :prefix => true
+ to: :author,
+ prefix: true
attr_protected :author, :author_id
attr_accessor :notify
@@ -23,19 +23,19 @@ class Note < ActiveRecord::Base
validates_presence_of :project
validates :note,
- :presence => true,
- :length => { :within => 0..5000 }
+ presence: true,
+ length: { within: 0..5000 }
validates :attachment,
- :file_size => {
- :maximum => 10.megabytes.to_i
+ file_size: {
+ maximum: 10.megabytes.to_i
}
- scope :common, where(:noteable_id => nil)
+ scope :common, where(noteable_id: nil)
- scope :today, where("created_at >= :date", :date => Date.today)
- scope :last_week, where("created_at >= :date", :date => (Date.today - 7.days))
- scope :since, lambda { |day| where("created_at >= :date", :date => (day)) }
+ scope :today, where("created_at >= :date", date: Date.today)
+ scope :last_week, where("created_at >= :date", date: (Date.today - 7.days))
+ scope :since, lambda { |day| where("created_at >= :date", date: (day)) }
scope :fresh, order("created_at DESC")
scope :inc_author_project, includes(:project, :author)
scope :inc_author, includes(:author)
@@ -43,11 +43,11 @@ class Note < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
def self.create_status_change_note(noteable, author, status)
- create({ :noteable => noteable,
- :project => noteable.project,
- :author => author,
- :note => "_Status changed to #{status}_" },
- :without_protection => true)
+ create({ noteable: noteable,
+ project: noteable.project,
+ author: author,
+ note: "_Status changed to #{status}_" },
+ without_protection: true)
end
def notify
View
72 app/models/project.rb
@@ -9,19 +9,19 @@ class Project < ActiveRecord::Base
#
# Relations
#
- belongs_to :owner, :class_name => "User"
- has_many :users, :through => :users_projects
- has_many :events, :dependent => :destroy
- has_many :merge_requests, :dependent => :destroy
- has_many :issues, :dependent => :destroy, :order => "closed, created_at DESC"
- has_many :milestones, :dependent => :destroy
- has_many :users_projects, :dependent => :destroy
- has_many :notes, :dependent => :destroy
- has_many :snippets, :dependent => :destroy
- has_many :deploy_keys, :dependent => :destroy, :foreign_key => "project_id", :class_name => "Key"
- has_many :hooks, :dependent => :destroy, :class_name => "ProjectHook"
- has_many :wikis, :dependent => :destroy
- has_many :protected_branches, :dependent => :destroy
+ belongs_to :owner, class_name: "User"
+ has_many :users, through: :users_projects
+ has_many :events, dependent: :destroy
+ has_many :merge_requests, dependent: :destroy
+ has_many :issues, dependent: :destroy, order: "closed, created_at DESC"
+ has_many :milestones, dependent: :destroy
+ has_many :users_projects, dependent: :destroy
+ has_many :notes, dependent: :destroy
+ has_many :snippets, dependent: :destroy
+ has_many :deploy_keys, dependent: :destroy, foreign_key: "project_id", class_name: "Key"
+ has_many :hooks, dependent: :destroy, class_name: "ProjectHook"
+ has_many :wikis, dependent: :destroy
+ has_many :protected_branches, dependent: :destroy
attr_accessor :error_code
@@ -33,15 +33,15 @@ class Project < ActiveRecord::Base
#
# Scopes
#
- scope :public_only, where(:private_flag => false)
- scope :without_user, lambda { |user| where("id not in (:ids)", :ids => user.projects.map(&:id) ) }
+ scope :public_only, where(private_flag: false)
+ scope :without_user, lambda { |user| where("id not in (:ids)", ids: user.projects.map(&:id) ) }
def self.active
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
end
def self.search query
- where("name like :query or code like :query or path like :query", :query => "%#{query}%")
+ where("name like :query or code like :query or path like :query", query: "%#{query}%")
end
def self.create_by_user(params, user)
@@ -53,7 +53,7 @@ def self.create_by_user(params, user)
project.save!
# Add user as project master
- project.users_projects.create!(:project_access => UsersProject::MASTER, :user => user)
+ project.users_projects.create!(project_access: UsersProject::MASTER, user: user)
# when project saved no team member exist so
# project repository should be updated after first user add
@@ -82,28 +82,28 @@ def saved?
# Validations
#
validates :name,
- :uniqueness => true,
- :presence => true,
- :length => { :within => 0..255 }
+ uniqueness: true,
+ presence: true,
+ length: { within: 0..255 }
validates :path,
- :uniqueness => true,
- :presence => true,
- :format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
- :message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
- :length => { :within => 0..255 }
+ uniqueness: true,
+ presence: true,
+ format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
+ message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
+ length: { within: 0..255 }
validates :description,
- :length => { :within => 0..2000 }
+ length: { within: 0..2000 }
validates :code,
- :presence => true,
- :uniqueness => true,
- :format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
- :message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
- :length => { :within => 1..255 }
+ presence: true,
+ uniqueness: true,
+ format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/,
+ message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" },
+ length: { within: 1..255 }
- validates :owner, :presence => true
+ validates :owner, presence: true
validate :check_limit
validate :repo_name
@@ -134,19 +134,19 @@ def web_url
end
def common_notes
- notes.where(:noteable_type => ["", nil]).inc_author_project
+ notes.where(noteable_type: ["", nil]).inc_author_project
end
def build_commit_note(commit)
- notes.new(:noteable_id => commit.id, :noteable_type => "Commit")
+ notes.new(noteable_id: commit.id, noteable_type: "Commit")
end
def commit_notes(commit)
- notes.where(:noteable_id => commit.id, :noteable_type => "Commit", :line_code => nil)
+ notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil)
end
def commit_line_notes(commit)
- notes.where(:noteable_id => commit.id, :noteable_type => "Commit").where("line_code is not null")
+ notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code is not null")
end
def public?
View
20 app/models/snippet.rb
@@ -2,29 +2,29 @@ class Snippet < ActiveRecord::Base
include Linguist::BlobHelper
belongs_to :project
- belongs_to :author, :class_name => "User"
- has_many :notes, :as => :noteable, :dependent => :destroy
+ belongs_to :author, class_name: "User"
+ has_many :notes, as: :noteable, dependent: :destroy
delegate :name,
:email,
- :to => :author,
- :prefix => true
+ to: :author,
+ prefix: true
attr_protected :author, :author_id, :project, :project_id
validates_presence_of :project_id
validates_presence_of :author_id
validates :title,
- :presence => true,
- :length => { :within => 0..255 }
+ presence: true,
+ length: { within: 0..255 }
validates :file_name,
- :presence => true,
- :length => { :within => 0..255 }
+ presence: true,
+ length: { within: 0..255 }
validates :content,
- :presence => true,
- :length => { :within => 0..10000 }
+ presence: true,
+ length: { within: 0..10000 }
scope :fresh, order("created_at DESC")
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
View
2  app/models/tree.rb
@@ -11,7 +11,7 @@ class Tree
:size,
:text?,
:colorize,
- :to => :tree
+ to: :tree
def initialize(raw_tree, project, ref = nil, path = nil)
@project, @ref, @path = project, ref, path,
View
72 app/models/user.rb
@@ -11,58 +11,58 @@ class User < ActiveRecord::Base
attr_accessor :force_random_password
- has_many :users_projects, :dependent => :destroy
- has_many :projects, :through => :users_projects
- has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id
- has_many :keys, :dependent => :destroy
+ has_many :users_projects, dependent: :destroy
+ has_many :projects, through: :users_projects
+ has_many :my_own_projects, class_name: "Project", foreign_key: :owner_id
+ has_many :keys, dependent: :destroy
has_many :events,
- :class_name => "Event",
- :foreign_key => :author_id,
- :dependent => :destroy
+ class_name: "Event",
+ foreign_key: :author_id,
+ dependent: :destroy
has_many :recent_events,
- :class_name => "Event",
- :foreign_key => :author_id,
- :order => "id DESC"
+ class_name: "Event",
+ foreign_key: :author_id,
+ order: "id DESC"
has_many :issues,
- :foreign_key => :author_id,
- :dependent => :destroy
+ foreign_key: :author_id,
+ dependent: :destroy
has_many :notes,
- :foreign_key => :author_id,
- :dependent => :destroy
+ foreign_key: :author_id,
+ dependent: :destroy
has_many :assigned_issues,
- :class_name => "Issue",
- :foreign_key => :assignee_id,
- :dependent => :destroy
+ class_name: "Issue",
+ foreign_key: :assignee_id,
+ dependent: :destroy
has_many :merge_requests,
- :foreign_key => :author_id,
- :dependent => :destroy
+ foreign_key: :author_id,
+ dependent: :destroy
has_many :assigned_merge_requests,
- :class_name => "MergeRequest",
- :foreign_key => :assignee_id,
- :dependent => :destroy
+ class_name: "MergeRequest",
+ foreign_key: :assignee_id,
+ dependent: :destroy
validates :projects_limit,
- :presence => true,
- :numericality => {:greater_than_or_equal_to => 0}
+ presence: true,
+ numericality: {greater_than_or_equal_to: 0}
- validates :bio, :length => { :within => 0..255 }
+ validates :bio, length: { within: 0..255 }
before_save :ensure_authentication_token
alias_attribute :private_token, :authentication_token
- scope :not_in_project, lambda { |project| where("id not in (:ids)", :ids => project.users.map(&:id) ) }
- scope :admins, where(:admin => true)
- scope :blocked, where(:blocked => true)
- scope :active, where(:blocked => false)
+ scope :not_in_project, lambda { |project| where("id not in (:ids)", ids: project.users.map(&:id) ) }
+ scope :admins, where(admin: true)
+ scope :blocked, where(blocked: true)
+ scope :active, where(blocked: false)