From 1ea0dd0ffc37232d27f4fa1350af6ebb3b5439f2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 25 Oct 2012 11:59:41 +0300 Subject: [PATCH] App docs --- doc/app/Ability.html | 570 ++++++ doc/app/Account.html | 881 +++++++++ doc/app/ActivityObserver.html | 531 +++++ doc/app/Admin.html | 432 ++++ doc/app/Admin/DashboardController.html | 488 +++++ doc/app/Admin/GroupsController.html | 771 ++++++++ doc/app/Admin/HooksController.html | 603 ++++++ doc/app/Admin/LogsController.html | 439 +++++ doc/app/Admin/ProjectsController.html | 733 +++++++ doc/app/Admin/ResqueController.html | 484 +++++ doc/app/Admin/TeamMembersController.html | 558 ++++++ doc/app/Admin/UsersController.html | 839 ++++++++ doc/app/AdminController.html | 490 +++++ doc/app/ApplicationController.html | 1015 ++++++++++ doc/app/ApplicationDecorator.html | 439 +++++ doc/app/ApplicationHelper.html | 1018 ++++++++++ doc/app/AttachmentUploader.html | 486 +++++ doc/app/Authority.html | 782 ++++++++ doc/app/BaseContext.html | 605 ++++++ doc/app/BlameController.html | 500 +++++ doc/app/BlobController.html | 519 +++++ doc/app/Commit.html | 1191 +++++++++++ doc/app/CommitController.html | 509 +++++ doc/app/CommitDecorator.html | 663 +++++++ doc/app/CommitLoadContext.html | 513 +++++ doc/app/CommitsController.html | 507 +++++ doc/app/CommitsHelper.html | 625 ++++++ doc/app/CompareController.html | 556 ++++++ doc/app/DashboardController.html | 569 ++++++ doc/app/DeployKeysController.html | 626 ++++++ doc/app/ErrorsController.html | 485 +++++ doc/app/Event.html | 1222 ++++++++++++ doc/app/EventDecorator.html | 578 ++++++ doc/app/EventsHelper.html | 566 ++++++ doc/app/ExtractsPath.html | 614 ++++++ doc/app/ExtractsPath/InvalidPathError.html | 441 +++++ doc/app/FileSizeValidator.html | 652 ++++++ doc/app/FileSizeValidator/Helper.html | 455 +++++ doc/app/GitHost.html | 479 +++++ doc/app/Gitlab.html | 454 +++++ doc/app/Gitlab/API.html | 452 +++++ doc/app/Gitlab/APIHelpers.html | 846 ++++++++ doc/app/Gitlab/AppLogger.html | 523 +++++ doc/app/Gitlab/Auth.html | 630 ++++++ doc/app/Gitlab/Encode.html | 537 +++++ doc/app/Gitlab/Entities.html | 433 ++++ doc/app/Gitlab/Entities/Hook.html | 439 +++++ doc/app/Gitlab/Entities/Issue.html | 439 +++++ doc/app/Gitlab/Entities/Milestone.html | 439 +++++ doc/app/Gitlab/Entities/Project.html | 439 +++++ doc/app/Gitlab/Entities/ProjectMember.html | 439 +++++ doc/app/Gitlab/Entities/ProjectSnippet.html | 439 +++++ doc/app/Gitlab/Entities/RepoCommit.html | 439 +++++ doc/app/Gitlab/Entities/RepoObject.html | 439 +++++ doc/app/Gitlab/Entities/SSHKey.html | 439 +++++ doc/app/Gitlab/Entities/User.html | 439 +++++ doc/app/Gitlab/Entities/UserBasic.html | 439 +++++ doc/app/Gitlab/Entities/UserLogin.html | 439 +++++ doc/app/Gitlab/FileEditor.html | 647 ++++++ doc/app/Gitlab/GitLogger.html | 523 +++++ doc/app/Gitlab/Gitolite.html | 716 +++++++ doc/app/Gitlab/Gitolite/AccessDenied.html | 439 +++++ doc/app/Gitlab/GitoliteConfig.html | 994 ++++++++++ doc/app/Gitlab/GitoliteConfig/PullError.html | 439 +++++ doc/app/Gitlab/GitoliteConfig/PushError.html | 439 +++++ doc/app/Gitlab/GraphCommit.html | 967 +++++++++ doc/app/Gitlab/InlineDiff.html | 611 ++++++ doc/app/Gitlab/Issues.html | 441 +++++ doc/app/Gitlab/Logger.html | 583 ++++++ doc/app/Gitlab/Markdown.html | 580 ++++++ doc/app/Gitlab/Merge.html | 628 ++++++ doc/app/Gitlab/Milestones.html | 441 +++++ doc/app/Gitlab/Projects.html | 441 +++++ doc/app/Gitlab/Satellite.html | 664 +++++++ doc/app/Gitlab/Session.html | 441 +++++ doc/app/Gitlab/Theme.html | 493 +++++ doc/app/Gitlab/Users.html | 441 +++++ doc/app/GitlabMarkdownHelper.html | 559 ++++++ doc/app/Grack.html | 433 ++++ doc/app/Grack/Auth.html | 734 +++++++ doc/app/Group.html | 555 ++++++ doc/app/GroupsController.html | 735 +++++++ doc/app/HelpController.html | 484 +++++ doc/app/HooksController.html | 595 ++++++ doc/app/Issue.html | 501 +++++ doc/app/IssueCommonality.html | 641 ++++++ doc/app/IssueCommonality/ClassMethods.html | 479 +++++ doc/app/IssueObserver.html | 571 ++++++ doc/app/IssuesBulkUpdateContext.html | 503 +++++ doc/app/IssuesController.html | 996 ++++++++++ doc/app/IssuesHelper.html | 698 +++++++ doc/app/IssuesListContext.html | 537 +++++ doc/app/Key.html | 700 +++++++ doc/app/KeyObserver.html | 530 +++++ doc/app/KeysController.html | 624 ++++++ doc/app/LabelsController.html | 523 +++++ doc/app/MergeRequest.html | 1478 ++++++++++++++ doc/app/MergeRequestObserver.html | 569 ++++++ doc/app/MergeRequestsController.html | 1114 +++++++++++ doc/app/MergeRequestsHelper.html | 599 ++++++ doc/app/MergeRequestsLoadContext.html | 496 +++++ doc/app/Milestone.html | 589 ++++++ doc/app/MilestonesController.html | 816 ++++++++ doc/app/Note.html | 777 ++++++++ doc/app/NoteObserver.html | 603 ++++++ doc/app/Notes.html | 434 ++++ doc/app/Notes/CreateContext.html | 490 +++++ doc/app/Notes/LoadContext.html | 513 +++++ doc/app/NotesController.html | 636 ++++++ doc/app/NotesHelper.html | 581 ++++++ doc/app/Notify.html | 883 +++++++++ doc/app/OmniauthCallbacksController.html | 527 +++++ doc/app/PostReceive.html | 495 +++++ doc/app/ProfileController.html | 683 +++++++ doc/app/ProfileHelper.html | 481 +++++ doc/app/Project.html | 1202 +++++++++++ doc/app/ProjectHook.html | 439 +++++ doc/app/ProjectObserver.html | 589 ++++++ doc/app/ProjectResourceController.html | 439 +++++ doc/app/ProjectsController.html | 785 ++++++++ doc/app/ProjectsHelper.html | 543 +++++ doc/app/ProtectedBranch.html | 529 +++++ doc/app/ProtectedBranchesController.html | 556 ++++++ doc/app/PushEvent.html | 1105 +++++++++++ doc/app/PushObserver.html | 699 +++++++ doc/app/Redcarpet.html | 432 ++++ doc/app/Redcarpet/Render.html | 432 ++++ doc/app/Redcarpet/Render/GitlabHTML.html | 594 ++++++ doc/app/RefsController.html | 638 ++++++ doc/app/RepositoriesController.html | 593 ++++++ doc/app/Repository.html | 1566 +++++++++++++++ doc/app/SearchContext.html | 599 ++++++ doc/app/SearchController.html | 489 +++++ doc/app/Snippet.html | 667 +++++++ doc/app/SnippetsController.html | 833 ++++++++ doc/app/SnippetsHelper.html | 485 +++++ doc/app/StaticModel.html | 648 ++++++ doc/app/StaticModel/ClassMethods.html | 511 +++++ doc/app/SystemHook.html | 525 +++++ doc/app/SystemHookObserver.html | 573 ++++++ doc/app/SystemHookWorker.html | 485 +++++ doc/app/TabHelper.html | 621 ++++++ doc/app/TagsHelper.html | 516 +++++ doc/app/Team.html | 710 +++++++ doc/app/TeamMembersController.html | 698 +++++++ doc/app/TestHookContext.html | 488 +++++ doc/app/Tree.html | 663 +++++++ doc/app/TreeController.html | 583 ++++++ doc/app/TreeDecorator.html | 597 ++++++ doc/app/TreeHelper.html | 736 +++++++ doc/app/User.html | 755 +++++++ doc/app/UserObserver.html | 557 ++++++ doc/app/UsersProject.html | 904 +++++++++ doc/app/UsersProjectObserver.html | 558 ++++++ doc/app/Votes.html | 615 ++++++ doc/app/WebHook.html | 506 +++++ doc/app/Wiki.html | 567 ++++++ doc/app/WikisController.html | 676 +++++++ doc/app/created.rid | 135 ++ doc/app/doc/README_FOR_APP.html | 399 ++++ doc/app/images/add.png | Bin 0 -> 733 bytes doc/app/images/brick.png | Bin 0 -> 452 bytes doc/app/images/brick_link.png | Bin 0 -> 764 bytes doc/app/images/bug.png | Bin 0 -> 774 bytes doc/app/images/bullet_black.png | Bin 0 -> 211 bytes doc/app/images/bullet_toggle_minus.png | Bin 0 -> 207 bytes doc/app/images/bullet_toggle_plus.png | Bin 0 -> 209 bytes doc/app/images/date.png | Bin 0 -> 626 bytes doc/app/images/delete.png | Bin 0 -> 715 bytes doc/app/images/find.png | Bin 0 -> 659 bytes doc/app/images/loadingAnimation.gif | Bin 0 -> 5886 bytes doc/app/images/macFFBgHack.png | Bin 0 -> 207 bytes doc/app/images/package.png | Bin 0 -> 853 bytes doc/app/images/page_green.png | Bin 0 -> 621 bytes doc/app/images/page_white_text.png | Bin 0 -> 342 bytes doc/app/images/page_white_width.png | Bin 0 -> 309 bytes doc/app/images/plugin.png | Bin 0 -> 591 bytes doc/app/images/ruby.png | Bin 0 -> 592 bytes doc/app/images/tag_blue.png | Bin 0 -> 1880 bytes doc/app/images/tag_green.png | Bin 0 -> 613 bytes doc/app/images/transparent.png | Bin 0 -> 97 bytes doc/app/images/wrench.png | Bin 0 -> 610 bytes doc/app/images/wrench_orange.png | Bin 0 -> 584 bytes doc/app/images/zoom.png | Bin 0 -> 692 bytes doc/app/index.html | 392 ++++ doc/app/js/darkfish.js | 153 ++ doc/app/js/jquery.js | 18 + doc/app/js/navigation.js | 142 ++ doc/app/js/search.js | 94 + doc/app/js/search_index.js | 1 + doc/app/js/searcher.js | 228 +++ doc/app/rdoc.css | 543 +++++ doc/app/table_of_contents.html | 1858 ++++++++++++++++++ 193 files changed, 100336 insertions(+) create mode 100644 doc/app/Ability.html create mode 100644 doc/app/Account.html create mode 100644 doc/app/ActivityObserver.html create mode 100644 doc/app/Admin.html create mode 100644 doc/app/Admin/DashboardController.html create mode 100644 doc/app/Admin/GroupsController.html create mode 100644 doc/app/Admin/HooksController.html create mode 100644 doc/app/Admin/LogsController.html create mode 100644 doc/app/Admin/ProjectsController.html create mode 100644 doc/app/Admin/ResqueController.html create mode 100644 doc/app/Admin/TeamMembersController.html create mode 100644 doc/app/Admin/UsersController.html create mode 100644 doc/app/AdminController.html create mode 100644 doc/app/ApplicationController.html create mode 100644 doc/app/ApplicationDecorator.html create mode 100644 doc/app/ApplicationHelper.html create mode 100644 doc/app/AttachmentUploader.html create mode 100644 doc/app/Authority.html create mode 100644 doc/app/BaseContext.html create mode 100644 doc/app/BlameController.html create mode 100644 doc/app/BlobController.html create mode 100644 doc/app/Commit.html create mode 100644 doc/app/CommitController.html create mode 100644 doc/app/CommitDecorator.html create mode 100644 doc/app/CommitLoadContext.html create mode 100644 doc/app/CommitsController.html create mode 100644 doc/app/CommitsHelper.html create mode 100644 doc/app/CompareController.html create mode 100644 doc/app/DashboardController.html create mode 100644 doc/app/DeployKeysController.html create mode 100644 doc/app/ErrorsController.html create mode 100644 doc/app/Event.html create mode 100644 doc/app/EventDecorator.html create mode 100644 doc/app/EventsHelper.html create mode 100644 doc/app/ExtractsPath.html create mode 100644 doc/app/ExtractsPath/InvalidPathError.html create mode 100644 doc/app/FileSizeValidator.html create mode 100644 doc/app/FileSizeValidator/Helper.html create mode 100644 doc/app/GitHost.html create mode 100644 doc/app/Gitlab.html create mode 100644 doc/app/Gitlab/API.html create mode 100644 doc/app/Gitlab/APIHelpers.html create mode 100644 doc/app/Gitlab/AppLogger.html create mode 100644 doc/app/Gitlab/Auth.html create mode 100644 doc/app/Gitlab/Encode.html create mode 100644 doc/app/Gitlab/Entities.html create mode 100644 doc/app/Gitlab/Entities/Hook.html create mode 100644 doc/app/Gitlab/Entities/Issue.html create mode 100644 doc/app/Gitlab/Entities/Milestone.html create mode 100644 doc/app/Gitlab/Entities/Project.html create mode 100644 doc/app/Gitlab/Entities/ProjectMember.html create mode 100644 doc/app/Gitlab/Entities/ProjectSnippet.html create mode 100644 doc/app/Gitlab/Entities/RepoCommit.html create mode 100644 doc/app/Gitlab/Entities/RepoObject.html create mode 100644 doc/app/Gitlab/Entities/SSHKey.html create mode 100644 doc/app/Gitlab/Entities/User.html create mode 100644 doc/app/Gitlab/Entities/UserBasic.html create mode 100644 doc/app/Gitlab/Entities/UserLogin.html create mode 100644 doc/app/Gitlab/FileEditor.html create mode 100644 doc/app/Gitlab/GitLogger.html create mode 100644 doc/app/Gitlab/Gitolite.html create mode 100644 doc/app/Gitlab/Gitolite/AccessDenied.html create mode 100644 doc/app/Gitlab/GitoliteConfig.html create mode 100644 doc/app/Gitlab/GitoliteConfig/PullError.html create mode 100644 doc/app/Gitlab/GitoliteConfig/PushError.html create mode 100644 doc/app/Gitlab/GraphCommit.html create mode 100644 doc/app/Gitlab/InlineDiff.html create mode 100644 doc/app/Gitlab/Issues.html create mode 100644 doc/app/Gitlab/Logger.html create mode 100644 doc/app/Gitlab/Markdown.html create mode 100644 doc/app/Gitlab/Merge.html create mode 100644 doc/app/Gitlab/Milestones.html create mode 100644 doc/app/Gitlab/Projects.html create mode 100644 doc/app/Gitlab/Satellite.html create mode 100644 doc/app/Gitlab/Session.html create mode 100644 doc/app/Gitlab/Theme.html create mode 100644 doc/app/Gitlab/Users.html create mode 100644 doc/app/GitlabMarkdownHelper.html create mode 100644 doc/app/Grack.html create mode 100644 doc/app/Grack/Auth.html create mode 100644 doc/app/Group.html create mode 100644 doc/app/GroupsController.html create mode 100644 doc/app/HelpController.html create mode 100644 doc/app/HooksController.html create mode 100644 doc/app/Issue.html create mode 100644 doc/app/IssueCommonality.html create mode 100644 doc/app/IssueCommonality/ClassMethods.html create mode 100644 doc/app/IssueObserver.html create mode 100644 doc/app/IssuesBulkUpdateContext.html create mode 100644 doc/app/IssuesController.html create mode 100644 doc/app/IssuesHelper.html create mode 100644 doc/app/IssuesListContext.html create mode 100644 doc/app/Key.html create mode 100644 doc/app/KeyObserver.html create mode 100644 doc/app/KeysController.html create mode 100644 doc/app/LabelsController.html create mode 100644 doc/app/MergeRequest.html create mode 100644 doc/app/MergeRequestObserver.html create mode 100644 doc/app/MergeRequestsController.html create mode 100644 doc/app/MergeRequestsHelper.html create mode 100644 doc/app/MergeRequestsLoadContext.html create mode 100644 doc/app/Milestone.html create mode 100644 doc/app/MilestonesController.html create mode 100644 doc/app/Note.html create mode 100644 doc/app/NoteObserver.html create mode 100644 doc/app/Notes.html create mode 100644 doc/app/Notes/CreateContext.html create mode 100644 doc/app/Notes/LoadContext.html create mode 100644 doc/app/NotesController.html create mode 100644 doc/app/NotesHelper.html create mode 100644 doc/app/Notify.html create mode 100644 doc/app/OmniauthCallbacksController.html create mode 100644 doc/app/PostReceive.html create mode 100644 doc/app/ProfileController.html create mode 100644 doc/app/ProfileHelper.html create mode 100644 doc/app/Project.html create mode 100644 doc/app/ProjectHook.html create mode 100644 doc/app/ProjectObserver.html create mode 100644 doc/app/ProjectResourceController.html create mode 100644 doc/app/ProjectsController.html create mode 100644 doc/app/ProjectsHelper.html create mode 100644 doc/app/ProtectedBranch.html create mode 100644 doc/app/ProtectedBranchesController.html create mode 100644 doc/app/PushEvent.html create mode 100644 doc/app/PushObserver.html create mode 100644 doc/app/Redcarpet.html create mode 100644 doc/app/Redcarpet/Render.html create mode 100644 doc/app/Redcarpet/Render/GitlabHTML.html create mode 100644 doc/app/RefsController.html create mode 100644 doc/app/RepositoriesController.html create mode 100644 doc/app/Repository.html create mode 100644 doc/app/SearchContext.html create mode 100644 doc/app/SearchController.html create mode 100644 doc/app/Snippet.html create mode 100644 doc/app/SnippetsController.html create mode 100644 doc/app/SnippetsHelper.html create mode 100644 doc/app/StaticModel.html create mode 100644 doc/app/StaticModel/ClassMethods.html create mode 100644 doc/app/SystemHook.html create mode 100644 doc/app/SystemHookObserver.html create mode 100644 doc/app/SystemHookWorker.html create mode 100644 doc/app/TabHelper.html create mode 100644 doc/app/TagsHelper.html create mode 100644 doc/app/Team.html create mode 100644 doc/app/TeamMembersController.html create mode 100644 doc/app/TestHookContext.html create mode 100644 doc/app/Tree.html create mode 100644 doc/app/TreeController.html create mode 100644 doc/app/TreeDecorator.html create mode 100644 doc/app/TreeHelper.html create mode 100644 doc/app/User.html create mode 100644 doc/app/UserObserver.html create mode 100644 doc/app/UsersProject.html create mode 100644 doc/app/UsersProjectObserver.html create mode 100644 doc/app/Votes.html create mode 100644 doc/app/WebHook.html create mode 100644 doc/app/Wiki.html create mode 100644 doc/app/WikisController.html create mode 100644 doc/app/created.rid create mode 100644 doc/app/doc/README_FOR_APP.html create mode 100755 doc/app/images/add.png create mode 100644 doc/app/images/brick.png create mode 100644 doc/app/images/brick_link.png create mode 100644 doc/app/images/bug.png create mode 100644 doc/app/images/bullet_black.png create mode 100644 doc/app/images/bullet_toggle_minus.png create mode 100644 doc/app/images/bullet_toggle_plus.png create mode 100644 doc/app/images/date.png create mode 100755 doc/app/images/delete.png create mode 100644 doc/app/images/find.png create mode 100644 doc/app/images/loadingAnimation.gif create mode 100644 doc/app/images/macFFBgHack.png create mode 100644 doc/app/images/package.png create mode 100644 doc/app/images/page_green.png create mode 100644 doc/app/images/page_white_text.png create mode 100644 doc/app/images/page_white_width.png create mode 100644 doc/app/images/plugin.png create mode 100644 doc/app/images/ruby.png create mode 100755 doc/app/images/tag_blue.png create mode 100644 doc/app/images/tag_green.png create mode 100644 doc/app/images/transparent.png create mode 100644 doc/app/images/wrench.png create mode 100644 doc/app/images/wrench_orange.png create mode 100644 doc/app/images/zoom.png create mode 100644 doc/app/index.html create mode 100644 doc/app/js/darkfish.js create mode 100644 doc/app/js/jquery.js create mode 100644 doc/app/js/navigation.js create mode 100644 doc/app/js/search.js create mode 100644 doc/app/js/search_index.js create mode 100644 doc/app/js/searcher.js create mode 100644 doc/app/rdoc.css create mode 100644 doc/app/table_of_contents.html diff --git a/doc/app/Ability.html b/doc/app/Ability.html new file mode 100644 index 00000000..f780d067 --- /dev/null +++ b/doc/app/Ability.html @@ -0,0 +1,570 @@ + + + + + + +class Ability - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Ability

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ allowed(object, subject) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/ability.rb, line 3
+def allowed(object, subject)
+  case subject.class.name
+  when "Project" then project_abilities(object, subject)
+  when "Issue" then issue_abilities(object, subject)
+  when "Note" then note_abilities(object, subject)
+  when "Snippet" then snippet_abilities(object, subject)
+  when "MergeRequest" then merge_request_abilities(object, subject)
+  else []
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_abilities(user, project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/ability.rb, line 14
+def project_abilities(user, project)
+  rules = []
+
+  rules << [
+    :read_project,
+    :read_wiki,
+    :read_issue,
+    :read_milestone,
+    :read_snippet,
+    :read_team_member,
+    :read_merge_request,
+    :read_note,
+    :write_project,
+    :write_issue,
+    :write_note
+  ] if project.guest_access_for?(user)
+
+  rules << [
+    :download_code,
+    :write_merge_request,
+    :write_snippet
+  ] if project.report_access_for?(user)
+
+  rules << [
+    :write_wiki,
+    :push_code
+  ] if project.dev_access_for?(user)
+
+  rules << [
+    :push_code_to_protected_branches
+  ] if project.master_access_for?(user)
+
+  rules << [
+    :modify_issue,
+    :modify_snippet,
+    :modify_merge_request,
+    :admin_project,
+    :admin_issue,
+    :admin_milestone,
+    :admin_snippet,
+    :admin_team_member,
+    :admin_merge_request,
+    :admin_note,
+    :accept_mr,
+    :admin_wiki
+  ] if project.master_access_for?(user) || project.owner == user
+
+  rules.flatten
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Account.html b/doc/app/Account.html new file mode 100644 index 00000000..58f65758 --- /dev/null +++ b/doc/app/Account.html @@ -0,0 +1,881 @@ + + + + + + +module Account - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Account

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ block() + click to toggle source +
+ + +
+ +

Remove user from all projects and set blocked attribute to true

+ + + +
+
# File app/roles/account.rb, line 47
+def block
+  users_projects.find_each do |membership|
+    return false unless membership.destroy
+  end
+
+  self.blocked = true
+  save
+end
+
+ +
+ + + + +
+ + +
+ +
+ can_create_group?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 25
+def can_create_group?
+  is_admin?
+end
+
+ +
+ + + + +
+ + +
+ +
+ can_create_project?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 21
+def can_create_project?
+  projects_limit > my_own_projects.count
+end
+
+ +
+ + + + +
+ + +
+ +
+ cared_merge_requests() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 37
+def cared_merge_requests
+  MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id).opened
+end
+
+ +
+ + + + +
+ + +
+ +
+ first_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 33
+def first_name
+  name.split.first unless name.blank?
+end
+
+ +
+ + + + +
+ + +
+ +
+ identifier() + click to toggle source +
+ + +
+ +

Returns a string for use as a Gitolite user identifier

+ +

Note that Gitolite 2.x requires the following +pattern for users:

+ +
^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$
+ + + +
+
# File app/roles/account.rb, line 7
+def identifier
+  # Replace non-word chars with underscores, then make sure it starts with
+  # valid chars
+  email.gsub(%r\W/, '_').gsub(%r\A([\W\_])+/, '')
+end
+
+ +
+ + + + +
+ + +
+ +
+ is_admin?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 13
+def is_admin?
+  admin
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_activity_project() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 29
+def last_activity_project
+  projects.first
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_ids() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 41
+def project_ids
+  projects.map(&:id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ projects_limit_percent() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 56
+def projects_limit_percent
+  return 100 if projects_limit.zero?
+  (my_own_projects.count.to_f / projects_limit) * 100
+end
+
+ +
+ + + + +
+ + +
+ +
+ projects_with_events() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 70
+def projects_with_events
+  projects.includes(:events).order("events.created_at DESC")
+end
+
+ +
+ + + + +
+ + +
+ +
+ recent_push(project_id = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 61
+def recent_push project_id = nil
+  # Get push events not earlier than 2 hours ago
+  events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours)
+  events = events.where(project_id: project_id) if project_id
+
+  # Take only latest one
+  events = events.recent.limit(1).first
+end
+
+ +
+ + + + +
+ + +
+ +
+ require_ssh_key?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/account.rb, line 17
+def require_ssh_key?
+  keys.count == 0
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ActivityObserver.html b/doc/app/ActivityObserver.html new file mode 100644 index 00000000..3b31271d --- /dev/null +++ b/doc/app/ActivityObserver.html @@ -0,0 +1,531 @@ + + + + + + +class ActivityObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ActivityObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(record) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/activity_observer.rb, line 4
+def after_create(record)
+  Event.create(
+    project: record.project,
+    target_id: record.id,
+    target_type: record.class.name,
+    action: Event.determine_action(record),
+    author_id: record.author_id
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_save(record) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/activity_observer.rb, line 14
+def after_save(record)
+  if record.changed.include?("closed") 
+    Event.create(
+      project: record.project,
+      target_id: record.id,
+      target_type: record.class.name,
+      action: (record.closed ? Event::Closed : Event::Reopened),
+      author_id: record.author_id_of_changes
+    )
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin.html b/doc/app/Admin.html new file mode 100644 index 00000000..94fb27ef --- /dev/null +++ b/doc/app/Admin.html @@ -0,0 +1,432 @@ + + + + + + +module Admin - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Admin

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Admin/DashboardController.html b/doc/app/Admin/DashboardController.html new file mode 100644 index 00000000..00154b3d --- /dev/null +++ b/doc/app/Admin/DashboardController.html @@ -0,0 +1,488 @@ + + + + + + +class Admin::DashboardController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::DashboardController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/dashboard_controller.rb, line 2
+def index
+  @workers = Resque.workers
+  @pending_jobs = Resque.size(:post_receive)
+  @projects = Project.order("created_at DESC").limit(10)
+  @users = User.order("created_at DESC").limit(10)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin/GroupsController.html b/doc/app/Admin/GroupsController.html new file mode 100644 index 00000000..ef4dae9e --- /dev/null +++ b/doc/app/Admin/GroupsController.html @@ -0,0 +1,771 @@ + + + + + + +class Admin::GroupsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::GroupsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 23
+def create
+  @group = Group.new(params[:group])
+  @group.owner = current_user
+
+  if @group.save
+    redirect_to [:admin, @group], notice: 'Group was successfully created.'
+  else
+    render action: "new"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 64
+def destroy
+  @group.destroy
+
+  redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 20
+def edit
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 4
+def index
+  @groups = Group.scoped
+  @groups = @groups.search(params[:name]) if params[:name].present?
+  @groups = @groups.page(params[:page]).per(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 16
+def new
+  @group = Group.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 49
+def project_update
+  project_ids = params[:project_ids]
+  Project.where(id: project_ids).update_all(group_id: @group.id)
+
+  redirect_to :back, notice: 'Group was successfully updated.'
+end
+
+ +
+ + + + +
+ + +
+ +
+ remove_project() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 56
+def remove_project
+  @project = Project.find(params[:project_id])
+  @project.group_id = nil
+  @project.save
+
+  redirect_to :back, notice: 'Group was successfully updated.'
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 10
+def show
+  @projects = Project.scoped
+  @projects = @projects.not_in_group(@group) if @group.projects.present?
+  @projects = @projects.all
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/groups_controller.rb, line 34
+def update
+  group_params = params[:group].dup
+  owner_id =group_params.delete(:owner_id)
+
+  if owner_id
+    @group.owner = User.find(owner_id)
+  end
+
+  if @group.update_attributes(group_params)
+    redirect_to [:admin, @group], notice: 'Group was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin/HooksController.html b/doc/app/Admin/HooksController.html new file mode 100644 index 00000000..48cd5d00 --- /dev/null +++ b/doc/app/Admin/HooksController.html @@ -0,0 +1,603 @@ + + + + + + +class Admin::HooksController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::HooksController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/hooks_controller.rb, line 7
+def create
+  @hook = SystemHook.new(params[:hook])
+
+  if @hook.save
+    redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
+  else
+    @hooks = SystemHook.all
+    render :index
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/hooks_controller.rb, line 18
+def destroy
+  @hook = SystemHook.find(params[:id])
+  @hook.destroy
+
+  redirect_to admin_hooks_path
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/hooks_controller.rb, line 2
+def index
+  @hooks = SystemHook.all
+  @hook = SystemHook.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ test() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/hooks_controller.rb, line 26
+def test
+  @hook = SystemHook.find(params[:hook_id])
+  data = {
+    event_name: "project_create",
+    name: "Ruby",
+    path: "ruby",
+    project_id: 1,
+    owner_name: "Someone",
+    owner_email: "example@gitlabhq.com"
+  }
+  @hook.execute(data)
+
+  redirect_to :back
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin/LogsController.html b/doc/app/Admin/LogsController.html new file mode 100644 index 00000000..8f70b1ad --- /dev/null +++ b/doc/app/Admin/LogsController.html @@ -0,0 +1,439 @@ + + + + + + +class Admin::LogsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::LogsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Admin/ProjectsController.html b/doc/app/Admin/ProjectsController.html new file mode 100644 index 00000000..5744746b --- /dev/null +++ b/doc/app/Admin/ProjectsController.html @@ -0,0 +1,733 @@ + + + + + + +class Admin::ProjectsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::ProjectsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 29
+def create
+  @admin_project = Project.new(params[:project])
+  @admin_project.owner = current_user
+
+  if @admin_project.save
+    redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
+  else
+    render action: "new"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 54
+def destroy
+  @admin_project.destroy
+
+  redirect_to admin_projects_url, notice: 'Project was successfully deleted.'
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 20
+def edit
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 4
+def index
+  @admin_projects = Project.scoped
+  @admin_projects = @admin_projects.search(params[:name]) if params[:name].present?
+  @admin_projects = @admin_projects.page(params[:page]).per(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 16
+def new
+  @admin_project = Project.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 10
+def show
+  @users = User.scoped
+  @users = @users.not_in_project(@admin_project) if @admin_project.users.present?
+  @users = @users.all
+end
+
+ +
+ + + + +
+ + +
+ +
+ team_update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 23
+def team_update
+  @admin_project.add_users_ids_to_team(params[:user_ids], params[:project_access])
+
+  redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/projects_controller.rb, line 40
+def update
+  owner_id = params[:project].delete(:owner_id)
+
+  if owner_id
+    @admin_project.owner = User.find(owner_id)
+  end
+
+  if @admin_project.update_attributes(params[:project])
+    redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin/ResqueController.html b/doc/app/Admin/ResqueController.html new file mode 100644 index 00000000..db73599b --- /dev/null +++ b/doc/app/Admin/ResqueController.html @@ -0,0 +1,484 @@ + + + + + + +class Admin::ResqueController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::ResqueController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/resque_controller.rb, line 2
+def show
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin/TeamMembersController.html b/doc/app/Admin/TeamMembersController.html new file mode 100644 index 00000000..907bf279 --- /dev/null +++ b/doc/app/Admin/TeamMembersController.html @@ -0,0 +1,558 @@ + + + + + + +class Admin::TeamMembersController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::TeamMembersController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/team_members_controller.rb, line 16
+def destroy
+  @admin_team_member = UsersProject.find(params[:id])
+  @admin_team_member.destroy
+
+  redirect_to :back
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/team_members_controller.rb, line 2
+def edit
+  @admin_team_member = UsersProject.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/team_members_controller.rb, line 6
+def update
+  @admin_team_member = UsersProject.find(params[:id])
+
+  if @admin_team_member.update_attributes(params[:team_member])
+    redirect_to [:admin, @admin_team_member.project],  notice: 'Project Access was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Admin/UsersController.html b/doc/app/Admin/UsersController.html new file mode 100644 index 00000000..b300e4f7 --- /dev/null +++ b/doc/app/Admin/UsersController.html @@ -0,0 +1,839 @@ + + + + + + +class Admin::UsersController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Admin::UsersController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ block() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 40
+def block
+  @admin_user = User.find(params[:id])
+
+  if @admin_user.block
+    redirect_to :back, alert: "Successfully blocked"
+  else
+    redirect_to :back, alert: "Error occured. User was not blocked"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 60
+def create
+  admin = params[:user].delete("admin")
+
+  @admin_user = User.new(params[:user], as: :admin)
+  @admin_user.admin = (admin && admin.to_i > 0)
+
+  respond_to do |format|
+    if @admin_user.save
+      format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully created.' }
+      format.json { render json: @admin_user, status: :created, location: @admin_user }
+    else
+      format.html { render action: "new" }
+      format.json { render json: @admin_user.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 99
+def destroy
+  @admin_user = User.find(params[:id])
+  @admin_user.destroy
+
+  respond_to do |format|
+    format.html { redirect_to admin_users_url }
+    format.json { head :ok }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 36
+def edit
+  @admin_user = User.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 2
+def index
+  @admin_users = User.scoped
+  @admin_users = @admin_users.filter(params[:filter])
+  @admin_users = @admin_users.search(params[:name]) if params[:name].present?
+  @admin_users = @admin_users.order("updated_at DESC").page(params[:page])
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 32
+def new
+  @admin_user = User.new({ projects_limit: Gitlab.config.default_projects_limit }, as: :admin)
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 9
+def show
+  @admin_user = User.find(params[:id])
+
+  @projects = if @admin_user.projects.empty?
+             Project
+           else
+             Project.without_user(@admin_user)
+           end.all
+end
+
+ +
+ + + + +
+ + +
+ +
+ team_update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 19
+def team_update
+  @admin_user = User.find(params[:id])
+
+  UsersProject.user_bulk_import(
+    @admin_user,
+    params[:project_ids],
+    params[:project_access]
+  )
+
+  redirect_to [:admin, @admin_user], notice: 'Teams were successfully updated.'
+end
+
+ +
+ + + + +
+ + +
+ +
+ unblock() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 50
+def unblock
+  @admin_user = User.find(params[:id])
+
+  if @admin_user.update_attribute(:blocked, false)
+    redirect_to :back, alert: "Successfully unblocked"
+  else
+    redirect_to :back, alert: "Error occured. User was not unblocked"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin/users_controller.rb, line 77
+def update
+  admin = params[:user].delete("admin")
+
+  if params[:user][:password].blank?
+    params[:user].delete(:password)
+    params[:user].delete(:password_confirmation)
+  end
+
+  @admin_user = User.find(params[:id])
+  @admin_user.admin = (admin && admin.to_i > 0)
+
+  respond_to do |format|
+    if @admin_user.update_attributes(params[:user], as: :admin)
+      format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully updated.' }
+      format.json { head :ok }
+    else
+      format.html { render action: "edit" }
+      format.json { render json: @admin_user.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/AdminController.html b/doc/app/AdminController.html new file mode 100644 index 00000000..bdda7958 --- /dev/null +++ b/doc/app/AdminController.html @@ -0,0 +1,490 @@ + + + + + + +class AdminController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class AdminController

+ +
+ +

Provides a base class for Admin controllers to +subclass

+ +

Automatically sets the layout and ensures an administrator is logged in

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ authenticate_admin!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/admin_controller.rb, line 8
+def authenticate_admin!
+  return render_404 unless current_user.is_admin?
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html new file mode 100644 index 00000000..dafa3413 --- /dev/null +++ b/doc/app/ApplicationController.html @@ -0,0 +1,1015 @@ + + + + + + +class ApplicationController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ApplicationController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Protected Instance Methods

+ + +
+ +
+ abilities() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 48
+def abilities
+  @abilities ||= Six.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ access_denied!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 73
+def access_denied!
+  render "errors/access_denied", layout: "errors", status: 404
+end
+
+ +
+ + + + +
+ + +
+ +
+ add_project_abilities() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 61
+def add_project_abilities
+  abilities << Ability
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_sign_in_path_for(resource) + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 33
+def after_sign_in_path_for resource
+  if resource.is_a?(User) && resource.respond_to?(:blocked) && resource.blocked
+    sign_out resource
+    flash[:alert] = "Your account was blocked"
+    new_user_session_path
+  else
+    super
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ authorize_code_access!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 69
+def authorize_code_access!
+  return access_denied! unless can?(current_user, :download_code, project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ authorize_project!(action) + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 65
+def authorize_project!(action)
+  return access_denied! unless can?(current_user, action, project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ can?(object, action, subject) + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 52
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+ +
+ + + + +
+ + +
+ +
+ dev_tools() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 107
+def dev_tools
+  Rack::MiniProfiler.authorize_request
+end
+
+ +
+ + + + +
+ + +
+ +
+ git_not_found!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 81
+def git_not_found!
+  render "errors/git_not_found", layout: "errors", status: 404
+end
+
+ +
+ + + + +
+ + +
+ +
+ method_missing(method_sym, *arguments, &block) + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 85
+def method_missing(method_sym, *arguments, &block)
+  if method_sym.to_s =~ %r^authorize_(.*)!$/
+    authorize_project!($1.to_sym)
+  else
+    super
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ no_cache_headers() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 101
+def no_cache_headers
+  response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
+  response.headers["Pragma"] = "no-cache"
+  response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
+end
+
+ +
+ + + + +
+ + +
+ +
+ not_found!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 77
+def not_found!
+  render "errors/not_found", layout: "errors", status: 404
+end
+
+ +
+ + + + +
+ + +
+ +
+ project() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 56
+def project
+  @project ||= current_user.projects.find_by_code(params[:project_id] || params[:id])
+  @project || render_404
+end
+
+ +
+ + + + +
+ + +
+ +
+ reject_blocked!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 25
+def reject_blocked!
+  if current_user && current_user.blocked
+    sign_out current_user
+    flash[:alert] = "Your account was blocked"
+    redirect_to new_user_session_path
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ render_404() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 93
+def render_404
+  render file: Rails.root.join("public", "404"), layout: false, status: "404"
+end
+
+ +
+ + + + +
+ + +
+ +
+ require_non_empty_project() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 97
+def require_non_empty_project
+  redirect_to @project if @project.empty_repo?
+end
+
+ +
+ + + + +
+ + +
+ +
+ set_current_user_for_observers() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/application_controller.rb, line 43
+def set_current_user_for_observers
+  MergeRequestObserver.current_user = current_user
+  IssueObserver.current_user = current_user
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ApplicationDecorator.html b/doc/app/ApplicationDecorator.html new file mode 100644 index 00000000..72a459bb --- /dev/null +++ b/doc/app/ApplicationDecorator.html @@ -0,0 +1,439 @@ + + + + + + +class ApplicationDecorator - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ApplicationDecorator

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/ApplicationHelper.html b/doc/app/ApplicationHelper.html new file mode 100644 index 00000000..9bc4243e --- /dev/null +++ b/doc/app/ApplicationHelper.html @@ -0,0 +1,1018 @@ + + + + + + +module ApplicationHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module ApplicationHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ app_theme() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 125
+def app_theme
+  Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
+end
+
+ +
+ + + + +
+ + +
+ +
+ authbutton(provider, size = 64) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 150
+def authbutton(provider, size = 64)
+  file_name = "#{provider.to_s.split('_').first}_#{size}.png"
+  image_tag("authbuttons/#{file_name}",
+            alt: "Sign in with #{provider.to_s.titleize}")
+end
+
+ +
+ + + + +
+ + +
+ +
+ current_action?(*args) + click to toggle source +
+ + +
+ +

Check if a partcular action is the current one

+ +

args - One or more action names to check

+ +

Examples

+ +
# On Projects#new
+current_action?(:new)           # => true
+current_action?(:create)        # => false
+current_action?(:new, :create)  # => true
+
+ + + +
+
# File app/helpers/application_helper.rb, line 29
+def current_action?(*args)
+  args.any? { |v| v.to_s.downcase == action_name }
+end
+
+ +
+ + + + +
+ + +
+ +
+ current_controller?(*args) + click to toggle source +
+ + +
+ +

Check if a particular controller is the current one

+ +

args - One or more controller names to check

+ +

Examples

+ +
# On TreeController
+current_controller?(:tree)           # => true
+current_controller?(:commits)        # => false
+current_controller?(:commits, :tree) # => true
+
+ + + +
+
# File app/helpers/application_helper.rb, line 15
+def current_controller?(*args)
+  args.any? { |v| v.to_s.downcase == controller.controller_name }
+end
+
+ +
+ + + + +
+ + +
+ +
+ emoji_autocomplete_source() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 115
+def emoji_autocomplete_source
+  # should be an array of strings
+  # so to_s can be called, because it is sufficient and to_json is too slow
+  Emoji.names.to_s
+end
+
+ +
+ + + + +
+ + +
+ +
+ gravatar_icon(user_email = '', size = 40) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 33
+def gravatar_icon(user_email = '', size = 40)
+  if Gitlab.config.disable_gravatar? || user_email.blank?
+    'no_avatar.png'
+  else
+    gravatar_prefix = request.ssl? ? "https://secure" : "http://www"
+    user_email.strip!
+    "#{gravatar_prefix}.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ grouped_options_refs(destination = :tree) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 61
+def grouped_options_refs(destination = :tree)
+  options = [
+    ["Branch", @project.branch_names ],
+    [ "Tag", @project.tag_names ]
+  ]
+
+  # If reference is commit id -
+  # we should add it to branch/tag selectbox
+  if(@ref && !options.flatten.include?(@ref) &&
+     @ref =~ %r^[0-9a-zA-Z]{6,52}$/)
+    options << ["Commit", [@ref]]
+  end
+
+  grouped_options_for_select(options, @ref || @project.default_branch)
+end
+
+ +
+ + + + +
+ + +
+ +
+ hexdigest(string) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 137
+def hexdigest(string)
+  Digest::SHA1.hexdigest string
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_commit(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 51
+def last_commit(project)
+  if project.repo_exists?
+    time_ago_in_words(project.commit.committed_date) + " ago"
+  else
+    "Never"
+  end
+rescue
+  "Never"
+end
+
+ +
+ + + + +
+ + +
+ +
+ ldap_enable?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 121
+def ldap_enable?
+  Devise.omniauth_providers.include?(:ldap)
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_last_activity(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 141
+def project_last_activity project
+  activity = project.last_activity
+  if activity && activity.created_at
+    time_ago_in_words(activity.created_at) + " ago"
+  else
+    "Never"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ request_protocol() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 43
+def request_protocol
+  request.ssl? ? "https" : "http"
+end
+
+ +
+ + + + +
+ + +
+ +
+ search_autocomplete_source() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 77
+def search_autocomplete_source
+  projects = current_user.projects.map{ |p| { label: p.name, url: project_path(p) } }
+
+  default_nav = [
+    { label: "My Profile", url: profile_path },
+    { label: "My SSH Keys", url: keys_path },
+    { label: "My Dashboard", url: root_path },
+    { label: "Admin Section", url: admin_root_path },
+  ]
+
+  help_nav = [
+    { label: "Workflow Help", url: help_workflow_path },
+    { label: "Permissions Help", url: help_permissions_path },
+    { label: "Web Hooks Help", url: help_web_hooks_path },
+    { label: "System Hooks Help", url: help_system_hooks_path },
+    { label: "API Help", url: help_api_path },
+    { label: "Markdown Help", url: help_markdown_path },
+    { label: "SSH Keys Help", url: help_ssh_path },
+  ]
+
+  project_nav = []
+  if @project && !@project.new_record?
+    project_nav = [
+      { label: "#{@project.name} Issues",   url: project_issues_path(@project) },
+      { label: "#{@project.name} Commits",  url: project_commits_path(@project, @ref || @project.root_ref) },
+      { label: "#{@project.name} Merge Requests", url: project_merge_requests_path(@project) },
+      { label: "#{@project.name} Milestones", url: project_milestones_path(@project) },
+      { label: "#{@project.name} Snippets", url: project_snippets_path(@project) },
+      { label: "#{@project.name} Team",     url: project_team_index_path(@project) },
+      { label: "#{@project.name} Tree",     url: project_tree_path(@project, @ref || @project.root_ref) },
+      { label: "#{@project.name} Wall",     url: wall_project_path(@project) },
+      { label: "#{@project.name} Wiki",     url: project_wikis_path(@project) },
+    ]
+  end
+
+  [projects, default_nav, project_nav, help_nav].flatten.to_json
+end
+
+ +
+ + + + +
+ + +
+ +
+ show_last_push_widget?(event) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 129
+def show_last_push_widget?(event)
+  event &&
+    event.last_push_to_non_root? &&
+    !event.rm_ref? &&
+    event.project &&
+    event.project.merge_requests_enabled
+end
+
+ +
+ + + + +
+ + +
+ +
+ web_app_url() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/application_helper.rb, line 47
+def web_app_url
+  "#{request_protocol}://#{Gitlab.config.web_host}/"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/AttachmentUploader.html b/doc/app/AttachmentUploader.html new file mode 100644 index 00000000..b6e9d1ba --- /dev/null +++ b/doc/app/AttachmentUploader.html @@ -0,0 +1,486 @@ + + + + + + +class AttachmentUploader - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class AttachmentUploader

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ store_dir() + click to toggle source +
+ + +
+ +

Override the directory where uploaded files will be stored. This is a +sensible default for uploaders that are meant to be mounted:

+ + + +
+
# File app/uploaders/attachment_uploader.rb, line 15
+def store_dir
+  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Authority.html b/doc/app/Authority.html new file mode 100644 index 00000000..92f46c55 --- /dev/null +++ b/doc/app/Authority.html @@ -0,0 +1,782 @@ + + + + + + +module Authority - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Authority

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ add_access(user, *access) + click to toggle source +
+ + +
+ +

Compatible with all access rights Should be rewrited for new access rights

+ + + +
+
# File app/roles/authority.rb, line 4
+def add_access(user, *access)
+  access = if access.include?(:admin)
+             { project_access: UsersProject::MASTER }
+           elsif access.include?(:write)
+             { project_access: UsersProject::DEVELOPER }
+           else
+             { project_access: UsersProject::REPORTER }
+           end
+  opts = { user: user }
+  opts.merge!(access)
+  users_projects.create(opts)
+end
+
+ +
+ + + + +
+ + +
+ +
+ allow_read_for?(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 39
+def allow_read_for?(user)
+  !users_projects.where(user_id: user.id).empty?
+end
+
+ +
+ + + + +
+ + +
+ +
+ dev_access_for?(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 51
+def dev_access_for?(user)
+  !users_projects.where(user_id: user.id, project_access: [UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
+end
+
+ +
+ + + + +
+ + +
+ +
+ guest_access_for?(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 43
+def guest_access_for?(user)
+  !users_projects.where(user_id: user.id).empty?
+end
+
+ +
+ + + + +
+ + +
+ +
+ master_access_for?(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 55
+def master_access_for?(user)
+  !users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty?
+end
+
+ +
+ + + + +
+ + +
+ +
+ report_access_for?(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 47
+def report_access_for?(user)
+  !users_projects.where(user_id: user.id, project_access: [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
+end
+
+ +
+ + + + +
+ + +
+ +
+ repository_masters() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 33
+def repository_masters
+  keys = Key.joins({user: :users_projects}).
+    where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::MASTER)
+  keys.map(&:identifier)
+end
+
+ +
+ + + + +
+ + +
+ +
+ repository_readers() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 21
+def repository_readers
+  keys = Key.joins({user: :users_projects}).
+    where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::REPORTER)
+  keys.map(&:identifier) + deploy_keys.map(&:identifier)
+end
+
+ +
+ + + + +
+ + +
+ +
+ repository_writers() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 27
+def repository_writers
+  keys = Key.joins({user: :users_projects}).
+    where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::DEVELOPER)
+  keys.map(&:identifier)
+end
+
+ +
+ + + + +
+ + +
+ +
+ reset_access(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/authority.rb, line 17
+def reset_access(user)
+  users_projects.where(project_id: self.id, user_id: user.id).destroy if self.id
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/BaseContext.html b/doc/app/BaseContext.html new file mode 100644 index 00000000..b9c46738 --- /dev/null +++ b/doc/app/BaseContext.html @@ -0,0 +1,605 @@ + + + + + + +class BaseContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class BaseContext

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ current_user[RW] +
+ +
+ + + +
+
+ +
+
+ params[RW] +
+ +
+ + + +
+
+ +
+
+ project[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(project, user, params) + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/base_context.rb, line 4
+def initialize(project, user, params)
+  @project, @current_user, @params = project, user, params.dup
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ abilities() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/base_context.rb, line 8
+def abilities
+  @abilities ||= begin
+                   abilities = Six.new
+                   abilities << Ability
+                   abilities
+                 end
+end
+
+ +
+ + + + +
+ + +
+ +
+ can?(object, action, subject) + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/base_context.rb, line 16
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/BlameController.html b/doc/app/BlameController.html new file mode 100644 index 00000000..4b23b227 --- /dev/null +++ b/doc/app/BlameController.html @@ -0,0 +1,500 @@ + + + + + + +class BlameController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class BlameController

+ +
+ +

Controller for viewing a file’s blame

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/blame_controller.rb, line 12
+def show
+  @repo = @project.repo
+  @blame = Grit::Blob.blame(@repo, @commit.id, @path)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/BlobController.html b/doc/app/BlobController.html new file mode 100644 index 00000000..e8f069c2 --- /dev/null +++ b/doc/app/BlobController.html @@ -0,0 +1,519 @@ + + + + + + +class BlobController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class BlobController

+ +
+ +

Controller for viewing a file’s blame

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/blob_controller.rb, line 13
+def show
+  if @tree.is_blob?
+    if @tree.text?
+      encoding = detect_encoding(@tree.data)
+      mime_type = encoding ? "text/plain; charset=#{encoding}" : "text/plain"
+    else
+      mime_type = @tree.mime_type
+    end
+
+    send_data(
+      @tree.data,
+      type: mime_type,
+      disposition: 'inline',
+      filename: @tree.name
+    )
+  else
+    not_found!
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Commit.html b/doc/app/Commit.html new file mode 100644 index 00000000..05a3f3ce --- /dev/null +++ b/doc/app/Commit.html @@ -0,0 +1,1191 @@ + + + + + + +class Commit - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Commit

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ commit[RW] +
+ +
+ + + +
+
+ +
+
+ head[RW] +
+ +
+ + + +
+
+ +
+
+ refs[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ commits(repo, ref, path = nil, limit = nil, offset = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 58
+def commits(repo, ref, path = nil, limit = nil, offset = nil)
+  if path
+    repo.log(ref, path, max_count: limit, skip: offset)
+  elsif limit && offset
+    repo.commits(ref, limit, offset)
+  else
+    repo.commits(ref)
+  end.map{ |c| Commit.new(c) }
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_between(repo, from, to) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 68
+def commits_between(repo, from, to)
+  repo.commits_between(from, to).map { |c| Commit.new(c) }
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_since(repo, date) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 46
+def commits_since(repo, date)
+  commits = repo.heads.map do |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|
+    y.committed_date <=> x.committed_date
+  end
+
+  commits
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_with_refs(repo, n = 20) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 36
+def commits_with_refs(repo, n = 20)
+  commits = repo.branches.map { |ref| Commit.new(ref.commit, ref) }
+
+  commits.sort! do |x, y|
+    y.committed_date <=> x.committed_date
+  end
+
+  commits[0..n]
+end
+
+ +
+ + + + +
+ + +
+ +
+ compare(project, from, to) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 72
+def compare(project, from, to)
+  result = {
+    commits: [],
+    diffs: [],
+    commit: nil,
+    same: false
+  }
+
+  return result unless from && to
+
+  first = project.commit(to.try(:strip))
+  last = project.commit(from.try(:strip))
+
+  if first && last
+    commits = [first, last].sort_by(&:created_at)
+    younger = commits.first
+    older = commits.last
+
+    result[:same] = (younger.id == older.id)
+    result[:commits] = project.repo.commits_between(younger.id, older.id).map {|c| Commit.new(c)}
+    result[:diffs] = project.repo.diff(younger.id, older.id) rescue []
+    result[:commit] = Commit.new(older)
+  end
+
+  result
+end
+
+ +
+ + + + +
+ + +
+ +
+ find_or_first(repo, commit_id = nil, root_ref) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 14
+def find_or_first(repo, commit_id = nil, root_ref)
+  commit = if commit_id
+             repo.commit(commit_id)
+           else
+             repo.commits(root_ref).first
+           end
+
+  Commit.new(commit) if commit
+end
+
+ +
+ + + + +
+ + +
+ +
+ fresh_commits(repo, n = 10) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 24
+def fresh_commits(repo, n = 10)
+  commits = repo.heads.map do |h|
+    repo.commits(h.name, n).map { |c| Commit.new(c, h) }
+  end.flatten.uniq { |c| c.id }
+
+  commits.sort! do |x, y|
+    y.committed_date <=> x.committed_date
+  end
+
+  commits[0...n]
+end
+
+ +
+ + + + +
+ + +
+ +
+ new(raw_commit, head = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 100
+def initialize(raw_commit, head = nil)
+  @commit = raw_commit
+  @head = head
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ author_email() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 117
+def author_email
+  author.email
+end
+
+ +
+ + + + +
+ + +
+ +
+ author_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 121
+def author_name
+  utf8 author.name
+end
+
+ +
+ + + + +
+ + +
+ +
+ committer_email() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 134
+def committer_email
+  committer.email
+end
+
+ +
+ + + + +
+ + +
+ +
+ committer_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 130
+def committer_name
+  utf8 committer.name
+end
+
+ +
+ + + + +
+ + +
+ +
+ created_at() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 113
+def created_at
+  committed_date
+end
+
+ +
+ + + + +
+ + +
+ +
+ different_committer?() + click to toggle source +
+ + +
+ +

Was this commit committed by a different person than the original author?

+ + + +
+
# File app/models/commit.rb, line 126
+def different_committer?
+  author_name != committer_name || author_email != committer_email
+end
+
+ +
+ + + + +
+ + +
+ +
+ parents_count() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 146
+def parents_count
+  parents && parents.count || 0
+end
+
+ +
+ + + + +
+ + +
+ +
+ prev_commit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 138
+def prev_commit
+  parents.try :first
+end
+
+ +
+ + + + +
+ + +
+ +
+ prev_commit_id() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 142
+def prev_commit_id
+  prev_commit.try :id
+end
+
+ +
+ + + + +
+ + +
+ +
+ safe_message() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 109
+def safe_message
+  @safe_message ||= utf8 message
+end
+
+ +
+ + + + +
+ + +
+ +
+ short_id(length = 10) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/commit.rb, line 105
+def short_id(length = 10)
+  id.to_s[0..length]
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/CommitController.html b/doc/app/CommitController.html new file mode 100644 index 00000000..564161e9 --- /dev/null +++ b/doc/app/CommitController.html @@ -0,0 +1,509 @@ + + + + + + +class CommitController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class CommitController

+ +
+ +

Controller for a specific Commit

+ +

Not to be confused with CommitsController, plural.

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/commit_controller.rb, line 10
+def show
+  result = CommitLoadContext.new(project, current_user, params).execute
+
+  @commit = result[:commit]
+  git_not_found! unless @commit
+
+  @suppress_diff    = result[:suppress_diff]
+  @note             = result[:note]
+  @line_notes       = result[:line_notes]
+  @notes_count      = result[:notes_count]
+  @comments_allowed = true
+
+  respond_to do |format|
+    format.html do
+      if result[:status] == :huge_commit
+        render "huge_commit" and return
+      end
+    end
+
+    format.patch
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/CommitDecorator.html b/doc/app/CommitDecorator.html new file mode 100644 index 00000000..3cca57a4 --- /dev/null +++ b/doc/app/CommitDecorator.html @@ -0,0 +1,663 @@ + + + + + + +class CommitDecorator - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class CommitDecorator

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + + + + +
+ +
+ description() + click to toggle source +
+ + +
+ +

Returns the commits description

+ +

cut off, ellipses (`&hellp;`) are prepended to the commit message.

+ + + +
+
# File app/decorators/commit_decorator.rb, line 34
+def description
+  description = safe_message
+
+  title_end = description.index(%r\n/)
+  if (!title_end && description.length > 80) || (title_end && title_end > 80)
+    "&hellip;".html_safe << description[70..-1]
+  else
+    description.split(%r\n/, 2)[1].try(:chomp)
+  end
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ title() + click to toggle source +
+ + +
+ +

Returns the commits title.

+ +

Usually, the commit title is the first line of the commit message. In case +this first line is longer than 80 characters, it is cut off after 70 +characters and ellipses (`&hellp;`) are appended.

+ + + +
+
# File app/decorators/commit_decorator.rb, line 18
+def title
+  title = safe_message
+
+  return no_commit_message if title.blank?
+
+  title_end = title.index(%r\n/)
+  if (!title_end && title.length > 80) || (title_end && title_end > 80)
+    title[0..69] << "&hellip;".html_safe
+  else
+    title.split(%r\n/, 2).first
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ no_commit_message() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/commit_decorator.rb, line 69
+def no_commit_message
+  "--no commit message"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/CommitLoadContext.html b/doc/app/CommitLoadContext.html new file mode 100644 index 00000000..feb6dbf4 --- /dev/null +++ b/doc/app/CommitLoadContext.html @@ -0,0 +1,513 @@ + + + + + + +class CommitLoadContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class CommitLoadContext

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/commit_load_context.rb, line 2
+def execute
+  result = {
+    commit: nil,
+    suppress_diff: false,
+    line_notes: [],
+    notes_count: 0,
+    note: nil,
+    status: :ok
+  }
+
+  commit = project.commit(params[:id])
+
+  if commit
+    commit = CommitDecorator.decorate(commit)
+    line_notes = project.commit_line_notes(commit)
+
+    result[:commit] = commit
+    result[:note] = project.build_commit_note(commit)
+    result[:line_notes] = line_notes
+    result[:notes_count] = line_notes.count + project.commit_notes(commit).count
+
+    begin
+      result[:suppress_diff] = true if commit.diffs.size > 200 && !params[:force_show_diff]
+    rescue Grit::Git::GitTimeout
+      result[:suppress_diff] = true
+      result[:status] = :huge_commit
+    end
+  end
+
+  result
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/CommitsController.html b/doc/app/CommitsController.html new file mode 100644 index 00000000..52eaad04 --- /dev/null +++ b/doc/app/CommitsController.html @@ -0,0 +1,507 @@ + + + + + + +class CommitsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class CommitsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/commits_controller.rb, line 11
+def show
+  @repo = @project.repo
+  @limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
+
+  @commits = @project.commits(@ref, @path, @limit, @offset)
+  @commits = CommitDecorator.decorate(@commits)
+
+  respond_to do |format|
+    format.html # index.html.erb
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/CommitsHelper.html b/doc/app/CommitsHelper.html new file mode 100644 index 00000000..58844bec --- /dev/null +++ b/doc/app/CommitsHelper.html @@ -0,0 +1,625 @@ + + + + + + +module CommitsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module CommitsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ build_line_anchor(index, line_new, line_old) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/commits_helper.rb, line 12
+def build_line_anchor(index, line_new, line_old)
+  "#{index}_#{line_old}_#{line_new}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ each_diff_line(diff_arr, index) { |full_line, type, nil, nil, nil| ... } + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/commits_helper.rb, line 16
+def each_diff_line(diff_arr, index)
+  line_old = 1
+  line_new = 1
+  type = nil
+
+  lines_arr = ::Gitlab::InlineDiff.processing diff_arr
+  lines_arr.each do |line|
+    next if line.match(%r^\-\-\- \/dev\/null/)
+    next if line.match(%r^\+\+\+ \/dev\/null/)
+    next if line.match(%r^\-\-\- a/)
+    next if line.match(%r^\+\+\+ b/)
+
+    full_line = html_escape(line.gsub(%r\n/, ''))
+    full_line = ::Gitlab::InlineDiff.replace_markers full_line
+
+    if line.match(%r^@@ -/)
+      type = "match"
+
+      line_old = line.match(%r\-[0-9]*/)[0].to_i.abs rescue 0
+      line_new = line.match(%r\+[0-9]*/)[0].to_i.abs rescue 0
+
+      next if line_old == 1 && line_new == 1 #top of file
+      yield(full_line, type, nil, nil, nil)
+      next
+    else
+      type = identification_type(line)
+      line_code = build_line_anchor(index, line_new, line_old)
+      yield(full_line, type, line_code, line_new, line_old)
+    end
+
+
+    if line[0] == "+"
+      line_new += 1
+    elsif line[0] == "-"
+      line_old += 1
+    else
+      line_new += 1
+      line_old += 1
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ identification_type(line) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/commits_helper.rb, line 2
+def identification_type(line)
+  if line[0] == "+"
+    "new"
+  elsif line[0] == "-"
+    "old"
+  else
+    nil
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ image_diff_class(diff) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/commits_helper.rb, line 58
+def image_diff_class(diff)
+  if diff.deleted_file
+    "diff_image_removed"
+  elsif diff.new_file
+    "diff_image_added"
+  else
+    nil
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/CompareController.html b/doc/app/CompareController.html new file mode 100644 index 00000000..177e22d2 --- /dev/null +++ b/doc/app/CompareController.html @@ -0,0 +1,556 @@ + + + + + + +class CompareController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class CompareController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/compare_controller.rb, line 22
+def create
+  redirect_to project_compare_path(@project, params[:from], params[:to])
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/compare_controller.rb, line 7
+def index
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/compare_controller.rb, line 10
+def show
+  result = Commit.compare(project, params[:from], params[:to])
+
+  @commits       = result[:commits]
+  @commit        = result[:commit]
+  @diffs         = result[:diffs]
+  @refs_are_same = result[:same]
+  @line_notes    = []
+
+  @commits = CommitDecorator.decorate(@commits)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/DashboardController.html b/doc/app/DashboardController.html new file mode 100644 index 00000000..e3f4d1b4 --- /dev/null +++ b/doc/app/DashboardController.html @@ -0,0 +1,569 @@ + + + + + + +class DashboardController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class DashboardController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/dashboard_controller.rb, line 4
+def index
+  @groups = Group.where(id: current_user.projects.pluck(:group_id))
+  @projects = current_user.projects_with_events
+  @projects = @projects.page(params[:page]).per(30)
+
+  @events = Event.in_projects(current_user.project_ids).limit(20).offset(params[:offset] || 0)
+  @last_push = current_user.recent_push
+
+  respond_to do |format|
+    format.html
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ issues() + click to toggle source +
+ + +
+ +

Get only assigned issues

+ + + +
+
# File app/controllers/dashboard_controller.rb, line 26
+def issues
+  @projects = current_user.projects.all
+  @user   = current_user
+  @issues = current_user.assigned_issues.opened.recent.page(params[:page]).per(20)
+  @issues = @issues.includes(:author, :project)
+
+  respond_to do |format|
+    format.html
+    format.atom { render layout: false }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge_requests() + click to toggle source +
+ + +
+ +

Get authored or assigned open merge requests

+ + + +
+
# File app/controllers/dashboard_controller.rb, line 20
+def merge_requests
+  @projects = current_user.projects.all
+  @merge_requests = current_user.cared_merge_requests.recent.page(params[:page]).per(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/DeployKeysController.html b/doc/app/DeployKeysController.html new file mode 100644 index 00000000..318a1441 --- /dev/null +++ b/doc/app/DeployKeysController.html @@ -0,0 +1,626 @@ + + + + + + +class DeployKeysController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class DeployKeysController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/deploy_keys_controller.rb, line 21
+def create
+  @key = @project.deploy_keys.new(params[:key])
+  if @key.save
+    redirect_to project_deploy_keys_path(@project)
+  else
+    render "new"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/deploy_keys_controller.rb, line 30
+def destroy
+  @key = @project.deploy_keys.find(params[:id])
+  @key.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_deploy_keys_url }
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/deploy_keys_controller.rb, line 7
+def index
+  @keys = @project.deploy_keys.all
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/deploy_keys_controller.rb, line 15
+def new
+  @key = @project.deploy_keys.new
+
+  respond_with(@key)
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/deploy_keys_controller.rb, line 11
+def show
+  @key = @project.deploy_keys.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ErrorsController.html b/doc/app/ErrorsController.html new file mode 100644 index 00000000..e77a67d7 --- /dev/null +++ b/doc/app/ErrorsController.html @@ -0,0 +1,485 @@ + + + + + + +class ErrorsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ErrorsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ githost() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/errors_controller.rb, line 2
+def githost
+  render "errors/gitolite"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Event.html b/doc/app/Event.html new file mode 100644 index 00000000..1347cda3 --- /dev/null +++ b/doc/app/Event.html @@ -0,0 +1,1222 @@ + + + + + + +class Event - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Event

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
Closed + +
+ + +
Commented + +
+ + +
Created + +
+ + +
Joined + +
+ + +
Left + +
+ + +
Merged + +
+ + +
Pushed + +
+ + +
Reopened + +
+ + +
Updated + +
+ + +
+
+ + + + + + +
+

Public Class Methods

+ + +
+ +
+ determine_action(record) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 36
+def determine_action(record)
+  if [Issue, MergeRequest].include? record.class
+    Event::Created
+  elsif record.kind_of? Note
+    Event::Commented
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ action_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 133
+def action_name
+  if closed?
+    "closed"
+  elsif merged?
+    "merged"
+  elsif joined?
+    'joined'
+  elsif left?
+    'left'
+  else
+    "opened"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ allowed?() + click to toggle source +
+ + +
+ +

Next events currently enabled for system

+ +
- push
+- new issue
+- merge request
+ + + +
+
# File app/models/event.rb, line 49
+def allowed?
+  push? || issue? || merge_request? || membership_changed?
+end
+
+ +
+ + + + +
+ + +
+ +
+ author() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 129
+def author
+  @author ||= User.find(author_id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ changed_issue?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 104
+def changed_issue?
+  target_type == "Issue" &&
+    [Closed, Reopened].include?(action)
+end
+
+ +
+ + + + +
+ + +
+ +
+ changed_merge_request?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 99
+def changed_merge_request?
+  target_type == "MergeRequest" &&
+    [Closed, Reopened].include?(action)
+end
+
+ +
+ + + + +
+ + +
+ +
+ closed?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 73
+def closed?
+  action == self.class::Closed
+end
+
+ +
+ + + + +
+ + +
+ +
+ issue() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 121
+def issue
+  target if target_type == "Issue"
+end
+
+ +
+ + + + +
+ + +
+ +
+ issue?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 81
+def issue?
+  target_type == "Issue"
+end
+
+ +
+ + + + +
+ + +
+ +
+ joined?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 109
+def joined?
+  action == Joined
+end
+
+ +
+ + + + +
+ + +
+ +
+ left?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 113
+def left?
+  action == Left
+end
+
+ +
+ + + + +
+ + +
+ +
+ membership_changed?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 117
+def membership_changed?
+  joined? || left?
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge_request() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 125
+def merge_request
+  target if target_type == "MergeRequest"
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge_request?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 85
+def merge_request?
+  target_type == "MergeRequest"
+end
+
+ +
+ + + + +
+ + +
+ +
+ merged?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 69
+def merged?
+  action == self.class::Merged
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_issue?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 89
+def new_issue?
+  target_type == "Issue" &&
+    action == Created
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_merge_request?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 94
+def new_merge_request?
+  target_type == "MergeRequest" &&
+    action == Created
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 53
+def project_name
+  if project
+    project.name
+  else
+    "(deleted project)"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ push?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 65
+def push?
+  action == self.class::Pushed && valid_push?
+end
+
+ +
+ + + + +
+ + +
+ +
+ reopened?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 77
+def reopened?
+  action == self.class::Reopened
+end
+
+ +
+ + + + +
+ + +
+ +
+ target_title() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/event.rb, line 61
+def target_title
+  target.try :title
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/EventDecorator.html b/doc/app/EventDecorator.html new file mode 100644 index 00000000..dddb98a6 --- /dev/null +++ b/doc/app/EventDecorator.html @@ -0,0 +1,578 @@ + + + + + + +class EventDecorator - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class EventDecorator

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ feed_summary() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/event_decorator.rb, line 37
+def feed_summary
+  if self.issue?
+    h.render "events/event_issue", issue: self.issue
+  elsif self.push?
+    h.render "events/event_push", event: self
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ feed_title() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/event_decorator.rb, line 4
+def feed_title
+  if self.issue?
+    "#{self.author_name} #{self.action_name} issue ##{self.target_id}: #{self.issue_title} at #{self.project.name}"
+  elsif self.merge_request?
+    "#{self.author_name} #{self.action_name} MR ##{self.target_id}: #{self.merge_request_title} at #{self.project.name}"
+  elsif self.push?
+    "#{self.author_name} #{self.push_action_name} #{self.ref_type} #{self.ref_name} at #{self.project.name}"
+  elsif self.membership_changed?
+    "#{self.author_name} #{self.action_name} #{self.project.name}"
+  else
+    ""
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ feed_url() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/event_decorator.rb, line 18
+def feed_url
+  if self.issue?
+    h.project_issue_url(self.project, self.issue)
+  elsif self.merge_request?
+    h.project_merge_request_url(self.project, self.merge_request)
+
+  elsif self.push?
+    if self.push_with_commits?
+      if self.commits_count > 1
+        h.project_compare_url(self.project, :from => self.parent_commit.id, :to => self.last_commit.id)
+      else
+        h.project_commit_url(self.project, :id => self.last_commit.id)
+      end
+    else
+      h.project_commits_url(self.project, self.ref_name)
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/EventsHelper.html b/doc/app/EventsHelper.html new file mode 100644 index 00000000..4f7c0454 --- /dev/null +++ b/doc/app/EventsHelper.html @@ -0,0 +1,566 @@ + + + + + + +module EventsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module EventsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ event_action_name(event) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/events_helper.rb, line 13
+def event_action_name(event)
+  target = if event.target_type
+             event.target_type.titleize.downcase
+           else
+             'project'
+           end
+
+  [event.action_name, target].join(" ")
+end
+
+ +
+ + + + +
+ + +
+ +
+ event_image(event) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/events_helper.rb, line 23
+def event_image event
+  event_image_path = if event.push?
+                 "event_push.png"
+               elsif event.merged?
+                 "event_mr_merged.png"
+               end
+
+  return nil unless event_image_path
+
+  content_tag :div, class: 'event_icon' do
+    image_tag event_image_path
+  end
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ +
+ + + + diff --git a/doc/app/ExtractsPath.html b/doc/app/ExtractsPath.html new file mode 100644 index 00000000..e3825307 --- /dev/null +++ b/doc/app/ExtractsPath.html @@ -0,0 +1,614 @@ + + + + + + +module ExtractsPath - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module ExtractsPath

+ +
+ +

Module providing methods for dealing with separating a tree-ish string and +a file path string when combined in a request parameter

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ assign_ref_vars() + click to toggle source +
+ + +
+ +

Assigns common instance variables for views working with Git tree-ish +objects

+ +

Assignments are:

+
  • +

    @id - A string representing the joined ref and path

    +
  • +

    @ref - A string representing the ref (e.g., the branch, tag, or commit +SHA)

    +
  • +

    @path - A string representing the filesystem path

    +
  • +

    @commit - A CommitDecorator representing +the commit from the given ref

    +
  • +

    @tree - A TreeDecorator representing the +tree at the given ref/path

    +
+ +

If the :id parameter appears to be requesting a specific response format, +that will be handled as well.

+ +

Automatically renders `not_found!` if a valid tree path could not be +resolved (e.g., when a user inserts an invalid path or ref).

+ + + +
+
# File lib/extracts_path.rb, line 94
+def assign_ref_vars
+  # Handle formats embedded in the id
+  if params[:id].ends_with?('.atom')
+    params[:id].gsub!(%r\.atom$/, '')
+    request.format = :atom
+  end
+
+  @ref, @path = extract_ref(params[:id])
+
+  @id = File.join(@ref, @path)
+
+  @commit = CommitDecorator.decorate(@project.commit(@ref))
+
+  @tree = Tree.new(@commit.tree, @project, @ref, @path)
+  @tree = TreeDecorator.new(@tree)
+
+  raise InvalidPathError if @tree.invalid?
+rescue NoMethodError, InvalidPathError
+  not_found!
+end
+
+ +
+ + + + +
+ + +
+ +
+ extract_ref(input) + click to toggle source +
+ + +
+ +

Given a string containing both a Git tree-ish, such as a branch or tag, and +a filesystem path joined by forward slashes, attempts to separate the two.

+ +

Expects a @project instance variable to contain the active project. This is +used to check the input against a list of valid repository refs.

+ +

Examples

+ +
# No @project available
+extract_ref('master')
+# => ['', '']
+
+extract_ref('master')
+# => ['master', '']
+
+extract_ref("f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG")
+# => ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG']
+
+extract_ref("v2.0.0/README.md")
+# => ['v2.0.0', 'README.md']
+
+extract_ref('issues/1234/app/models/project.rb')
+# => ['issues/1234', 'app/models/project.rb']
+
+# Given an invalid branch, we fall back to just splitting on the first slash
+extract_ref('non/existent/branch/README.md')
+# => ['non', 'existent/branch/README.md']
+
+ +

Returns an Array where the first value is the tree-ish and the second is +the path

+ + + +
+
# File lib/extracts_path.rb, line 45
+def extract_ref(input)
+  pair = ['', '']
+
+  return pair unless @project
+
+  if input.match(%r^([[:alnum:]]{40})(.+)/)
+    # If the ref appears to be a SHA, we're done, just split the string
+    pair = $~.captures
+  else
+    # Otherwise, attempt to detect the ref using a list of the project's
+    # branches and tags
+
+    # Append a trailing slash if we only get a ref and no file path
+    id = input
+    id += '/' unless id.ends_with?('/')
+
+    valid_refs = @project.ref_names
+    valid_refs.select! { |v| id.start_with?("#{v}/") }
+
+    if valid_refs.length != 1
+      # No exact ref match, so just try our best
+      pair = id.match(%r([^\/]+)(.*)/).captures
+    else
+      # Partition the string into the ref and the path, ignoring the empty first value
+      pair = id.partition(valid_refs.first)[1..-1]
+    end
+  end
+
+  # Remove ending slashes from path
+  pair[1].gsub!(%r^\/|\/$/, '')
+
+  pair
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ExtractsPath/InvalidPathError.html b/doc/app/ExtractsPath/InvalidPathError.html new file mode 100644 index 00000000..3c8c60fc --- /dev/null +++ b/doc/app/ExtractsPath/InvalidPathError.html @@ -0,0 +1,441 @@ + + + + + + +class ExtractsPath::InvalidPathError - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ExtractsPath::InvalidPathError

+ +
+ +

Raised when given an invalid file path

+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/FileSizeValidator.html b/doc/app/FileSizeValidator.html new file mode 100644 index 00000000..5acdf291 --- /dev/null +++ b/doc/app/FileSizeValidator.html @@ -0,0 +1,652 @@ + + + + + + +class FileSizeValidator - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class FileSizeValidator

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
CHECKS + +
+ + +
DEFAULT_TOKENIZER + +
+ + +
MESSAGES + +
+ + +
RESERVED_OPTIONS + +
+ + +
+
+ + + + + + +
+

Public Class Methods

+ + +
+ +
+ new(options) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/file_size_validator.rb, line 8
+def initialize(options)
+  if range = (options.delete(:in) || options.delete(:within))
+    raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
+    options[:minimum], options[:maximum] = range.begin, range.end
+    options[:maximum] -= 1 if range.exclude_end?
+  end
+
+  super
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ check_validity!() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/file_size_validator.rb, line 18
+def check_validity!
+  keys = CHECKS.keys & options.keys
+
+  if keys.empty?
+    raise ArgumentError, 'Range unspecified. Specify the :within, :maximum, :minimum, or :is option.'
+  end
+
+  keys.each do |key|
+    value = options[key]
+
+    unless value.is_a?(Integer) && value >= 0
+      raise ArgumentError, ":#{key} must be a nonnegative Integer"
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ help() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/file_size_validator.rb, line 57
+def help
+  Helper.instance
+end
+
+ +
+ + + + +
+ + +
+ +
+ validate_each(record, attribute, value) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/file_size_validator.rb, line 34
+def validate_each(record, attribute, value)
+  raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
+
+  value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
+
+  CHECKS.each do |key, validity_check|
+    next unless check_value = options[key]
+
+    value ||= [] if key == :maximum
+
+    value_size = value.size
+    next if value_size.send(validity_check, check_value)
+
+    errors_options = options.except(*RESERVED_OPTIONS)
+    errors_options[:file_size] = help.number_to_human_size check_value
+
+    default_message = options[MESSAGES[key]]
+    errors_options[:message] ||= default_message if default_message
+
+    record.errors.add(attribute, MESSAGES[key], errors_options)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/FileSizeValidator/Helper.html b/doc/app/FileSizeValidator/Helper.html new file mode 100644 index 00000000..4fd146c2 --- /dev/null +++ b/doc/app/FileSizeValidator/Helper.html @@ -0,0 +1,455 @@ + + + + + + +class FileSizeValidator::Helper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class FileSizeValidator::Helper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/GitHost.html b/doc/app/GitHost.html new file mode 100644 index 00000000..3197a73f --- /dev/null +++ b/doc/app/GitHost.html @@ -0,0 +1,479 @@ + + + + + + +module GitHost - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module GitHost

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ git_host() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/git_host.rb, line 2
+def git_host
+  Gitlab::Gitolite.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab.html b/doc/app/Gitlab.html new file mode 100644 index 00000000..0e28a24b --- /dev/null +++ b/doc/app/Gitlab.html @@ -0,0 +1,454 @@ + + + + + + +module Gitlab - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Gitlab

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/API.html b/doc/app/Gitlab/API.html new file mode 100644 index 00000000..8fad1eec --- /dev/null +++ b/doc/app/Gitlab/API.html @@ -0,0 +1,452 @@ + + + + + + +class Gitlab::API - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::API

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
VERSION + +
+ + +
+
+ + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/APIHelpers.html b/doc/app/Gitlab/APIHelpers.html new file mode 100644 index 00000000..47bf3fb1 --- /dev/null +++ b/doc/app/Gitlab/APIHelpers.html @@ -0,0 +1,846 @@ + + + + + + +module Gitlab::APIHelpers - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Gitlab::APIHelpers

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ attributes_for_keys(keys) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 35
+def attributes_for_keys(keys)
+  attrs = {}
+  keys.each do |key|
+    attrs[key] = params[key] if params[key].present?
+  end
+  attrs
+end
+
+ +
+ + + + +
+ + +
+ +
+ authenticate!() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 21
+def authenticate!
+  unauthorized! unless current_user
+end
+
+ +
+ + + + +
+ + +
+ +
+ authenticated_as_admin!() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 25
+def authenticated_as_admin!
+  forbidden! unless current_user.is_admin?
+end
+
+ +
+ + + + +
+ + +
+ +
+ authorize!(action, subject) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 29
+def authorize! action, subject
+  unless abilities.allowed?(current_user, action, subject)
+    forbidden!
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ current_user() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 3
+def current_user
+  @current_user ||= User.find_by_authentication_token(params[:private_token] || env["HTTP_PRIVATE_TOKEN"])
+end
+
+ +
+ + + + +
+ + +
+ +
+ forbidden!() + click to toggle source +
+ + +
+ +

error helpers

+ + + +
+
# File lib/api/helpers.rb, line 45
+def forbidden!
+  render_api_error!('403 Forbidden', 403)
+end
+
+ +
+ + + + +
+ + +
+ +
+ not_allowed!() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 60
+def not_allowed!
+  render_api_error!('Method Not Allowed', 405)
+end
+
+ +
+ + + + +
+ + +
+ +
+ not_found!(resource = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 49
+def not_found!(resource = nil)
+  message = ["404"]
+  message << resource if resource
+  message << "Not Found"
+  render_api_error!(message.join(' '), 404)
+end
+
+ +
+ + + + +
+ + +
+ +
+ paginate(object) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 17
+def paginate(object)
+  object.page(params[:page]).per(params[:per_page].to_i)
+end
+
+ +
+ + + + +
+ + +
+ +
+ render_api_error!(message, status) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 64
+def render_api_error!(message, status)
+  error!({'message' => message}, status)
+end
+
+ +
+ + + + +
+ + +
+ +
+ unauthorized!() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 56
+def unauthorized!
+  render_api_error!('401 Unauthorized', 401)
+end
+
+ +
+ + + + +
+ + +
+ +
+ user_project() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/api/helpers.rb, line 7
+def user_project
+  if @project ||= current_user.projects.find_by_id(params[:id]) ||
+                  current_user.projects.find_by_code(params[:id])
+  else
+    not_found!
+  end
+
+  @project
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/AppLogger.html b/doc/app/Gitlab/AppLogger.html new file mode 100644 index 00000000..e3a352af --- /dev/null +++ b/doc/app/Gitlab/AppLogger.html @@ -0,0 +1,523 @@ + + + + + + +class Gitlab::AppLogger - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::AppLogger

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ file_name() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/app_logger.rb, line 3
+def self.file_name
+  'application.log'
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ format_message(severity, timestamp, progname, msg) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/app_logger.rb, line 7
+def format_message(severity, timestamp, progname, msg)
+  "#{timestamp.to_s(:long)}: #{msg}\n"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Auth.html b/doc/app/Gitlab/Auth.html new file mode 100644 index 00000000..ac4fd556 --- /dev/null +++ b/doc/app/Gitlab/Auth.html @@ -0,0 +1,630 @@ + + + + + + +class Gitlab::Auth - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Auth

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create_from_omniauth(auth, ldap = false) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/auth.rb, line 20
+def create_from_omniauth(auth, ldap = false)
+  provider = auth.provider
+  uid = auth.info.uid || auth.uid
+  name = auth.info.name.force_encoding("utf-8")
+  email = auth.info.email.downcase unless auth.info.email.nil?
+
+  ldap_prefix = ldap ? '(LDAP) ' : ''
+  raise OmniAuth::Error, "#{ldap_prefix}#{provider} does not provide an email"         " address" if auth.info.email.blank?
+
+  log.info "#{ldap_prefix}Creating user from #{provider} login"         " {uid => #{uid}, name => #{name}, email => #{email}}"
+  password = Devise.friendly_token[0, 8].downcase
+  @user = User.new({
+    extern_uid: uid,
+    provider: provider,
+    name: name,
+    email: email,
+    password: password,
+    password_confirmation: password,
+    projects_limit: Gitlab.config.default_projects_limit,
+  }, as: :admin)
+  if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
+    @user.blocked = true
+  end
+  @user.save!
+  @user
+end
+
+ +
+ + + + +
+ + +
+ +
+ find_for_ldap_auth(auth, signed_in_resource = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/auth.rb, line 3
+def find_for_ldap_auth(auth, signed_in_resource = nil)
+  uid = auth.info.uid
+  provider = auth.provider
+  email = auth.info.email.downcase unless auth.info.email.nil?
+  raise OmniAuth::Error, "LDAP accounts must provide an uid and email address" if uid.nil? or email.nil?
+
+  if @user = User.find_by_extern_uid_and_provider(uid, provider)
+    @user
+  elsif @user = User.find_by_email(email)
+    log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}"
+    @user.update_attributes(:extern_uid => uid, :provider => provider)
+    @user
+  else
+    create_from_omniauth(auth, true)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ find_or_new_for_omniauth(auth) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/auth.rb, line 49
+def find_or_new_for_omniauth(auth)
+  provider, uid = auth.provider, auth.uid
+  email = auth.info.email.downcase unless auth.info.email.nil?
+
+  if @user = User.find_by_provider_and_extern_uid(provider, uid)
+    @user
+  elsif @user = User.find_by_email(email)
+    @user.update_attributes(:extern_uid => uid, :provider => provider)
+    @user
+  else
+    if Gitlab.config.omniauth['allow_single_sign_on']
+      @user = create_from_omniauth(auth)
+      @user
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ log() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/auth.rb, line 66
+def log
+  Gitlab::AppLogger
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Encode.html b/doc/app/Gitlab/Encode.html new file mode 100644 index 00000000..387e0db2 --- /dev/null +++ b/doc/app/Gitlab/Encode.html @@ -0,0 +1,537 @@ + + + + + + +module Gitlab::Encode - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Gitlab::Encode

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ detect_encoding(message) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/encode.rb, line 34
+def detect_encoding message
+  return nil unless message
+
+  hash = CharlockHolmes::EncodingDetector.detect(message) rescue {}
+  return hash[:encoding] ? hash[:encoding] : nil
+end
+
+ +
+ + + + +
+ + +
+ +
+ utf8(message) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/encode.rb, line 7
+def utf8 message
+  # return nil if message is nil
+  return nil unless message
+
+  message.force_encoding("utf-8")
+  # return message if message type is binary
+  detect = CharlockHolmes::EncodingDetector.detect(message)
+  return message if detect[:type] == :binary
+
+  # if message is utf-8 encoding, just return it
+  return message if message.valid_encoding?
+
+  # if message is not utf-8 encoding, convert it
+  if detect[:encoding]
+    message.force_encoding(detect[:encoding])
+    message.encode!("utf-8", detect[:encoding], undef: :replace, replace: "", invalid: :replace)
+  end
+
+  # ensure message encoding is utf8
+  message.valid_encoding? ? message : raise
+
+# Prevent app from crash cause of encoding errors
+rescue
+  encoding = detect ? detect[:encoding] : "unknown"
+  "--broken encoding: #{encoding}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities.html b/doc/app/Gitlab/Entities.html new file mode 100644 index 00000000..8cd0d837 --- /dev/null +++ b/doc/app/Gitlab/Entities.html @@ -0,0 +1,433 @@ + + + + + + +module Gitlab::Entities - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Gitlab::Entities

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/Hook.html b/doc/app/Gitlab/Entities/Hook.html new file mode 100644 index 00000000..c9eba832 --- /dev/null +++ b/doc/app/Gitlab/Entities/Hook.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::Hook - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::Hook

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/Issue.html b/doc/app/Gitlab/Entities/Issue.html new file mode 100644 index 00000000..f713b7ab --- /dev/null +++ b/doc/app/Gitlab/Entities/Issue.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::Issue - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::Issue

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/Milestone.html b/doc/app/Gitlab/Entities/Milestone.html new file mode 100644 index 00000000..f762ad29 --- /dev/null +++ b/doc/app/Gitlab/Entities/Milestone.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::Milestone - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::Milestone

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/Project.html b/doc/app/Gitlab/Entities/Project.html new file mode 100644 index 00000000..725e6b75 --- /dev/null +++ b/doc/app/Gitlab/Entities/Project.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::Project - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::Project

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/ProjectMember.html b/doc/app/Gitlab/Entities/ProjectMember.html new file mode 100644 index 00000000..468d3dc1 --- /dev/null +++ b/doc/app/Gitlab/Entities/ProjectMember.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::ProjectMember - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::ProjectMember

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/ProjectSnippet.html b/doc/app/Gitlab/Entities/ProjectSnippet.html new file mode 100644 index 00000000..e19fad75 --- /dev/null +++ b/doc/app/Gitlab/Entities/ProjectSnippet.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::ProjectSnippet - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::ProjectSnippet

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/RepoCommit.html b/doc/app/Gitlab/Entities/RepoCommit.html new file mode 100644 index 00000000..04c118a3 --- /dev/null +++ b/doc/app/Gitlab/Entities/RepoCommit.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::RepoCommit - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::RepoCommit

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/RepoObject.html b/doc/app/Gitlab/Entities/RepoObject.html new file mode 100644 index 00000000..27f928c1 --- /dev/null +++ b/doc/app/Gitlab/Entities/RepoObject.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::RepoObject - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::RepoObject

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/SSHKey.html b/doc/app/Gitlab/Entities/SSHKey.html new file mode 100644 index 00000000..43ed0f01 --- /dev/null +++ b/doc/app/Gitlab/Entities/SSHKey.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::SSHKey - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::SSHKey

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/User.html b/doc/app/Gitlab/Entities/User.html new file mode 100644 index 00000000..fb978194 --- /dev/null +++ b/doc/app/Gitlab/Entities/User.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::User - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::User

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/UserBasic.html b/doc/app/Gitlab/Entities/UserBasic.html new file mode 100644 index 00000000..dcb1e782 --- /dev/null +++ b/doc/app/Gitlab/Entities/UserBasic.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::UserBasic - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::UserBasic

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Entities/UserLogin.html b/doc/app/Gitlab/Entities/UserLogin.html new file mode 100644 index 00000000..fde77335 --- /dev/null +++ b/doc/app/Gitlab/Entities/UserLogin.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Entities::UserLogin - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Entities::UserLogin

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/FileEditor.html b/doc/app/Gitlab/FileEditor.html new file mode 100644 index 00000000..0916d63c --- /dev/null +++ b/doc/app/Gitlab/FileEditor.html @@ -0,0 +1,647 @@ + + + + + + +class Gitlab::FileEditor - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::FileEditor

+ +
+ +

GitLab file editor

+ +

It gives you ability to make changes to files & commit this changes +from GitLab UI.

+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ project[RW] +
+ +
+ + + +
+
+ +
+
+ ref[RW] +
+ +
+ + + +
+
+ +
+
+ user[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(user, project, ref) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/file_editor.rb, line 9
+def initialize(user, project, ref)
+  self.user = user
+  self.project = project
+  self.ref = ref
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ update(path, content, commit_message, last_commit) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/file_editor.rb, line 15
+def update(path, content, commit_message, last_commit)
+  return false unless can_edit?(path, last_commit)
+
+  Grit::Git.with_timeout(10.seconds) do
+    lock_file = Rails.root.join("tmp", "#{project.path}.lock")
+
+    File.open(lock_file, "w+") do |f|
+      f.flock(File::LOCK_EX)
+
+      unless project.satellite.exists?
+        raise "Satellite doesn't exist"
+      end
+
+      project.satellite.clear
+
+      Dir.chdir(project.satellite.path) do
+        r = Grit::Repo.new('.')
+        r.git.sh "git reset --hard"
+        r.git.sh "git fetch origin"
+        r.git.sh "git config user.name \"#{user.name}\""
+        r.git.sh "git config user.email \"#{user.email}\""
+        r.git.sh "git checkout -b #{ref} origin/#{ref}"
+        File.open(path, 'w'){|f| f.write(content)}
+        r.git.sh "git add ."
+        r.git.sh "git commit -am '#{commit_message}'"
+        output = r.git.sh "git push origin #{ref}"
+
+        if output =~ %rreject/
+          return false
+        end
+      end
+    end
+  end
+  true
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ can_edit?(path, last_commit) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/file_editor.rb, line 53
+def can_edit?(path, last_commit)
+  current_last_commit = @project.last_commit_for(ref, path).sha
+  last_commit == current_last_commit
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/GitLogger.html b/doc/app/Gitlab/GitLogger.html new file mode 100644 index 00000000..c37bce98 --- /dev/null +++ b/doc/app/Gitlab/GitLogger.html @@ -0,0 +1,523 @@ + + + + + + +class Gitlab::GitLogger - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::GitLogger

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ file_name() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/git_logger.rb, line 3
+def self.file_name
+  'githost.log'
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ format_message(severity, timestamp, progname, msg) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/git_logger.rb, line 7
+def format_message(severity, timestamp, progname, msg)
+  "#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Gitolite.html b/doc/app/Gitlab/Gitolite.html new file mode 100644 index 00000000..60ef3b13 --- /dev/null +++ b/doc/app/Gitlab/Gitolite.html @@ -0,0 +1,716 @@ + + + + + + +class Gitlab::Gitolite - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Gitolite

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ config() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 7
+def config
+  Gitlab::GitoliteConfig.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ create_repository(project) + click to toggle source +
+ + +
+ + + + + +
+ + + + +
+ Alias for: update_repository +
+ +
+ + +
+ +
+ enable_automerge() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 37
+def enable_automerge
+  config.admin_all_repo!
+end
+
+ +
+ + + + +
+ + +
+ +
+ remove_key(key_id, projects) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 18
+def remove_key key_id, projects
+  config.apply do |config|
+    config.rm_key(key_id)
+    config.update_projects(projects)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ remove_repository(project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 29
+def remove_repository project
+  config.destroy_project!(project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ set_key(key_id, key_content, projects) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 11
+def set_key key_id, key_content, projects
+  config.apply do |config|
+    config.write_key(key_id, key_content)
+    config.update_projects(projects)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_repository(project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 25
+def update_repository project
+  config.update_project!(project.path, project)
+end
+
+ +
+ + +
+ Also aliased as: create_repository +
+ + + +
+ + +
+ +
+ url_to_repo(path) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite.rb, line 33
+def url_to_repo path
+  Gitlab.config.ssh_path + "#{path}.git"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Gitolite/AccessDenied.html b/doc/app/Gitlab/Gitolite/AccessDenied.html new file mode 100644 index 00000000..64a3b17a --- /dev/null +++ b/doc/app/Gitlab/Gitolite/AccessDenied.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::Gitolite::AccessDenied - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Gitolite::AccessDenied

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/GitoliteConfig.html b/doc/app/Gitlab/GitoliteConfig.html new file mode 100644 index 00000000..19671089 --- /dev/null +++ b/doc/app/Gitlab/GitoliteConfig.html @@ -0,0 +1,994 @@ + + + + + + +class Gitlab::GitoliteConfig - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::GitoliteConfig

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ conf[R] +
+ +
+ + + +
+
+ +
+
+ config_tmp_dir[R] +
+ +
+ + + +
+
+ +
+
+ ga_repo[R] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Instance Methods

+ + +
+ +
+ admin_all_repo() + click to toggle source +
+ + +
+ +

Enable access to all repos for gitolite admin. We use it for accept merge +request feature

+ + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 162
+def admin_all_repo
+  owner_name = Gitlab.config.gitolite_admin_key
+
+  # @ALL repos premission for gitolite owner
+  repo_name = "@all"
+  repo = if conf.has_repo?(repo_name)
+           conf.get_repo(repo_name)
+         else
+           ::Gitolite::Config::Repo.new(repo_name)
+         end
+
+  repo.add_permission("RW+", "", owner_name)
+  conf.add_repo(repo, true)
+end
+
+ +
+ + + + +
+ + +
+ +
+ admin_all_repo!() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 177
+def admin_all_repo!
+  apply { |config| config.admin_all_repo }
+end
+
+ +
+ + + + +
+ + +
+ +
+ apply() { |self| ... } + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 20
+def apply
+  Timeout::timeout(30) do
+    File.open(Rails.root.join('tmp', "gitlabhq-gitolite.lock"), "w+") do |f|
+      begin
+        # Set exclusive lock
+        # to prevent race condition
+        f.flock(File::LOCK_EX)
+
+        # Pull gitolite-admin repo
+        # in tmp dir before do any changes
+        pull(config_tmp_dir)
+
+        # Build ga_repo object and @conf
+        # to access gitolite-admin configuration
+        @conf = ga_repo.config
+
+        # Do any changes
+        # in gitolite-admin
+        # config here
+        yield(self)
+
+        # Save changes in
+        # gitolite-admin repo
+        # before push it
+        ga_repo.save
+
+        # Push gitolite-admin repo
+        # to apply all changes
+        push(config_tmp_dir)
+      ensure
+        # Remove tmp dir
+        # removing the gitolite folder first is important to avoid
+        # NFS issues.
+        FileUtils.rm_rf(File.join(config_tmp_dir, 'gitolite'))
+
+        # Remove parent tmp dir
+        FileUtils.rm_rf(config_tmp_dir)
+
+        # Unlock so other task can access
+        # gitolite configuration
+        f.flock(File::LOCK_UN)
+      end
+    end
+  end
+rescue PullError => ex
+  log("Pull error ->  " + ex.message)
+  raise Gitolite::AccessDenied, ex.message
+
+rescue PushError => ex
+  log("Push error ->  " + " " + ex.message)
+  raise Gitolite::AccessDenied, ex.message
+
+rescue Exception => ex
+  log(ex.class.name + " " + ex.message)
+  raise Gitolite::AccessDenied.new("gitolite timeout")
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy_project(project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 81
+def destroy_project(project)
+  FileUtils.rm_rf(project.path_to_repo)
+  conf.rm_repo(project.path)
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy_project!(project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 86
+def destroy_project!(project)
+  apply do |config|
+    config.destroy_project(project)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ log(message) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 77
+def log message
+  Gitlab::GitLogger.error(message)
+end
+
+ +
+ + + + +
+ + +
+ +
+ rm_key(user) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 98
+def rm_key(user)
+  key_path = File.join(config_tmp_dir, 'gitolite/keydir', "#{user}.pub")
+  ga_key = ::Gitolite::SSHKey.from_file(key_path)
+  ga_repo.rm_key(ga_key)
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_project(repo_name, project) + click to toggle source +
+ + +
+ +

update or create

+ + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 105
+def update_project(repo_name, project)
+  repo = update_project_config(project, conf)
+  conf.add_repo(repo, true)
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_project!(repo_name, project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 110
+def update_project!(repo_name, project)
+  apply do |config|
+    config.update_project(repo_name, project)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_project_config(project, conf) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 125
+def update_project_config(project, conf)
+  repo_name = project.path
+
+  repo = if conf.has_repo?(repo_name)
+           conf.get_repo(repo_name)
+         else
+           ::Gitolite::Config::Repo.new(repo_name)
+         end
+
+  name_readers = project.repository_readers
+  name_writers = project.repository_writers
+  name_masters = project.repository_masters
+
+  pr_br = project.protected_branches.map(&:name).join("$ ")
+
+  repo.clean_permissions
+
+  # Deny access to protected branches for writers
+  unless name_writers.blank? || pr_br.blank?
+    repo.add_permission("-", pr_br.strip + "$ ", name_writers)
+  end
+
+  # Add read permissions
+  repo.add_permission("R", "", name_readers) unless name_readers.blank?
+
+  # Add write permissions
+  repo.add_permission("RW+", "", name_writers) unless name_writers.blank?
+  repo.add_permission("RW+", "", name_masters) unless name_masters.blank?
+
+  # Add sharedRepository config
+  repo.set_git_config("core.sharedRepository", "0660")
+
+  repo
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_projects(projects) + click to toggle source +
+ + +
+ +

Updates many projects and uses project.path as the repo path An order of +magnitude faster than #update_project

+ + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 118
+def update_projects(projects)
+  projects.each do |project|
+    repo = update_project_config(project, conf)
+    conf.add_repo(repo, true)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ write_key(id, key) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 92
+def write_key(id, key)
+  File.open(File.join(config_tmp_dir, 'gitolite/keydir',"#{id}.pub"), 'w') do |f|
+    f.write(key.gsub(%r\n/,''))
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/GitoliteConfig/PullError.html b/doc/app/Gitlab/GitoliteConfig/PullError.html new file mode 100644 index 00000000..8e5a1510 --- /dev/null +++ b/doc/app/Gitlab/GitoliteConfig/PullError.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::GitoliteConfig::PullError - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::GitoliteConfig::PullError

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/GitoliteConfig/PushError.html b/doc/app/Gitlab/GitoliteConfig/PushError.html new file mode 100644 index 00000000..c1541f49 --- /dev/null +++ b/doc/app/Gitlab/GitoliteConfig/PushError.html @@ -0,0 +1,439 @@ + + + + + + +class Gitlab::GitoliteConfig::PushError - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::GitoliteConfig::PushError

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/GraphCommit.html b/doc/app/Gitlab/GraphCommit.html new file mode 100644 index 00000000..b8ffa6f4 --- /dev/null +++ b/doc/app/Gitlab/GraphCommit.html @@ -0,0 +1,967 @@ + + + + + + +class Gitlab::GraphCommit - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::GraphCommit

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ refs[RW] +
+ +
+ + + +
+
+ +
+
+ space[RW] +
+ +
+ + + +
+
+ +
+
+ time[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ find_free_space(time_range) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 113
+def self.find_free_space(time_range)
+  reserved = []
+  for day in time_range
+      reserved += @_reserved[day]
+  end
+  space = 1
+  while reserved.include? space do
+    space += 1
+  end
+  space
+end
+
+ +
+ + + + +
+ + +
+ +
+ index_commits(commits) + click to toggle source +
+ + +
+ +

Method is adding time and space on the list of commits. As well as returns +date list corelated with time set on commits.

+ +

@param [Array<GraphCommit>] comits to index

+ +

@return [Array<TimeDate>] list of commit dates corelated with time on +commits

+ + + +
+
# File lib/gitlab/graph_commit.rb, line 33
+def self.index_commits(commits)
+  days, heads = [], []
+  map = {}
+
+  commits.reverse.each_with_index do |c,i|
+    c.time = i
+    days[i] = c.committed_date
+    map[c.id] = c
+    heads += c.refs unless c.refs.nil?
+  end
+
+  heads.select!{|h| h.is_a? Grit::Head or h.is_a? Grit::Remote}
+  # sort heads so the master is top and current branches are closer
+  heads.sort! do |a,b|
+    if a.name == "master"
+      -1
+    elsif b.name == "master"
+      1
+    else
+      b.commit.committed_date <=> a.commit.committed_date
+    end
+  end
+
+  @_reserved = {}
+  days.each_index do |i|
+    @_reserved[i] = []
+  end
+
+  heads.each do |h|
+    if map.include? h.commit.id then
+      place_chain(map[h.commit.id], map)
+    end
+  end
+  days
+end
+
+ +
+ + + + +
+ + +
+ +
+ mark_reserved(time_range, space) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 107
+def self.mark_reserved(time_range, space)
+  for day in time_range
+    @_reserved[day].push(space)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 148
+def initialize(commit)
+  @_commit = commit
+  @time = -1
+  @space = 0
+end
+
+ +
+ + + + +
+ + +
+ +
+ place_chain(commit, map, parent_time = nil) + click to toggle source +
+ + +
+ +

Add space mark on commit and its parents

+ +

@param [GraphCommit] the commit object. @param +[Hash<String,GraphCommit>] map of commits

+ + + +
+
# File lib/gitlab/graph_commit.rb, line 73
+def self.place_chain(commit, map, parent_time = nil)
+  leaves = take_left_leaves(commit, map)
+  if leaves.empty? then
+    return
+  end
+  space = find_free_space(leaves.last.time..leaves.first.time)
+  leaves.each{|l| l.space = space}
+  # and mark it as reserved
+  min_time = leaves.last.time
+  parents = leaves.last.parents.collect
+  parents.each do |p|
+    if map.include? p.id then
+      parent = map[p.id]
+      if parent.time < min_time then
+        min_time = parent.time
+      end
+    end
+  end
+  if parent_time.nil? then
+    max_time = leaves.first.time
+  else
+    max_time = parent_time - 1
+  end
+  mark_reserved(min_time..max_time, space)
+  # Visit branching chains
+  leaves.each do |l|
+    parents = l.parents.collect
+      .select{|p| map.include? p.id and map[p.id].space == 0}
+    for p in parents
+      place_chain(map[p.id], map, l.time)
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ take_left_leaves(commit, map) + click to toggle source +
+ + +
+ +

Takes most left subtree branch of commits which don’t have space mark yet.

+ +

@param [GraphCommit] the commit object. @param +[Hash<String,GraphCommit>] map of commits

+ +

@return [Array<GraphCommit>] list of branch commits

+ + + +
+
# File lib/gitlab/graph_commit.rb, line 132
+def self.take_left_leaves(commit, map)
+  leaves = []
+  leaves.push(commit)  if commit.space == 0
+  while true
+    parent = commit.parents.collect
+      .select{|p| map.include? p.id and map[p.id].space == 0}
+    if parent.count == 0 then
+      return leaves
+    else
+      commit = map[parent.first.id]
+      leaves.push(commit)
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_graph(project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 10
+def self.to_graph(project)
+  @repo = project.repo
+  commits = Grit::Commit.find_all(@repo, nil, {max_count: 650})
+
+  ref_cache = {}
+
+  commits.map! {|c| GraphCommit.new(Commit.new(c))}
+  commits.each { |commit| commit.add_refs(ref_cache, @repo) }
+
+  days = GraphCommit.index_commits(commits)
+  @days_json = days.compact.collect{|d| [d.day, d.strftime("%b")] }.to_json
+  @commits_json = commits.map(&:to_graph_hash).to_json
+
+  return @days_json, @commits_json
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ add_refs(ref_cache, repo) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 174
+def add_refs(ref_cache, repo)
+  if ref_cache.empty?
+    repo.refs.each do |ref|
+      ref_cache[ref.commit.id] ||= []
+      ref_cache[ref.commit.id] << ref
+    end
+  end
+  @refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
+  @refs ||= []
+end
+
+ +
+ + + + +
+ + +
+ +
+ method_missing(m, *args, &block) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 154
+def method_missing(m, *args, &block)
+  @_commit.send(m, *args, &block)
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_graph_hash() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/graph_commit.rb, line 158
+def to_graph_hash
+  h = {}
+  h[:parents] = self.parents.collect do |p|
+    [p.id,0,0]
+  end
+  h[:author]  = Gitlab::Encode.utf8(author.name)
+  h[:time]    = time
+  h[:space]   = space
+  h[:refs]    = refs.collect{|r|r.name}.join(" ") unless refs.nil?
+  h[:id]      = sha
+  h[:date]    = date
+  h[:message] = escape_once(Gitlab::Encode.utf8(message))
+  h[:login]   = author.email
+  h
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/InlineDiff.html b/doc/app/Gitlab/InlineDiff.html new file mode 100644 index 00000000..91eeae9c --- /dev/null +++ b/doc/app/Gitlab/InlineDiff.html @@ -0,0 +1,611 @@ + + + + + + +class Gitlab::InlineDiff - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::InlineDiff

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
FINISH + +
+ + +
START + +
+ + +
+
+ + + + + + +
+

Public Class Methods

+ + +
+ +
+ _indexes_of_changed_lines(diff_arr) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/inline_diff.rb, line 42
+def _indexes_of_changed_lines diff_arr
+  chain_of_first_symbols = ""
+  diff_arr.each_with_index do |line, i|
+    chain_of_first_symbols += line[0]
+  end
+  chain_of_first_symbols.gsub!(%r[^\-\+]/, "#")
+
+  offset = 0
+  indexes = []
+  while index = chain_of_first_symbols.index("#-+#", offset)
+    indexes << index
+    offset = index + 1
+  end
+  indexes
+end
+
+ +
+ + + + +
+ + +
+ +
+ processing(diff_arr) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/inline_diff.rb, line 8
+def processing diff_arr
+  indexes = _indexes_of_changed_lines diff_arr
+
+  indexes.each do |index|
+    first_line = diff_arr[index+1]
+    second_line = diff_arr[index+2]
+    max_length = [first_line.size, second_line.size].max
+
+    first_the_same_symbols = 0
+    (0..max_length + 1).each do |i|
+      first_the_same_symbols = i - 1
+      if first_line[i] != second_line[i] && i > 0
+        break
+      end
+    end
+    first_token = first_line[0..first_the_same_symbols][1..-1]
+    diff_arr[index+1].sub!(first_token, first_token + START)
+    diff_arr[index+2].sub!(first_token, first_token + START)
+    last_the_same_symbols = 0
+    (1..max_length + 1).each do |i|
+      last_the_same_symbols = -i
+      shortest_line = second_line.size > first_line.size ? first_line : second_line
+      if ( first_line[-i] != second_line[-i] ) || "#{first_token}#{START}".size == shortest_line[1..-i].size
+        break
+      end
+    end
+    last_the_same_symbols += 1
+    last_token = first_line[last_the_same_symbols..-1]
+    diff_arr[index+1].sub!(%r#{Regexp.escape(last_token)}$/, FINISH + last_token)
+    diff_arr[index+2].sub!(%r#{Regexp.escape(last_token)}$/, FINISH + last_token)
+  end
+  diff_arr
+end
+
+ +
+ + + + +
+ + +
+ +
+ replace_markers(line) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/inline_diff.rb, line 58
+def replace_markers line
+  line.gsub!(START, "<span class='idiff'>")
+  line.gsub!(FINISH, "</span>")
+  line
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Issues.html b/doc/app/Gitlab/Issues.html new file mode 100644 index 00000000..eda99ed1 --- /dev/null +++ b/doc/app/Gitlab/Issues.html @@ -0,0 +1,441 @@ + + + + + + +class Gitlab::Issues - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Issues

+ +
+ +

Issues API

+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Logger.html b/doc/app/Gitlab/Logger.html new file mode 100644 index 00000000..8cc6cdea --- /dev/null +++ b/doc/app/Gitlab/Logger.html @@ -0,0 +1,583 @@ + + + + + + +class Gitlab::Logger - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Logger

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ build() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/logger.rb, line 17
+def self.build
+  new(Rails.root.join("log", file_name))
+end
+
+ +
+ + + + +
+ + +
+ +
+ error(message) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/logger.rb, line 3
+def self.error(message)
+  build.error(message)
+end
+
+ +
+ + + + +
+ + +
+ +
+ info(message) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/logger.rb, line 7
+def self.info(message)
+  build.info(message)
+end
+
+ +
+ + + + +
+ + +
+ +
+ read_latest() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/logger.rb, line 11
+def self.read_latest
+  path = Rails.root.join("log", file_name)
+  self.build unless File.exist?(path)
+  logs = File.read(path).split("\n")
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Markdown.html b/doc/app/Gitlab/Markdown.html new file mode 100644 index 00000000..12691455 --- /dev/null +++ b/doc/app/Gitlab/Markdown.html @@ -0,0 +1,580 @@ + + + + + + +module Gitlab::Markdown - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Gitlab::Markdown

+ +
+ +

Custom parser for GitLab-flavored Markdown

+ +

It replaces references in the text with links to the appropriate items in +GitLab.

+ +

Supported reference formats are:

+ +
* @foo for team members
+* #123 for issues
+* !123 for merge requests
+* $123 for snippets
+* 123456 for commits
+ +

It also parses Emoji codes to insert images. See www.emoji-cheat-sheet.com/ for +a list of the supported icons.

+ +

Examples

+ +
>> gfm("Hey @david, can you fix this?")
+=> "Hey <a href="/gitlab/team_members/1">@david</a>, can you fix this?"
+
+>> gfm("Commit 35d5f7c closes #1234")
+=> "Commit <a href="/gitlab/commits/35d5f7c">35d5f7c</a> closes <a href="/gitlab/issues/1234">#1234</a>"
+
+>> gfm(":trollface:")
+=> "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
+
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
EMOJI_PATTERN + +
+ + +
REFERENCE_PATTERN + +
+ + +
+
+ + + + +
+

Attributes

+ + +
+
+ html_options[R] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Instance Methods

+ + +
+ +
+ gfm(text, html_options = {}) + click to toggle source +
+ + +
+ +

Public: Parse the provided text with GitLab-Flavored Markdown

+ +

text - the source text #html_options - extra +options for the reference links as given to link_to

+ +

Note: reference links will only be generated if @project is set

+ + + +
+
# File lib/gitlab/markdown.rb, line 48
+def gfm(text, html_options = {})
+  return text if text.nil?
+
+  # Duplicate the string so we don't alter the original, then call to_str
+  # to cast it back to a String instead of a SafeBuffer. This is required
+  # for gsub calls to work as we need them to.
+  text = text.dup.to_str
+
+  @html_options = html_options
+
+  # Extract pre blocks so they are not altered
+  # from http://github.github.com/github-flavored-markdown/
+  extractions = {}
+  text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}) do |match|
+    md5 = Digest::MD5.hexdigest(match)
+    extractions[md5] = match
+    "{gfm-extraction-#{md5}}"
+  end
+
+  # TODO: add popups with additional information
+
+  text = parse(text)
+
+  # Insert pre block extractions
+  text.gsub!(%r\{gfm-extraction-(\h{32})\}/) do
+    extractions[$1]
+  end
+
+  sanitize text.html_safe, attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Merge.html b/doc/app/Gitlab/Merge.html new file mode 100644 index 00000000..99a66cd5 --- /dev/null +++ b/doc/app/Gitlab/Merge.html @@ -0,0 +1,628 @@ + + + + + + +class Gitlab::Merge - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Merge

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ merge_request[RW] +
+ +
+ + + +
+
+ +
+
+ project[RW] +
+ +
+ + + +
+
+ +
+
+ user[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(merge_request, user) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/merge.rb, line 5
+def initialize(merge_request, user)
+  @merge_request = merge_request
+  @project = merge_request.project
+  @user = user
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ can_be_merged?() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/merge.rb, line 11
+def can_be_merged?
+  in_locked_and_timed_satellite do |merge_repo|
+    merge_in_satellite!(merge_repo)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge!() + click to toggle source +
+ + +
+ +

Merges the source branch into the target branch in the satellite and pushes +it back to Gitolite. It also removes the source +branch if requested in the merge request.

+ +

Returns false if the merge produced conflicts Returns false if pushing from +the satallite to Gitolite failed or was +rejected Returns true otherwise

+ + + +
+
# File lib/gitlab/merge.rb, line 24
+def merge!
+  in_locked_and_timed_satellite do |merge_repo|
+    if merge_in_satellite!(merge_repo)
+      # push merge back to Gitolite
+      # will raise CommandFailed when push fails
+      merge_repo.git.push({raise: true}, :origin, merge_request.target_branch)
+
+      # remove source branch
+      if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)
+        # will raise CommandFailed when push fails
+        merge_repo.git.push({raise: true}, :origin, ":#{merge_request.source_branch}")
+      end
+
+      # merge, push and branch removal successful
+      true
+    end
+  end
+rescue Grit::Git::CommandFailed
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Milestones.html b/doc/app/Gitlab/Milestones.html new file mode 100644 index 00000000..aac605b2 --- /dev/null +++ b/doc/app/Gitlab/Milestones.html @@ -0,0 +1,441 @@ + + + + + + +class Gitlab::Milestones - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Milestones

+ +
+ +

Milestones API

+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Projects.html b/doc/app/Gitlab/Projects.html new file mode 100644 index 00000000..a44cba3c --- /dev/null +++ b/doc/app/Gitlab/Projects.html @@ -0,0 +1,441 @@ + + + + + + +class Gitlab::Projects - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Projects

+ +
+ +

Projects API

+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Satellite.html b/doc/app/Gitlab/Satellite.html new file mode 100644 index 00000000..4615d1c6 --- /dev/null +++ b/doc/app/Gitlab/Satellite.html @@ -0,0 +1,664 @@ + + + + + + +class Gitlab::Satellite - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Satellite

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
PARKING_BRANCH + +
+ + +
+
+ + + + +
+

Attributes

+ + +
+
+ project[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(project) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/satellite.rb, line 8
+def initialize project
+  self.project = project
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ clear() + click to toggle source +
+ + +
+ +

will be deleted all branches except PARKING_BRANCH

+ + + +
+
# File lib/gitlab/satellite.rb, line 25
+def clear
+  Dir.chdir(path) do
+    heads = Grit::Repo.new(".").heads.map{|head| head.name}
+    if heads.include? PARKING_BRANCH
+      %xgit checkout #{PARKING_BRANCH}`
+    else
+      %xgit checkout -b #{PARKING_BRANCH}`
+    end
+    heads.delete(PARKING_BRANCH)
+    heads.each do |head|
+      %xgit branch -D #{head}`
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/satellite.rb, line 12
+def create
+  %xgit clone #{project.url_to_repo} #{path}`
+end
+
+ +
+ + + + +
+ + +
+ +
+ exists?() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/satellite.rb, line 20
+def exists?
+  File.exists? path
+end
+
+ +
+ + + + +
+ + +
+ +
+ path() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/satellite.rb, line 16
+def path
+  Rails.root.join("tmp", "repo_satellites", project.path)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Session.html b/doc/app/Gitlab/Session.html new file mode 100644 index 00000000..12f3433e --- /dev/null +++ b/doc/app/Gitlab/Session.html @@ -0,0 +1,441 @@ + + + + + + +class Gitlab::Session - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Session

+ +
+ +

Users API

+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Gitlab/Theme.html b/doc/app/Gitlab/Theme.html new file mode 100644 index 00000000..00b3e5f6 --- /dev/null +++ b/doc/app/Gitlab/Theme.html @@ -0,0 +1,493 @@ + + + + + + +class Gitlab::Theme - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Theme

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ css_class_by_id(id) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/theme.rb, line 3
+def self.css_class_by_id(id)
+  themes = { 
+    1 => "ui_basic",
+    2 => "ui_mars",
+    3 => "ui_modern"
+  }
+
+  id ||= 1
+
+  return themes[id]
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Gitlab/Users.html b/doc/app/Gitlab/Users.html new file mode 100644 index 00000000..c9712874 --- /dev/null +++ b/doc/app/Gitlab/Users.html @@ -0,0 +1,441 @@ + + + + + + +class Gitlab::Users - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Gitlab::Users

+ +
+ +

Users API

+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/GitlabMarkdownHelper.html b/doc/app/GitlabMarkdownHelper.html new file mode 100644 index 00000000..6bf172ac --- /dev/null +++ b/doc/app/GitlabMarkdownHelper.html @@ -0,0 +1,559 @@ + + + + + + +module GitlabMarkdownHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module GitlabMarkdownHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + + + + +
+ +
+ markdown(text) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/gitlab_markdown_helper.rb, line 25
+def markdown(text)
+  unless @markdown
+    gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
+                        # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
+                        filter_html: true,
+                        with_toc_data: true,
+                        hard_wrap: true)
+    @markdown = Redcarpet::Markdown.new(gitlab_renderer,
+                    # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
+                    no_intra_emphasis: true,
+                    tables: true,
+                    fenced_code_blocks: true,
+                    autolink: true,
+                    strikethrough: true,
+                    lax_html_blocks: true,
+                    space_after_headers: true,
+                    superscript: true)
+  end
+
+  @markdown.render(text).html_safe
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Grack.html b/doc/app/Grack.html new file mode 100644 index 00000000..e3c5bbd4 --- /dev/null +++ b/doc/app/Grack.html @@ -0,0 +1,433 @@ + + + + + + +module Grack - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Grack

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Grack/Auth.html b/doc/app/Grack/Auth.html new file mode 100644 index 00000000..5da483f7 --- /dev/null +++ b/doc/app/Grack/Auth.html @@ -0,0 +1,734 @@ + + + + + + +class Grack::Auth - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Grack::Auth

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ project[RW] +
+ +
+ + + +
+
+ +
+
+ user[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Instance Methods

+ + +
+ +
+ can?(object, action, subject) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/grack_auth.rb, line 56
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+ +
+ + + + +
+ + +
+ +
+ current_ref() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/grack_auth.rb, line 60
+def current_ref
+  if @env["HTTP_CONTENT_ENCODING"] =~ %rgzip/
+    input = Zlib::GzipReader.new(@request.body).read
+  else
+    input = @request.body.read
+  end
+  # Need to reset seek point
+  @request.body.rewind
+  %rrefs\/heads\/([\w-]+)/.match(input).to_a.first
+end
+
+ +
+ + + + +
+ + +
+ +
+ valid?() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/grack_auth.rb, line 5
+def valid?
+  # Authentication with username and password
+  email, password = @auth.credentials
+  self.user = User.find_by_email(email)
+  return false unless user.try(:valid_password?, password)
+
+  # Set GL_USER env variable
+  ENV['GL_USER'] = email
+  # Pass Gitolite update hook
+  ENV['GL_BYPASS_UPDATE_HOOK'] = "true"
+
+  # Need this patch due to the rails mount
+  @env['PATH_INFO'] = @request.path
+  @env['SCRIPT_NAME'] = ""
+
+  # Find project by PATH_INFO from env
+  if m = %r^\/([\w-]+).git/.match(@request.path_info).to_a
+    self.project = Project.find_by_path(m.last)
+    return false unless project
+  end
+
+  # Git upload and receive
+  if @request.get?
+    validate_get_request
+  elsif @request.post?
+    validate_post_request
+  else
+    false
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ validate_get_request() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/grack_auth.rb, line 36
+def validate_get_request
+  true
+end
+
+ +
+ + + + +
+ + +
+ +
+ validate_post_request() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/grack_auth.rb, line 40
+def validate_post_request
+  if @request.path_info.end_with?('git-upload-pack')
+    can?(user, :push_code, project)
+  elsif @request.path_info.end_with?('git-receive-pack')
+    action = if project.protected_branch?(current_ref)
+               :push_code_to_protected_branches
+             else
+               :push_code
+             end
+
+    can?(user, action, project)
+  else
+    false
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ abilities() + click to toggle source +
+ + +
+ + + + + +
+
# File lib/gitlab/backend/grack_auth.rb, line 73
+def abilities
+  @abilities ||= begin
+                   abilities = Six.new
+                   abilities << Ability
+                   abilities
+                 end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Group.html b/doc/app/Group.html new file mode 100644 index 00000000..a23e1da6 --- /dev/null +++ b/doc/app/Group.html @@ -0,0 +1,555 @@ + + + + + + +class Group - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Group

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + + + + +
+ +
+

Public Instance Methods

+ + +
+ +
+ to_param() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/group.rb, line 17
+def to_param
+  code
+end
+
+ +
+ + + + +
+ + +
+ +
+ users() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/group.rb, line 21
+def users
+  User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/GroupsController.html b/doc/app/GroupsController.html new file mode 100644 index 00000000..72e1022c --- /dev/null +++ b/doc/app/GroupsController.html @@ -0,0 +1,735 @@ + + + + + + +class GroupsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class GroupsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ issues() + click to toggle source +
+ + +
+ +

Get only assigned issues

+ + + +
+
# File app/controllers/groups_controller.rb, line 26
+def issues
+  @user   = current_user
+  @issues = current_user.assigned_issues.opened
+  @issues = @issues.of_group(@group).recent.page(params[:page]).per(20)
+  @issues = @issues.includes(:author, :project)
+
+  respond_to do |format|
+    format.html
+    format.atom { render layout: false }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge_requests() + click to toggle source +
+ + +
+ +

Get authored or assigned open merge requests

+ + + +
+
# File app/controllers/groups_controller.rb, line 20
+def merge_requests
+  @merge_requests = current_user.cared_merge_requests
+  @merge_requests = @merge_requests.of_group(@group).recent.page(params[:page]).per(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ people() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/groups_controller.rb, line 46
+def people
+  @users = group.users.all
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/groups_controller.rb, line 8
+def show
+  @events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0)
+  @last_push = current_user.recent_push
+
+  respond_to do |format|
+    format.html
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ group() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/groups_controller.rb, line 52
+def group
+  @group ||= Group.find_by_code(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_ids() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/groups_controller.rb, line 60
+def project_ids
+  projects.map(&:id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ projects() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/groups_controller.rb, line 56
+def projects
+  @projects ||= current_user.projects_with_events.where(group_id: @group.id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/HelpController.html b/doc/app/HelpController.html new file mode 100644 index 00000000..afbbeb0b --- /dev/null +++ b/doc/app/HelpController.html @@ -0,0 +1,484 @@ + + + + + + +class HelpController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class HelpController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/help_controller.rb, line 2
+def index
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/HooksController.html b/doc/app/HooksController.html new file mode 100644 index 00000000..70fd89c3 --- /dev/null +++ b/doc/app/HooksController.html @@ -0,0 +1,595 @@ + + + + + + +class HooksController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class HooksController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/hooks_controller.rb, line 13
+def create
+  @hook = @project.hooks.new(params[:hook])
+  @hook.save
+
+  if @hook.valid?
+    redirect_to project_hooks_path(@project)
+  else
+    @hooks = @project.hooks.all
+    render :index
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/hooks_controller.rb, line 31
+def destroy
+  @hook = @project.hooks.find(params[:id])
+  @hook.destroy
+
+  redirect_to project_hooks_path(@project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/hooks_controller.rb, line 8
+def index
+  @hooks = @project.hooks.all
+  @hook = ProjectHook.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ test() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/hooks_controller.rb, line 25
+def test
+  TestHookContext.new(project, current_user, params).execute
+
+  redirect_to :back
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Issue.html b/doc/app/Issue.html new file mode 100644 index 00000000..e8a7881c --- /dev/null +++ b/doc/app/Issue.html @@ -0,0 +1,501 @@ + + + + + + +class Issue - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Issue

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ open_for(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/issue.rb, line 14
+def self.open_for(user)
+  opened.assigned(user)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/IssueCommonality.html b/doc/app/IssueCommonality.html new file mode 100644 index 00000000..336580d8 --- /dev/null +++ b/doc/app/IssueCommonality.html @@ -0,0 +1,641 @@ + + + + + + +module IssueCommonality - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module IssueCommonality

+ +
+ +

Contains common functionality shared between Issues and MergeRequests

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ is_assigned?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/issue_commonality.rb, line 50
+def is_assigned?
+  !!assignee_id
+end
+
+ +
+ + + + +
+ + +
+ +
+ is_being_closed?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/issue_commonality.rb, line 58
+def is_being_closed?
+  closed_changed? && closed
+end
+
+ +
+ + + + +
+ + +
+ +
+ is_being_reassigned?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/issue_commonality.rb, line 54
+def is_being_reassigned?
+  assignee_id_changed?
+end
+
+ +
+ + + + +
+ + +
+ +
+ is_being_reopened?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/issue_commonality.rb, line 62
+def is_being_reopened?
+  closed_changed? && !closed
+end
+
+ +
+ + + + +
+ + +
+ +
+ new?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/issue_commonality.rb, line 46
+def new?
+  today? && created_at == updated_at
+end
+
+ +
+ + + + +
+ + +
+ +
+ today?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/issue_commonality.rb, line 42
+def today?
+  Date.today == created_at.to_date
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/IssueCommonality/ClassMethods.html b/doc/app/IssueCommonality/ClassMethods.html new file mode 100644 index 00000000..d4ab179d --- /dev/null +++ b/doc/app/IssueCommonality/ClassMethods.html @@ -0,0 +1,479 @@ + + + + + + +module IssueCommonality::ClassMethods - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module IssueCommonality::ClassMethods

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + + + + +
+ +
+ +
+ + + + diff --git a/doc/app/IssueObserver.html b/doc/app/IssueObserver.html new file mode 100644 index 00000000..7f16a865 --- /dev/null +++ b/doc/app/IssueObserver.html @@ -0,0 +1,571 @@ + + + + + + +class IssueObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class IssueObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(issue) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/issue_observer.rb, line 4
+def after_create(issue)
+  if issue.assignee && issue.assignee != current_user
+    Notify.new_issue_email(issue.id).deliver 
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_update(issue) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/issue_observer.rb, line 10
+def after_update(issue)
+  send_reassigned_email(issue) if issue.is_being_reassigned?
+
+  status = nil
+  status = 'closed' if issue.is_being_closed?
+  status = 'reopened' if issue.is_being_reopened?
+  if status
+    Note.create_status_change_note(issue, current_user, status) 
+    [issue.author, issue.assignee].compact.each do |recipient| 
+      Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user)
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ send_reassigned_email(issue) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/issue_observer.rb, line 26
+def send_reassigned_email(issue)
+  recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id }
+
+  recipient_ids.each do |recipient_id|
+    Notify.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was).deliver
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/IssuesBulkUpdateContext.html b/doc/app/IssuesBulkUpdateContext.html new file mode 100644 index 00000000..1d87a757 --- /dev/null +++ b/doc/app/IssuesBulkUpdateContext.html @@ -0,0 +1,503 @@ + + + + + + +class IssuesBulkUpdateContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class IssuesBulkUpdateContext

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/issues_bulk_update_context.rb, line 2
+def execute
+  update_data = params[:update]
+
+  issues_ids   = update_data[:issues_ids].split(",")
+  milestone_id = update_data[:milestone_id]
+  assignee_id  = update_data[:assignee_id]
+  status       = update_data[:status]
+
+  opts = {} 
+  opts[:milestone_id] = milestone_id if milestone_id.present?
+  opts[:assignee_id] = assignee_id if assignee_id.present?
+  opts[:closed] = (status == "closed") if status.present?
+
+  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?
+  }
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/IssuesController.html b/doc/app/IssuesController.html new file mode 100644 index 00000000..6b3edbb6 --- /dev/null +++ b/doc/app/IssuesController.html @@ -0,0 +1,996 @@ + + + + + + +class IssuesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class IssuesController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ bulk_update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 111
+def bulk_update
+  result = IssuesBulkUpdateContext.new(project, current_user, params).execute
+  redirect_to :back, notice: "#{result[:count]} issues updated"
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 48
+def create
+  @issue = @project.issues.new(params[:issue])
+  @issue.author = current_user
+  @issue.save
+
+  respond_to do |format|
+    format.html do
+      if @issue.valid?
+        redirect_to project_issue_path(@project, @issue)
+      else
+        render :new
+      end
+    end
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 80
+def destroy
+  @issue.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_issues_path }
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 35
+def edit
+  respond_with(@issue)
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 19
+def index
+  @issues = issues_filtered
+  @issues = @issues.page(params[:page]).per(20)
+
+  respond_to do |format|
+    format.html # index.html.erb
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 30
+def new
+  @issue = @project.issues.new(params[:issue])
+  respond_with(@issue)
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 39
+def show
+  @note = @project.notes.new(noteable: @issue)
+
+  respond_to do |format|
+    format.html
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ sort() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 89
+def sort
+  return render_404 unless can?(current_user, :admin_issue, @project)
+
+  @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
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 65
+def update
+  @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))
+
+  respond_to do |format|
+    format.js
+    format.html do
+      if @issue.valid?
+        redirect_to [@project, @issue]
+      else
+        render :edit
+      end
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ authorize_admin_issue!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 126
+def authorize_admin_issue!
+  return render_404 unless can?(current_user, :admin_issue, @issue)
+end
+
+ +
+ + + + +
+ + +
+ +
+ authorize_modify_issue!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 122
+def authorize_modify_issue!
+  return render_404 unless can?(current_user, :modify_issue, @issue)
+end
+
+ +
+ + + + +
+ + +
+ +
+ issue() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 118
+def issue
+  @issue ||= @project.issues.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ issues_filtered() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 134
+def issues_filtered
+  @issues = IssuesListContext.new(project, current_user, params).execute
+end
+
+ +
+ + + + +
+ + +
+ +
+ module_enabled() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/issues_controller.rb, line 130
+def module_enabled
+  return render_404 unless @project.issues_enabled
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/IssuesHelper.html b/doc/app/IssuesHelper.html new file mode 100644 index 00000000..d58a5f7f --- /dev/null +++ b/doc/app/IssuesHelper.html @@ -0,0 +1,698 @@ + + + + + + +module IssuesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module IssuesHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ issue_css_classes(issue) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/issues_helper.rb, line 29
+def issue_css_classes issue
+  classes = "issue"
+  classes << " closed" if issue.closed
+  classes << " today" if issue.today?
+  classes
+end
+
+ +
+ + + + +
+ + +
+ +
+ issue_tags() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/issues_helper.rb, line 36
+def issue_tags
+  @project.issues.tag_counts_on(:labels).map(&:name)
+end
+
+ +
+ + + + +
+ + +
+ +
+ issues_filter() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/issues_helper.rb, line 47
+def issues_filter
+  {
+    all: "all",
+    closed: "closed",
+    to_me: "assigned-to-me",
+    open: "open"
+  }
+end
+
+ +
+ + + + +
+ + + + + + + + +
+ +
+ project_issues_filter_path(project, params = {}) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/issues_helper.rb, line 2
+def project_issues_filter_path project, params = {}
+  params[:f] ||= cookies['issue_filter']
+  project_issues_path project, params
+end
+
+ +
+ + + + +
+ + +
+ +
+ unassigned_filter() + click to toggle source +
+ + +
+ +

Returns an OpenStruct object suitable for use by +options_from_collection_for_select to allow filtering issues +by an unassigned User or Milestone

+ + + +
+
# File app/helpers/issues_helper.rb, line 42
+def unassigned_filter
+  # Milestone uses :title, Issue uses :name
+  OpenStruct.new(id: 0, title: 'Unspecified', name: 'Unassigned')
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/IssuesListContext.html b/doc/app/IssuesListContext.html new file mode 100644 index 00000000..01acec45 --- /dev/null +++ b/doc/app/IssuesListContext.html @@ -0,0 +1,537 @@ + + + + + + +class IssuesListContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class IssuesListContext

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ issues[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/issues_list_context.rb, line 6
+def execute
+  @issues = case params[:f]
+            when issues_filter[:all] then @project.issues
+            when issues_filter[:closed] then @project.issues.closed
+            when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
+            else @project.issues.opened
+            end
+
+  @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
+  @issues = @issues.includes(:author, :project).order("updated_at")
+
+  # Filter by specific assignee_id (or lack thereof)?
+  if params[:assignee_id].present?
+    @issues = @issues.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
+  end
+
+  # Filter by specific milestone_id (or lack thereof)?
+  if params[:milestone_id].present?
+    @issues = @issues.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
+  end
+
+  @issues
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Key.html b/doc/app/Key.html new file mode 100644 index 00000000..afbcea93 --- /dev/null +++ b/doc/app/Key.html @@ -0,0 +1,700 @@ + + + + + + +class Key - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Key

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ fingerprintable_key() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/key.rb, line 30
+def fingerprintable_key
+  return true unless key # Don't test if there is no key.
+  # `ssh-keygen -lf /dev/stdin <<< "#{key}"` errors with: redirection unexpected
+  file = Tempfile.new('key_file')
+  begin
+    file.puts key
+    file.rewind
+    fingerprint_output = %xssh-keygen -lf #{file.path} 2>&1` # Catch stderr.
+  ensure
+    file.close
+    file.unlink # deletes the temp file
+  end
+  errors.add(:key, "can't be fingerprinted") if fingerprint_output.match("failed")
+end
+
+ +
+ + + + +
+ + +
+ +
+ is_deploy_key() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/key.rb, line 53
+def is_deploy_key
+  true if project_id
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_deploy?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/key.rb, line 66
+def last_deploy?
+  Key.where(identifier: identifier).count == 0
+end
+
+ +
+ + + + +
+ + +
+ +
+ projects() + click to toggle source +
+ + +
+ +

projects that has this key

+ + + +
+
# File app/models/key.rb, line 58
+def projects
+  if is_deploy_key
+    [project]
+  else
+    user.projects
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ set_identifier() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/key.rb, line 45
+def set_identifier
+  if is_deploy_key
+    self.identifier = "deploy_#{Digest::MD5.hexdigest(key)}"
+  else
+    self.identifier = "#{user.identifier}_#{Time.now.to_i}"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ strip_white_space() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/key.rb, line 18
+def strip_white_space
+  self.key = self.key.strip unless self.key.blank?
+end
+
+ +
+ + + + +
+ + +
+ +
+ unique_key() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/key.rb, line 22
+def unique_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.'
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/KeyObserver.html b/doc/app/KeyObserver.html new file mode 100644 index 00000000..bdaf9f84 --- /dev/null +++ b/doc/app/KeyObserver.html @@ -0,0 +1,530 @@ + + + + + + +class KeyObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class KeyObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_destroy(key) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/key_observer.rb, line 8
+def after_destroy(key)
+  return if key.is_deploy_key && !key.last_deploy?
+  git_host.remove_key(key.identifier, key.projects)
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_save(key) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/key_observer.rb, line 4
+def after_save(key)
+  git_host.set_key(key.identifier, key.key, key.projects)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/KeysController.html b/doc/app/KeysController.html new file mode 100644 index 00000000..13fac402 --- /dev/null +++ b/doc/app/KeysController.html @@ -0,0 +1,624 @@ + + + + + + +class KeysController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class KeysController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/keys_controller.rb, line 19
+def create
+  @key = current_user.keys.new(params[:key])
+  @key.save
+
+  respond_with(@key)
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/keys_controller.rb, line 26
+def destroy
+  @key = current_user.keys.find(params[:id])
+  @key.destroy
+
+  respond_to do |format|
+    format.html { redirect_to keys_url }
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/keys_controller.rb, line 5
+def index
+  @keys = current_user.keys.all
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/keys_controller.rb, line 13
+def new
+  @key = current_user.keys.new
+
+  respond_with(@key)
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/keys_controller.rb, line 9
+def show
+  @key = current_user.keys.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/LabelsController.html b/doc/app/LabelsController.html new file mode 100644 index 00000000..7dece840 --- /dev/null +++ b/doc/app/LabelsController.html @@ -0,0 +1,523 @@ + + + + + + +class LabelsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class LabelsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/labels_controller.rb, line 9
+def index
+  @labels = @project.issues_labels.order('count DESC')
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ module_enabled() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/labels_controller.rb, line 15
+def module_enabled
+  return render_404 unless @project.issues_enabled
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/MergeRequest.html b/doc/app/MergeRequest.html new file mode 100644 index 00000000..7dbe6f4f --- /dev/null +++ b/doc/app/MergeRequest.html @@ -0,0 +1,1478 @@ + + + + + + +class MergeRequest - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class MergeRequest

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
BROKEN_DIFF + +
+ + +
CANNOT_BE_MERGED + +
+ + +
CAN_BE_MERGED + +
+ + +
UNCHECKED + +
+ + +
+
+ + + + +
+

Attributes

+ + +
+
+ should_remove_source_branch[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ find_all_by_branch(branch_name) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 25
+def self.find_all_by_branch(branch_name)
+  where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name)
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ automerge!(current_user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 169
+def automerge!(current_user)
+  if Gitlab::Merge.new(self, current_user).merge! && self.unmerged_commits.empty?
+    self.merge!(current_user.id)
+    true
+  end
+rescue
+  self.mark_as_unmergable
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ broken_diffs?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 86
+def broken_diffs?
+  diffs == [BROKEN_DIFF]
+end
+
+ +
+ + + + +
+ + +
+ +
+ can_be_merged?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 58
+def can_be_merged?
+  state == CAN_BE_MERGED
+end
+
+ +
+ + + + +
+ + +
+ +
+ check_if_can_be_merged() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 62
+def check_if_can_be_merged
+  self.state = if Gitlab::Merge.new(self, self.author).can_be_merged?
+                 CAN_BE_MERGED
+               else
+                 CANNOT_BE_MERGED
+               end
+  self.save
+end
+
+ +
+ + + + +
+ + +
+ +
+ closed_event() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 114
+def closed_event
+  self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Closed).last
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 118
+def commits
+  st_commits || []
+end
+
+ +
+ + + + +
+ + +
+ +
+ diffs() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 71
+def diffs
+  st_diffs || []
+end
+
+ +
+ + + + +
+ + +
+ +
+ human_state() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 29
+def human_state
+  states = {
+    CAN_BE_MERGED =>  "can_be_merged",
+    CANNOT_BE_MERGED => "cannot_be_merged",
+    UNCHECKED => "unchecked"
+  }
+  states[self.state]
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_commit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 102
+def last_commit
+  commits.first
+end
+
+ +
+ + + + +
+ + +
+ +
+ mark_as_merged!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 131
+def mark_as_merged!
+  self.merged = true
+  self.closed = true
+  save
+end
+
+ +
+ + + + +
+ + +
+ +
+ mark_as_unchecked() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 53
+def mark_as_unchecked
+  self.state = UNCHECKED
+  self.save
+end
+
+ +
+ + + + +
+ + +
+ +
+ mark_as_unmergable() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 137
+def mark_as_unmergable
+  self.state = CANNOT_BE_MERGED
+  self.save
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge!(user_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 158
+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
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge_event() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 110
+def merge_event
+  self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Merged).last
+end
+
+ +
+ + + + +
+ + +
+ +
+ merged?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 106
+def merged?
+  merged && merge_event
+end
+
+ +
+ + + + +
+ + +
+ +
+ mr_and_commit_notes() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 191
+def mr_and_commit_notes
+  commit_ids = commits.map(&:id)
+  Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids)
+end
+
+ +
+ + + + +
+ + +
+ +
+ open?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 127
+def open?
+  !closed
+end
+
+ +
+ + + + +
+ + +
+ +
+ probably_merged?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 122
+def probably_merged?
+  unmerged_commits.empty? &&
+    commits.any? && open?
+end
+
+ +
+ + + + +
+ + +
+ +
+ reload_code() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 44
+def reload_code
+  self.reloaded_commits
+  self.reloaded_diffs
+end
+
+ +
+ + + + +
+ + +
+ +
+ reloaded_commits() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 142
+def reloaded_commits
+  if open? && unmerged_commits.any?
+    self.st_commits = unmerged_commits
+    save
+  end
+  commits
+end
+
+ +
+ + + + +
+ + +
+ +
+ reloaded_diffs() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 75
+def reloaded_diffs
+  if open? && unmerged_diffs.any?
+    self.st_diffs = unmerged_diffs
+    self.save
+  end
+
+rescue Grit::Git::GitTimeout
+  self.st_diffs = [BROKEN_DIFF]
+  self.save
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_raw() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 179
+def to_raw
+  FileUtils.mkdir_p(Rails.root.join("tmp", "patches"))
+  patch_path = Rails.root.join("tmp", "patches", "merge_request_#{self.id}.patch")
+
+  from = commits.last.id
+  to = source_branch
+
+  project.repo.git.run('', "format-patch" , " > #{patch_path.to_s}", {}, ["#{from}..#{to}", "--stdout"])
+
+  patch_path
+end
+
+ +
+ + + + +
+ + +
+ +
+ unchecked?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 49
+def unchecked?
+  state == UNCHECKED
+end
+
+ +
+ + + + +
+ + +
+ +
+ unmerged_commits() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 150
+def unmerged_commits
+  self.project.repo.
+    commits_between(self.target_branch, self.source_branch).
+    map {|c| Commit.new(c)}.
+    sort_by(&:created_at).
+    reverse
+end
+
+ +
+ + + + +
+ + +
+ +
+ unmerged_diffs() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 94
+def unmerged_diffs
+  # Only show what is new in the source branch compared to the target branch, not the other way around.
+  # The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
+  # From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
+  common_commit = project.repo.git.native(:merge_base, {}, [target_branch, source_branch]).strip
+  diffs = project.repo.diff(common_commit, source_branch)
+end
+
+ +
+ + + + +
+ + +
+ +
+ valid_diffs?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 90
+def valid_diffs?
+  !broken_diffs?
+end
+
+ +
+ + + + +
+ + +
+ +
+ validate_branches() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/merge_request.rb, line 38
+def validate_branches
+  if target_branch == source_branch
+    errors.add :base, "You can not use same branch for source and target branches"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/MergeRequestObserver.html b/doc/app/MergeRequestObserver.html new file mode 100644 index 00000000..f2d0dbd7 --- /dev/null +++ b/doc/app/MergeRequestObserver.html @@ -0,0 +1,569 @@ + + + + + + +class MergeRequestObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class MergeRequestObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(merge_request) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/merge_request_observer.rb, line 4
+def after_create(merge_request)
+  if merge_request.assignee && merge_request.assignee != current_user
+    Notify.new_merge_request_email(merge_request.id).deliver
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_update(merge_request) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/merge_request_observer.rb, line 10
+def after_update(merge_request)
+  send_reassigned_email(merge_request) if merge_request.is_being_reassigned?
+
+  status = nil
+  status = 'closed' if merge_request.is_being_closed?
+  status = 'reopened' if merge_request.is_being_reopened?
+  if status
+    Note.create_status_change_note(merge_request, current_user, status)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ send_reassigned_email(merge_request) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/merge_request_observer.rb, line 23
+def send_reassigned_email(merge_request)
+  recipients_ids = merge_request.assignee_id_was, merge_request.assignee_id
+  recipients_ids.delete current_user.id
+
+  recipients_ids.each do |recipient_id|
+    Notify.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was).deliver
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/MergeRequestsController.html b/doc/app/MergeRequestsController.html new file mode 100644 index 00000000..ef257c6c --- /dev/null +++ b/doc/app/MergeRequestsController.html @@ -0,0 +1,1114 @@ + + + + + + +class MergeRequestsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class MergeRequestsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ automerge() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 79
+def automerge
+  return access_denied! unless can?(current_user, :accept_mr, @project)
+  if @merge_request.open? && @merge_request.can_be_merged?
+    @merge_request.should_remove_source_branch = params[:should_remove_source_branch]
+    @merge_request.automerge!(current_user)
+    @status = true
+  else
+    @status = false
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ automerge_check() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 72
+def automerge_check
+  if @merge_request.unchecked?
+    @merge_request.check_if_can_be_merged
+  end
+  render json: {state: @merge_request.human_state}
+end
+
+ +
+ + + + +
+ + +
+ +
+ branch_from() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 98
+def branch_from
+  @commit = project.commit(params[:ref])
+  @commit = CommitDecorator.decorate(@commit)
+end
+
+ +
+ + + + +
+ + +
+ +
+ branch_to() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 103
+def branch_to
+  @commit = project.commit(params[:ref])
+  @commit = CommitDecorator.decorate(@commit)
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 50
+def create
+  @merge_request = @project.merge_requests.new(params[:merge_request])
+  @merge_request.author = current_user
+
+  if @merge_request.save
+    @merge_request.reload_code
+    redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.'
+  else
+    render action: "new"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 90
+def destroy
+  @merge_request.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_merge_requests_url(@project) }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ diffs() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 35
+def diffs
+  @diffs = @merge_request.diffs
+  @commit = @merge_request.last_commit
+
+  @comments_allowed = true
+  @line_notes = @merge_request.notes.where("line_code is not null")
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 47
+def edit
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 20
+def index
+  @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 43
+def new
+  @merge_request = @project.merge_requests.new(params[:merge_request])
+end
+
+ +
+ + + + +
+ + +
+ +
+ raw() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 31
+def raw
+  send_file @merge_request.to_raw
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 24
+def show
+  respond_to do |format|
+    format.html
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 62
+def update
+  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.'
+  else
+    render action: "edit"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ authorize_admin_merge_request!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 118
+def authorize_admin_merge_request!
+  return render_404 unless can?(current_user, :admin_merge_request, @merge_request)
+end
+
+ +
+ + + + +
+ + +
+ +
+ authorize_modify_merge_request!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 114
+def authorize_modify_merge_request!
+  return render_404 unless can?(current_user, :modify_merge_request, @merge_request)
+end
+
+ +
+ + + + +
+ + +
+ +
+ define_show_vars() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 135
+def define_show_vars
+  # Build a note object for comment form
+  @note = @project.notes.new(noteable: @merge_request)
+
+  # Get commits from repository
+  # or from cache if already merged
+  @commits = @merge_request.commits
+  @commits = CommitDecorator.decorate(@commits)
+end
+
+ +
+ + + + +
+ + +
+ +
+ merge_request() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 110
+def merge_request
+  @merge_request ||= @project.merge_requests.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ module_enabled() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 122
+def module_enabled
+  return render_404 unless @project.merge_requests_enabled
+end
+
+ +
+ + + + +
+ + +
+ +
+ validates_merge_request() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/merge_requests_controller.rb, line 126
+def validates_merge_request
+  # Show git not found page if target branch doesnt exist
+  return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch)
+
+  # Show git not found page if source branch doesnt exist
+  # and there is no saved commits between source & target branch
+  return git_not_found! if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank?
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/MergeRequestsHelper.html b/doc/app/MergeRequestsHelper.html new file mode 100644 index 00000000..fec9b0e0 --- /dev/null +++ b/doc/app/MergeRequestsHelper.html @@ -0,0 +1,599 @@ + + + + + + +module MergeRequestsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module MergeRequestsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + + + + + + + +
+ +
+ mr_css_classes(mr) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/merge_requests_helper.rb, line 35
+def mr_css_classes mr
+  classes = "merge_request"
+  classes << " closed" if mr.closed
+  classes << " merged" if mr.merged?
+  classes
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_mr_path_from_push_event(event) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/merge_requests_helper.rb, line 24
+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
+    }
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/MergeRequestsLoadContext.html b/doc/app/MergeRequestsLoadContext.html new file mode 100644 index 00000000..5c1b8829 --- /dev/null +++ b/doc/app/MergeRequestsLoadContext.html @@ -0,0 +1,496 @@ + + + + + + +class MergeRequestsLoadContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class MergeRequestsLoadContext

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/merge_requests_load_context.rb, line 2
+def execute
+  type = params[:f]
+
+  merge_requests = project.merge_requests
+
+  merge_requests = case type
+                   when 'all' then merge_requests
+                   when 'closed' then merge_requests.closed
+                   when 'assigned-to-me' then merge_requests.opened.assigned(current_user)
+                   else merge_requests.opened
+                   end.page(params[:page]).per(20)
+
+  merge_requests.includes(:author, :project).order("closed, created_at desc")
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Milestone.html b/doc/app/Milestone.html new file mode 100644 index 00000000..cc3bdc58 --- /dev/null +++ b/doc/app/Milestone.html @@ -0,0 +1,589 @@ + + + + + + +class Milestone - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Milestone

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ active() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/milestone.rb, line 10
+def self.active
+  where("due_date > ? OR due_date IS NULL", Date.today)
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ expires_at() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/milestone.rb, line 24
+def expires_at
+  "expires at #{due_date.stamp("Aug 21, 2011")}" if due_date
+end
+
+ +
+ + + + +
+ + +
+ +
+ participants() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/milestone.rb, line 14
+def participants
+  User.where(id: issues.pluck(:assignee_id))
+end
+
+ +
+ + + + +
+ + +
+ +
+ percent_complete() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/milestone.rb, line 18
+def percent_complete
+  ((self.issues.closed.count * 100) / self.issues.count).abs
+rescue ZeroDivisionError
+  100
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/MilestonesController.html b/doc/app/MilestonesController.html new file mode 100644 index 00000000..e15d6fef --- /dev/null +++ b/doc/app/MilestonesController.html @@ -0,0 +1,816 @@ + + + + + + +class MilestonesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class MilestonesController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 42
+def create
+  @milestone = @project.milestones.new(params[:milestone])
+
+  if @milestone.save
+    redirect_to project_milestone_path(@project, @milestone)
+  else
+    render "new"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 67
+def destroy
+  return access_denied! unless can?(current_user, :admin_milestone, @milestone)
+
+  @milestone.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_milestones_path }
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 28
+def edit
+  respond_with(@milestone)
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 13
+def index
+  @milestones = case params[:f]
+                when 'all'; @project.milestones
+                else @project.milestones.active
+                end
+
+  @milestones = @milestones.includes(:project).order("due_date")
+  @milestones = @milestones.page(params[:page]).per(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 23
+def new
+  @milestone = @project.milestones.new
+  respond_with(@milestone)
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 32
+def show
+  @issues = @milestone.issues
+  @users = @milestone.participants
+
+  respond_to do |format|
+    format.html
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 52
+def update
+  @milestone.update_attributes(params[:milestone])
+
+  respond_to do |format|
+    format.js
+    format.html do
+      if @milestone.valid?
+        redirect_to [@project, @milestone]
+      else
+        render :edit
+      end
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ authorize_admin_milestone!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 84
+def authorize_admin_milestone!
+  return render_404 unless can?(current_user, :admin_milestone, @project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ milestone() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 80
+def milestone
+  @milestone ||= @project.milestones.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ module_enabled() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/milestones_controller.rb, line 88
+def module_enabled
+  return render_404 unless @project.issues_enabled
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Note.html b/doc/app/Note.html new file mode 100644 index 00000000..24a474b0 --- /dev/null +++ b/doc/app/Note.html @@ -0,0 +1,777 @@ + + + + + + +class Note - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Note

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ notify[RW] +
+ +
+ + + +
+
+ +
+
+ notify_author[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ create_status_change_note(noteable, author, status) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/note.rb, line 34
+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)
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ commit_author() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/note.rb, line 90
+def commit_author
+  @commit_author ||=
+    project.users.find_by_email(noteable.author_email) ||
+    project.users.find_by_name(noteable.author_name)
+rescue
+  nil
+end
+
+ +
+ + + + +
+ + +
+ +
+ downvote?() + click to toggle source +
+ + +
+ +

Returns true if this is a downvote note, otherwise false is returned

+ + + +
+
# File app/models/note.rb, line 106
+def downvote?
+  note.start_with?('-1') || note.start_with?(':-1:')
+end
+
+ +
+ + + + +
+ + +
+ +
+ for_commit?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/note.rb, line 82
+def for_commit?
+  noteable_type == "Commit"
+end
+
+ +
+ + + + +
+ + +
+ +
+ for_diff_line?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/note.rb, line 86
+def for_diff_line?
+  line_code.present?
+end
+
+ +
+ + + + +
+ + +
+ +
+ noteable() + click to toggle source +
+ + +
+ +

override to return commits, which are not active record

+ + + +
+
# File app/models/note.rb, line 52
+def noteable
+  if for_commit?
+    project.commit(noteable_id)
+  else
+    super
+  end
+# Temp fix to prevent app crash
+# if note commit id doesnt exist
+rescue
+  nil
+end
+
+ +
+ + + + +
+ + +
+ +
+ notify_only_author?(user) + click to toggle source +
+ + +
+ +

Check if we can notify commit author with email about our comment

+ +

If commit author email exist in project and commit author is not passed +user we can send email to him

+ +

params:

+ +
user - current user
+ +

return:

+ +
Boolean
+ + + +
+
# File app/models/note.rb, line 77
+def notify_only_author?(user)
+  for_commit? && commit_author &&
+    commit_author.email != user.email
+end
+
+ +
+ + + + +
+ + +
+ +
+ upvote?() + click to toggle source +
+ + +
+ +

Returns true if this is an upvote note, otherwise false is returned

+ + + +
+
# File app/models/note.rb, line 100
+def upvote?
+  note.start_with?('+1') || note.start_with?(':+1:')
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/NoteObserver.html b/doc/app/NoteObserver.html new file mode 100644 index 00000000..d0528833 --- /dev/null +++ b/doc/app/NoteObserver.html @@ -0,0 +1,603 @@ + + + + + + +class NoteObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class NoteObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(note) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/note_observer.rb, line 3
+def after_create(note)
+  send_notify_mails(note)
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ notify_team(note) + click to toggle source +
+ + +
+ +

Notifies the whole team except the author of note

+ + + +
+
# File app/observers/note_observer.rb, line 22
+def notify_team(note)
+  # Note: wall posts are not "attached" to anything, so fall back to "Wall"
+  noteable_type = note.noteable_type || "Wall"
+  notify_method = "note_#{noteable_type.underscore}_email".to_sym
+
+  if Notify.respond_to? notify_method
+    team_without_note_author(note).map do |u|
+      Notify.send(notify_method, u.id, note.id).deliver
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ send_notify_mails(note) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/note_observer.rb, line 9
+def send_notify_mails(note)
+  if note.notify
+    notify_team(note)
+  elsif note.notify_author
+    # Notify only author of resource
+    Notify.note_commit_email(note.commit_author.id, note.id).deliver
+  else
+    # Otherwise ignore it
+    nil
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ team_without_note_author(note) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/note_observer.rb, line 34
+def team_without_note_author(note)
+  note.project.users.reject { |u| u.id == note.author.id }
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Notes.html b/doc/app/Notes.html new file mode 100644 index 00000000..d6bcc540 --- /dev/null +++ b/doc/app/Notes.html @@ -0,0 +1,434 @@ + + + + + + +module Notes - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Notes

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Notes/CreateContext.html b/doc/app/Notes/CreateContext.html new file mode 100644 index 00000000..6d4c8449 --- /dev/null +++ b/doc/app/Notes/CreateContext.html @@ -0,0 +1,490 @@ + + + + + + +class Notes::CreateContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Notes::CreateContext

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/notes/create_context.rb, line 3
+def execute
+  note = project.notes.new(params[:note])
+  note.author = current_user
+  note.notify = true if params[:notify] == '1'
+  note.notify_author = true if params[:notify_author] == '1'
+  note.save
+  note
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Notes/LoadContext.html b/doc/app/Notes/LoadContext.html new file mode 100644 index 00000000..273fc0f0 --- /dev/null +++ b/doc/app/Notes/LoadContext.html @@ -0,0 +1,513 @@ + + + + + + +class Notes::LoadContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Notes::LoadContext

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/notes/load_context.rb, line 3
+def execute
+  target_type = params[:target_type]
+  target_id   = params[:target_id]
+  after_id    = params[:after_id]
+  before_id   = params[:before_id]
+
+
+  @notes = case target_type
+           when "commit"
+             project.commit_notes(project.commit(target_id)).fresh.limit(20)
+           when "issue"
+             project.issues.find(target_id).notes.inc_author.fresh.limit(20)
+           when "merge_request"
+             project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh.limit(20)
+           when "snippet"
+             project.snippets.find(target_id).notes.fresh
+           when "wall"
+             # this is the only case, where the order is DESC
+             project.common_notes.order("created_at DESC, id DESC").limit(50)
+           when "wiki"
+             project.wiki_notes.limit(20)
+           end
+
+  @notes = if after_id
+             @notes.where("id > ?", after_id)
+           elsif before_id
+             @notes.where("id < ?", before_id)
+           else
+             @notes
+           end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/NotesController.html b/doc/app/NotesController.html new file mode 100644 index 00000000..5623d4a2 --- /dev/null +++ b/doc/app/NotesController.html @@ -0,0 +1,636 @@ + + + + + + +class NotesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class NotesController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/notes_controller.rb, line 18
+def create
+  @note = Notes::CreateContext.new(project, current_user, params).execute
+
+  respond_to do |format|
+    format.html {redirect_to :back}
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/notes_controller.rb, line 27
+def destroy
+  @note = @project.notes.find(params[:id])
+  return access_denied! unless can?(current_user, :admin_note, @note)
+  @note.destroy
+
+  respond_to do |format|
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/notes_controller.rb, line 8
+def index
+  notes
+  if params[:target_type] == "merge_request"
+    @mixed_targets = true
+    @main_target_type = params[:target_type].camelize
+  end
+
+  respond_with(@notes)
+end
+
+ +
+ + + + +
+ + +
+ +
+ preview() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/notes_controller.rb, line 37
+def preview
+  render text: view_context.markdown(params[:note])
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ notes() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/notes_controller.rb, line 43
+def notes
+  @notes = Notes::LoadContext.new(project, current_user, params).execute
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/NotesHelper.html b/doc/app/NotesHelper.html new file mode 100644 index 00000000..c2940f8d --- /dev/null +++ b/doc/app/NotesHelper.html @@ -0,0 +1,581 @@ + + + + + + +module NotesHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module NotesHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + + + + +
+ +
+ loading_more_notes?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/notes_helper.rb, line 2
+def loading_more_notes?
+  params[:loading_more].present?
+end
+
+ +
+ + + + +
+ + +
+ +
+ loading_new_notes?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/notes_helper.rb, line 6
+def loading_new_notes?
+  params[:loading_new].present?
+end
+
+ +
+ + + + +
+ + +
+ +
+ note_for_main_target?(note) + click to toggle source +
+ + +
+ +

Helps to distinguish e.g. commit notes in mr notes list

+ + + +
+
# File app/helpers/notes_helper.rb, line 11
+def note_for_main_target?(note)
+  !@mixed_targets || @main_target_type == note.noteable_type
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Notify.html b/doc/app/Notify.html new file mode 100644 index 00000000..933e1cbc --- /dev/null +++ b/doc/app/Notify.html @@ -0,0 +1,883 @@ + + + + + + +class Notify - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Notify

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 31
+def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
+  @issue = Issue.find issue_id
+  @issue_status = status
+  @updated_by = User.find updated_by_user_id
+  mail(to: recipient(recipient_id),
+      subject: subject("changed issue ##{@issue.id}", @issue.title))
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_issue_email(issue_id) + click to toggle source +
+ + +
+ +

Issue

+ + + +
+
# File app/mailers/notify.rb, line 18
+def new_issue_email(issue_id)
+  @issue = Issue.find(issue_id)
+  @project = @issue.project
+  mail(to: @issue.assignee_email, subject: subject("new issue ##{@issue.id}", @issue.title))
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_merge_request_email(merge_request_id) + click to toggle source +
+ + +
+ +

Merge Request

+ + + +
+
# File app/mailers/notify.rb, line 45
+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: subject("new merge request !#{@merge_request.id}", @merge_request.title))
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_user_email(user_id, password) + click to toggle source +
+ + +
+ +

User

+ + + +
+
# File app/mailers/notify.rb, line 118
+def new_user_email(user_id, password)
+  @user = User.find(user_id)
+  @password = password
+  mail(to: @user.email, subject: subject("Account was created for you"))
+end
+
+ +
+ + + + +
+ + +
+ +
+ note_commit_email(recipient_id, note_id) + click to toggle source +
+ + +
+ +

Note

+ + + +
+
# File app/mailers/notify.rb, line 64
+def note_commit_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @commit = @note.noteable
+  @commit = CommitDecorator.decorate(@commit)
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for commit #{@commit.short_id}", @commit.title))
+end
+
+ +
+ + + + +
+ + +
+ +
+ note_issue_email(recipient_id, note_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 72
+def note_issue_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @issue = @note.noteable
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for issue ##{@issue.id}"))
+end
+
+ +
+ + + + +
+ + +
+ +
+ note_merge_request_email(recipient_id, note_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 79
+def note_merge_request_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @merge_request = @note.noteable
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for merge request !#{@merge_request.id}"))
+end
+
+ +
+ + + + +
+ + +
+ +
+ note_wall_email(recipient_id, note_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 86
+def note_wall_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject)
+end
+
+ +
+ + + + +
+ + +
+ +
+ note_wiki_email(recipient_id, note_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 92
+def note_wiki_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @wiki = @note.noteable
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for wiki"))
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_access_granted_email(user_project_id) + click to toggle source +
+ + +
+ +

Project

+ + + +
+
# File app/mailers/notify.rb, line 105
+def project_access_granted_email(user_project_id)
+  @users_project = UsersProject.find user_project_id
+  @project = @users_project.project
+  mail(to: @users_project.user.email, 
+       subject: subject("access to project was granted"))
+end
+
+ +
+ + + + +
+ + +
+ +
+ reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 24
+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(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title))
+end
+
+ +
+ + + + +
+ + +
+ +
+ reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) + click to toggle source +
+ + +
+ + + + + +
+
# File app/mailers/notify.rb, line 51
+def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
+  @merge_request = MergeRequest.find(merge_request_id)
+  @previous_assignee ||= User.find(previous_assignee_id)
+  @project = @merge_request.project
+  mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title))
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/OmniauthCallbacksController.html b/doc/app/OmniauthCallbacksController.html new file mode 100644 index 00000000..d40a16a3 --- /dev/null +++ b/doc/app/OmniauthCallbacksController.html @@ -0,0 +1,527 @@ + + + + + + +class OmniauthCallbacksController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class OmniauthCallbacksController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ failure_message() + click to toggle source +
+ + +
+ +

Extend the standard message generation to accept our custom exception

+ + + +
+
# File app/controllers/omniauth_callbacks_controller.rb, line 9
+def failure_message
+  exception = env["omniauth.error"]
+  error   = exception.error_reason if exception.respond_to?(:error_reason)
+  error ||= exception.error        if exception.respond_to?(:error)
+  error ||= exception.message      if exception.respond_to?(:message)
+  error ||= env["omniauth.error.type"].to_s
+  error.to_s.humanize if error
+end
+
+ +
+ + + + +
+ + +
+ +
+ ldap() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/omniauth_callbacks_controller.rb, line 18
+def ldap
+  # We only find ourselves here if the authentication to LDAP was successful.
+  @user = User.find_for_ldap_auth(request.env["omniauth.auth"], current_user)
+  if @user.persisted?
+    @user.remember_me = true
+  end
+  sign_in_and_redirect @user
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/PostReceive.html b/doc/app/PostReceive.html new file mode 100644 index 00000000..11468fd9 --- /dev/null +++ b/doc/app/PostReceive.html @@ -0,0 +1,495 @@ + + + + + + +class PostReceive - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class PostReceive

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ perform(reponame, oldrev, newrev, ref, identifier) + click to toggle source +
+ + +
+ + + + + +
+
# File app/workers/post_receive.rb, line 4
+def self.perform(reponame, oldrev, newrev, ref, identifier)
+  project = Project.find_by_path(reponame)
+  return false if project.nil?
+
+  # Ignore push from non-gitlab users
+  if %r^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
+    return false unless user = User.find_by_email(identifier)
+  else
+    return false unless user = Key.find_by_identifier(identifier).try(:user)
+  end
+
+  project.trigger_post_receive(oldrev, newrev, ref, user)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProfileController.html b/doc/app/ProfileController.html new file mode 100644 index 00000000..deb4b0bc --- /dev/null +++ b/doc/app/ProfileController.html @@ -0,0 +1,683 @@ + + + + + + +class ProfileController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProfileController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ design() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 7
+def design
+end
+
+ +
+ + + + +
+ + +
+ +
+ history() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 34
+def history
+  @events = current_user.recent_events.page(params[:page]).per(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ password_update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 18
+def password_update
+  params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
+
+  if @user.update_attributes(params[:user])
+    flash[:notice] = "Password was successfully updated. Please login with it"
+    redirect_to new_user_session_path
+  else
+    render action: "password"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ reset_private_token() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 29
+def reset_private_token
+  current_user.reset_authentication_token!
+  redirect_to profile_account_path
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 4
+def show
+end
+
+ +
+ + + + +
+ + +
+ +
+ token() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 15
+def token
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/profile_controller.rb, line 10
+def update
+  @user.update_attributes(params[:user])
+  redirect_to :back
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProfileHelper.html b/doc/app/ProfileHelper.html new file mode 100644 index 00000000..ab7773ba --- /dev/null +++ b/doc/app/ProfileHelper.html @@ -0,0 +1,481 @@ + + + + + + +module ProfileHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module ProfileHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ oauth_active_class(provider) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/profile_helper.rb, line 2
+def oauth_active_class provider
+  if current_user.provider == provider.to_s
+    'active'
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Project.html b/doc/app/Project.html new file mode 100644 index 00000000..55868ef1 --- /dev/null +++ b/doc/app/Project.html @@ -0,0 +1,1202 @@ + + + + + + +class Project - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Project

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ error_code[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ access_options() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 85
+def access_options
+  UsersProject.access_roles
+end
+
+ +
+ + + + +
+ + +
+ +
+ active() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 52
+def active
+  joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
+end
+
+ +
+ + + + +
+ + +
+ +
+ create_by_user(params, user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 60
+def create_by_user(params, user)
+  project = Project.new params
+
+  Project.transaction do
+    project.owner = user
+    project.save!
+
+    # Add user as project master
+    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
+    project.update_repository
+  end
+
+  project
+rescue Gitlab::Gitolite::AccessDenied => ex
+  project.error_code = :gitolite
+  project
+rescue => ex
+  project.error_code = :db
+  project.errors.add(:base, "Can't save project. Please try again later")
+  project
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+

Public Instance Methods

+ + +
+ +
+ build_commit_note(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 124
+def build_commit_note(commit)
+  notes.new(noteable_id: commit.id, noteable_type: "Commit")
+end
+
+ +
+ + + + +
+ + +
+ +
+ check_limit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 98
+def check_limit
+  unless owner.can_create_project?
+    errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
+  end
+rescue
+  errors[:base] << ("Can't check your ability to create project")
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit_line_notes(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 132
+def commit_line_notes(commit)
+  notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit_notes(commit) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 128
+def commit_notes(commit)
+  notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil)
+end
+
+ +
+ + + + +
+ + +
+ +
+ common_notes() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 120
+def common_notes
+  notes.where(noteable_type: ["", nil]).inc_author_project
+end
+
+ +
+ + + + +
+ + +
+ +
+ git_error?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 90
+def git_error?
+  error_code == :gitolite
+end
+
+ +
+ + + + +
+ + +
+ +
+ issues_labels() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 160
+def issues_labels
+  issues.tag_counts_on(:labels)
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_activity() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 144
+def last_activity
+  last_event
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_activity_date() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 148
+def last_activity_date
+  last_event.try(:created_at) || updated_at
+end
+
+ +
+ + + + +
+ + +
+ +
+ private?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 140
+def private?
+  private_flag
+end
+
+ +
+ + + + +
+ + +
+ +
+ project_id() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 156
+def project_id
+  self.id
+end
+
+ +
+ + + + +
+ + +
+ +
+ public?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 136
+def public?
+  !private_flag
+end
+
+ +
+ + + + +
+ + +
+ +
+ repo_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 106
+def repo_name
+  if path == "gitolite-admin"
+    errors.add(:path, " like 'gitolite-admin' is not allowed")
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ saved?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 94
+def saved?
+  id && valid?
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_param() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 112
+def to_param
+  code
+end
+
+ +
+ + + + +
+ + +
+ +
+ web_url() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 116
+def web_url
+  [Gitlab.config.url, code].join("/")
+end
+
+ +
+ + + + +
+ + +
+ +
+ wiki_notes() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/project.rb, line 152
+def wiki_notes
+  Note.where(noteable_id: wikis.pluck(:id), noteable_type: 'Wiki', project_id: self.id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProjectHook.html b/doc/app/ProjectHook.html new file mode 100644 index 00000000..e5d17ef0 --- /dev/null +++ b/doc/app/ProjectHook.html @@ -0,0 +1,439 @@ + + + + + + +class ProjectHook - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProjectHook

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/ProjectObserver.html b/doc/app/ProjectObserver.html new file mode 100644 index 00000000..d4ce7824 --- /dev/null +++ b/doc/app/ProjectObserver.html @@ -0,0 +1,589 @@ + + + + + + +class ProjectObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProjectObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/project_observer.rb, line 12
+def after_create project
+  log_info("#{project.owner.name} created a new project \"#{project.name}\"")
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_destroy(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/project_observer.rb, line 6
+def after_destroy(project)
+  log_info("Project \"#{project.name}\" was removed")
+
+  project.destroy_repository
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_save(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/project_observer.rb, line 2
+def after_save(project)
+  project.update_repository
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ log_info(message) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/project_observer.rb, line 18
+def log_info message
+  Gitlab::AppLogger.info message
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProjectResourceController.html b/doc/app/ProjectResourceController.html new file mode 100644 index 00000000..aa972617 --- /dev/null +++ b/doc/app/ProjectResourceController.html @@ -0,0 +1,439 @@ + + + + + + +class ProjectResourceController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProjectResourceController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/ProjectsController.html b/doc/app/ProjectsController.html new file mode 100644 index 00000000..6982deab --- /dev/null +++ b/doc/app/ProjectsController.html @@ -0,0 +1,785 @@ + + + + + + +class ProjectsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProjectsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 20
+def create
+  @project = Project.create_by_user(params[:project], current_user)
+
+  respond_to do |format|
+    format.html do
+      if @project.saved?
+        redirect_to(@project, notice: 'Project was successfully created.')
+      else
+        render action: "new"
+      end
+    end
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 85
+def destroy
+  # Disable the UsersProject update_repository call, otherwise it will be
+  # called once for every person removed from the project
+  UsersProject.skip_callback(:destroy, :after, :update_repository)
+  project.destroy
+  UsersProject.set_callback(:destroy, :after, :update_repository)
+
+  respond_to do |format|
+    format.html { redirect_to root_path }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 17
+def edit
+end
+
+ +
+ + + + +
+ + +
+ +
+ files() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 64
+def files
+  @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
+end
+
+ +
+ + + + +
+ + +
+ +
+ graph() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 81
+def graph
+  @days_json, @commits_json = Gitlab::GraphCommit.to_graph(project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 13
+def new
+  @project = Project.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 47
+def show
+  limit = (params[:limit] || 20).to_i
+  @events = @project.events.recent.limit(limit).offset(params[:offset] || 0)
+
+  respond_to do |format|
+    format.html do
+       unless @project.empty_repo?
+         @last_push = current_user.recent_push(@project.id)
+         render :show
+       else
+         render "projects/empty"
+       end
+    end
+    format.js
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/projects_controller.rb, line 35
+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.js
+    else
+      format.html { render action: "edit" }
+      format.js
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ wall() + click to toggle source +
+ + +
+ +

Wall

+ + + +
+
# File app/controllers/projects_controller.rb, line 72
+def wall
+  return render_404 unless @project.wall_enabled
+  @note = Note.new
+
+  respond_to do |format|
+    format.html
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProjectsHelper.html b/doc/app/ProjectsHelper.html new file mode 100644 index 00000000..5edd4592 --- /dev/null +++ b/doc/app/ProjectsHelper.html @@ -0,0 +1,543 @@ + + + + + + +module ProjectsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module ProjectsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ grouper_project_members(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/projects_helper.rb, line 2
+def grouper_project_members(project)
+  @project.users_projects.sort_by(&:project_access).reverse.group_by(&:project_access)
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ remove_from_team_message(project, member) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/projects_helper.rb, line 6
+def remove_from_team_message(project, member)
+  "You are going to remove #{member.user_name} from #{project.name}. Are you sure?"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProtectedBranch.html b/doc/app/ProtectedBranch.html new file mode 100644 index 00000000..900646dc --- /dev/null +++ b/doc/app/ProtectedBranch.html @@ -0,0 +1,529 @@ + + + + + + +class ProtectedBranch - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProtectedBranch

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ commit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/protected_branch.rb, line 17
+def commit
+  project.commit(self.name)
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_repository() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/protected_branch.rb, line 13
+def update_repository
+  git_host.update_repository(project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/ProtectedBranchesController.html b/doc/app/ProtectedBranchesController.html new file mode 100644 index 00000000..7eb2b1fd --- /dev/null +++ b/doc/app/ProtectedBranchesController.html @@ -0,0 +1,556 @@ + + + + + + +class ProtectedBranchesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class ProtectedBranchesController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/protected_branches_controller.rb, line 13
+def create
+  @project.protected_branches.create(params[:protected_branch])
+  redirect_to project_protected_branches_path(@project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/protected_branches_controller.rb, line 18
+def destroy
+  @project.protected_branches.find(params[:id]).destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_protected_branches_path }
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/protected_branches_controller.rb, line 8
+def index
+  @branches = @project.protected_branches.all
+  @protected_branch = @project.protected_branches.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/PushEvent.html b/doc/app/PushEvent.html new file mode 100644 index 00000000..002866a6 --- /dev/null +++ b/doc/app/PushEvent.html @@ -0,0 +1,1105 @@ + + + + + + +module PushEvent - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module PushEvent

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ branch?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 12
+def branch?
+  data[:ref]["refs/heads"]
+end
+
+ +
+ + + + +
+ + +
+ +
+ branch_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 48
+def branch_name
+  @branch_name ||= data[:ref].gsub("refs/heads/", "")
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit_from() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 32
+def commit_from
+  data[:before]
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit_to() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 36
+def commit_to
+  data[:after]
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits() + click to toggle source +
+ + +
+ +

Max 20 commits from push DESC

+ + + +
+
# File app/roles/push_event.rb, line 57
+def commits
+  @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_count() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 61
+def commits_count 
+  data[:total_commits_count] || commits.count || 0
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_commit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 85
+def last_commit
+  project.commit(commit_to)
+rescue => ex
+  nil
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_push_to_non_root?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 97
+def last_push_to_non_root?
+  branch? && project.default_branch != branch_name
+end
+
+ +
+ + + + +
+ + +
+ +
+ md_ref?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 28
+def md_ref?
+  !(rm_ref? || new_ref?)
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_branch?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 16
+def new_branch?
+  commit_from =~ %r^00000/
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_ref?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 20
+def new_ref?
+  commit_from =~ %r^00000/
+end
+
+ +
+ + + + +
+ + +
+ +
+ parent_commit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 79
+def parent_commit
+  project.commit(commit_from)
+rescue => ex
+  nil
+end
+
+ +
+ + + + +
+ + +
+ +
+ push_action_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 69
+def push_action_name
+  if new_ref?
+    "pushed new"
+  elsif rm_ref?
+    "deleted"
+  else
+    "pushed to"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ push_with_commits?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 91
+def push_with_commits? 
+  md_ref? && commits.any? && parent_commit && last_commit
+rescue Grit::NoSuchPathError
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ ref_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 40
+def ref_name
+  if tag?
+    tag_name
+  else
+    branch_name
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ ref_type() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 65
+def ref_type
+  tag? ? "tag" : "branch"
+end
+
+ +
+ + + + +
+ + +
+ +
+ rm_ref?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 24
+def rm_ref?
+  commit_to =~ %r^00000/
+end
+
+ +
+ + + + +
+ + +
+ +
+ tag?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 8
+def tag?
+  data[:ref]["refs/tags"]
+end
+
+ +
+ + + + +
+ + +
+ +
+ tag_name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 52
+def tag_name
+  @tag_name ||= data[:ref].gsub("refs/tags/", "")
+end
+
+ +
+ + + + +
+ + +
+ +
+ valid_push?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_event.rb, line 2
+def valid_push?
+  data[:ref]
+rescue => ex
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/PushObserver.html b/doc/app/PushObserver.html new file mode 100644 index 00000000..804447a6 --- /dev/null +++ b/doc/app/PushObserver.html @@ -0,0 +1,699 @@ + + + + + + +module PushObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module PushObserver

+ +
+ +

Includes methods for handling Git Push events

+ +

Triggered by PostReceive job

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute_hooks(oldrev, newrev, ref, user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_observer.rb, line 33
+def execute_hooks(oldrev, newrev, ref, user)
+  ref_parts = ref.split('/')
+
+  # Return if this is not a push to a branch (e.g. new commits)
+  return if ref_parts[1] !~ %rheads/ || oldrev == "00000000000000000000000000000000"
+
+  data = post_receive_data(oldrev, newrev, ref, user)
+
+  hooks.each { |hook| hook.execute(data) }
+end
+
+ +
+ + + + +
+ + +
+ +
+ observe_push(oldrev, newrev, ref, user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_observer.rb, line 5
+def observe_push(oldrev, newrev, ref, user)
+  data = post_receive_data(oldrev, newrev, ref, user)
+
+  Event.create(
+    project: self,
+    action: Event::Pushed,
+    data: data,
+    author_id: data[:user_id]
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ post_receive_data(oldrev, newrev, ref, user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_observer.rb, line 44
+def post_receive_data(oldrev, newrev, ref, user)
+
+  push_commits = commits_between(oldrev, newrev)
+
+  # Total commits count
+  push_commits_count = push_commits.size
+
+  # Get latest 20 commits ASC
+  push_commits_limited = push_commits.last(20)
+
+  # Hash to be passed as post_receive_data
+  data = {
+    before: oldrev,
+    after: newrev,
+    ref: ref,
+    user_id: user.id,
+    user_name: user.name,
+    repository: {
+      name: name,
+      url: web_url,
+      description: description,
+      homepage: web_url,
+    },
+    commits: [],
+    total_commits_count: push_commits_count
+  }
+
+  # For perfomance purposes maximum 20 latest commits
+  # will be passed as post receive hook data.
+  #
+  push_commits_limited.each do |commit|
+    data[:commits] << {
+      id: commit.id,
+      message: commit.safe_message,
+      timestamp: commit.date.xmlschema,
+      url: "#{Gitlab.config.url}/#{code}/commits/#{commit.id}",
+      author: {
+        name: commit.author_name,
+        email: commit.author_email
+      }
+    }
+  end
+
+  data
+end
+
+ +
+ + + + +
+ + +
+ +
+ trigger_post_receive(oldrev, newrev, ref, user) + click to toggle source +
+ + +
+ +

This method will be called after each post receive and only if the provided +user is present in GitLab.

+ +

All callbacks for post receive should be placed here.

+ + + +
+
# File app/roles/push_observer.rb, line 94
+def trigger_post_receive(oldrev, newrev, ref, user)
+  # Create push event
+  self.observe_push(oldrev, newrev, ref, user)
+
+  # Close merged MR
+  self.update_merge_requests(oldrev, newrev, ref, user)
+
+  # Execute web hooks
+  self.execute_hooks(oldrev, newrev, ref, user)
+
+  # Create satellite
+  self.satellite.create unless self.satellite.exists?
+
+  # Discover the default branch, but only if it hasn't already been set to
+  # something else
+  if default_branch.nil?
+    update_attributes(default_branch: discover_default_branch)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_merge_requests(oldrev, newrev, ref, user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/push_observer.rb, line 16
+def update_merge_requests(oldrev, newrev, ref, user)
+  return true unless ref =~ %rheads/
+  branch_name = ref.gsub("refs/heads/", "")
+  c_ids = self.commits_between(oldrev, newrev).map(&:id)
+
+  # Update code for merge requests
+  mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all
+  mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
+
+  # Close merge requests
+  mrs = self.merge_requests.opened.where(target_branch: branch_name).all
+  mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
+  mrs.each { |merge_request| merge_request.merge!(user.id) }
+
+  true
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Redcarpet.html b/doc/app/Redcarpet.html new file mode 100644 index 00000000..238b7f25 --- /dev/null +++ b/doc/app/Redcarpet.html @@ -0,0 +1,432 @@ + + + + + + +module Redcarpet - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Redcarpet

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Redcarpet/Render.html b/doc/app/Redcarpet/Render.html new file mode 100644 index 00000000..acb7ba3c --- /dev/null +++ b/doc/app/Redcarpet/Render.html @@ -0,0 +1,432 @@ + + + + + + +module Redcarpet::Render - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Redcarpet::Render

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+ +
+ + + + diff --git a/doc/app/Redcarpet/Render/GitlabHTML.html b/doc/app/Redcarpet/Render/GitlabHTML.html new file mode 100644 index 00000000..93212eab --- /dev/null +++ b/doc/app/Redcarpet/Render/GitlabHTML.html @@ -0,0 +1,594 @@ + + + + + + +class Redcarpet::Render::GitlabHTML - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Redcarpet::Render::GitlabHTML

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ h[R] +
+ +
+ + + +
+
+ +
+
+ template[R] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(template, options = {}) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/redcarpet/render/gitlab_html.rb, line 6
+def initialize(template, options = {})
+  @template = template
+  @project = @template.instance_variable_get("@project")
+  super options
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ block_code(code, language) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/redcarpet/render/gitlab_html.rb, line 12
+def block_code(code, language)
+  if Pygments::Lexer.find(language)
+    Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'})
+  else
+    Pygments.highlight(code, options: {encoding: 'utf-8'})
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ postprocess(full_document) + click to toggle source +
+ + +
+ + + + + +
+
# File lib/redcarpet/render/gitlab_html.rb, line 20
+def postprocess(full_document)
+  h.gfm(full_document)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/RefsController.html b/doc/app/RefsController.html new file mode 100644 index 00000000..a8248da0 --- /dev/null +++ b/doc/app/RefsController.html @@ -0,0 +1,638 @@ + + + + + + +class RefsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class RefsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ logs_tree() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/refs_controller.rb, line 31
+def logs_tree
+  contents = @tree.contents
+  @logs = contents.map do |content|
+    file = params[:path] ? File.join(params[:path], content.name) : content.name
+    last_commit = @project.commits(@commit.id, file, 1).last
+    last_commit = CommitDecorator.decorate(last_commit)
+    {
+      file_name: content.name,
+      commit: last_commit
+    }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ switch() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/refs_controller.rb, line 12
+def switch
+  respond_to do |format|
+    format.html do
+      new_path = if params[:destination] == "tree"
+                   project_tree_path(@project, @ref)
+                 else
+                   project_commits_path(@project, @ref)
+                 end
+
+      redirect_to new_path
+    end
+    format.js do
+      @ref = params[:ref]
+      define_tree_vars
+      render "tree"
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ define_tree_vars() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/refs_controller.rb, line 46
+def define_tree_vars
+  params[:path] = nil if params[:path].blank?
+
+  @repo = project.repo
+  @commit = project.commit(@ref)
+  @commit = CommitDecorator.decorate(@commit)
+  @tree = Tree.new(@commit.tree, project, @ref, params[:path])
+  @tree = TreeDecorator.new(@tree)
+  @hex_path = Digest::SHA1.hexdigest(params[:path] || "")
+
+  if params[:path]
+    @logs_path = logs_file_project_ref_path(@project, @ref, params[:path])
+  else
+    @logs_path = logs_tree_project_ref_path(@project, @ref)
+  end
+rescue
+  return render_404
+end
+
+ +
+ + + + +
+ + +
+ +
+ ref() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/refs_controller.rb, line 65
+def ref
+  @ref = params[:id] || params[:ref]
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/RepositoriesController.html b/doc/app/RepositoriesController.html new file mode 100644 index 00000000..3a22f71e --- /dev/null +++ b/doc/app/RepositoriesController.html @@ -0,0 +1,593 @@ + + + + + + +class RepositoriesController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class RepositoriesController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ archive() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/repositories_controller.rb, line 19
+def archive
+  unless can?(current_user, :download_code, @project)
+    render_404 and return 
+  end
+
+
+  file_path = @project.archive_repo(params[:ref])
+
+  if file_path
+    # Send file to user
+    send_file file_path
+  else
+    render_404
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ branches() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/repositories_controller.rb, line 11
+def branches
+  @branches = @project.branches
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/repositories_controller.rb, line 7
+def show
+  @activities = @project.commits_with_refs(20)
+end
+
+ +
+ + + + +
+ + +
+ +
+ tags() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/repositories_controller.rb, line 15
+def tags
+  @tags = @project.tags
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Repository.html b/doc/app/Repository.html new file mode 100644 index 00000000..cb68146c --- /dev/null +++ b/doc/app/Repository.html @@ -0,0 +1,1566 @@ + + + + + + +module Repository - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Repository

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ archive_repo(ref) + click to toggle source +
+ + +
+ +

Archive Project to .tar.gz

+ +

Already packed repo archives stored at +app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz

+ + + +
+
# File app/roles/repository.rb, line 157
+def archive_repo(ref)
+  ref = ref || self.root_ref
+  commit = self.commit(ref)
+  return nil unless commit
+
+  # Build file path
+  file_name = self.code + "-" + commit.id.to_s + ".tar.gz"
+  storage_path = Rails.root.join("tmp", "repositories", self.code)
+  file_path = File.join(storage_path, file_name)
+
+  # Put files into a directory before archiving
+  prefix = self.code + "/"
+
+  # Create file if not exists
+  unless File.exists?(file_path)
+    FileUtils.mkdir_p storage_path
+    file = self.repo.archive_to_file(ref, prefix,  file_path)
+  end
+
+  file_path
+end
+
+ +
+ + + + +
+ + +
+ +
+ branch_names() + click to toggle source +
+ + +
+ +

Returns an Array of branch names

+ + + +
+
# File app/roles/repository.rb, line 53
+def branch_names
+  repo.branches.collect(&:name).sort
+end
+
+ +
+ + + + +
+ + +
+ +
+ branches() + click to toggle source +
+ + +
+ +

Returns an Array of Branches

+ + + +
+
# File app/roles/repository.rb, line 58
+def branches
+  repo.branches.sort_by(&:name)
+end
+
+ +
+ + + + +
+ + +
+ +
+ commit(commit_id = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 15
+def commit(commit_id = nil)
+  Commit.find_or_first(repo, commit_id, root_ref)
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits(ref, path = nil, limit = nil, offset = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 31
+def commits(ref, path = nil, limit = nil, offset = nil)
+  Commit.commits(repo, ref, path, limit, offset)
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_between(from, to) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 39
+def commits_between(from, to)
+  Commit.commits_between(repo, from, to)
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_since(date) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 27
+def commits_since(date)
+  Commit.commits_since(repo, date)
+end
+
+ +
+ + + + +
+ + +
+ +
+ commits_with_refs(n = 20) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 23
+def commits_with_refs(n = 20)
+  Commit.commits_with_refs(repo, n)
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy_repository() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 93
+def destroy_repository
+  git_host.remove_repository(self)
+end
+
+ +
+ + + + +
+ + +
+ +
+ discover_default_branch() + click to toggle source +
+ + +
+ +

Discovers the default branch based on the repository’s available branches

+
  • +

    If no branches are present, returns nil

    +
  • +

    If one branch is present, returns its name

    +
  • +

    If two or more branches are present, returns the one that has a name +matching #root_ref +(default_branch or ‘master’ if default_branch is nil)

    +
+ + + +
+
# File app/roles/repository.rb, line 128
+def discover_default_branch
+  if branch_names.length == 0
+    nil
+  elsif branch_names.length == 1
+    branch_names.first
+  else
+    branch_names.select { |v| v == root_ref }.first
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ empty_repo?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 11
+def empty_repo?
+  !repo_exists? || !has_commits?
+end
+
+ +
+ + + + +
+ + +
+ +
+ fresh_commits(n = 10) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 19
+def fresh_commits(n = 10)
+  Commit.fresh_commits(repo, n)
+end
+
+ +
+ + + + +
+ + +
+ +
+ has_commits?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 138
+def has_commits?
+  !!commit
+rescue Grit::NoSuchPathError
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ has_post_receive_file?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 47
+def has_post_receive_file?
+  hook_file = File.join(path_to_repo, 'hooks', 'post-receive')
+  File.exists?(hook_file)
+end
+
+ +
+ + + + +
+ + +
+ +
+ heads() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 103
+def heads
+  @heads ||= repo.heads
+end
+
+ +
+ + + + +
+ + +
+ +
+ http_url_to_repo() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 183
+def http_url_to_repo
+  http_url = [Gitlab.config.url, "/", path, ".git"].join('')
+end
+
+ +
+ + + + +
+ + +
+ +
+ last_commit_for(ref, path = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 35
+def last_commit_for(ref, path = nil)
+  commits(ref, path, 1).first
+end
+
+ +
+ + + + +
+ + +
+ +
+ open_branches() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 113
+def open_branches
+  if protected_branches.empty?
+    self.repo.heads
+  else
+    pnames = protected_branches.map(&:name)
+    self.repo.heads.reject { |h| pnames.include?(h.name) }
+  end.sort_by(&:name)
+end
+
+ +
+ + + + +
+ + +
+ +
+ path_to_repo() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 85
+def path_to_repo
+  File.join(Gitlab.config.git_base_path, "#{path}.git")
+end
+
+ +
+ + + + +
+ + +
+ +
+ protected_branch?(branch_name) + click to toggle source +
+ + +
+ +

Check if current branch name is marked as protected in the system

+ + + +
+
# File app/roles/repository.rb, line 188
+def protected_branch? branch_name
+  protected_branches.map(&:name).include?(branch_name)
+end
+
+ +
+ + + + +
+ + +
+ +
+ ref_names() + click to toggle source +
+ + +
+ +

Returns an Array of branch and tag names

+ + + +
+
# File app/roles/repository.rb, line 73
+def ref_names
+  [branch_names + tag_names].flatten
+end
+
+ +
+ + + + +
+ + +
+ +
+ repo() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 77
+def repo
+  @repo ||= Grit::Repo.new(path_to_repo)
+end
+
+ +
+ + + + +
+ + +
+ +
+ repo_exists?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 97
+def repo_exists?
+  @repo_exists ||= (repo && !repo.branches.empty?)
+rescue
+  @repo_exists = false
+end
+
+ +
+ + + + +
+ + +
+ +
+ root_ref() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 144
+def root_ref
+  default_branch || "master"
+end
+
+ +
+ + + + +
+ + +
+ +
+ root_ref?(branch) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 148
+def root_ref?(branch)
+  root_ref == branch
+end
+
+ +
+ + + + +
+ + +
+ +
+ satellite() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 43
+def satellite
+  @satellite ||= Gitlab::Satellite.new(self)
+end
+
+ +
+ + + + +
+ + +
+ +
+ ssh_url_to_repo() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 179
+def ssh_url_to_repo
+  url_to_repo
+end
+
+ +
+ + + + +
+ + +
+ +
+ tag_names() + click to toggle source +
+ + +
+ +

Returns an Array of tag names

+ + + +
+
# File app/roles/repository.rb, line 63
+def tag_names
+  repo.tags.collect(&:name).sort.reverse
+end
+
+ +
+ + + + +
+ + +
+ +
+ tags() + click to toggle source +
+ + +
+ +

Returns an Array of Tags

+ + + +
+
# File app/roles/repository.rb, line 68
+def tags
+  repo.tags.sort_by(&:name).reverse
+end
+
+ +
+ + + + +
+ + +
+ +
+ tree(fcommit, path = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 107
+def tree(fcommit, path = nil)
+  fcommit = commit if fcommit == :head
+  tree = fcommit.tree
+  path ? (tree / path) : tree
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_repository() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 89
+def update_repository
+  git_host.update_repository(self)
+end
+
+ +
+ + + + +
+ + +
+ +
+ url_to_repo() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 81
+def url_to_repo
+  git_host.url_to_repo(path)
+end
+
+ +
+ + + + +
+ + +
+ +
+ valid_repo?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/repository.rb, line 4
+def valid_repo?
+  repo
+rescue
+  errors.add(:path, "Invalid repository path")
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SearchContext.html b/doc/app/SearchContext.html new file mode 100644 index 00000000..6a3d2bd5 --- /dev/null +++ b/doc/app/SearchContext.html @@ -0,0 +1,599 @@ + + + + + + +class SearchContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class SearchContext

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ params[RW] +
+ +
+ + + +
+
+ +
+
+ project_ids[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(project_ids, params) + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/search_context.rb, line 4
+def initialize(project_ids, params)
+  @project_ids, @params = project_ids, params.dup
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/search_context.rb, line 8
+def execute
+  query = params[:search]
+
+  return result unless query.present?
+
+  result[:projects] = Project.where(id: project_ids).search(query).limit(10)
+  result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
+  result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
+  result
+end
+
+ +
+ + + + +
+ + +
+ +
+ result() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/search_context.rb, line 19
+def result
+  @result ||= {
+    projects: [],
+    merge_requests: [],
+    issues: []
+  }
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SearchController.html b/doc/app/SearchController.html new file mode 100644 index 00000000..0c14ea8f --- /dev/null +++ b/doc/app/SearchController.html @@ -0,0 +1,489 @@ + + + + + + +class SearchController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class SearchController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/search_controller.rb, line 2
+def show
+  result = SearchContext.new(current_user.project_ids, params).execute
+
+  @projects       = result[:projects]
+  @merge_requests = result[:merge_requests]
+  @issues         = result[:issues]
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Snippet.html b/doc/app/Snippet.html new file mode 100644 index 00000000..a24e4494 --- /dev/null +++ b/doc/app/Snippet.html @@ -0,0 +1,667 @@ + + + + + + +class Snippet - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Snippet

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ content_types() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/snippet.rb, line 23
+def self.content_types
+  [
+    ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
+    ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb",
+    ".js", ".sh", ".coffee", ".yml", ".md"
+  ]
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ data() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/snippet.rb, line 31
+def data
+  content
+end
+
+ +
+ + + + +
+ + +
+ +
+ expired?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/snippet.rb, line 47
+def expired?
+  expires_at && expires_at < Time.current
+end
+
+ +
+ + + + +
+ + +
+ +
+ mode() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/snippet.rb, line 43
+def mode
+  nil
+end
+
+ +
+ + + + +
+ + +
+ +
+ name() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/snippet.rb, line 39
+def name
+  file_name
+end
+
+ +
+ + + + +
+ + +
+ +
+ size() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/snippet.rb, line 35
+def size
+  0
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SnippetsController.html b/doc/app/SnippetsController.html new file mode 100644 index 00000000..7585a295 --- /dev/null +++ b/doc/app/SnippetsController.html @@ -0,0 +1,833 @@ + + + + + + +class SnippetsController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class SnippetsController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 26
+def create
+  @snippet = @project.snippets.new(params[:snippet])
+  @snippet.author = current_user
+  @snippet.save
+
+  if @snippet.valid?
+    redirect_to [@project, @snippet]
+  else
+    respond_with(@snippet)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 55
+def destroy
+  return access_denied! unless can?(current_user, :admin_snippet, @snippet)
+
+  @snippet.destroy
+
+  redirect_to project_snippets_path(@project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 38
+def edit
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 18
+def index
+  @snippets = @project.snippets
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 22
+def new
+  @snippet = @project.snippets.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ raw() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 63
+def raw 
+  send_data(
+    @snippet.content,
+    type: "text/plain",
+    disposition: 'inline',
+    filename: @snippet.file_name
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 51
+def show
+  @note = @project.notes.new(noteable: @snippet)
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 41
+def update
+  @snippet.update_attributes(params[:snippet])
+
+  if @snippet.valid?
+    redirect_to [@project, @snippet]
+  else
+    respond_with(@snippet)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ authorize_admin_snippet!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 82
+def authorize_admin_snippet!
+  return render_404 unless can?(current_user, :admin_snippet, @snippet)
+end
+
+ +
+ + + + +
+ + +
+ +
+ authorize_modify_snippet!() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 78
+def authorize_modify_snippet!
+  return render_404 unless can?(current_user, :modify_snippet, @snippet)
+end
+
+ +
+ + + + +
+ + +
+ +
+ snippet() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/snippets_controller.rb, line 74
+def snippet
+  @snippet ||= @project.snippets.find(params[:id])
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SnippetsHelper.html b/doc/app/SnippetsHelper.html new file mode 100644 index 00000000..99c08d51 --- /dev/null +++ b/doc/app/SnippetsHelper.html @@ -0,0 +1,485 @@ + + + + + + +module SnippetsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module SnippetsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ lifetime_select_options() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/snippets_helper.rb, line 2
+def lifetime_select_options
+  options = [
+      ['forever', nil],
+      ['1 day',   "#{Date.current + 1.day}"],
+      ['1 week',  "#{Date.current + 1.week}"],
+      ['1 month', "#{Date.current + 1.month}"]
+  ]
+  options_for_select(options)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/StaticModel.html b/doc/app/StaticModel.html new file mode 100644 index 00000000..9dd1617c --- /dev/null +++ b/doc/app/StaticModel.html @@ -0,0 +1,648 @@ + + + + + + +module StaticModel - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module StaticModel

+ +
+ +

Provides an ActiveRecord-like interface to a model whose data is not +persisted to a database.

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ ==(other) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/static_model.rb, line 40
+def ==(other)
+  if other.is_a? StaticModel
+    id == other.id
+  else
+    super
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ [](key) + click to toggle source +
+ + +
+ +

Used by AR for fetching attributes

+ +

Pass it along if we respond to it.

+ + + +
+
# File app/roles/static_model.rb, line 20
+def [](key)
+  send(key) if respond_to?(key)
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroyed?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/static_model.rb, line 36
+def destroyed?
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ new_record?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/static_model.rb, line 28
+def new_record?
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ persisted?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/static_model.rb, line 32
+def persisted?
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_param() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/static_model.rb, line 24
+def to_param
+  id
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/StaticModel/ClassMethods.html b/doc/app/StaticModel/ClassMethods.html new file mode 100644 index 00000000..27ee1373 --- /dev/null +++ b/doc/app/StaticModel/ClassMethods.html @@ -0,0 +1,511 @@ + + + + + + +module StaticModel::ClassMethods - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module StaticModel::ClassMethods

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ base_class() + click to toggle source +
+ + +
+ +

Used by ActiveRecord’s polymorphic association to set object_type

+ + + +
+
# File app/roles/static_model.rb, line 12
+def base_class
+  self
+end
+
+ +
+ + + + +
+ + +
+ +
+ primary_key() + click to toggle source +
+ + +
+ +

Used by ActiveRecord’s polymorphic association to set object_id

+ + + +
+
# File app/roles/static_model.rb, line 7
+def primary_key
+  'id'
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SystemHook.html b/doc/app/SystemHook.html new file mode 100644 index 00000000..8e35bf27 --- /dev/null +++ b/doc/app/SystemHook.html @@ -0,0 +1,525 @@ + + + + + + +class SystemHook - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class SystemHook

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ all_hooks_fire(data) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/system_hook.rb, line 2
+def self.all_hooks_fire(data)
+  SystemHook.all.each do |sh|
+    sh.async_execute data
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ async_execute(data) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/system_hook.rb, line 8
+def async_execute(data)
+  Resque.enqueue(SystemHookWorker, id, data)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SystemHookObserver.html b/doc/app/SystemHookObserver.html new file mode 100644 index 00000000..20d81963 --- /dev/null +++ b/doc/app/SystemHookObserver.html @@ -0,0 +1,573 @@ + + + + + + +class SystemHookObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class SystemHookObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(model) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/system_hook_observer.rb, line 4
+def after_create(model)
+  if model.kind_of? Project
+    SystemHook.all_hooks_fire({
+      event_name: "project_create",
+      name: model.name,
+      path: model.path,
+      project_id: model.id,
+      owner_name: model.owner.name,
+      owner_email: model.owner.email,
+      created_at: model.created_at
+    })
+  elsif model.kind_of? User 
+    SystemHook.all_hooks_fire({
+      event_name: "user_create",
+      name: model.name,
+      email: model.email,
+      created_at: model.created_at
+    })
+
+  elsif model.kind_of? UsersProject
+    SystemHook.all_hooks_fire({
+      event_name: "user_add_to_team",
+      project_name: model.project.name,
+      project_path: model.project.path,
+      project_id: model.project_id,
+      user_name: model.user.name,
+      user_email: model.user.email,
+      project_access: model.repo_access_human,
+      created_at: model.created_at
+    })
+
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_destroy(model) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/system_hook_observer.rb, line 38
+def after_destroy(model)
+  if model.kind_of? Project
+    SystemHook.all_hooks_fire({
+      event_name: "project_destroy",
+      name: model.name,
+      path: model.path,
+      project_id: model.id,
+      owner_name: model.owner.name,
+      owner_email: model.owner.email,
+    })
+  elsif model.kind_of? User
+    SystemHook.all_hooks_fire({
+      event_name: "user_destroy",
+      name: model.name,
+      email: model.email
+    })
+
+  elsif model.kind_of? UsersProject
+    SystemHook.all_hooks_fire({
+      event_name: "user_remove_from_team",
+      project_name: model.project.name,
+      project_path: model.project.path,
+      project_id: model.project_id,
+      user_name: model.user.name,
+      user_email: model.user.email,
+      project_access: model.repo_access_human
+    })
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/SystemHookWorker.html b/doc/app/SystemHookWorker.html new file mode 100644 index 00000000..153eb577 --- /dev/null +++ b/doc/app/SystemHookWorker.html @@ -0,0 +1,485 @@ + + + + + + +class SystemHookWorker - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class SystemHookWorker

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Class Methods

+ + +
+ +
+ perform(hook_id, data) + click to toggle source +
+ + +
+ + + + + +
+
# File app/workers/system_hook_worker.rb, line 4
+def self.perform(hook_id, data)
+  SystemHook.find(hook_id).execute data
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TabHelper.html b/doc/app/TabHelper.html new file mode 100644 index 00000000..43cc08a4 --- /dev/null +++ b/doc/app/TabHelper.html @@ -0,0 +1,621 @@ + + + + + + +module TabHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module TabHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ branches_tab_class() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tab_helper.rb, line 80
+def branches_tab_class
+  if current_page?(branches_project_repository_path(@project)) ||
+    current_controller?(:protected_branches) ||
+    current_page?(project_repository_path(@project))
+    'active'
+  end
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ project_tab_class() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tab_helper.rb, line 70
+def project_tab_class
+  [:show, :files, :edit, :update].each do |action|
+    return "active" if current_page?(controller: "projects", action: action, id: @project)
+  end
+
+  if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
+   "active"
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TagsHelper.html b/doc/app/TagsHelper.html new file mode 100644 index 00000000..3a98d61f --- /dev/null +++ b/doc/app/TagsHelper.html @@ -0,0 +1,516 @@ + + + + + + +module TagsHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module TagsHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ tag_list(project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tags_helper.rb, line 6
+def tag_list project
+  html = ''
+  project.tag_list.each do |tag|
+    html += link_to tag, tag_path(tag)
+  end
+
+  html.html_safe
+end
+
+ +
+ + + + +
+ + +
+ +
+ tag_path(tag) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tags_helper.rb, line 2
+def tag_path tag
+  "/tags/#{tag}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Team.html b/doc/app/Team.html new file mode 100644 index 00000000..3a583694 --- /dev/null +++ b/doc/app/Team.html @@ -0,0 +1,710 @@ + + + + + + +module Team - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Team

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ add_user_id_to_team(user_id, access_role) + click to toggle source +
+ + +
+ +

Add user to project with passed access role by user id

+ + + +
+
# File app/roles/team.rb, line 26
+def add_user_id_to_team(user_id, access_role)
+  users_projects.create(
+    user_id: user_id,
+    project_access: access_role
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ add_user_to_team(user, access_role) + click to toggle source +
+ + +
+ +

Add user to project with passed access role

+ + + +
+
# File app/roles/team.rb, line 14
+def add_user_to_team(user, access_role)
+  add_user_id_to_team(user.id, access_role)
+end
+
+ +
+ + + + +
+ + +
+ +
+ add_users_ids_to_team(users_ids, access_role) + click to toggle source +
+ + +
+ +

Add multiple users to project with same access role by user ids

+ + + +
+
# File app/roles/team.rb, line 35
+def add_users_ids_to_team(users_ids, access_role)
+  UsersProject.bulk_import(self, users_ids, access_role)
+  self.update_repository
+end
+
+ +
+ + + + +
+ + +
+ +
+ add_users_to_team(users, access_role) + click to toggle source +
+ + +
+ +

Add multiple users to project with same access role

+ + + +
+
# File app/roles/team.rb, line 20
+def add_users_to_team(users, access_role)
+  add_users_ids_to_team(users.map(&:id), access_role)
+end
+
+ +
+ + + + +
+ + +
+ +
+ delete_users_ids_from_team(users_ids) + click to toggle source +
+ + +
+ +

Delete multiple users from project by user ids

+ + + +
+
# File app/roles/team.rb, line 48
+def delete_users_ids_from_team(users_ids)
+  UsersProject.bulk_delete(self, users_ids)
+  self.update_repository
+end
+
+ +
+ + + + +
+ + +
+ +
+ team_member_by_id(user_id) + click to toggle source +
+ + +
+ +

Get Team Member record by user id

+ + + +
+
# File app/roles/team.rb, line 8
+def team_member_by_id(user_id)
+  users_projects.find_by_user_id(user_id)
+end
+
+ +
+ + + + +
+ + +
+ +
+ team_member_by_name_or_email(name = nil, email = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/team.rb, line 2
+def team_member_by_name_or_email(name = nil, email = nil)
+  user = users.where("name like ? or email like ?", name, email).first
+  users_projects.where(user: user) if user
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_users_ids_to_role(users_ids, access_role) + click to toggle source +
+ + +
+ +

Update multiple project users to same access role by user ids

+ + + +
+
# File app/roles/team.rb, line 42
+def update_users_ids_to_role(users_ids, access_role)
+  UsersProject.bulk_update(self, users_ids, access_role)
+  self.update_repository
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TeamMembersController.html b/doc/app/TeamMembersController.html new file mode 100644 index 00000000..46af7c9f --- /dev/null +++ b/doc/app/TeamMembersController.html @@ -0,0 +1,698 @@ + + + + + + +class TeamMembersController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class TeamMembersController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ apply_import() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 47
+def apply_import
+  giver = Project.find(params[:source_project_id])
+  status = UsersProject.import_team(giver, project)
+  notice = status ? "Succesfully imported" : "Import failed"
+
+  redirect_to project_team_members_path(project), notice: notice
+end
+
+ +
+ + + + +
+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 18
+def create
+  @project.add_users_ids_to_team(
+    params[:user_ids],
+    params[:project_access]
+  )
+
+  redirect_to project_team_index_path(@project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 37
+def destroy
+  @team_member = project.users_projects.find(params[:id])
+  @team_member.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_team_index_path(@project) }
+    format.js { render nothing: true }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ index() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 6
+def index
+end
+
+ +
+ + + + +
+ + +
+ +
+ new() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 14
+def new
+  @team_member = project.users_projects.new
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 9
+def show
+  @team_member = project.users_projects.find(params[:id])
+  @events = @team_member.user.recent_events.where(:project_id => @project.id).limit(7)
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/team_members_controller.rb, line 27
+def update
+  @team_member = project.users_projects.find(params[:id])
+  @team_member.update_attributes(params[:team_member])
+
+  unless @team_member.valid?
+    flash[:alert] = "User should have at least one role"
+  end
+  redirect_to project_team_index_path(@project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TestHookContext.html b/doc/app/TestHookContext.html new file mode 100644 index 00000000..e18701cb --- /dev/null +++ b/doc/app/TestHookContext.html @@ -0,0 +1,488 @@ + + + + + + +class TestHookContext - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class TestHookContext

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute() + click to toggle source +
+ + +
+ + + + + +
+
# File app/contexts/test_hook_context.rb, line 2
+def execute
+  hook = project.hooks.find(params[:id])
+  commits = project.commits(project.default_branch, nil, 3)
+  data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user)
+  hook.execute(data)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Tree.html b/doc/app/Tree.html new file mode 100644 index 00000000..f1f414a4 --- /dev/null +++ b/doc/app/Tree.html @@ -0,0 +1,663 @@ + + + + + + +class Tree - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Tree

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ path[RW] +
+ +
+ + + +
+
+ +
+
+ project[RW] +
+ +
+ + + +
+
+ +
+
+ ref[RW] +
+ +
+ + + +
+
+ +
+
+ tree[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ new(raw_tree, project, ref = nil, path = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/tree.rb, line 8
+def initialize(raw_tree, project, ref = nil, path = nil)
+  @project, @ref, @path = project, ref, path
+  @tree = if path.present?
+            raw_tree / path.dup.force_encoding('ascii-8bit')
+          else
+            raw_tree
+          end
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ empty?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/tree.rb, line 25
+def empty?
+  data.blank?
+end
+
+ +
+ + + + +
+ + +
+ +
+ invalid?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/tree.rb, line 21
+def invalid?
+  tree.nil?
+end
+
+ +
+ + + + +
+ + +
+ +
+ is_blob?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/tree.rb, line 17
+def is_blob?
+  tree.is_a?(Grit::Blob)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TreeController.html b/doc/app/TreeController.html new file mode 100644 index 00000000..1adba0ec --- /dev/null +++ b/doc/app/TreeController.html @@ -0,0 +1,583 @@ + + + + + + +class TreeController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class TreeController

+ +
+ +

Controller for viewing a repository’s file structure

+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/tree_controller.rb, line 24
+def edit
+  @last_commit = @project.last_commit_for(@ref, @path).sha
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/tree_controller.rb, line 13
+def show
+  @hex_path  = Digest::SHA1.hexdigest(@path)
+  @logs_path = logs_file_project_ref_path(@project, @ref, @path)
+
+  respond_to do |format|
+    format.html
+    # Disable cache so browser history works
+    format.js { no_cache_headers }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ update() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/tree_controller.rb, line 28
+def update
+  file_editor = Gitlab::FileEditor.new(current_user, @project, @ref)
+  update_status = file_editor.update(
+    @path,
+    params[:content],
+    params[:commit_message],
+    params[:last_commit]
+  )
+
+  if update_status
+    redirect_to project_tree_path(@project, @id), notice: "Your changes have been successfully commited"
+  else
+    flash[:notice] = "Your changes could not be commited, because the file has been changed"
+    render :edit
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TreeDecorator.html b/doc/app/TreeDecorator.html new file mode 100644 index 00000000..e6bdc0fa --- /dev/null +++ b/doc/app/TreeDecorator.html @@ -0,0 +1,597 @@ + + + + + + +class TreeDecorator - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class TreeDecorator

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ breadcrumbs(max_links = 2) { |link_to("..", "| ... } + click to toggle source +
+ + +
+ + + + + + + +
+ + + + +
+ + +
+ +
+ readme() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/tree_decorator.rb, line 32
+def readme
+  @readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ %r^readme/ }
+end
+
+ +
+ + + + +
+ + +
+ +
+ up_dir?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/tree_decorator.rb, line 23
+def up_dir?
+  path.present?
+end
+
+ +
+ + + + +
+ + +
+ +
+ up_dir_path() + click to toggle source +
+ + +
+ + + + + +
+
# File app/decorators/tree_decorator.rb, line 27
+def up_dir_path
+  file = File.join(path, "..")
+  h.project_tree_path(project, h.tree_join(ref, file))
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/TreeHelper.html b/doc/app/TreeHelper.html new file mode 100644 index 00000000..e185ba72 --- /dev/null +++ b/doc/app/TreeHelper.html @@ -0,0 +1,736 @@ + + + + + + +module TreeHelper - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module TreeHelper

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ allowed_tree_edit?() + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tree_helper.rb, line 63
+def allowed_tree_edit?
+  if @project.protected_branch? @ref
+    can?(current_user, :push_code_to_protected_branches, @project)
+  else
+    can?(current_user, :push_code, @project)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ gitlab_markdown?(filename) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tree_helper.rb, line 50
+def gitlab_markdown?(filename)
+  filename.end_with?(*%w(.mdown .md .markdown))
+end
+
+ +
+ + + + +
+ + +
+ +
+ markup?(filename) + click to toggle source +
+ + +
+ +

Public: Determines if a given filename is compatible with GitHub::Markup.

+ +

filename - Filename string to check

+ +

Returns boolean

+ + + +
+
# File app/helpers/tree_helper.rb, line 45
+def markup?(filename)
+  filename.end_with?(*%w(.textile .rdoc .org .creole
+                         .mediawiki .rst .asciidoc .pod))
+end
+
+ +
+ + + + +
+ + +
+ +
+ plain_text_readme?(filename) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tree_helper.rb, line 54
+def plain_text_readme? filename
+  filename == 'README'
+end
+
+ +
+ + + + +
+ + +
+ +
+ render_tree(contents) + click to toggle source +
+ + +
+ +

Sorts a repository’s tree so that folders are before files and renders +their corresponding partials

+ +

contents - A Grit::Tree object for the current tree

+ + + +
+
# File app/helpers/tree_helper.rb, line 6
+def render_tree(contents)
+  # Render Folders before Files/Submodules
+  folders, files = contents.partition { |v| v.kind_of?(Grit::Tree) }
+
+  tree = ""
+
+  # Render folders if we have any
+  tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
+
+  files.each do |f|
+    if f.respond_to?(:url)
+      # Object is a Submodule
+      tree += render partial: 'tree/submodule_item', object: f
+    else
+      # Object is a Blob
+      tree += render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
+    end
+  end
+
+  tree.html_safe
+end
+
+ +
+ + + + +
+ + +
+ +
+ tree_hex_class(content) + click to toggle source +
+ + +
+ + + + + +
+
# File app/helpers/tree_helper.rb, line 36
+def tree_hex_class(content)
+  "file_#{hexdigest(content.name)}"
+end
+
+ +
+ + + + +
+ + +
+ +
+ tree_icon(type) + click to toggle source +
+ + +
+ +

Return an image icon depending on the file type

+ +

type - String type of the tree item; either ‘folder’ or ‘file’

+ + + +
+
# File app/helpers/tree_helper.rb, line 31
+def tree_icon(type)
+  image = type == 'folder' ? 'file_dir.png' : 'file_txt.png'
+  image_tag(image, size: '16x16')
+end
+
+ +
+ + + + +
+ + +
+ +
+ tree_join(*args) + click to toggle source +
+ + +
+ +

Simple shortcut to File.join

+ + + +
+
# File app/helpers/tree_helper.rb, line 59
+def tree_join(*args)
+  File.join(*args)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/User.html b/doc/app/User.html new file mode 100644 index 00000000..513f9644 --- /dev/null +++ b/doc/app/User.html @@ -0,0 +1,755 @@ + + + + + + +class User - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class User

+ +
+ +
+ + + + +
+ + + + + + + + +
+

Attributes

+ + +
+
+ force_random_password[RW] +
+ +
+ + + +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ +
+ create_from_omniauth(auth, ldap = false) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 55
+def create_from_omniauth(auth, ldap = false)
+  gitlab_auth.create_from_omniauth(auth, ldap)
+end
+
+ +
+ + + + +
+ + +
+ +
+ filter(filter_name) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 41
+def filter filter_name
+  case filter_name
+  when "admins"; self.admins
+  when "blocked"; self.blocked
+  when "wop"; self.without_projects
+  else
+    self.active
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ find_for_ldap_auth(auth, signed_in_resource = nil) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 63
+def find_for_ldap_auth(auth, signed_in_resource = nil)
+  gitlab_auth.find_for_ldap_auth(auth, signed_in_resource)
+end
+
+ +
+ + + + +
+ + +
+ +
+ find_or_new_for_omniauth(auth) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 59
+def find_or_new_for_omniauth(auth)
+  gitlab_auth.find_or_new_for_omniauth(auth)
+end
+
+ +
+ + + + +
+ + +
+ +
+ gitlab_auth() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 67
+def gitlab_auth
+  Gitlab::Auth.new
+end
+
+ +
+ + + + +
+ + + + + +
+ +
+ without_projects() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 51
+def without_projects
+  where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)')
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ generate_password() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/user.rb, line 76
+def generate_password
+  if self.force_random_password
+    self.password = self.password_confirmation = Devise.friendly_token.first(8)
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/UserObserver.html b/doc/app/UserObserver.html new file mode 100644 index 00000000..95c7249d --- /dev/null +++ b/doc/app/UserObserver.html @@ -0,0 +1,557 @@ + + + + + + +class UserObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class UserObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_create(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/user_observer.rb, line 2
+def after_create(user)
+  log_info("User \"#{user.name}\" (#{user.email}) was created")
+
+  Notify.new_user_email(user.id, user.password).deliver
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_destroy(user) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/user_observer.rb, line 8
+def after_destroy user
+  log_info("User \"#{user.name}\" (#{user.email})  was removed")
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ log_info(message) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/user_observer.rb, line 14
+def log_info message
+  Gitlab::AppLogger.info message
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/UsersProject.html b/doc/app/UsersProject.html new file mode 100644 index 00000000..f157832b --- /dev/null +++ b/doc/app/UsersProject.html @@ -0,0 +1,904 @@ + + + + + + +class UsersProject - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class UsersProject

+ +
+ +
+ + + + +
+ + + + + + +
+

Constants

+
+ +
DEVELOPER + +
+ + +
GUEST + +
+ + +
MASTER + +
+ + +
REPORTER + +
+ + +
+
+ + + + + + +
+

Public Class Methods

+ + +
+ +
+ access_roles() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 96
+def access_roles
+  {
+    "Guest"     => GUEST,
+    "Reporter"  => REPORTER,
+    "Developer" => DEVELOPER,
+    "Master"    => MASTER
+  }
+end
+
+ +
+ + + + +
+ + +
+ +
+ bulk_delete(project, user_ids) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 53
+def bulk_delete(project, user_ids)
+  UsersProject.transaction do
+    UsersProject.where(:user_id => user_ids, :project_id => project.id).each do |users_project|
+      users_project.destroy
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ bulk_import(project, user_ids, project_access) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 70
+def bulk_import(project, user_ids, project_access)
+  UsersProject.transaction do
+    user_ids.each do |user_id|
+      users_project = UsersProject.new(
+        project_access: project_access,
+        user_id: user_id
+      )
+      users_project.project = project
+      users_project.save
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ bulk_update(project, user_ids, project_access) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 61
+def bulk_update(project, user_ids, project_access)
+  UsersProject.transaction do
+    UsersProject.where(:user_id => user_ids, :project_id => project.id).each do |users_project|
+      users_project.project_access = project_access
+      users_project.save
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ import_team(source_project, target_project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 24
+def import_team(source_project, target_project)
+  UsersProject.without_repository_callback do
+    UsersProject.transaction do
+      team = source_project.users_projects.all
+
+      team.each do |tm|
+        # Skip if user already present in team
+        next if target_project.users.include?(tm.user)
+
+        new_tm = tm.dup
+        new_tm.id = nil
+        new_tm.project_id = target_project.id
+        new_tm.save
+      end
+    end
+  end
+
+  target_project.update_repository
+  true
+rescue
+  false
+end
+
+ +
+ + + + +
+ + +
+ +
+ user_bulk_import(user, project_ids, project_access) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 83
+def user_bulk_import(user, project_ids, project_access)
+  UsersProject.transaction do
+    project_ids.each do |project_id|
+      users_project = UsersProject.new(
+        project_access: project_access,
+      )
+      users_project.project_id = project_id
+      users_project.user_id = user.id
+      users_project.save
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ without_repository_callback() { || ... } + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 47
+def without_repository_callback
+  UsersProject.skip_callback(:destroy, :after, :update_repository)
+  yield
+  UsersProject.set_callback(:destroy, :after, :update_repository)
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ project_access_human() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 114
+def project_access_human
+  Project.access_options.key(self.project_access)
+end
+
+ +
+ + + + +
+ + +
+ +
+ repo_access_human() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 118
+def repo_access_human
+  self.class.access_roles.invert[self.project_access]
+end
+
+ +
+ + + + +
+ + +
+ +
+ role_access() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 106
+def role_access
+  project_access
+end
+
+ +
+ + + + +
+ + +
+ +
+ update_repository() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/users_project.rb, line 110
+def update_repository
+  git_host.update_repository(project)
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/UsersProjectObserver.html b/doc/app/UsersProjectObserver.html new file mode 100644 index 00000000..7c7b90a0 --- /dev/null +++ b/doc/app/UsersProjectObserver.html @@ -0,0 +1,558 @@ + + + + + + +class UsersProjectObserver - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class UsersProjectObserver

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ after_commit(users_project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/users_project_observer.rb, line 2
+def after_commit(users_project)
+  return if users_project.destroyed?
+  Notify.project_access_granted_email(users_project.id).deliver
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_create(users_project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/users_project_observer.rb, line 7
+def after_create(users_project)
+  Event.create(
+    project_id: users_project.project.id,
+    action: Event::Joined,
+    author_id: users_project.user.id
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ after_destroy(users_project) + click to toggle source +
+ + +
+ + + + + +
+
# File app/observers/users_project_observer.rb, line 15
+def after_destroy(users_project)
+  Event.create(
+    project_id: users_project.project.id,
+    action: Event::Left,
+    author_id: users_project.user.id
+  )
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Votes.html b/doc/app/Votes.html new file mode 100644 index 00000000..9fa2a0b7 --- /dev/null +++ b/doc/app/Votes.html @@ -0,0 +1,615 @@ + + + + + + +module Votes - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

module Votes

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ downvotes() + click to toggle source +
+ + +
+ +

Return the number of -1 comments (downvotes)

+ + + +
+
# File app/roles/votes.rb, line 16
+def downvotes
+  notes.select(&:downvote?).size
+end
+
+ +
+ + + + +
+ + +
+ +
+ downvotes_in_percent() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/votes.rb, line 20
+def downvotes_in_percent
+  if votes_count.zero?
+    0
+  else
+    100.0 - upvotes_in_percent
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ upvotes() + click to toggle source +
+ + +
+ +

Return the number of +1 comments (upvotes)

+ + + +
+
# File app/roles/votes.rb, line 3
+def upvotes
+  notes.select(&:upvote?).size
+end
+
+ +
+ + + + +
+ + +
+ +
+ upvotes_in_percent() + click to toggle source +
+ + +
+ + + + + +
+
# File app/roles/votes.rb, line 7
+def upvotes_in_percent
+  if votes_count.zero?
+    0
+  else
+    100.0 / votes_count * upvotes
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ votes_count() + click to toggle source +
+ + +
+ +

Return the total number of votes

+ + + +
+
# File app/roles/votes.rb, line 29
+def votes_count
+  upvotes + downvotes
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/WebHook.html b/doc/app/WebHook.html new file mode 100644 index 00000000..44a89adb --- /dev/null +++ b/doc/app/WebHook.html @@ -0,0 +1,506 @@ + + + + + + +class WebHook - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class WebHook

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ execute(data) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/web_hook.rb, line 12
+def execute(data)
+  parsed_url = URI.parse(url)
+  if parsed_url.userinfo.blank?
+    WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" })
+  else
+    post_url = url.gsub("#{parsed_url.userinfo}@", "")
+    WebHook.post(post_url,
+                 body: data.to_json,
+                 headers: {"Content-Type" => "application/json"},
+                 basic_auth: {username: parsed_url.user, password: parsed_url.password})
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/Wiki.html b/doc/app/Wiki.html new file mode 100644 index 00000000..c2bf5b61 --- /dev/null +++ b/doc/app/Wiki.html @@ -0,0 +1,567 @@ + + + + + + +class Wiki - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class Wiki

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Protected Class Methods

+ + +
+ +
+ regenerate_from(wiki) + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/wiki.rb, line 20
+def self.regenerate_from wiki
+  regenerated_field = [:slug, :content, :title]
+
+  new_wiki = Wiki.new
+  regenerated_field.each do |field|
+    new_wiki.send("#{field}=", wiki.send(field))
+  end
+  new_wiki
+end
+
+ +
+ + + + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ +
+ to_param() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/wiki.rb, line 14
+def to_param
+  slug
+end
+
+ +
+ + + + +
+ + +
+ +
+

Protected Instance Methods

+ + +
+ +
+ set_slug() + click to toggle source +
+ + +
+ + + + + +
+
# File app/models/wiki.rb, line 30
+def set_slug
+  self.slug = self.title.parameterize
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/WikisController.html b/doc/app/WikisController.html new file mode 100644 index 00000000..4a4e930c --- /dev/null +++ b/doc/app/WikisController.html @@ -0,0 +1,676 @@ + + + + + + +class WikisController - Rails Application Documentation + + + + + + + + + + + + + + + + +
+

class WikisController

+ +
+ +
+ + + + +
+ + + + + + + + + + +
+

Public Instance Methods

+ + +
+ +
+ create() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/wikis_controller.rb, line 36
+def create
+  @wiki = @project.wikis.new(params[:wiki])
+  @wiki.user = current_user
+
+  respond_to do |format|
+    if @wiki.save
+      format.html { redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' }
+    else
+      format.html { render action: "edit" }
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ destroy() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/wikis_controller.rb, line 53
+def destroy
+  @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" }
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ edit() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/wikis_controller.rb, line 31
+def edit
+  @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
+  @wiki = Wiki.regenerate_from @wiki
+end
+
+ +
+ + + + +
+ + +
+ +
+ history() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/wikis_controller.rb, line 49
+def history
+  @wikis = @project.wikis.where(slug: params[:id]).order("created_at")
+end
+
+ +
+ + + + +
+ + +
+ +
+ pages() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/wikis_controller.rb, line 6
+def pages
+  @wikis = @project.wikis.group(:slug).order("created_at")
+end
+
+ +
+ + + + +
+ + +
+ +
+ show() + click to toggle source +
+ + +
+ + + + + +
+
# File app/controllers/wikis_controller.rb, line 10
+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
+  end
+
+  @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])
+      render 'edit'
+    else
+      render 'empty'
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ +
+ + + + diff --git a/doc/app/created.rid b/doc/app/created.rid new file mode 100644 index 00000000..972a7e6f --- /dev/null +++ b/doc/app/created.rid @@ -0,0 +1,135 @@ +Thu, 25 Oct 2012 11:45:21 +0300 +doc/README_FOR_APP Wed, 06 Jun 2012 13:56:49 +0300 +app/observers/issue_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/observers/key_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/observers/project_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/observers/activity_observer.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/observers/user_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/observers/merge_request_observer.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/observers/note_observer.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/observers/system_hook_observer.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/observers/users_project_observer.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/contexts/test_hook_context.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/contexts/commit_load_context.rb Mon, 22 Oct 2012 16:08:19 +0300 +app/contexts/notes/create_context.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/contexts/notes/load_context.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/contexts/search_context.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/contexts/issues_bulk_update_context.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/contexts/base_context.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/contexts/merge_requests_load_context.rb Mon, 22 Oct 2012 16:08:19 +0300 +app/contexts/issues_list_context.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/mailers/notify.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/team.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/push_event.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/votes.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/roles/issue_commonality.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/git_host.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/roles/authority.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/push_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/roles/account.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/static_model.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/roles/repository.rb Wed, 24 Oct 2012 12:43:00 +0300 +app/workers/post_receive.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/workers/system_hook_worker.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/controllers/issues_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/labels_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/project_resource_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/dashboard_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/projects_controller.rb Tue, 23 Oct 2012 11:29:23 +0300 +app/controllers/repositories_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/milestones_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/hooks_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/blob_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/merge_requests_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/admin/logs_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/admin/dashboard_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/admin/projects_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/admin/hooks_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/admin/team_members_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/admin/groups_controller.rb Wed, 24 Oct 2012 12:43:00 +0300 +app/controllers/admin/users_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/admin/resque_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/blame_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/keys_controller.rb Wed, 26 Sep 2012 13:10:32 +0300 +app/controllers/admin_controller.rb Wed, 26 Sep 2012 13:10:32 +0300 +app/controllers/errors_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/help_controller.rb Wed, 06 Jun 2012 13:56:49 +0300 +app/controllers/profile_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/commits_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/team_members_controller.rb Wed, 24 Oct 2012 16:14:03 +0300 +app/controllers/omniauth_callbacks_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/controllers/protected_branches_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/snippets_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/groups_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/compare_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/wikis_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/search_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/deploy_keys_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/tree_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/commit_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/refs_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/controllers/application_controller.rb Wed, 24 Oct 2012 14:17:22 +0300 +app/controllers/notes_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/uploaders/attachment_uploader.rb Wed, 22 Aug 2012 14:52:27 +0300 +app/models/tree.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/project.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/issue.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/project_hook.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/group.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/key.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/snippet.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/user.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/note.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/wiki.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/users_project.rb Wed, 24 Oct 2012 16:14:03 +0300 +app/models/web_hook.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/ability.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/milestone.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/commit.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/protected_branch.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/merge_request.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/event.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/models/system_hook.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/decorators/commit_decorator.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/decorators/event_decorator.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/decorators/application_decorator.rb Fri, 21 Sep 2012 15:40:04 +0300 +app/decorators/tree_decorator.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/tags_helper.rb Wed, 06 Jun 2012 13:56:49 +0300 +app/helpers/application_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/gitlab_markdown_helper.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/helpers/notes_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/profile_helper.rb Fri, 21 Sep 2012 15:47:07 +0300 +app/helpers/tree_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/commits_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/projects_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/events_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/issues_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/tab_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +app/helpers/snippets_helper.rb Wed, 06 Jun 2012 13:56:49 +0300 +app/helpers/merge_requests_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 +lib/file_size_validator.rb Wed, 22 Aug 2012 14:52:27 +0300 +lib/api.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/gitlab/encode.rb Wed, 22 Aug 2012 14:52:27 +0300 +lib/gitlab/graph_commit.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/gitlab/theme.rb Tue, 26 Jun 2012 16:08:37 +0300 +lib/gitlab/app_logger.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/gitlab/inline_diff.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/merge.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/backend/gitolite.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/gitlab/backend/grack_auth.rb Mon, 22 Oct 2012 19:02:02 +0300 +lib/gitlab/backend/gitolite_config.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/git_logger.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/gitlab/markdown.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/file_editor.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/logger.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/satellite.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/gitlab/auth.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/extracts_path.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/api/issues.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/api/projects.rb Mon, 22 Oct 2012 16:08:18 +0300 +lib/api/helpers.rb Mon, 22 Oct 2012 16:08:18 +0300 +lib/api/entities.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/api/session.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/api/users.rb Mon, 22 Oct 2012 16:08:19 +0300 +lib/api/milestones.rb Fri, 21 Sep 2012 15:47:07 +0300 +lib/redcarpet/render/gitlab_html.rb Wed, 22 Aug 2012 14:52:27 +0300 diff --git a/doc/app/doc/README_FOR_APP.html b/doc/app/doc/README_FOR_APP.html new file mode 100644 index 00000000..9456512e --- /dev/null +++ b/doc/app/doc/README_FOR_APP.html @@ -0,0 +1,399 @@ + + + + + + +README_FOR_APP - Rails Application Documentation + + + + + + + + + + + + + + + + +
+ +

Use this README file to introduce your application and point to useful +places in the API for learning more. Run “rake doc:app” to generate API +documentation for your models, controllers, helpers, and libraries.

+ +
+ + + + + diff --git a/doc/app/images/add.png b/doc/app/images/add.png new file mode 100755 index 0000000000000000000000000000000000000000..6332fefea4be19eeadf211b0b202b272e8564898 GIT binary patch literal 733 zcmV<30wVp1P)9VHk(~TedF+gQSL8D5xnVSSWAVY>J9b+m>@{iq7_KE}go~11+5s4;8hc+i0Xa zI1j@EX5!S+Me6HNqKzU5YQwL;-W5$p%ZMKMeR<%zp69-~?<4?8|C8S?bklXr4v&Ov zb&06v2|-x?qB`90yn>Qi%Sh2^G4n)$ZdyvTPf9}1)_buUT7>`e2G&2VU@~Bb(o+Mz zi4)>IxlSY${Dj4k={-9RzU^W5g9|2V5RZ2ZulL9s2xQbZ@r6eP9Ra5u(s|C0Nj#&4>wTSkb?%#=9?@ z^oxDy-O@tyN{L@by(WWvQ3%CyEu8x{+#Jb4-h&K9Owi)2pgg+heWDyked|3R$$kL@A z#sp1v-r+=G4B8D6DqsDH0@7OztA7aT9qc1Py{()w`m``?Y0&gi2=ROcc-9+nU^I6< zT=e_Y=vSnG@?3Ue{BW5ONFttcE!R-R_W4O01|0-|K-YNXLo2`4Qv z`r1LxR6#yf3FB%T95gJnaKKivA~Z}S9A(ZxEDK}O3T04USJ P00000NkvXXu0mjf^IS-S literal 0 HcmV?d00001 diff --git a/doc/app/images/brick.png b/doc/app/images/brick.png new file mode 100644 index 0000000000000000000000000000000000000000..7851cf34c946e5667221e3478668503eb1cd733f GIT binary patch literal 452 zcmV;#0XzPQP)Pdwe5?6tW?r-ok|b$oDQj8FV%kZPq;(MWOV8?8;<)(iP}>hNMU> z7fbz%jjlr7h8uuoQ~J6}n}@Y@PdTk=)PxO{%7zmL?dchpZX*~n;I{!C>*(8cU;q(~ zAS%Po_@naEU!xidrBXD?;hN|x^%W|Ij)0y*r5vi|?W&Fub(NqJ@z0o=O&SR3v>A``^efOSo-hEdApp;^Jd;9y!%1UfzX6Bh- z%-mbG|0Na{7Ruai_Y+DEb1s+b!*9k%Q!whMxjtZKA*?o;i1g&jy0@( zaU=-@d-h+o%gal6JRXEXA&L3`d2 z%jIxzZ~*p9O-;EJp_Ds0If38rM<5W8ic~K>FOK&2_p!CLg^i63OioVb6k$)zWHLx3 z5;!|M!}<9+#QSi1dRlbEcxPt^;cysUuU8@%3}RwpLRIGG<|IKnoyP6$Eh3SKw7a*r zSDXP=IYc&YZf;7@?fCe($^l9ORaJ3wbAx0uiC8QqRr$2t-Cfy8%XCI3B%pxJW>XdM zw~zPt_s}#A@pxQ5Ly)4szaMtH9lgE1SXx@b+S(fW`ub$fYPE8J7#bSNDzme*Ub07{ zQKV8SjEs!%0@v5ql8ggm!@$6Rbi^E8vBqpRM-}l+@5OSMrl+TWj*gC^qoV@>u{fQb zov5v?g~?>X@bEC&+uLPaQ&Ypn-y~^mZA}+f(&2EFH8eE%dU|@ENpN*_1-)L6_4Rc* zFuq@`IjX9vp1QiaK9ZojyZhnQURP99d=u;%37VRkpwsD4U0sd3x;hEQB&e^i|3QN0 z=H|Os1fRqaw!?#igLmS4HE!G3*ce(`TF} zlgUq0Q544c8(ae&UR$8ps&snq6^bPY3v3xAmMW74Di$h~GCH6E3TaYs2#6A<7K*gC z777H71_Wa;(dfp+g-drPCSWu)#PInZi72LJ;o?i~$-U=y&UbQ89Dul3%3P+Axkzc* zbH-y;QF=hR{qLItf%ci2_&e5wNo0gnVatG?ul6Zw=o$I9Ljfn*ic3`U?>IfEim3g{ zujU&$-hy6wn;w(xme|zJm;lWJxtTFfM)q0`kX!Vu0+d${$}LCddK1<^htTe-fUYL3 zB`SdNsZD>RgvLj1<^@h6_+cDRK2Brcr2~>%$*5S)hyV33PV^teac3%|4lz@8p4?)5 z?t5o^?q+%^%)Yygo~I^U4VR!bTnWuE35hcWrfCDR3q+sxJ79e7Fg`&)RCqLA^2^y^ z0laVfadW90_Fz8Brm|r47sB^u1VgI>kanj)Z4`zMSfHlm8>CwXa$JVM`$2RrmZB-3 zN10m-!;BvH*Br3V8t`DH7m`jf#2upVDXl{5ff18_pzCPK1Zu$$CKKvd8FGeFf)+K<|x33pc7P&S#3GZT4mEw;nr(Ze*F z3&*?-4U-lm*#tber5 z%S_ceqB`b3ko6r~BbvDwdohTvP(3a(pq{x#T$yQsu#OKwEe}KuH^Mh@nxg_(Nw136 zq#a^3xNBke)In+!?qk3%4wB69{pF`Tzg`07*qoM6N<$ Eg55P&8UO$Q literal 0 HcmV?d00001 diff --git a/doc/app/images/bullet_black.png b/doc/app/images/bullet_black.png new file mode 100644 index 0000000000000000000000000000000000000000..57619706d10d9736b1849a83f2c5694fbe09c53b GIT binary patch literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$h^>lFz(Kw&{<9vg>5sw~gS5O!4 zr|{HuUFIBKiQyL}eBJ-L{`UVT|6_O~L{G%N{Wbre{kQtZ_0LvEhC#5QQ<|d}62BjvZR2H60wE-$h^mK6y(Kw&{<9vg>(S^W+6Zii9 z|Nhthr~iNb*Z!}6uiN$Dz5neG3a-`baBX8yz1H+_;eX)`ni0%X8XBDc-`=Ph(Uan2 zYsR{H!kvIN--9isvHznRsC#5QQ<|d}62BjvZR2H60wE-$h_H=O!(Kw&{<9vg>(S^W+6Zii9 z|Nhthr~iNb*Z!}6uiN$Dz5neG3a-`baBX8yz4q@v|B?28{s)#N@CGn3@%_y|zAV9T z66e<&B4?b6oF&azg|C(V&1ZbI_D}pL`}(^FT2yXwG1Ph~$Q@h8mJYOz!PC{xWt~$( F699+YQR)By literal 0 HcmV?d00001 diff --git a/doc/app/images/date.png b/doc/app/images/date.png new file mode 100644 index 0000000000000000000000000000000000000000..783c83357fdf90a1c7c024358e1d768b5c09c135 GIT binary patch literal 626 zcmV-&0*(ENP)5OC%H;f`~O(q$Q#t2<^v$A>fbmv%e#dKTwK=Ku{5lS|}<-`a#7b zzTCOnnT>at)D}AMFuOZ5&%EqFN(lyumd$2ASF6=;nM~%2?gqc@U=#|4PqkX@EBo-9 z7pD#bO_RUa>*faM`8;MYfVi$JnB-zcBFc6gjl$d!bF98Q!!!(Z1_R~P?e!pt#6CHJ9S&n_n&@=9 z%GP;!@Co4c*at+6vNz7o(6en^Q1%qHrc;1)9IRaz-$@S$Z-qdC^ds3X0NvQH;KS)D z-dh&rW&@X;1cS(45z)J&BVt+tv&GMVJ%!EiW) zLBGZW)#Z+gl-Lih&?>X3SS-S#ujQ;9JRXmIB7X)8`d6ETj)D#Q2+$s|<_b7-B9Xvq zwNfqlEp%y3$uY`h{Y$(Gn5@}sqEsq95lpAkFO5dyBmP6^H-51G4J|rN2Ujt<`2YX_ M07*qoM6N<$fC4}Mrzlg<+1Y8PEBfUp0jJpx4B>@E+cy3`^(Gw`Mf+2&yxZm<$to~Vpgvg&QKNR z_f#1(r6svZt%iF?s+n<8X?B&!h3g9Dbb8_=MX}!;HiQSAh`bp^WMl~Z-44teO7W_Y zV4thSL{h;rJY7!l3%5J4H1!tIzB`Dv+YxO(haWeausGZYkI8^hWj6mzo=L0{%;yxzh{5!Htr?51 zvG|W62MzC8BZ76hRpCyO2zOn<%e)K>NHge!-~)Ap33OdWw6hsLYbCxGNt0%wk_2z7 zfyYvXheSG)5HRK1VB~%mq7Dmurw#bi@hEcOr3&G1ZiF*$M=&9nB#VNf&Q^r$4G5kp zTURh&s)E0%5&hyVD}sp<72~zmAY`Y(9aqO6CXF%=zFHGzO-A&I(pE}v70YQxCPJ{Y z4L+?5-crdLn3ZRPEs!A4ehEY3ZRpL~w9>@aMN+{F4dI@v&>(QDHQum!mG~E^$OS8l z!7?%Uwib*ROP67Hw`ika)gX-(8Ia`-u_IEhxG7U<13kSsMW+$lbb2dUMm5p6pa}cjgA+U$^mJ^AjD?&bdi)8~y+Q002ovPDHLkV1g8IMc@Dc literal 0 HcmV?d00001 diff --git a/doc/app/images/find.png b/doc/app/images/find.png new file mode 100644 index 0000000000000000000000000000000000000000..1547479646722bda4647df52cf3e8bc9b77428c6 GIT binary patch literal 659 zcmV;E0&M+>P)IO9T&v~?D!=C@G6X*U1@h2}>2WE%HrrsjTfQsh6N9%SR25A5rkWp0g zzi;-6|3HJE;58sAyX1e@^d7EwiKQLb00%dp|5+t<{|l;G!D3eSuFDma zRCxr2MVY_`ELgLXqo}ssqp5E;*r|opZT~&|!~VN?1^mw`Yxp0VmiIp*r|Ey~#AW|W zTBd;IxVd?%*x1<_!3Ip2yP9Rn!u1aqt=siKx4a3At0%7dKV|u@|9wlg|7x7R;eT!K z{QuFp&Huxb3&AdAW?^~2z`(!^HUQ{cR*=op7H|BYU0VMi3A-|5H&#ol!zs_8lnTUg(&PtE($2Dhdk=&(F^R z|KGZGj(DV`tD_*NsU$2QNCCXqf9n(sfdh~LzJJdCa}5CGoUI+JZJBOCDz({abl~fE zw*5kfzVoR6cNi2r#C!ZEH0O;NW@rIh| zlqsqSSs9s#;sV;-@|>77A1W_O_DV`91Pq4Kz`Z(PaO&pn=GOMkuU$ROkc5GuVd!Y* zcn`UMYkYq7V07o@rsi~>-ziMLT zG+?a49zQWzia{TFcs{FKj#dh}e#z5@`O3omC>ELXboP2cR7WT?J@&ao#fn-I;sJ*F zD;=5p9?%y~V{F{q4^{|Zlt~d?*Ve!iWj&E%8@h^*gN$V29v5mAsN{O(ULD=kFMd^> zzLGLp)CZ#Qm6Q%3+`@kXtfre9GnE->Ai(oKKDoxtH@hRaB&C1e=IHR>I8;havNP_A z5Rq#nPVBdI5VpJ;S&et6>VVp>c?LwQ)tZWlq#H^i>)VP@16GREXU98`irCrvkEecY zkv~S7^T>M0*)Mb{LvE6`M77!t_ZXXI^`uU6W|L`YE-^~uca*s^)=F=9o*rxs>$qx+ zN_$rAd`ahYK2^cpF)HkQ1(Vq|Urh;b~<55D)DL$EUNo=p_A6VQ1A+M~) zfa$>U0O5Rbu4r3$+|O$+gUQaOR@{dPsf3U1Dln%z0(Y0xq^w4=AKW8UMLXPC9RL7* zZ3?i~&mg|kvE%&Q2{D=<{q^E0^^uNwISF-V^g!SN_6Pp zHm8=*qyzo0O&|aW=mQ}BV^c}pv_6$imk>cA#v4GgKI?F@S#sYw42|o9Jp1uLDt+Ls z2-H#~>q=LQWTF;nU7xJYKH2KCI4{O5B$T{{EgN}dE+rE|#F+n@O!gj|u;Xxe?Su03 z2tWqC_4M@)#<@OoQ{pg&@m`>d=YYXNQlKHoj2tjT2nB<`FCZcENCi2SLd5c#Iz{+w= zQMis*31e?RPgP7h#4AOzY&hE#R4n&Ii?x5Yq0)?J7KNcBj@XdX zlWZ;>n^k?`V`54w4oMu!H=JW%u_9}!!vS4^ZMC2#K+@g2!t)G5*y)(xiYlL_px35D zIhY0lK348EIpV!%r-=F;O(7xbv>oQP6>|(>Opp4COU-9M>Q6ub0PdDCFo(En#x&eN zGni{g@pt^Yi&Zk-WUSBg%!GQT&imw!)F&}=v0^+ zPAeQFDhtKVnUuxMHpDJZ^)IYcqn3l$E3tGu>6%O0JW{Qd&uUAT_CJz)Db-2{$Z4Cq zibD~-93PZJRMP~xt4_LEY#WADM=C$k2DOim8}|&T7PflIw)ySUdh%=c{&;)e+r`Hd z>F)2L5sYyl@Pwfv-Z+Q9(~d^Q%E@BrXlV!+zKk$1SUf5lN)jz7MS>v}FnGm>Qbf5( zWmQ8>Y4OMAhWe&Lk?b!b?Oi z7q@cwX@48D4*Plhd-GIrduvP}Ef)tlzfP@U!q&vPH#vyU*UZF+Z1UXs%zV%z6LOs+ zcaVxUJ2&!|`1z(BM}Lk=9HZd_-+C?1s|j(*3pM}K)5P_O^ZvgjpgCOOIH^P=rz zrnafS&0I?@i8t47Fuv>lf^b*BgG?Gr8}Rx=$^MeEIq58C~R;2W5b2+Z6DSOmY&y?jM>PP zmCH(!b;p5a z08~hSk!QD03@!sbLen@urU{Gbn>9K(ikm zl#3h~9C5N=ig9Rs_qtTd=#qk`!ZGs7NvnMZ+uzd@j(?Rvpko)yuH)l~lSKOGS)aBD z7_OmZBdg=SE=0lny&|8m4WGI#J|9BJ}fBGEjmh_+3QFV-yUQn(l{$5#`e$ znfciyaIqFV2bzbhDu?7{<$RLQFC=|ws^?CtX)4I8sO>-(eMb1ar-sUdK)fzgqvMk> zZ^Rh)#8kxW$|S;j1HHPvzPz`!bA(!5h*+9K{Bl4}FHo45&3%yp?rDAP3~x@+ME*8G z&}mIK2Y`4+qxB<9rNt@5hlZ)HG`HKZFPtZ(CdCW@wfOGs!rXe8 z-mBDPnj{HhE4Ayk=DMsy6c5sbcY=`3>S0gZ@AO)^Sd)t$p13pA3PJ#dmLDTD1s}Wz z02ItQF~53Ov+wZ2P`n_U4VAJGo_<)CMpqJ3n-|`KmS8^ z<6NCKAuP(yrPRXiqft#MxAk}%PIb2CItemH*OUB$_E1dAyieI6EigfeNusQvXT~9L zwllbU*O+j+W5Qti)3H?p?*D`9lDN^-b^Q#pv$U8g4>1bxARs=rK5^IfwL5Y4H4Pl{I}`^(PH1gYU{*wqe@3$h1OCneK4J4!&MRe zOI%s;fxPp5H9Bx6x{QqEsK*Hpw`q|yBo$$v_ZDvLxN=kn=g9|eG|t{-cBCa zWSp2ev%7lwBK@tsaE^R7fx&OwUGQ#^arcni@_`qa0+Ih<3e19Mf+3k%g+)@Z0>QL0 z!HU9+@@y$mUhU^$zNMt8xbj1@av;@3!U%#u{N{thykrE-duU`-05?CiI5){L zy%f8$xwgE)K0S*=93sE3FU*{+{yF$b=Jm0O!B_#^eoI(9dVeEu^GYSFGhk6VM2eP; zSzH6(dYAFYJ=IMG-RZ%6^E|!yINDStfqn3^nx(_a*MMt-QOJ6FngYP6Flzi8{}M1u z?#m8_6qlhH0|2mB*E(B$x{iH!qh!(v^CX*om>t8m-!J2T%OyrE@fg!+W!rCupnGfE zR%c(5_C1*?Q|=SfK?@c3?d{0gfIk6Qne%2NAR%5!D1e2lrEA=#=314|^y}mlbdU!h zPIxs%P{lm;bYgjBs1qyXxkN6UD66G>mRl#Xr4z~PvG$je@$TcPPQN{YiFfsV4Ahz{ z;nj44T{SOdcs1301%HU_N_w4#jyn9@;-ar3_x<_h`fhkmBj(Iby8UQuwZ@CP3EK}j zbXm^OyhBqkWQ~AeVy^iVB)4Wh)+=b5--vjbtrvx4823+e>fN%unKd+&T&~@;LSp8#I-|*I=U2LzE0($<|LW%XsA_XQ z3>6@ct56W8`Y2>d{!pjH=F?<22mf_ejVWx&mfsLml615hA!(-FDBnc-jDQv_NKXNy z(=8#eu15MT`JMYUW~~vr%z{`z9S|~|_VAY6Ov4M7#Wa(*O#3EWzRYv@&_zy|0i*@_46?BhYPPEpVGD|(a((4@b>fF)l-3jQvCcv z{o)yqMWo1gDTG1vWp=_AJoP5UPxA^qrdn6*;Qh%^sB8>DcX5d2bXh zu<5X$-n2+RVUy$k%$jmfMxgu4ZWTs$Oy{Q?tryu(5>W>)zs2)w zHL}wWPpTzwL2MM8=lkwHp3#jyMe3%J0Av0)*ixKl2lMvu@{j$n91n^pNe|jd``l0N z0RU<BSv#yWY}G&Kb9IUxK2(l z!4Sz=T3g)J1mqFu!`seMX@O}Bp}gyZ@I7GK*7vWYuax&DJ=8$){{tXS> z7+}lu)M-J126vy;?q&^}iM1!NCf1I@E@@H~O-PIlsM7kknVdsATr@pmBo(C~$G6gS z02;)2O@0&~`#fHDeC1eCZZs;s2N)@A;Z!v}6IRW@+w4GRSlrsuorBjfJ?y*o(0gj> zt+;DN~K1pX*UvM(B(Di$9F6+&eT z#bhNzlMA>q^N?j+@1IqnYvK};_)_77Ts{!elaGqJg{uwb(1mX6u=pkfLJYkfX+`v! zOm>eolNV>Nz$A&W8YqkN#cU|#i6j>Ox+Eu4*8Myq{Eq?u*kn+nT zQ@k8?r`Isov^UI2=T{#K~skC)fRP-aj zcrJyQmQ!u>p5&{_zp7xOM(Q%smb6M%g6o4s^>A8#L41?8Ox^e7CM$W~*3!e8F7P`S zK9!26tqJVBt`?fLxM^Gf`xAacdcbz&)u<6pKM?qA_ms76BOQWg0Le^W#?SMIT$jE7 zyw1!lG*$#k#iqZyl9~L_CjIwBb}$%9+e2Vw!1@$nfpvj1y2o4hJabo7^;(V}>++Tz z{|NtdydBeFpKnv*Vg9BTu3P)+)3J?9`*6t|c{b*k>-L!PvY`#5^i1^XCnxh zky})0T&rp6 zJFwUVv-;Dzt2_z1)}rtpHBQH#<-`N0%%UP1TF^VNx2@~Zh_4nbMMxj7zeHTrB&q)a Dl)1NK literal 0 HcmV?d00001 diff --git a/doc/app/images/macFFBgHack.png b/doc/app/images/macFFBgHack.png new file mode 100644 index 0000000000000000000000000000000000000000..c6473b324ee1dae1faaacc0826639833f551116c GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEX7WqAsj$Z!;#Vf4nJ za0`Jjl>Qs8<JF;+Fd5q0wCR k?u=~bH}2*0f`J3~k>FVdQ&MBb@0BAfpf&c&j literal 0 HcmV?d00001 diff --git a/doc/app/images/package.png b/doc/app/images/package.png new file mode 100644 index 0000000000000000000000000000000000000000..da3c2a2d74bab159ba0f65d7db601768258afcb2 GIT binary patch literal 853 zcmV-b1FHOqP)5TQ^(M5v$(QKVE?W+9X! z*o}&~6c?_FreF)9NJB7b5Nbn{G0n4+%uJhR9(V5R|NFTpb|HgjefT!tIhLx@DR+N) zV+fHiR5Yt19}k|KnCsND{tH-`IMJ)3AE?OtyZ4>Un|6(d%h#JK`i&a7^xW9>`yBy` zS4SOHeOpC7$?hH5-#7Rswiue_8Ju*2N@$58=a#2OTA3png`w3v->gWif7t%e$ z$NLVS!tFT#8WL|Wa&K~+{%4P2cRfwesYV1_!F=3OaRVHl(>=`%&{x*s30c}#CNE@&;ItrAv!f!)Oy$Q9t$uS=(sD$-J{T*^(8Eez1E-l3}} zPrfHZ1`qsIFe&gipuL8-IZbo2Yg{lFGKs?ZZWcOaOdk*3`5T;$?AjbG1#`B510Er^h2)2r3Y{!8_2Gj=$KzuN5 zaErtW8W_Y2iJJjY)5pmTVJoPJYpanPOEuYHclM^C1F>${hFRpdi8a<2H|Xudf78bm(zwJ9`K%6I?q*Ua~ fW9JvIbn5*B+_J)rUMBs>00000NkvXXu0mjfH&TkY literal 0 HcmV?d00001 diff --git a/doc/app/images/page_green.png b/doc/app/images/page_green.png new file mode 100644 index 0000000000000000000000000000000000000000..de8e003f9fb8752c09e7f3655d5d8664b5c62fc3 GIT binary patch literal 621 zcmV-z0+RiSP)QqUjAtB;_Vvt6}AS_5YgM`Uqu`yva+H8^=4U$e4gHb}u zAQ2N{V3A%pO|?Pv?tb6z=jC}SiRa$G^v3q?*6XcYz$p|cq{uLj@#~Fi`J(>5{@&&N zy%T^+;>8cXx%|o77anP?&W1?1A(>-T49z9pyeCl@7YI+Si zKti7=B~``}TImz(G{0PnlQA3P#MAd}sorMjkP!50B7$nAkU^%#nl{Q9lW0@}9fE-> zN(q7tRuiC_T1r|BBtVBTlQ2+70$Rf;eF`Z;lx46Cpu-rEgb)EBKq(b^W8l<^We(`D z43?0=01z<3G6+UUv6`CsWCk6^93!#+<;ws7007{zS3k2k9-zZKFO~(k`>s0y006+1 zgF_jyIhsL-`FMf~JL~C=cV75(CrJ|q;MVO961G=O zm9d)YpJg5g(4i_HKL75eSE}mq$Y}r}hyVdcV~p>6a}oXr80q`oj%+s700000NkvXX Hu0mjfPs|!l literal 0 HcmV?d00001 diff --git a/doc/app/images/page_white_text.png b/doc/app/images/page_white_text.png new file mode 100644 index 0000000000000000000000000000000000000000..813f712f726c935f9adf8d2f2dd0d7683791ef11 GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^zbpD<_bdI{u9mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-%6;pyTSA|c6o&@eC9QG)Hj&ExYL zO&oVL^)+cM^qd@ApywS>pwx0H@RDN}hq;7mU-SKczYQ-hnrr=;iDAQMZQ+*g=YOM= z!QlMQEn7FbaD->uKAYgo_j9)W&$$zS*W9}m(ey0q$&7l-XEWO0Y(9M=SnhLbwy;d>@~SY$Ku*0xPvIOQeV1x7u_z-2-X>_74(yfh7C znXL|3GZ+d2`3re2hs?MKC#5QQ<|d}62BjvZR2H60wE-$R?&;zfqH(@;q9b3Efq-lM(nr^( z=EYR73-9e)UYMWsXy%?aZsD68Yyv^2$~6QgEcljw%kx>O(f-gQ?@fOOx3A-0+Qw?O zRx~W)kn~Qe2d6f9nMG#g9Q04Mk==M~N!Dglvxk!fgVh#w@ZV$IY1+Xc`d{d2UcaP~ zfWp)_Ivqj}l2SPy^9ZWy6rG9Yx4v67_uA&&9|XA~5-#3)W3%em1peD8RWH^#O%XoM zxMPud%}GTj#~*+7JMxTd!`{^Q+>(D3*|@KV`*G2;{QnANOxu1$r2xIe;OXk;vd$@? F2>@zac~<}c literal 0 HcmV?d00001 diff --git a/doc/app/images/plugin.png b/doc/app/images/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..6187b15aec001b7080b51a5f944f07591f26cc15 GIT binary patch literal 591 zcmV-V0eEcNHZMNv|IbJ-M`( zKwWL~opzjJe^WpCmV9E;(0&ut2;4va_(#>M8)>9$R5viQnf(Nkh~VM$y>J(jqb$cj z+nL1Nm|mV)Gm|9MnHf*7Ja4OEAQz__^LRKOLEwqpiGV^^A*T=#&inGm-62Xs;dnSp zKj&H9T*boh2i)W+(n27l!C)>fq|L%VB1i ziC4p;NwV_}ZjW7$LRW#(_bKF#hp=!IqNO26Z*w2+LEwx{PVnZ&Sn}T;mtzb$;qA*nT@@+ zV5uQ@iXDTPoTbV#FRr~z04|PPh`wXTNoCm9*tG&?e3+fYl>K6+&3|Cc$KOpL`ER+_ dcRl5U#9zn6ZO}GFk7R5;7c zlif>`Q5?tj7Yw@ZCMtTF^Q|ZedeJhM%QPCR*bs8V79p$QTo7e94yQNXRs-{0?hOn_-8n0AMO@u1Ts zNl8QzJs1#rz%RBt?ux>l+amAvh+J!{$lkaqv}+Erb-6j2xp>K4GLQnNB*W`hFg*?P z^AL@~(h~Z+wfcWEXHqV^Tq-#z$7Y#o0;yFxA!00F}F2dX# zjE$iOgT#G4*1TR6kB1Gnn@>$meCh2a>c5YuIvFn-R2W@>4@M*m@-|jiDV?b)bccgA zyPfsMM!rjy>+1O2)5Eg29Z_*2p&qGnmS!OH?vZ(4>QB01d>j%9n4QINxkyT(Dos?I zjaWF$*IQmh`SF-?xU%xMEfjq1=6qY*g&lgG_cXv$BGoIWyfO5 zp>pdV*O+y=&6@N2WWFo(%RtT`Q(H^6zn^a%epE~Kx^mEJ{c8`luC$nc*z9j|4Ms8aJK-ladKLpnAK z!yd|CC&>l1b7`m$MH$ScEIP@XgT41O>|DzL{-38CH68OyX#u=G?d7;y&_o&o)f@3U z2(tr%Ok88caOL`xiQA8o;Vzr-$A$SOu6o|$&0DQAJ1Z7?OACaeoy+)PWu&~aueW<| z*KW^(^2}#30u*~<_mXScFNd6U&sxh5*GGMNytZGxkIGqL%v6329^u`FD6T?b?K!4B z@Hzh?O2Au=((Gu;rvgLMt^pS|u1rEkBgC8$oH%zgT`TvZiK#VDrVG?-i~6a_+WZb> zc1>>lb)xcuo^Cl8k%q3c_d*It_Vtj>RSovF&w;hS=6uYrT2e@-@l@P~uBN`zu!v>e zTm(is&jcQ6vuP?|;!e+(n8w)-Xjd!hwk@r2D0i00ygdKo2Xvs?&w_lajj5DHS@9I! z;_&ji2e{!uusGnVn};Pu|dl5x-FhQyC8^-4Uo_;BLiOXzcE z&4PS2TBWSC=hsw0og;z#(mly@Ed2E1E$_VDaM?kloE4ob2XK&K;OS~-nhIGlA4~UZrJu6*|}wi#TT?|yWUH+_&n($t0xta zBwTzSfE)uAw*L0>+`pTps}L-$jIP5Q_E$Am+l|{XfsKr0Vi~`Em?SJQ#0y)8vsxb1 zMdxJl^){_CDwI^}>)Pw${G?Ajc@P}x{Fvhoi0jbY^427?KPmoA_G)sqK}u$2(79Xg zC%}xm5JDcrsm5^vQEQpGEdJDc^yfuNAlqV1pZQVkOSceV<|{=|=@?=o4i_1RFUZth zC7cu<6%V3dVCI}P6DL4iUgTc@&(nXY)ox}HZ z(a#EgiNj%{kjRLL2t?{m_aKN`{5-&u+HAtQ-Qq#@!I@<(M+B3i@|g=LY6 z90tpW!JuMn_Lcy1q7g&LUSuLE3XS}K#P^nHVUmL`L)dbP| z0bt(+Cp#M-bH!LM*DzJ0Lfn;eTBV@|JvGSgpdoc1RhhV>(G-2(vE|>MrVgA9+?+0m4OzUqbT>-U-jg|v zLZMntq`r?fy1UCMh>z2Koi1SL-~N2ZrIf+dZW|;SWszsde}Dl!HOMc1Fa>K9)e&RI z)A?aK zcviCdKDUg_%#u7YAE`A`Y3$(P4&m^@fEWAvjAwVmRWeUnmkrxA;E!fKoc{9Vi=lvFL}KmoS;g* zdjL?Y!VHUFq63aLj6VZE+tHts?Z1pFkiO9^k*5pGpFpU&5#5G4ATd{t>a&9zKBVB9=Ns^HFU|DTGH8C+Xr2UqOU`Zxe)!|%j4=-QojGePq)pRGe;!f)Czk!u3vP_Jxu8(e6 zf4Q`F$Qio2Jw@N*E@k?c`+Sw}AYQjkT+x)OAe6eq(AT!iRuksKQn%Ao_Ac1T-p#Js I_CnHs0qX}mlmGw# literal 0 HcmV?d00001 diff --git a/doc/app/images/tag_green.png b/doc/app/images/tag_green.png new file mode 100644 index 0000000000000000000000000000000000000000..83ec984bd73364134da0f98d27a800c5d3264180 GIT binary patch literal 613 zcmV-r0-F7aP)^5T)AZ%#@G{_P{NCN^P z(J0zvSn~SSm(Ur);-M~8^*;61*VRI`T1BN&LAhK;sZ>I-SVW;vfUfJv=ko^ugnc0x zhJodBxe>iyk3%w<%wC8holUJ4(iv>tL{`DQt zPOsyUbO_Cmc&*iHkqbm3ku`|GcC^OhF>jj9W*GkH;^g!iUVpib_h*=@udp4h(P+e*zL_~ZmJjh(y^BxULwq>9zXoYE8sq{#pN~U0C6!8vY)5N2 z9P*}mw}7X$O^qTtJef1ACWvJT9^wt-)Zh0r~j#0bT`f;-zv6 z^Tmw22!%rMcs!TaUX<-8s;X-B`+Xbo+_uWuFa z1yIPc?DTrQ7KvRhmt*TG|L=EYQ=LqFX;=Lp`4}jx6BE-@00000NkvXXu0mjf=s_29 literal 0 HcmV?d00001 diff --git a/doc/app/images/transparent.png b/doc/app/images/transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..d665e179efd797451084235f105425247fea0a14 GIT binary patch literal 97 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;bAV5X>;M1%mmiTn0pv241o;Is pI6S+N2ITN~x;Tb#$R;N!@B(=T42&&nK2`x)44$rjF6*2UngG277DE64 literal 0 HcmV?d00001 diff --git a/doc/app/images/wrench.png b/doc/app/images/wrench.png new file mode 100644 index 0000000000000000000000000000000000000000..5c8213fef5ab969f03189d4367e32e597e38bd7f GIT binary patch literal 610 zcmV-o0-gPdP)^jb z4`0v}DG1te)wmeb(>p90leRz?_mO+^JKy=v&2<29Od6?F%9%(c8los#f*@G`-%W&* z$)uBj2i@u-@SgX}gtyWPe6d*|w6h%R? zScK2#Yn%$sum0cy>90DmY*i{1XqpClEtktsRTZ)lCUe z<FogV^*tm>8*AlX za4oiR!&85LrobG57qUHUX#{>Vz(RHpB5|@>9O6N$jqB8>%($0wxE5R3)b>Y~xtCo$ zCgEk&A?_#IxHdN)9tqre^o{ho4{?hmPuf@^@I3-wncaRd%|~O3xbrKY=&TiwPYkJroM{;WUQTuMY8vpg}f4o)2%U3C;eEDoiEh?94d(rV57VIF#8VqzW$HrDC|#U`x@QDbgi zVl)t9GGz&YY#D?gc%>hISA+_EBpnXt#pnC`p6@xw0$8TCbULjhlgVx(kuc)%xbgqq zR5+DNDFRN0!y)7Gm}oT0i39}h4h928qY?Rho^UvPGJ#kuW|-Amtrn`Pmd&+bFo@sp z$LI4IQw7BG?|#2ewOS<<3VjL$0=lMY^m;wqZujv5kx1l%Sl;V&Iy4#$ip3&@LV2!7vhhN=PCz%^9v24`qb(+m4W?!q-&~=?ssf5GfnAmJKV;3bvpDm0(NhahZ=&^sqo6Odj6>)Dq_3p~4~ zvb`d3Mydwjt&Df^hVmLtI2x=U&h9(JVYX-!y~z3zi;1>=LY;o(bL$(Yf$lf)dMf0-u^0HrpTG Wk@)HE*94aU0000m+BBgry{~j2fHLegbHP( zrgXNbr0}2;^nywdjLjZe?uxtrd3D(pZH@fFFc0{BW_~jxoO1w7-VX;6vK@ROA$$R6 zEmo;Ht-Mj|>5jUy{bQ^V5@53LRI8AgLpUm|m+15sqcz@QtVSo|oz7ArM8?pIn+>gN z0b=4_b5O|4A*;Q+vc9Vqr~%3V155*NV~@gTz}KSUiKB-uJzjMZ>5%Q#n24H!V{ zTY(LLAE*NAHZ}C#wnj%Bw5OFIkRhkkAW#kDC3j9Wm0YXRaXlyyp>#mVfYG)eC;@ab zDb=T-BCAY4LI(Z@GOTr2V_A{pRwSmz+8Be>CjAw(=gnbVWAeguvZa93JmL(EDxv1m z0OP4q=fpAK1Mq!C2`OkEn37o;m#wF#(t(8Pu#S?2f#x<~4EO{@fmm`p9veD6RZ_jp z@Au4};q&`XuKEYgIiB4((kgxOs#YdqJw0fY>9^K_agEu5+$#k;w#%I2N>n_?)YIqu z`tq&#_^p?-%K*U0^}|7+9U(&k0?s;=r=uCZ%)H9_edH8wK}gB(nUB1FFk+2Ol%BXV zHoFY`D~2x|2 + + + + + +Rails Application Documentation + + + + + + + + + + + + + + + + +

This is the API documentation for Rails Application Documentation. + + +

+ diff --git a/doc/app/js/darkfish.js b/doc/app/js/darkfish.js new file mode 100644 index 00000000..4be722fa --- /dev/null +++ b/doc/app/js/darkfish.js @@ -0,0 +1,153 @@ +/** + * + * Darkfish Page Functions + * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* Provide console simulation for firebug-less environments */ +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +}; + + +/** + * Unwrap the first element that matches the given @expr@ from the targets and return them. + */ +$.fn.unwrap = function( expr ) { + return this.each( function() { + $(this).parents( expr ).eq( 0 ).after( this ).remove(); + }); +}; + + +function showSource( e ) { + var target = e.target; + var codeSections = $(target). + parents('.method-detail'). + find('.method-source-code'); + + $(target). + parents('.method-detail'). + find('.method-source-code'). + slideToggle(); +}; + +function hookSourceViews() { + $('.method-heading').click( showSource ); +}; + +function toggleDebuggingSection() { + $('.debugging-section').slideToggle(); +}; + +function hookDebuggingToggle() { + $('#debugging-toggle img').click( toggleDebuggingSection ); +}; + +function hookTableOfContentsToggle() { + $('.indexpage li .toc-toggle').each( function() { + $(this).click( function() { + $(this).toggleClass('open'); + }); + + var section = $(this).next(); + + $(this).click( function() { + section.slideToggle(); + }); + }); +} + +function hookSearch() { + var input = $('#search-field').eq(0); + var result = $('#search-results').eq(0); + $(result).show(); + + var search_section = $('#search-section').get(0); + $(search_section).show(); + + var search = new Search(search_data, input, result); + + search.renderItem = function(result) { + var li = document.createElement('li'); + var html = ''; + + // TODO add relative path to + + + + + + + + + + +

Table of Contents - Rails Application Documentation

+ +

Pages

+ + +

Classes/Modules

+ + +

Methods

+ + + + +