summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hound.yml4
-rw-r--r--.pkgr.yml6
-rw-r--r--.teatro.yml8
-rw-r--r--.travis.yml36
-rw-r--r--CHANGELOG75
-rw-r--r--CONTRIBUTING.md22
-rw-r--r--GITLAB_SHELL_VERSION2
-rw-r--r--Gemfile28
-rw-r--r--Gemfile.lock81
-rw-r--r--Guardfile4
-rw-r--r--PROCESS.md4
-rw-r--r--Procfile2
-rw-r--r--README.md18
-rw-r--r--VERSION2
-rw-r--r--app/assets/images/brand_logo.pngbin0 -> 32119 bytes
-rw-r--r--app/assets/javascripts/application.js.coffee72
-rw-r--r--app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee14
-rw-r--r--app/assets/javascripts/branch-graph.js.coffee37
-rw-r--r--app/assets/javascripts/diff.js.coffee47
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee50
-rw-r--r--app/assets/javascripts/extensions/array.js2
-rw-r--r--app/assets/javascripts/groups.js.coffee2
-rw-r--r--app/assets/javascripts/issues.js.coffee40
-rw-r--r--app/assets/javascripts/labels.js.coffee35
-rw-r--r--app/assets/javascripts/markdown_area.js.coffee121
-rw-r--r--app/assets/javascripts/network.js.coffee6
-rw-r--r--app/assets/javascripts/notes.js.coffee76
-rw-r--r--app/assets/javascripts/pager.js.coffee22
-rw-r--r--app/assets/javascripts/profile.js.coffee2
-rw-r--r--app/assets/javascripts/project.js.coffee5
-rw-r--r--app/assets/javascripts/shortcuts.js.coffee25
-rw-r--r--app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee14
-rw-r--r--app/assets/javascripts/shortcuts_issueable.coffee19
-rw-r--r--app/assets/javascripts/shortcuts_navigation.coffee20
-rw-r--r--app/assets/javascripts/shortcuts_network.js.coffee12
-rw-r--r--app/assets/stylesheets/application.scss2
-rw-r--r--app/assets/stylesheets/behaviors.scss6
-rw-r--r--app/assets/stylesheets/generic/buttons.scss11
-rw-r--r--app/assets/stylesheets/generic/common.scss29
-rw-r--r--app/assets/stylesheets/generic/issue_box.scss4
-rw-r--r--app/assets/stylesheets/generic/lists.scss2
-rw-r--r--app/assets/stylesheets/generic/timeline.scss77
-rw-r--r--app/assets/stylesheets/generic/typography.scss2
-rw-r--r--app/assets/stylesheets/main/layout.scss1
-rw-r--r--app/assets/stylesheets/main/variables.scss6
-rw-r--r--app/assets/stylesheets/sections/commits.scss17
-rw-r--r--app/assets/stylesheets/sections/dashboard.scss14
-rw-r--r--app/assets/stylesheets/sections/diff.scss18
-rw-r--r--app/assets/stylesheets/sections/errors.scss14
-rw-r--r--app/assets/stylesheets/sections/events.scss3
-rw-r--r--app/assets/stylesheets/sections/explore.scss8
-rw-r--r--app/assets/stylesheets/sections/groups.scss4
-rw-r--r--app/assets/stylesheets/sections/header.scss13
-rw-r--r--app/assets/stylesheets/sections/help.scss53
-rw-r--r--app/assets/stylesheets/sections/issues.scss26
-rw-r--r--app/assets/stylesheets/sections/labels.scss21
-rw-r--r--app/assets/stylesheets/sections/login.scss43
-rw-r--r--app/assets/stylesheets/sections/merge_requests.scss10
-rw-r--r--app/assets/stylesheets/sections/nav.scss25
-rw-r--r--app/assets/stylesheets/sections/notes.scss69
-rw-r--r--app/assets/stylesheets/sections/projects.scss107
-rw-r--r--app/assets/stylesheets/sections/search.scss7
-rw-r--r--app/assets/stylesheets/sections/tree.scss1
-rw-r--r--app/controllers/admin/broadcast_messages_controller.rb9
-rw-r--r--app/controllers/admin/groups_controller.rb8
-rw-r--r--app/controllers/admin/hooks_controller.rb6
-rw-r--r--app/controllers/admin/users_controller.rb35
-rw-r--r--app/controllers/application_controller.rb38
-rw-r--r--app/controllers/dashboard_controller.rb4
-rw-r--r--app/controllers/explore/groups_controller.rb14
-rw-r--r--app/controllers/explore/projects_controller.rb25
-rw-r--r--app/controllers/groups/milestones_controller.rb56
-rw-r--r--app/controllers/groups_controller.rb8
-rw-r--r--app/controllers/omniauth_callbacks_controller.rb32
-rw-r--r--app/controllers/profiles/emails_controller.rb8
-rw-r--r--app/controllers/profiles/keys_controller.rb7
-rw-r--r--app/controllers/profiles/passwords_controller.rb17
-rw-r--r--app/controllers/profiles_controller.rb14
-rw-r--r--app/controllers/projects/blob_controller.rb25
-rw-r--r--app/controllers/projects/branches_controller.rb14
-rw-r--r--app/controllers/projects/commit_controller.rb14
-rw-r--r--app/controllers/projects/commits_controller.rb2
-rw-r--r--app/controllers/projects/compare_controller.rb23
-rw-r--r--app/controllers/projects/deploy_keys_controller.rb6
-rw-r--r--app/controllers/projects/edit_tree_controller.rb2
-rw-r--r--app/controllers/projects/hooks_controller.rb18
-rw-r--r--app/controllers/projects/issues_controller.rb19
-rw-r--r--app/controllers/projects/labels_controller.rb51
-rw-r--r--app/controllers/projects/merge_requests_controller.rb75
-rw-r--r--app/controllers/projects/milestones_controller.rb8
-rw-r--r--app/controllers/projects/notes_controller.rb35
-rw-r--r--app/controllers/projects/protected_branches_controller.rb8
-rw-r--r--app/controllers/projects/raw_controller.rb6
-rw-r--r--app/controllers/projects/refs_controller.rb2
-rw-r--r--app/controllers/projects/repositories_controller.rb7
-rw-r--r--app/controllers/projects/services_controller.rb9
-rw-r--r--app/controllers/projects/snippets_controller.rb10
-rw-r--r--app/controllers/projects/tags_controller.rb14
-rw-r--r--app/controllers/projects/team_members_controller.rb6
-rw-r--r--app/controllers/projects/tree_controller.rb9
-rw-r--r--app/controllers/projects/wikis_controller.rb4
-rw-r--r--app/controllers/projects_controller.rb51
-rw-r--r--app/controllers/public/projects_controller.rb14
-rw-r--r--app/controllers/registrations_controller.rb13
-rw-r--r--app/controllers/search_controller.rb23
-rw-r--r--app/controllers/sessions_controller.rb27
-rw-r--r--app/controllers/snippets_controller.rb10
-rw-r--r--app/controllers/users_groups_controller.rb6
-rw-r--r--app/controllers/users_sessions_controller.rb6
-rw-r--r--app/finders/issuable_finder.rb (renamed from app/finders/base_finder.rb)14
-rw-r--r--app/finders/issues_finder.rb2
-rw-r--r--app/finders/merge_requests_finder.rb2
-rw-r--r--app/finders/notes_finder.rb2
-rw-r--r--app/finders/trending_projects_finder.rb19
-rw-r--r--app/helpers/appearances_helper.rb17
-rw-r--r--app/helpers/application_helper.rb13
-rw-r--r--app/helpers/commits_helper.rb24
-rw-r--r--app/helpers/dashboard_helper.rb38
-rw-r--r--app/helpers/diff_helper.rb22
-rw-r--r--app/helpers/events_helper.rb27
-rw-r--r--app/helpers/gitlab_markdown_helper.rb29
-rw-r--r--app/helpers/groups_helper.rb11
-rw-r--r--app/helpers/labels_helper.rb45
-rw-r--r--app/helpers/notes_helper.rb25
-rw-r--r--app/helpers/projects_helper.rb46
-rw-r--r--app/helpers/search_helper.rb17
-rw-r--r--app/helpers/tree_helper.rb28
-rw-r--r--app/mailers/emails/issues.rb32
-rw-r--r--app/mailers/emails/merge_requests.rb43
-rw-r--r--app/mailers/emails/notes.rb23
-rw-r--r--app/mailers/emails/profile.rb3
-rw-r--r--app/mailers/notify.rb46
-rw-r--r--app/models/ability.rb51
-rw-r--r--app/models/broadcast_message.rb2
-rw-r--r--app/models/commit.rb27
-rw-r--r--app/models/concerns/issuable.rb22
-rw-r--r--app/models/concerns/mentionable.rb12
-rw-r--r--app/models/concerns/token_authenticatable.rb31
-rw-r--r--app/models/deploy_keys_project.rb3
-rw-r--r--app/models/email.rb8
-rw-r--r--app/models/event.rb14
-rw-r--r--app/models/forked_project_link.rb4
-rw-r--r--app/models/group.rb18
-rw-r--r--app/models/group_milestone.rb95
-rw-r--r--app/models/issue.rb11
-rw-r--r--app/models/key.rb12
-rw-r--r--app/models/label.rb38
-rw-r--r--app/models/label_link.rb19
-rw-r--r--app/models/merge_request.rb21
-rw-r--r--app/models/merge_request_diff.rb25
-rw-r--r--app/models/milestone.rb2
-rw-r--r--app/models/namespace.rb6
-rw-r--r--app/models/network/graph.rb6
-rw-r--r--app/models/note.rb69
-rw-r--r--app/models/project.rb90
-rw-r--r--app/models/project_hook.rb2
-rw-r--r--app/models/project_services/assembla_service.rb2
-rw-r--r--app/models/project_services/campfire_service.rb2
-rw-r--r--app/models/project_services/ci_service.rb19
-rw-r--r--app/models/project_services/emails_on_push_service.rb2
-rw-r--r--app/models/project_services/gitlab_ci_service.rb2
-rw-r--r--app/models/project_services/hipchat_service.rb19
-rw-r--r--app/models/project_services/slack_service.rb3
-rw-r--r--app/models/project_wiki.rb14
-rw-r--r--app/models/protected_branch.rb2
-rw-r--r--app/models/repository.rb61
-rw-r--r--app/models/service.rb2
-rw-r--r--app/models/snippet.rb2
-rw-r--r--app/models/tree.rb20
-rw-r--r--app/models/user.rb77
-rw-r--r--app/models/users_group.rb2
-rw-r--r--app/models/users_project.rb4
-rw-r--r--app/models/users_star_project.rb19
-rw-r--r--app/models/web_hook.rb2
-rw-r--r--app/services/archive_repository_service.rb14
-rw-r--r--app/services/compare_service.rb27
-rw-r--r--app/services/create_branch_service.rb27
-rw-r--r--app/services/create_tag_service.rb35
-rw-r--r--app/services/delete_branch_service.rb11
-rw-r--r--app/services/files/create_service.rb5
-rw-r--r--app/services/files/update_service.rb2
-rw-r--r--app/services/issues/base_service.rb7
-rw-r--r--app/services/issues/close_service.rb2
-rw-r--r--app/services/issues/create_service.rb6
-rw-r--r--app/services/issues/reopen_service.rb3
-rw-r--r--app/services/issues/update_service.rb6
-rw-r--r--app/services/merge_requests/auto_merge_service.rb6
-rw-r--r--app/services/merge_requests/build_service.rb68
-rw-r--r--app/services/merge_requests/create_service.rb4
-rw-r--r--app/services/merge_requests/reopen_service.rb1
-rw-r--r--app/services/merge_requests/update_service.rb8
-rw-r--r--app/services/milestones/group_service.rb26
-rw-r--r--app/services/milestones/update_service.rb4
-rw-r--r--app/services/notification_service.rb37
-rw-r--r--app/services/projects/create_service.rb28
-rw-r--r--app/services/projects/fork_service.rb7
-rw-r--r--app/services/projects/participants_service.rb43
-rw-r--r--app/services/projects/transfer_service.rb2
-rw-r--r--app/services/projects/update_service.rb15
-rw-r--r--app/services/search/global_service.rb19
-rw-r--r--app/services/search/project_service.rb28
-rw-r--r--app/services/system_hooks_service.rb10
-rw-r--r--app/services/test_hook_service.rb3
-rw-r--r--app/views/admin/dashboard/index.html.haml2
-rw-r--r--app/views/admin/users/_form.html.haml4
-rw-r--r--app/views/admin/users/show.html.haml8
-rw-r--r--app/views/dashboard/_groups.html.haml7
-rw-r--r--app/views/dashboard/_projects.html.haml7
-rw-r--r--app/views/dashboard/_projects_filter.html.haml12
-rw-r--r--app/views/dashboard/_zero_authorized_projects.html.haml2
-rw-r--r--app/views/dashboard/issues.html.haml1
-rw-r--r--app/views/dashboard/merge_requests.html.haml1
-rw-r--r--app/views/dashboard/projects.html.haml4
-rwxr-xr-xapp/views/devise/confirmations/new.html.haml26
-rw-r--r--app/views/devise/mailer/confirmation_instructions.html.erb2
-rw-r--r--app/views/devise/mailer/reset_password_instructions.html.erb2
-rw-r--r--app/views/devise/mailer/unlock_instructions.html.erb2
-rw-r--r--app/views/devise/passwords/edit.html.haml33
-rwxr-xr-xapp/views/devise/passwords/new.html.haml27
-rw-r--r--app/views/devise/registrations/new.html.haml51
-rw-r--r--app/views/devise/sessions/_new_base.html.haml8
-rw-r--r--app/views/devise/sessions/_new_ldap.html.haml2
-rw-r--r--app/views/devise/sessions/_oauth_providers.html.haml3
-rw-r--r--app/views/devise/sessions/new.html.haml75
-rw-r--r--app/views/devise/shared/_sign_in_link.html.haml5
-rw-r--r--app/views/errors/access_denied.html.haml4
-rw-r--r--app/views/errors/encoding.html.haml4
-rw-r--r--app/views/errors/git_not_found.html.haml4
-rw-r--r--app/views/errors/not_found.html.haml4
-rw-r--r--app/views/errors/omniauth_error.html.haml12
-rw-r--r--app/views/events/_event_issue.atom.haml4
-rw-r--r--app/views/events/_event_merge_request.atom.haml2
-rw-r--r--app/views/events/_event_note.atom.haml2
-rw-r--r--app/views/events/_event_push.atom.haml2
-rw-r--r--app/views/explore/groups/index.html.haml51
-rw-r--r--app/views/explore/projects/_project.html.haml25
-rw-r--r--app/views/explore/projects/index.html.haml38
-rw-r--r--app/views/explore/projects/starred.html.haml10
-rw-r--r--app/views/explore/projects/trending.html.haml11
-rw-r--r--app/views/groups/_filter.html.haml23
-rw-r--r--app/views/groups/issues.html.haml1
-rw-r--r--app/views/groups/merge_requests.html.haml1
-rw-r--r--app/views/groups/milestones/_issue.html.haml10
-rw-r--r--app/views/groups/milestones/_issues.html.haml6
-rw-r--r--app/views/groups/milestones/_merge_request.html.haml10
-rw-r--r--app/views/groups/milestones/_merge_requests.html.haml6
-rw-r--r--app/views/groups/milestones/index.html.haml50
-rw-r--r--app/views/groups/milestones/show.html.haml88
-rw-r--r--app/views/groups/new.html.haml8
-rw-r--r--app/views/help/_shortcuts.html.haml229
-rw-r--r--app/views/help/index.html.haml28
-rw-r--r--app/views/layouts/_head.html.haml1
-rw-r--r--app/views/layouts/_head_panel.html.haml2
-rw-r--r--app/views/layouts/_public_head_panel.html.haml6
-rw-r--r--app/views/layouts/_search.html.haml7
-rw-r--r--app/views/layouts/admin.html.haml2
-rw-r--r--app/views/layouts/devise.html.haml35
-rw-r--r--app/views/layouts/errors.html.haml7
-rw-r--r--app/views/layouts/explore.html.haml30
-rw-r--r--app/views/layouts/nav/_admin.html.haml6
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml10
-rw-r--r--app/views/layouts/nav/_group.html.haml5
-rw-r--r--app/views/layouts/nav/_profile.html.haml2
-rw-r--r--app/views/layouts/nav/_project.html.haml23
-rw-r--r--app/views/layouts/notify.html.haml4
-rw-r--r--app/views/layouts/projects.html.haml2
-rw-r--r--app/views/layouts/public.html.haml11
-rw-r--r--app/views/notify/_reassigned_issuable_email.html.haml10
-rw-r--r--app/views/notify/_reassigned_issuable_email.text.erb6
-rw-r--r--app/views/notify/merge_request_status_email.html.haml2
-rw-r--r--app/views/notify/merge_request_status_email.text.haml8
-rw-r--r--app/views/notify/new_user_email.html.haml9
-rw-r--r--app/views/notify/new_user_email.text.erb7
-rw-r--r--app/views/notify/project_was_moved_email.html.haml8
-rw-r--r--app/views/notify/project_was_moved_email.text.erb4
-rw-r--r--app/views/notify/reassigned_issue_email.html.haml9
-rw-r--r--app/views/notify/reassigned_issue_email.text.erb6
-rw-r--r--app/views/notify/reassigned_merge_request_email.html.haml8
-rw-r--r--app/views/notify/reassigned_merge_request_email.text.erb8
-rw-r--r--app/views/notify/repository_push_email.html.haml8
-rw-r--r--app/views/notify/repository_push_email.text.haml6
-rw-r--r--app/views/profiles/keys/new.html.haml4
-rw-r--r--app/views/profiles/passwords/new.html.haml3
-rw-r--r--app/views/profiles/show.html.haml10
-rw-r--r--app/views/projects/_home_panel.html.haml71
-rw-r--r--app/views/projects/_issuable_form.html.haml39
-rw-r--r--app/views/projects/blame/show.html.haml11
-rw-r--r--app/views/projects/blob/_actions.html.haml3
-rw-r--r--app/views/projects/blob/_download.html.haml2
-rw-r--r--app/views/projects/blob/diff.html.haml19
-rw-r--r--app/views/projects/branches/_branch.html.haml2
-rw-r--r--app/views/projects/branches/destroy.js.haml4
-rw-r--r--app/views/projects/branches/new.html.haml8
-rw-r--r--app/views/projects/commit/_commit_box.html.haml2
-rw-r--r--app/views/projects/commit/huge_commit.html.haml3
-rw-r--r--app/views/projects/commit/show.html.haml2
-rw-r--r--app/views/projects/commits/_commit.html.haml18
-rw-r--r--app/views/projects/commits/_diff_file.html.haml48
-rw-r--r--app/views/projects/commits/_diff_head.html.haml26
-rw-r--r--app/views/projects/commits/_diff_stats.html.haml41
-rw-r--r--app/views/projects/commits/_diff_warning.html.haml19
-rw-r--r--app/views/projects/commits/_diffs.html.haml111
-rw-r--r--app/views/projects/commits/_text_file.html.haml16
-rw-r--r--app/views/projects/commits/diffs/_match_line.html.haml7
-rw-r--r--app/views/projects/compare/show.html.haml19
-rw-r--r--app/views/projects/edit.html.haml12
-rw-r--r--app/views/projects/edit_tree/preview.html.haml2
-rw-r--r--app/views/projects/edit_tree/show.html.haml6
-rw-r--r--app/views/projects/empty.html.haml2
-rw-r--r--app/views/projects/graphs/show.html.haml2
-rw-r--r--app/views/projects/import.html.haml8
-rw-r--r--app/views/projects/issues/_form.html.haml84
-rw-r--r--app/views/projects/issues/_head.html.haml4
-rw-r--r--app/views/projects/issues/_issue.html.haml10
-rw-r--r--app/views/projects/issues/_issue_context.html.haml4
-rw-r--r--app/views/projects/issues/index.html.haml2
-rw-r--r--app/views/projects/issues/show.html.haml9
-rw-r--r--app/views/projects/labels/_form.html.haml33
-rw-r--r--app/views/projects/labels/_label.html.haml21
-rw-r--r--app/views/projects/labels/destroy.js.haml2
-rw-r--r--app/views/projects/labels/edit.html.haml8
-rw-r--r--app/views/projects/labels/index.html.haml21
-rw-r--r--app/views/projects/labels/new.html.haml6
-rw-r--r--app/views/projects/merge_requests/_form.html.haml71
-rw-r--r--app/views/projects/merge_requests/_merge_request.html.haml6
-rw-r--r--app/views/projects/merge_requests/_new_compare.html.haml8
-rw-r--r--app/views/projects/merge_requests/_new_submit.html.haml26
-rw-r--r--app/views/projects/merge_requests/_show.html.haml4
-rw-r--r--app/views/projects/merge_requests/index.html.haml3
-rw-r--r--app/views/projects/merge_requests/new.html.haml2
-rw-r--r--app/views/projects/merge_requests/show/_commits.html.haml2
-rw-r--r--app/views/projects/merge_requests/show/_context.html.haml4
-rw-r--r--app/views/projects/merge_requests/show/_mr_accept.html.haml53
-rw-r--r--app/views/projects/merge_requests/show/_mr_ci.html.haml8
-rw-r--r--app/views/projects/merge_requests/show/_mr_title.html.haml20
-rw-r--r--app/views/projects/merge_requests/show/_participants.html.haml5
-rw-r--r--app/views/projects/milestones/_form.html.haml2
-rw-r--r--app/views/projects/milestones/_issue.html.haml2
-rw-r--r--app/views/projects/milestones/_merge_request.html.haml2
-rw-r--r--app/views/projects/milestones/_milestone.html.haml2
-rw-r--r--app/views/projects/milestones/show.html.haml6
-rw-r--r--app/views/projects/network/show.html.haml3
-rw-r--r--app/views/projects/new.html.haml2
-rw-r--r--app/views/projects/notes/_commit_discussion.html.haml0
-rw-r--r--app/views/projects/notes/_diff_notes_with_reply.html.haml8
-rw-r--r--app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml8
-rw-r--r--app/views/projects/notes/_discussion.html.haml51
-rw-r--r--app/views/projects/notes/_discussion_reply_button.html.haml10
-rw-r--r--app/views/projects/notes/_note.html.haml117
-rw-r--r--app/views/projects/notes/_notes_with_form.html.haml2
-rw-r--r--app/views/projects/notes/discussions/_active.html.haml20
-rw-r--r--app/views/projects/notes/discussions/_commit.html.haml27
-rw-r--r--app/views/projects/notes/discussions/_diff.html.haml (renamed from app/views/projects/notes/_discussion_diff.html.haml)0
-rw-r--r--app/views/projects/notes/discussions/_outdated.html.haml19
-rw-r--r--app/views/projects/protected_branches/index.html.haml2
-rw-r--r--app/views/projects/repositories/_download_archive.html.haml2
-rw-r--r--app/views/projects/show.html.haml33
-rw-r--r--app/views/projects/tags/new.html.haml13
-rw-r--r--app/views/projects/team_members/_form.html.haml2
-rw-r--r--app/views/projects/team_members/import.html.haml2
-rw-r--r--app/views/projects/tree/_blob_item.html.haml2
-rw-r--r--app/views/projects/tree/_readme.html.haml9
-rw-r--r--app/views/projects/tree/_tree_item.html.haml2
-rw-r--r--app/views/public/projects/index.html.haml68
-rw-r--r--app/views/search/_filter.html.haml10
-rw-r--r--app/views/search/_global_filter.html.haml16
-rw-r--r--app/views/search/_global_results.html.haml5
-rw-r--r--app/views/search/_project_filter.html.haml25
-rw-r--r--app/views/search/_project_results.html.haml17
-rw-r--r--app/views/search/_results.html.haml22
-rw-r--r--app/views/search/results/_empty.html.haml4
-rw-r--r--app/views/search/results/_issue.html.haml21
-rw-r--r--app/views/search/results/_merge_request.html.haml28
-rw-r--r--app/views/search/results/_note.html.haml26
-rw-r--r--app/views/search/results/_project.html.haml9
-rw-r--r--app/views/search/show.html.haml2
-rw-r--r--app/views/shared/_clone_panel.html.haml5
-rw-r--r--app/views/shared/_file_hljs.html.haml2
-rw-r--r--app/views/shared/_filter.html.haml6
-rw-r--r--app/views/shared/_project_filter.html.haml35
-rw-r--r--app/views/users/_groups.html.haml2
-rw-r--r--app/workers/emails_on_push_worker.rb2
-rw-r--r--app/workers/post_receive.rb29
-rw-r--r--app/workers/repository_import_worker.rb3
-rwxr-xr-xbin/background_jobs20
-rwxr-xr-xbin/web10
-rw-r--r--config/application.rb25
-rw-r--r--config/database.yml.postgresql4
-rw-r--r--config/environments/development.rb5
-rw-r--r--config/environments/production.rb10
-rw-r--r--config/environments/test.rb3
-rw-r--r--config/gitlab.teatro.yml86
-rw-r--r--config/gitlab.yml.example44
-rw-r--r--config/initializers/1_settings.rb5
-rw-r--r--config/initializers/4_sidekiq.rb4
-rw-r--r--config/initializers/devise.rb4
-rw-r--r--config/initializers/rack_attack.rb.example12
-rw-r--r--config/initializers/session_store.rb3
-rw-r--r--config/locales/devise.en.yml3
-rw-r--r--config/routes.rb33
-rw-r--r--db/fixtures/development/01_admin.rb25
-rw-r--r--db/fixtures/development/04_project.rb102
-rw-r--r--db/fixtures/development/05_users.rb18
-rw-r--r--db/fixtures/development/07_milestones.rb28
-rw-r--r--db/fixtures/development/08_wall.rb21
-rw-r--r--db/fixtures/development/09_issues.rb36
-rw-r--r--db/fixtures/development/10_merge_requests.rb20
-rw-r--r--db/fixtures/development/11_keys.rb19
-rw-r--r--db/fixtures/development/13_comments.rb38
-rw-r--r--db/fixtures/production/001_admin.rb4
-rw-r--r--db/fixtures/test/001_repo.rb36
-rw-r--r--db/migrate/20140407135544_fix_namespaces.rb2
-rw-r--r--db/migrate/20140625115202_create_users_star_projects.rb15
-rw-r--r--db/migrate/20140729134820_create_labels.rb11
-rw-r--r--db/migrate/20140729140420_create_label_links.rb11
-rw-r--r--db/migrate/20140729145339_migrate_project_tags.rb9
-rw-r--r--db/migrate/20140729152420_migrate_taggable_labels.rb35
-rw-r--r--db/migrate/20140730111702_add_index_to_labels.rb7
-rw-r--r--db/migrate/20140903115954_migrate_to_new_shell.rb10
-rw-r--r--db/schema.rb36
-rw-r--r--doc/api/README.md15
-rw-r--r--doc/api/branches.md17
-rw-r--r--doc/api/commits.md7
-rw-r--r--doc/api/groups.md37
-rw-r--r--doc/api/issues.md23
-rw-r--r--doc/api/labels.md84
-rw-r--r--doc/api/merge_requests.md49
-rw-r--r--doc/api/notes.md54
-rw-r--r--doc/api/project_snippets.md2
-rw-r--r--doc/api/projects.md218
-rw-r--r--doc/api/repositories.md79
-rw-r--r--doc/api/repository_files.md15
-rw-r--r--doc/api/session.md8
-rw-r--r--doc/api/system_hooks.md2
-rw-r--r--doc/api/users.md72
-rw-r--r--doc/development/architecture.md14
-rw-r--r--doc/development/gitlab_diagram_overview.odgbin26292 -> 50512 bytes
-rw-r--r--doc/development/gitlab_diagram_overview.pngbin130285 -> 256612 bytes
-rw-r--r--doc/development/rake_tasks.md6
-rw-r--r--doc/install/installation.md133
-rw-r--r--doc/install/requirements.md71
-rw-r--r--doc/install/structure.md4
-rw-r--r--doc/integration/README.md9
-rw-r--r--doc/integration/github.md2
-rw-r--r--doc/integration/google.md14
-rw-r--r--doc/markdown/markdown.md69
-rw-r--r--doc/permissions/permissions.md2
-rw-r--r--doc/public_access/public_access.md6
-rw-r--r--doc/raketasks/backup_hrz.pngbin0 -> 21955 bytes
-rw-r--r--doc/raketasks/backup_restore.md12
-rw-r--r--doc/raketasks/features.md18
-rw-r--r--doc/raketasks/maintenance.md12
-rw-r--r--doc/raketasks/web_hooks.md12
-rw-r--r--doc/release/monthly.md160
-rw-r--r--doc/release/patch.md3
-rw-r--r--doc/release/security.md5
-rw-r--r--doc/system_hooks/system_hooks.md26
-rw-r--r--doc/update/4.0-to-4.1.md2
-rw-r--r--doc/update/4.2-to-5.0.md56
-rw-r--r--doc/update/5.0-to-5.1.md21
-rw-r--r--doc/update/5.1-to-5.2.md2
-rw-r--r--doc/update/5.1-to-5.4.md2
-rw-r--r--doc/update/5.1-to-6.0.md101
-rw-r--r--doc/update/5.2-to-5.3.md4
-rw-r--r--doc/update/5.3-to-5.4.md4
-rw-r--r--doc/update/6.0-to-6.1.md3
-rw-r--r--doc/update/6.0-to-7.2.md (renamed from doc/update/6.0-to-7.0.md)96
-rw-r--r--doc/update/6.1-to-6.2.md3
-rw-r--r--doc/update/6.2-to-6.3.md7
-rw-r--r--doc/update/6.3-to-6.4.md2
-rw-r--r--doc/update/6.4-to-6.5.md2
-rw-r--r--doc/update/6.5-to-6.6.md2
-rw-r--r--doc/update/6.6-to-6.7.md4
-rw-r--r--doc/update/6.7-to-6.8.md3
-rw-r--r--doc/update/6.8-to-6.9.md4
-rw-r--r--doc/update/6.9-to-7.0.md54
-rw-r--r--doc/update/7.0-to-7.1.md137
-rw-r--r--doc/update/7.1-to-7.2.md136
-rw-r--r--doc/update/7.2-to-7.3.md10
-rw-r--r--doc/update/README.md1
-rw-r--r--doc/update/mysql_to_postgresql.md7
-rw-r--r--doc/update/ruby.md59
-rw-r--r--doc/update/upgrader.md2
-rw-r--r--doc/web_hooks/web_hooks.md4
-rw-r--r--doc/workflow/README.md2
-rw-r--r--doc/workflow/groups.md71
-rw-r--r--doc/workflow/groups/add_member_to_group.pngbin0 -> 138184 bytes
-rw-r--r--doc/workflow/groups/group_dashboard.pngbin0 -> 107332 bytes
-rw-r--r--doc/workflow/groups/group_with_two_projects.pngbin0 -> 129319 bytes
-rw-r--r--doc/workflow/groups/new_group_button.pngbin0 -> 185406 bytes
-rw-r--r--doc/workflow/groups/new_group_form.pngbin0 -> 106491 bytes
-rw-r--r--doc/workflow/groups/override_access_level.pngbin0 -> 157193 bytes
-rw-r--r--doc/workflow/groups/project_members_via_group.pngbin0 -> 151339 bytes
-rw-r--r--doc/workflow/groups/transfer_project.pngbin0 -> 164958 bytes
-rw-r--r--doc/workflow/labels.md16
-rw-r--r--doc/workflow/labels/label1.pngbin0 -> 5846 bytes
-rw-r--r--doc/workflow/labels/label2.pngbin0 -> 16931 bytes
-rw-r--r--doc/workflow/labels/label3.pngbin0 -> 19360 bytes
-rw-r--r--doc/workflow/project_features.md2
-rw-r--r--features/dashboard/search.feature10
-rw-r--r--features/dashboard/shortcuts.feature21
-rw-r--r--features/explore/projects.feature (renamed from features/public/projects.feature)16
-rw-r--r--features/explore/public_groups.feature (renamed from features/public/public_groups.feature)34
-rw-r--r--features/group.feature21
-rw-r--r--features/project/commits/branches.feature26
-rw-r--r--features/project/commits/commits.feature4
-rw-r--r--features/project/commits/tags.feature20
-rw-r--r--features/project/commits/user_lookup.feature11
-rw-r--r--features/project/edit_issuetracker.feature2
-rw-r--r--features/project/forked_merge_requests.feature1
-rw-r--r--features/project/hooks.feature11
-rw-r--r--features/project/issues/filter_labels.feature22
-rw-r--r--features/project/issues/issues.feature37
-rw-r--r--features/project/issues/labels.feature42
-rw-r--r--features/project/merge_requests.feature22
-rw-r--r--features/project/network.feature24
-rw-r--r--features/project/project.feature11
-rw-r--r--features/project/public.feature8
-rw-r--r--features/project/redirects.feature5
-rw-r--r--features/project/shortcuts.feature46
-rw-r--r--features/project/source/browse_files.feature34
-rw-r--r--features/project/source/git_blame.feature2
-rw-r--r--features/project/source/markdown_render.feature24
-rw-r--r--features/project/source/multiselect_blob.feature2
-rw-r--r--features/project/source/search_code.feature16
-rw-r--r--features/project/star.feature38
-rw-r--r--features/search.feature46
-rw-r--r--features/steps/admin/active_tab.rb2
-rw-r--r--features/steps/dashboard/active_tab.rb14
-rw-r--r--features/steps/dashboard/dashboard.rb4
-rw-r--r--features/steps/dashboard/search.rb19
-rw-r--r--features/steps/dashboard/shortcuts.rb6
-rw-r--r--features/steps/explore/groups_feature.rb (renamed from features/steps/public/groups_feature.rb)19
-rw-r--r--features/steps/explore/projects.rb (renamed from features/steps/public/projects.rb)30
-rw-r--r--features/steps/group/group.rb101
-rw-r--r--features/steps/help.rb2
-rw-r--r--features/steps/profile/active_tab.rb2
-rw-r--r--features/steps/profile/profile.rb3
-rw-r--r--features/steps/project/active_tab.rb39
-rw-r--r--features/steps/project/archived.rb2
-rw-r--r--features/steps/project/browse_branches.rb43
-rw-r--r--features/steps/project/browse_commits.rb41
-rw-r--r--features/steps/project/browse_commits_user_lookup.rb47
-rw-r--r--features/steps/project/browse_files.rb65
-rw-r--r--features/steps/project/browse_git_repo.rb8
-rw-r--r--features/steps/project/browse_tags.rb48
-rw-r--r--features/steps/project/filter_labels.rb43
-rw-r--r--features/steps/project/fork.rb10
-rw-r--r--features/steps/project/forked_merge_requests.rb60
-rw-r--r--features/steps/project/hooks.rb38
-rw-r--r--features/steps/project/issues.rb77
-rw-r--r--features/steps/project/labels.rb99
-rw-r--r--features/steps/project/markdown_render.rb32
-rw-r--r--features/steps/project/merge_requests.rb59
-rw-r--r--features/steps/project/multiselect_blob.rb6
-rw-r--r--features/steps/project/network_graph.rb40
-rw-r--r--features/steps/project/project.rb21
-rw-r--r--features/steps/project/project_shortcuts.rb36
-rw-r--r--features/steps/project/public.rb9
-rw-r--r--features/steps/project/redirects.rb24
-rw-r--r--features/steps/project/search_code.rb14
-rw-r--r--features/steps/project/star.rb33
-rw-r--r--features/steps/search.rb73
-rw-r--r--features/steps/shared/active_tab.rb26
-rw-r--r--features/steps/shared/authentication.rb4
-rw-r--r--features/steps/shared/diff_note.rb63
-rw-r--r--features/steps/shared/group.rb8
-rw-r--r--features/steps/shared/paths.rb77
-rw-r--r--features/steps/shared/project.rb31
-rw-r--r--features/steps/shared/project_tab.rb46
-rw-r--r--features/steps/shared/shortcuts.rb18
-rw-r--r--features/support/env.rb5
-rw-r--r--lib/api/api.rb1
-rw-r--r--lib/api/branches.rb16
-rw-r--r--lib/api/entities.rb21
-rw-r--r--lib/api/helpers.rb31
-rw-r--r--lib/api/internal.rb9
-rw-r--r--lib/api/issues.rb78
-rw-r--r--lib/api/labels.rb103
-rw-r--r--lib/api/merge_requests.rb25
-rw-r--r--lib/api/projects.rb30
-rw-r--r--lib/api/repositories.rb41
-rw-r--r--lib/api/users.rb4
-rw-r--r--lib/backup/repository.rb2
-rw-r--r--lib/gitlab/backend/shell.rb11
-rw-r--r--lib/gitlab/blacklist.rb26
-rw-r--r--lib/gitlab/compare_result.rb9
-rw-r--r--lib/gitlab/config_helper.rb9
-rw-r--r--lib/gitlab/contributors.rb9
-rw-r--r--lib/gitlab/diff_parser.rb2
-rw-r--r--lib/gitlab/git_access.rb39
-rw-r--r--lib/gitlab/git_ref_validator.rb11
-rw-r--r--lib/gitlab/issues_labels.rb38
-rw-r--r--lib/gitlab/ldap/access.rb15
-rw-r--r--lib/gitlab/ldap/adapter.rb13
-rw-r--r--lib/gitlab/ldap/person.rb2
-rw-r--r--lib/gitlab/ldap/user.rb21
-rw-r--r--lib/gitlab/markdown.rb7
-rw-r--r--lib/gitlab/markdown_helper.rb25
-rw-r--r--lib/gitlab/oauth/user.rb14
-rw-r--r--lib/gitlab/project_search_results.rb52
-rw-r--r--lib/gitlab/regex.rb25
-rw-r--r--lib/gitlab/satellite/action.rb2
-rw-r--r--lib/gitlab/satellite/compare_action.rb37
-rw-r--r--lib/gitlab/satellite/merge_action.rb18
-rw-r--r--lib/gitlab/satellite/satellite.rb3
-rw-r--r--lib/gitlab/search_results.rb69
-rw-r--r--lib/gitlab/sidekiq_middleware/arguments_logger.rb10
-rw-r--r--lib/gitlab/theme.rb10
-rw-r--r--lib/gitlab/upgrader.rb2
-rw-r--r--lib/gitlab/url_builder.rb25
-rw-r--r--lib/gitlab/user_access.rb9
-rw-r--r--lib/gitlab/visibility_level.rb24
-rw-r--r--lib/gt_one_coercion.rb5
-rw-r--r--lib/support/nginx/gitlab100
-rw-r--r--lib/support/nginx/gitlab-ssl104
-rw-r--r--lib/tasks/gitlab/check.rake54
-rw-r--r--lib/tasks/gitlab/cleanup.rake24
-rw-r--r--lib/tasks/gitlab/shell.rake5
-rw-r--r--lib/tasks/gitlab/sidekiq.rake47
-rw-r--r--lib/tasks/gitlab/test.rake2
-rw-r--r--lib/unfold_form.rb11
-rw-r--r--spec/controllers/application_controller_spec.rb2
-rw-r--r--spec/controllers/blob_controller_spec.rb14
-rw-r--r--spec/controllers/merge_requests_controller_spec.rb5
-rw-r--r--spec/controllers/projects_controller_spec.rb19
-rw-r--r--spec/controllers/tree_controller_spec.rb17
-rw-r--r--spec/factories.rb145
-rw-r--r--spec/factories/label_links.rb20
-rw-r--r--spec/factories/labels.rb21
-rw-r--r--spec/factories/merge_requests.rb69
-rw-r--r--spec/factories/notes.rb59
-rw-r--r--spec/factories/projects.rb72
-rw-r--r--spec/features/issues_spec.rb4
-rw-r--r--spec/features/notes_on_merge_requests_spec.rb290
-rw-r--r--spec/fixtures/doc_sample.txt2
-rw-r--r--spec/helpers/application_helper_spec.rb13
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb23
-rw-r--r--spec/helpers/labels_helper_spec.rb11
-rw-r--r--spec/helpers/tree_helper_spec.rb15
-rw-r--r--spec/javascripts/stat_graph_spec.js2
-rw-r--r--spec/lib/git_ref_validator_spec.rb20
-rw-r--r--spec/lib/gitlab/auth_spec.rb (renamed from spec/lib/auth_spec.rb)0
-rw-r--r--spec/lib/gitlab/gitlab_markdown_helper_spec.rb28
-rw-r--r--spec/lib/gitlab/ldap/access_spec.rb (renamed from spec/lib/gitlab/ldap/ldap_access_spec.rb)8
-rw-r--r--spec/lib/gitlab/ldap/adapter_spec.rb (renamed from spec/lib/gitlab/ldap/ldap_adapter_spec.rb)0
-rw-r--r--spec/lib/gitlab/ldap/ldap_user_auth_spec.rb58
-rw-r--r--spec/lib/gitlab/ldap/user_spec.rb38
-rw-r--r--spec/lib/gitlab/oauth/user_spec.rb83
-rw-r--r--spec/lib/gitlab/regex_spec.rb21
-rw-r--r--spec/lib/gitlab/satellite/action_spec.rb4
-rw-r--r--spec/lib/gitlab/satellite/merge_action_spec.rb93
-rw-r--r--spec/lib/gitlab/url_builder_spec.rb11
-rw-r--r--spec/lib/oauth_spec.rb45
-rw-r--r--spec/mailers/notify_spec.rb95
-rw-r--r--spec/models/commit_spec.rb11
-rw-r--r--spec/models/gitlab_ci_service_spec.rb1
-rw-r--r--spec/models/issue_spec.rb2
-rw-r--r--spec/models/key_spec.rb2
-rw-r--r--spec/models/label_link_spec.rb21
-rw-r--r--spec/models/label_spec.rb43
-rw-r--r--spec/models/merge_request_spec.rb3
-rw-r--r--spec/models/milestone_spec.rb1
-rw-r--r--spec/models/namespace_spec.rb2
-rw-r--r--spec/models/note_spec.rb2
-rw-r--r--spec/models/project_snippet_spec.rb1
-rw-r--r--spec/models/project_spec.rb98
-rw-r--r--spec/models/project_wiki_spec.rb99
-rw-r--r--spec/models/protected_branch_spec.rb1
-rw-r--r--spec/models/service_spec.rb1
-rw-r--r--spec/models/snippet_spec.rb1
-rw-r--r--spec/models/user_spec.rb134
-rw-r--r--spec/models/users_group_spec.rb1
-rw-r--r--spec/models/users_project_spec.rb1
-rw-r--r--spec/models/web_hook_spec.rb1
-rw-r--r--spec/models/wiki_page_spec.rb43
-rw-r--r--spec/requests/api/branches_spec.rb83
-rw-r--r--spec/requests/api/files_spec.rb18
-rw-r--r--spec/requests/api/internal_spec.rb9
-rw-r--r--spec/requests/api/issues_spec.rb155
-rw-r--r--spec/requests/api/labels_spec.rb167
-rw-r--r--spec/requests/api/merge_requests_spec.rb28
-rw-r--r--spec/requests/api/projects_spec.rb49
-rw-r--r--spec/requests/api/repositories_spec.rb92
-rw-r--r--spec/requests/api/users_spec.rb13
-rw-r--r--spec/seed_project.tar.gzbin9769010 -> 0 bytes
-rw-r--r--spec/services/git_push_service_spec.rb6
-rw-r--r--spec/services/milestones/group_service_spec.rb70
-rw-r--r--spec/services/notes/create_service_spec.rb1
-rw-r--r--spec/services/notification_service_spec.rb86
-rw-r--r--spec/services/projects/create_service_spec.rb89
-rw-r--r--spec/services/projects/fork_service_spec.rb (renamed from spec/services/fork_service_spec.rb)23
-rw-r--r--spec/services/projects/update_service_spec.rb18
-rw-r--r--spec/services/search_service_spec.rb8
-rw-r--r--spec/services/system_hooks_service_spec.rb5
-rw-r--r--spec/spec_helper.rb9
-rw-r--r--spec/support/big_commits.rb8
-rw-r--r--spec/support/login_helpers.rb3
-rw-r--r--spec/support/mentionable_shared_examples.rb8
-rw-r--r--spec/support/repo_helpers.rb99
-rw-r--r--spec/support/test_env.rb168
-rw-r--r--spec/support/valid_commit.rb16
-rw-r--r--spec/support/valid_commit_with_alt_email.rb6
-rw-r--r--spec/workers/post_receive_spec.rb11
-rw-r--r--vendor/assets/javascripts/highlight.pack.js1
-rw-r--r--vendor/assets/javascripts/highlightjs.min.js1
-rwxr-xr-xvendor/assets/javascripts/jquery.sticky.js170
707 files changed, 11173 insertions, 5027 deletions
diff --git a/.hound.yml b/.hound.yml
new file mode 100644
index 00000000000..3bde29fb2bf
--- /dev/null
+++ b/.hound.yml
@@ -0,0 +1,4 @@
+# Prefer single quotes
+StringLiterals:
+ EnforcedStyle: single_quotes
+ Enabled: true
diff --git a/.pkgr.yml b/.pkgr.yml
index 97d78b6ef69..cf96e7916d8 100644
--- a/.pkgr.yml
+++ b/.pkgr.yml
@@ -5,6 +5,8 @@ targets:
debian-7: &wheezy
build_dependencies:
- libicu-dev
+ - cmake
+ - pkg-config
dependencies:
- libicu48
- libpcre3
@@ -13,6 +15,8 @@ targets:
ubuntu-14.04:
build_dependencies:
- libicu-dev
+ - cmake
+ - pkg-config
dependencies:
- libicu52
- libpcre3
@@ -20,6 +24,8 @@ targets:
centos-6:
build_dependencies:
- libicu-devel
+ - cmake
+ - pkgconfig
dependencies:
- libicu
- pcre
diff --git a/.teatro.yml b/.teatro.yml
new file mode 100644
index 00000000000..30054361981
--- /dev/null
+++ b/.teatro.yml
@@ -0,0 +1,8 @@
+stage:
+ before:
+ - cp config/gitlab.teatro.yml config/gitlab.yml
+ - mkdir /apps/gitlab-satellites
+ - mkdir /apps/repositories
+
+ database:
+ - RAILS_ENV=development force=yes bundle exec rake db:create gitlab:setup \ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 8bb2da5e51e..00000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-language: ruby
-env:
- global:
- - TRAVIS=true
- matrix:
- - TASK=spinach_project DB=mysql
- - TASK=spinach_other DB=mysql
- - TASK=spec:api DB=mysql
- - TASK=spec:feature DB=mysql
- - TASK=spec:other DB=mysql
- - TASK=jasmine:ci DB=mysql
- - TASK=spinach_project DB=postgresql
- - TASK=spinach_other DB=postgresql
- - TASK=spec:api DB=postgresql
- - TASK=spec:feature DB=postgresql
- - TASK=spec:other DB=postgresql
- - TASK=jasmine:ci DB=postgresql
-before_install:
- - sudo apt-get install libicu-dev -y
-install:
- - "bundle install --deployment --without production"
-branches:
- only:
- - 'master'
-rvm:
- - 2.0.0
-services:
- - redis-server
-before_script:
- - "cp config/database.yml.$DB config/database.yml"
- - "cp config/gitlab.yml.example config/gitlab.yml"
- - "bundle exec rake db:setup"
- - "bundle exec rake db:seed_fu"
-script: "bundle exec rake $TASK --trace"
-notifications:
- email: false
diff --git a/CHANGELOG b/CHANGELOG
index 495d20e8b04..ac44c0db2ea 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,70 @@
+v 7.3.0
+ - Always set the 'origin' remote in satellite actions
+ - Write authorized_keys in tmp/ during tests
+ - Expire Rack sessions after 1 week
+ - Cleaner signin/signup pages
+ - Improved comments UI
+ - Better search with filtering, pagination etc
+ - Added a checkbox to toggle line wrapping in diff (Yuriy Glukhov)
+ - Prevent project stars duplication when fork project
+ - Support Unix domain sockets for Redis
+ - Store session Redis keys in 'session:gitlab:' namespace
+ - Deprecate LDAP account takeover based on partial LDAP email / GitLab username match
+ - Keyboard shortcuts for productivity (Robert Schilling)
+ - API: filter issues by state (Julien Bianchi)
+ - API: filter issues by labels (Julien Bianchi)
+ - Add system hook for ssh key changes
+ - Add blob permalink link (Ciro Santilli)
+ - Create annotated tags through UI and API (Sean Edge)
+
+v 7.2.0
+ - Explore page
+ - Add project stars (Ciro Santilli)
+ - Log Sidekiq arguments
+ - Better labels: colors, ability to rename and remove
+ - Improve the way merge request collects diffs
+ - Improve compare page for large diffs
+ - Expose the full commit message via API
+ - Fix 500 error on repository rename
+ - Fix bug when MR download patch return invalid diff
+ - Test gitlab-shell integration
+ - Repository import timeout increased from 2 to 4 minutes allowing larger repos to be imported
+ - API for labels (Robert Schilling)
+ - API: ability to set an import url when creating project for specific user
+
+v 7.1.1
+ - Fix cpu usage issue in Firefox
+ - Fix redirect loop when changing password by new user
+ - Fix 500 error on new merge request page
+
+v 7.1.0
+ - Remove observers
+ - Improve MR discussions
+ - Filter by description on Issues#index page
+ - Fix bug with namespace select when create new project page
+ - Show README link after description for non-master members
+ - Add @all mention for comments
+ - Dont show reply button if user is not signed in
+ - Expose more information for issues with webhook
+ - Add a mention of the merge request into the default merge request commit message
+ - Improve code highlight, introduce support for more languages like Go, Clojure, Erlang etc
+ - Fix concurrency issue in repository download
+ - Dont allow repository name start with ?
+ - Improve email threading (Pierre de La Morinerie)
+ - Cleaner help page
+ - Group milestones
+ - Improved email notifications
+ - Contributors API (sponsored by Mobbr)
+ - Fix LDAP TLS authentication (Boris HUISGEN)
+ - Show VERSION information on project sidebar
+ - Improve branch removal logic when accept MR
+ - Fix bug where comment form is spawned inside the Reply button
+ - Remove Dir.chdir from Satellite#lock for thread-safety
+ - Increased default git max_size value from 5MB to 20MB in gitlab.yml. Please update your configs!
+ - Show error message in case of timeout in satellite when create MR
+ - Show first 100 files for huge diff instead of hiding all
+ - Change default admin email from admin@local.host to admin@example.com
+
v 7.0.0
- The CPU no longer overheats when you hold down the spacebar
- Improve edit file UI
@@ -25,7 +92,7 @@ v 7.0.0
- Show notice if your profile is public
- UI improvements for mobile devices
- Improve diff rendering performance
- - Drag-n-drop for issues and merge requests between states at milestone page
+ - Drag-n-drop for issues and merge requests between states at milestone page
- Fix '0 commits' message for huge repositories on project home page
- Prevent 500 error page when visit commit page from large repo
- Add notice about huge push over http to unicorn config
@@ -35,7 +102,7 @@ v 7.0.0
- Be more selective when killing stray Sidekiqs
- Check LDAP user filter during sign-in
- Remove wall feature (no data loss - you can take it from database)
- - Dont expose user emails via API unless you are admin
+ - Dont expose user emails via API unless you are admin
- Detect issues closed by Merge Request description
- Better email subject lines from email on push service (Alex Elman)
- Enable identicon for gravatar be default
@@ -110,7 +177,7 @@ v 6.7.0
- Blob and tree gfm links to anchors work
- Piwik Integration (Sebastian Winkler)
- Show contribution guide link for new issue form (Jeroen van Baarsen)
- - Fix CI status for merge requests from fork
+ - Fix CI status for merge requests from fork
- Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard)
- New page load indicator that includes a spinner that scrolls with the page
- Converted all the help sections into markdown
@@ -301,7 +368,7 @@ v 6.2.0
- Store the sessions in Redis instead of the cookie store
- Fixed relative links in markdown
- User must confirm their email if signup enabled
- - User must confirm changed email
+ - User must confirm changed email
v 6.1.0
- Project specific IDs for issues, mr, milestones
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3b6212c960d..845be6e482b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,8 +1,8 @@
# Contribute to GitLab
-This guide details how contribute to GitLab.
-
-If you want to know how the GitLab team handles contributions have a look at [the GitLab contributing process](PROCESS.md).
+Thank you for your interest in contributing to GitLab.
+This guide details how contribute to GitLab in a way that is efficient for everyone.
+If you have read this guide and want to know how the GitLab core-team operates please see [the GitLab contributing process](PROCESS.md).
## Contributor license agreement
@@ -42,7 +42,7 @@ Please send a merge request with a tested solution or a merge request with a fai
1. **Observed behavior**
1. **Relevant logs and/or screenshots:** Please use code blocks (\`\`\`) to format console output, logs, and code as it's very hard to read otherwise.
1. **Output of checks**
- * Results of GitLab [Application Check](doc/install/installation.md#check-application-status) (`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production`); we will only investigate if the tests are passing
+ * Results of GitLab [Application Check](doc/install/installation.md#check-application-status) (`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`); we will only investigate if the tests are passing
* Version of GitLab you are running; we will only investigate issues in the latest stable and development releases as per the [maintenance policy](MAINTENANCE.md)
* Add the last commit sha1 of the GitLab version you used to replicate the issue (obtainable from the help page)
* Describe your setup (use relevant parts from `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
@@ -62,22 +62,23 @@ If you can, please submit a merge request with the fix or improvements including
1. Create a feature branch
1. Write [tests](README.md#run-the-tests) and code
1. Add your changes to the [CHANGELOG](CHANGELOG)
+1. If you are changing the README, some documentation or other things which have no effect on the tests, add `[ci skip]` somewhere in the commit message
1. If you have multiple commits please combine them into one commit by [squashing them](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
1. Push the commit to your fork
1. Submit a merge request (MR) to the master branch
-1. The MR title should describes the change you want to make
+1. The MR title should describe the change you want to make
1. The MR description should give a motive for your change and the method you used to achieve it
1. If the MR changes the UI it should include before and after screenshots
1. If the MR changes CSS classes please include the list of affected pages `grep css-class ./app -R`
1. Link relevant [issues](https://gitlab.com/gitlab-org/gitlab-ce/issues) and/or [feature requests](http://feedback.gitlab.com/) from the merge request description and leave a comment on them with a link back to the MR
-1. Be prepared to answer questions and incorporate feedback even if requests for this arrive weeks or months after your MR submittion
+1. Be prepared to answer questions and incorporate feedback even if requests for this arrive weeks or months after your MR submission
1. If your MR touches code that executes shell commands, make sure it adheres to the [shell command guidelines]( doc/development/shell_commands.md).
The **official merge window** is in the beginning of the month from the 1st to the 7th day of the month. The best time to submit a MR and get feedback fast. Before this time the GitLab B.V. team is still dealing with work that is created by the monthly release such as assisting subscribers with upgrade issues, the release of Enterprise Edition and the upgrade of GitLab Cloud. After the 7th it is already getting closer to the release date of the next version. This means there is less time to fix the issues created by merging large new features.
-Please keep the change in a single MR **as small as possible**. If you want to contribute a large feature think very hard what the minimum viable change is. Can you split functionality? Can you only submit the backend/API code? Can you start with a very simple UI? The smaller a MR is the more likely it is it will be merged, after that you can send more MR's to enhance it.
+Please keep the change in a single MR **as small as possible**. If you want to contribute a large feature think very hard what the minimum viable change is. Can you split functionality? Can you only submit the backend/API code? Can you start with a very simple UI? Can you do part of the refactor? The increased reviewability of small MR's that leads to higher code quality is more important to us than having a mimimal commit log. The smaller a MR is the more likely it is it will be merged (quickly), after that you can send more MR's to enhance it.
-For examples of feedback on merge requests please look at already [closed merge requests](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests?assignee_id=&label_name=&milestone_id=&scope=&sort=&state=closed). Please ensure that your merge request meets the following contribution acceptance criteria.
+For examples of feedback on merge requests please look at already [closed merge requests](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests?assignee_id=&label_name=&milestone_id=&scope=&sort=&state=closed). If you would like quick feedback on your merge request feel free to mention one of the Merge Marshalls of [the core-team](https://about.gitlab.com/core-team/). Please ensure that your merge request meets the following contribution acceptance criteria.
**Please format your merge request description as follows:**
@@ -97,7 +98,8 @@ For examples of feedback on merge requests please look at already [closed merge
1. Keeps the GitLab code base clean and well structured
1. Contains functionality we think other users will benefit from too
1. Doesn't add configuration options since they complicate future changes
-1. Contains a single commit (please use `git rebase -i` to squash commits)
+1. Initially contains a single commit (please use `git rebase -i` to squash commits)
+1. Changes after submitting the merge request should be in separate commits (no squashing). You will be asked to squash when the review is over, before merging.
1. It conforms to the following style guides
## Style guides
@@ -113,4 +115,4 @@ For examples of feedback on merge requests please look at already [closed merge
1. [Shell commands](doc/development/shell_commands.md) created by GitLab contributors to enhance security
1. [Markdown](http://www.cirosantilli.com/markdown-styleguide)
-This is also the style used by linting tools such as [Rubocop](https://github.com/bbatsov/rubocop), PullReview[https://www.pullreview.com/] and [Hound CI](https://houndci.com).
+This is also the style used by linting tools such as [Rubocop](https://github.com/bbatsov/rubocop), [PullReview](https://www.pullreview.com/) and [Hound CI](https://houndci.com).
diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION
index 7bc1c40470f..227cea21564 100644
--- a/GITLAB_SHELL_VERSION
+++ b/GITLAB_SHELL_VERSION
@@ -1 +1 @@
-1.9.6
+2.0.0
diff --git a/Gemfile b/Gemfile
index 39ffd95b2e2..15854af4ed2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,8 +10,6 @@ end
gem "rails", "~> 4.1.0"
-gem "protected_attributes"
-
# Make links from text
gem 'rails_autolink', '~> 1.1'
@@ -23,8 +21,8 @@ gem "mysql2", group: :mysql
gem "pg", group: :postgres
# Auth
-gem "devise", '3.0.4'
-gem "devise-async", '0.8.0'
+gem "devise", '3.2.4'
+gem "devise-async", '0.9.0'
gem 'omniauth', "~> 1.1.3"
gem 'omniauth-google-oauth2'
gem 'omniauth-twitter'
@@ -48,7 +46,6 @@ gem "gitlab-linguist", "~> 3.0.0", require: "linguist"
# API
gem "grape", "~> 0.6.1"
-# Replace with rubygems when nesteted entities get released
gem "grape-entity", "~> 0.4.2"
gem 'rack-cors', require: 'rack/cors'
@@ -82,16 +79,20 @@ gem "six"
gem "seed-fu"
# Markdown to HTML
-gem "redcarpet", "~> 2.2.2"
gem "github-markup"
-gem "org-ruby" # For rendering .org files
+
+# Required markup gems by github-markdown
+gem 'redcarpet', '~> 3.1.2'
+gem 'RedCloth'
+gem 'rdoc', '~>3.6'
+gem 'org-ruby'
+gem 'creole', '~>0.3.6'
+gem 'wikicloth', '=0.8.1'
+gem 'asciidoctor', '= 0.1.4'
# Diffs
gem 'diffy', '~> 3.0.3'
-# Asciidoc to HTML
-gem "asciidoctor"
-
# Application server
group :unicorn do
gem "unicorn", '~> 4.6.3'
@@ -155,6 +156,9 @@ gem "rack-attack"
# Ace editor
gem 'ace-rails-ap'
+# Keyboard shortcuts
+gem 'mousetrap-rails'
+
# Semantic UI Sass for Sidebar
gem 'semantic-ui-sass', '~> 0.16.1.0'
@@ -176,6 +180,8 @@ gem "font-awesome-rails", '~> 3.2'
gem "gitlab_emoji", "~> 0.0.1.1"
gem "gon", '~> 5.0.0'
gem 'nprogress-rails'
+gem 'request_store'
+gem "virtus"
group :development do
gem "annotate", "~> 2.6.0.beta2"
@@ -228,7 +234,7 @@ group :development, :test do
gem 'jasmine', '2.0.2'
- gem "spring", '1.1.1'
+ gem "spring", '1.1.3'
gem "spring-commands-rspec", '1.0.1'
gem "spring-commands-spinach", '1.0.0'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 382633c2246..b20f4169174 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
+ RedCloth (4.2.9)
ace-rails-ap (2.0.1)
actionmailer (4.1.1)
actionpack (= 4.1.1)
@@ -40,7 +41,7 @@ GEM
axiom-types (0.0.5)
descendants_tracker (~> 0.0.1)
ice_nine (~> 0.9)
- bcrypt-ruby (3.1.2)
+ bcrypt (3.1.7)
better_errors (1.0.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
@@ -86,6 +87,7 @@ GEM
thor
crack (0.4.1)
safe_yaml (~> 0.9.0)
+ creole (0.3.8)
d3_rails (3.1.10)
railties (>= 3.1.0)
daemons (1.1.9)
@@ -94,13 +96,14 @@ GEM
default_value_for (3.0.0)
activerecord (>= 3.2.0, < 5.0)
descendants_tracker (0.0.3)
- devise (3.0.4)
- bcrypt-ruby (~> 3.0)
+ devise (3.2.4)
+ bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
+ thread_safe (~> 0.1)
warden (~> 1.2.3)
- devise-async (0.8.0)
- devise (>= 2.2, < 3.2)
+ devise-async (0.9.0)
+ devise (~> 3.2)
diff-lcs (1.2.5)
diffy (3.0.3)
docile (1.1.1)
@@ -120,12 +123,13 @@ GEM
eventmachine (1.0.3)
excon (0.32.1)
execjs (2.0.2)
+ expression_parser (0.9.0)
factory_girl (4.3.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.3.0)
factory_girl (~> 4.3.0)
railties (>= 3.0.0)
- faraday (0.8.8)
+ faraday (0.8.9)
multipart-post (~> 1.2.0)
faraday_middleware (0.9.0)
faraday (>= 0.7.4, < 0.9)
@@ -154,7 +158,7 @@ GEM
dotenv (>= 0.7)
thor (>= 0.13.6)
formatador (0.2.4)
- gemnasium-gitlab-service (0.2.1)
+ gemnasium-gitlab-service (0.2.2)
rugged (~> 0.19)
gherkin-ruby (0.3.1)
racc
@@ -164,7 +168,7 @@ GEM
multi_json
gitlab-grack (2.0.0.pre)
rack (~> 1.5.1)
- gitlab-grit (2.6.9)
+ gitlab-grit (2.6.10)
charlock_holmes (~> 0.6)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
@@ -175,12 +179,12 @@ GEM
mime-types (~> 1.19)
gitlab_emoji (0.0.1.1)
emoji (~> 1.0.1)
- gitlab_git (6.0.0)
+ gitlab_git (6.2.1)
activesupport (~> 4.0)
charlock_holmes (~> 0.6)
gitlab-grit (~> 2.6)
gitlab-linguist (~> 3.0)
- rugged (~> 0.19.0)
+ rugged (~> 0.21.0)
gitlab_meta (7.0)
gitlab_omniauth-ldap (1.0.4)
net-ldap (~> 0.3.1)
@@ -230,7 +234,7 @@ GEM
activesupport (>= 4.0.1)
haml (>= 3.1, < 5.0)
railties (>= 4.0.1)
- hashie (2.0.5)
+ hashie (2.1.2)
hike (1.2.3)
hipchat (0.14.0)
httparty
@@ -239,8 +243,8 @@ GEM
httparty (0.13.0)
json (~> 1.8)
multi_xml (>= 0.5.2)
- httpauth (0.2.0)
- i18n (0.6.9)
+ httpauth (0.2.1)
+ i18n (0.6.11)
ice_nine (0.10.0)
jasmine (2.0.2)
jasmine-core (~> 2.0.0)
@@ -260,7 +264,7 @@ GEM
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
json (1.8.1)
- jwt (0.1.8)
+ jwt (0.1.13)
multi_json (>= 1.5)
kaminari (0.15.1)
actionpack (>= 3.0.0)
@@ -282,7 +286,8 @@ GEM
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.0)
- minitest (5.3.4)
+ minitest (5.3.5)
+ mousetrap-rails (1.4.6)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (1.2.0)
@@ -307,9 +312,9 @@ GEM
omniauth-github (1.1.1)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
- omniauth-google-oauth2 (0.2.1)
- omniauth (~> 1.0)
- omniauth-oauth2
+ omniauth-google-oauth2 (0.2.5)
+ omniauth (> 1.0)
+ omniauth-oauth2 (~> 1.1)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
@@ -319,8 +324,8 @@ GEM
omniauth-twitter (1.0.1)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
- org-ruby (0.9.6)
- rubypants (>= 0.2.0)
+ org-ruby (0.9.8)
+ rubypants (~> 0.2)
orm_adapter (0.5.0)
pg (0.15.1)
phantomjs (1.9.2.0)
@@ -330,9 +335,7 @@ GEM
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
polyglot (0.3.4)
- posix-spawn (0.3.8)
- protected_attributes (1.0.5)
- activemodel (>= 4.0.1, < 5.0)
+ posix-spawn (0.3.9)
pry (0.9.12.4)
coderay (~> 1.0)
method_source (~> 0.8)
@@ -389,7 +392,7 @@ GEM
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
- redcarpet (2.2.2)
+ redcarpet (3.1.2)
redis (3.0.6)
redis-actionpack (4.0.0)
actionpack (~> 4)
@@ -410,9 +413,11 @@ GEM
redis-store (1.1.4)
redis (>= 2.2)
ref (1.0.5)
+ request_store (1.0.5)
require_all (1.3.2)
rest-client (1.6.7)
mime-types (>= 1.16)
+ rinku (1.7.3)
rouge (1.3.3)
rspec (2.14.1)
rspec-core (~> 2.14.0)
@@ -432,7 +437,7 @@ GEM
ruby-progressbar (1.2.0)
rubyntlm (0.1.1)
rubypants (0.2.0)
- rugged (0.19.0)
+ rugged (0.21.0)
safe_yaml (0.9.7)
sanitize (2.1.0)
nokogiri (>= 1.4.4)
@@ -485,7 +490,7 @@ GEM
capybara (>= 2.0.0)
railties (>= 3)
spinach (>= 0.4)
- spring (1.1.1)
+ spring (1.1.3)
spring-commands-rspec (1.0.1)
spring (>= 0.9.1)
spring-commands-spinach (1.0.0)
@@ -536,7 +541,7 @@ GEM
eventmachine (>= 0.12.8)
http_parser.rb (~> 0.5.1)
simple_oauth (~> 0.1.4)
- tzinfo (1.2.1)
+ tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.3.2)
execjs (>= 0.3.0)
@@ -563,6 +568,10 @@ GEM
addressable (>= 2.2.7)
crack (>= 0.3.2)
websocket-driver (0.3.3)
+ wikicloth (0.8.1)
+ builder
+ expression_parser
+ rinku
xpath (2.0.0)
nokogiri (~> 1.3)
@@ -570,10 +579,11 @@ PLATFORMS
ruby
DEPENDENCIES
+ RedCloth
ace-rails-ap
acts-as-taggable-on
annotate (~> 2.6.0.beta2)
- asciidoctor
+ asciidoctor (= 0.1.4)
awesome_print
better_errors
binding_of_caller
@@ -583,11 +593,12 @@ DEPENDENCIES
coffee-rails
colored
coveralls
+ creole (~> 0.3.6)
d3_rails (~> 3.1.4)
database_cleaner
default_value_for (~> 3.0.0)
- devise (= 3.0.4)
- devise-async (= 0.8.0)
+ devise (= 3.2.4)
+ devise-async (= 0.9.0)
diffy (~> 3.0.3)
dropzonejs-rails
email_spec
@@ -626,6 +637,7 @@ DEPENDENCIES
launchy
letter_opener
minitest (~> 5.3.0)
+ mousetrap-rails
mysql2
nprogress-rails
omniauth (~> 1.1.3)
@@ -635,7 +647,6 @@ DEPENDENCIES
org-ruby
pg
poltergeist (~> 1.5.1)
- protected_attributes
pry
quiet_assets (~> 1.0.1)
rack-attack
@@ -647,8 +658,10 @@ DEPENDENCIES
raphael-rails (~> 2.1.2)
rb-fsevent
rb-inotify
- redcarpet (~> 2.2.2)
+ rdoc (~> 3.6)
+ redcarpet (~> 3.1.2)
redis-rails
+ request_store
rspec-rails
sanitize (~> 2.0)
sass-rails (~> 4.0.2)
@@ -665,7 +678,7 @@ DEPENDENCIES
slack-notifier (~> 0.3.2)
slim
spinach-rails
- spring (= 1.1.1)
+ spring (= 1.1.3)
spring-commands-rspec (= 1.0.1)
spring-commands-spinach (= 1.0.0)
stamp
@@ -681,4 +694,6 @@ DEPENDENCIES
unicorn (~> 4.6.3)
unicorn-worker-killer
version_sorter
+ virtus
webmock
+ wikicloth (= 0.8.1)
diff --git a/Guardfile b/Guardfile
index e19a312377d..68ac3232b09 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,7 +1,7 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
-guard 'rspec', cmd: "spring rspec", version: 2, all_on_start: false, all_after_pass: false do
+guard 'rspec', cmd: "spring rspec", all_on_start: false, all_after_pass: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^lib/api/(.+)\.rb$}) { |m| "spec/requests/api/#{m[1]}_spec.rb" }
@@ -19,7 +19,7 @@ guard 'rspec', cmd: "spring rspec", version: 2, all_on_start: false, all_after_p
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
-guard 'spinach' do
+guard 'spinach', command_prefix: 'spring' do
watch(%r|^features/(.*)\.feature|)
watch(%r|^features/steps/(.*)([^/]+)\.rb|) do |m|
"features/#{m[1]}#{m[2]}.feature"
diff --git a/PROCESS.md b/PROCESS.md
index a6ff62a9a69..c986013e2f2 100644
--- a/PROCESS.md
+++ b/PROCESS.md
@@ -34,7 +34,7 @@ The most important thing is making sure valid issues receive feedback from the d
## Workflow labels
-Workflow labels are purposely not very detailed since that would be hard to keep updated as you would need to reevaluate them after every comment. We optionally use functional labels on demand when want to group related issues to get an overview (for example all issues related to RVM, to tackle them in one go) and to add details to the issue.
+Workflow labels are purposely not very detailed since that would be hard to keep updated as you would need to re-evaluate them after every comment. We optionally use functional labels on demand when want to group related issues to get an overview (for example all issues related to RVM, to tackle them in one go) and to add details to the issue.
- *Awaiting feedback*: Feedback pending from the reporter
- *Awaiting confirmation of fix*: The issue should already be solved in **master** (generally you can avoid this workflow item and just close the issue right away)
@@ -61,7 +61,7 @@ If an issue is complex and needs the attention of a specific person, assignment
## Be kind
-Be kind to people trying to contribute. Be aware that people can be a non-native or a native English speaker, they might not understand thing or they might be very sensitive to how your word things. Use emoji to express your feelings (heart, star, smile, etc.). Some good tips about giving feedback to merge requests is in the [Thoughtbot code review guide](https://github.com/thoughtbot/guides/tree/master/code-review).
+Be kind to people trying to contribute. Be aware that people may be a non-native English speaker, they might not understand things or they might be very sensitive as to how you word things. Use Emoji to express your feelings (heart, star, smile, etc.). Some good tips about giving feedback to merge requests is in the [Thoughtbot code review guide](https://github.com/thoughtbot/guides/tree/master/code-review).
## Copy & paste responses
diff --git a/Procfile b/Procfile
index a5693f8dbc5..c3128a741f1 100644
--- a/Procfile
+++ b/Procfile
@@ -1,2 +1,2 @@
web: bundle exec unicorn_rails -p ${PORT:="3000"} -E ${RAILS_ENV:="development"} -c ${UNICORN_CONFIG:="config/unicorn.rb"}
-worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell
+worker: bundle exec sidekiq -q post_receive,system_hook,project_web_hook,common,default,gitlab_shell
diff --git a/README.md b/README.md
index 07c5c61e939..8612d0c7c50 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,9 @@
- [![build status](https://ci.gitlab.org/projects/1/status.png?ref=master)](https://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch)
-- [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.png)](https://codeclimate.com/github/gitlabhq/gitlabhq)
+- [![Build Status](https://semaphoreapp.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/243338/badge.png)](https://semaphoreapp.com/gitlabhq/gitlabhq)
+
+- [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq)
- [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq)
@@ -81,11 +83,12 @@ or by directly calling the script:
sudo /etc/init.d/gitlab start
-Please login with `root` / `5iveL!fe`.
+Please login with `root` / `5iveL!fe`
## Install a development environment
-We recommend setting up your development environment with [the cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md#installation). If you do not use the cookbook you might need to copy the example development unicorn configuration file
+We recommend setting up your development environment with [the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit).
+If you do not use the development kit you might need to copy the example development unicorn configuration file
cp config/unicorn.rb.example.development config/unicorn.rb
@@ -127,3 +130,12 @@ All documentation can be found on [doc.gitlab.com/ce/](http://doc.gitlab.com/ce/
## Getting help
Please see [Getting help for GitLab](https://www.gitlab.com/getting-help/) on our website for the many options to get help.
+
+## Is it any good?
+
+[Yes](https://news.ycombinator.com/item?id=3067434)
+
+## Is it awesome?
+
+Thanks for [asking this question](https://twitter.com/supersloth/status/489462789384056832) Joshua.
+[These people](https://twitter.com/gitlabhq/favorites) seem to like it.
diff --git a/VERSION b/VERSION
index 66ce77b7ead..ab8884ed9bc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-7.0.0
+7.3.0.pre
diff --git a/app/assets/images/brand_logo.png b/app/assets/images/brand_logo.png
new file mode 100644
index 00000000000..09b1689ca45
--- /dev/null
+++ b/app/assets/images/brand_logo.png
Binary files differ
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 9bcd8f0a171..86ccd8c21ed 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -15,6 +15,7 @@
#= require jquery.atwho
#= require jquery.scrollTo
#= require jquery.blockUI
+#= require jquery.sticky
#= require turbolinks
#= require jquery.turbolinks
#= require bootstrap
@@ -23,14 +24,21 @@
#= require g.raphael-min
#= require g.bar-min
#= require branch-graph
-#= require highlightjs.min
+#= require highlight.pack
#= require ace/ace
+#= require ace/ext-searchbox
#= require d3
#= require underscore
#= require nprogress
#= require nprogress-turbolinks
#= require dropzone
#= require semantic-ui/sidebar
+#= require mousetrap
+#= require shortcuts
+#= require shortcuts_navigation
+#= require shortcuts_dashboard_navigation
+#= require shortcuts_issueable
+#= require shortcuts_network
#= require_tree .
window.slugify = (text) ->
@@ -53,15 +61,40 @@ window.split = (val) ->
window.extractLast = (term) ->
return split( term ).pop()
+window.rstrip = (val) ->
+ return val.replace(/\s+$/, '')
+
# Disable button if text field is empty
window.disableButtonIfEmptyField = (field_selector, button_selector) ->
field = $(field_selector)
- closest_submit = field.closest("form").find(button_selector)
+ closest_submit = field.closest('form').find(button_selector)
- closest_submit.disable() if field.val() is ""
+ closest_submit.disable() if rstrip(field.val()) is ""
- field.on "input", ->
- if $(@).val() is ""
+ field.on 'input', ->
+ if rstrip($(@).val()) is ""
+ closest_submit.disable()
+ else
+ closest_submit.enable()
+
+# Disable button if any input field with given selector is empty
+window.disableButtonIfAnyEmptyField = (form, form_selector, button_selector) ->
+ closest_submit = form.find(button_selector)
+ empty = false
+ form.find('input').filter(form_selector).each ->
+ empty = true if rstrip($(this).val()) is ""
+
+ if empty
+ closest_submit.disable()
+ else
+ closest_submit.enable()
+
+ form.keyup ->
+ empty = false
+ form.find('input').filter(form_selector).each ->
+ empty = true if rstrip($(this).val()) is ""
+
+ if empty
closest_submit.disable()
else
closest_submit.enable()
@@ -92,6 +125,13 @@ $ ->
# Initialize select2 selects
$('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
+ # Close select2 on escape
+ $('.js-select2').bind 'select2-close', ->
+ setTimeout ( ->
+ $('.select2-container-active').removeClass('select2-container-active')
+ $(':focus').blur()
+ ), 1
+
# Initialize tooltips
$('.has_tooltip').tooltip()
@@ -124,25 +164,19 @@ $ ->
# Show/Hide the profile menu when hovering the account box
$('.account-box').hover -> $(@).toggleClass('hover')
- # Focus search field by pressing 's' key
- $(document).keypress (e) ->
- # Don't do anything if typing in an input
- return if $(e.target).is(":input")
-
- switch e.which
- when 115
- $("#search").focus()
- e.preventDefault()
- when 63
- new Shortcuts()
- e.preventDefault()
-
-
# Commit show suppressed diff
$(".diff-content").on "click", ".supp_diff_link", ->
$(@).next('table').show()
$(@).remove()
+ # Show/hide comments on diff
+ $("body").on "click", ".js-toggle-diff-comments", (e) ->
+ $(@).find('i').
+ toggleClass('icon-chevron-down').
+ toggleClass('icon-chevron-up')
+ $(@).closest(".diff-file").find(".notes_holder").toggle()
+ e.preventDefault()
+
(($) ->
# Disable an element and add the 'disabled' Bootstrap class
$.fn.extend disable: ->
diff --git a/app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee b/app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee
new file mode 100644
index 00000000000..691ed4f98ae
--- /dev/null
+++ b/app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee
@@ -0,0 +1,14 @@
+$ ->
+ # Toggle line wrapping in diff.
+ #
+ # %div.diff-file
+ # %input.js-toggle-diff-line-wrap
+ # %td.line_content
+ #
+ $("body").on "click", ".js-toggle-diff-line-wrap", (e) ->
+ diffFile = $(@).closest(".diff-file")
+ if $(@).is(":checked")
+ diffFile.addClass("diff-wrap-lines")
+ else
+ diffFile.removeClass("diff-wrap-lines")
+
diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee
index f6d57bd55bb..b8af07579f2 100644
--- a/app/assets/javascripts/branch-graph.js.coffee
+++ b/app/assets/javascripts/branch-graph.js.coffee
@@ -1,4 +1,4 @@
-class BranchGraph
+class @BranchGraph
constructor: (@element, @options) ->
@preparedCommits = {}
@mtime = 0
@@ -120,23 +120,32 @@ class BranchGraph
@top.toFront()
bindEvents: ->
- drag = {}
element = @element
$(element).scroll (event) =>
@renderPartialGraph()
- $(window).on
- keydown: (event) =>
- # left
- element.scrollLeft element.scrollLeft() - 50 if event.keyCode is 37
- # top
- element.scrollTop element.scrollTop() - 50 if event.keyCode is 38
- # right
- element.scrollLeft element.scrollLeft() + 50 if event.keyCode is 39
- # bottom
- element.scrollTop element.scrollTop() + 50 if event.keyCode is 40
- @renderPartialGraph()
+ scrollDown: =>
+ @element.scrollTop @element.scrollTop() + 50
+ @renderPartialGraph()
+
+ scrollUp: =>
+ @element.scrollTop @element.scrollTop() - 50
+ @renderPartialGraph()
+
+ scrollLeft: =>
+ @element.scrollLeft @element.scrollLeft() - 50
+ @renderPartialGraph()
+
+ scrollRight: =>
+ @element.scrollLeft @element.scrollLeft() + 50
+ @renderPartialGraph()
+
+ scrollBottom: =>
+ @element.scrollTop @element.find('svg').height()
+
+ scrollTop: =>
+ @element.scrollTop 0
appendLabel: (x, y, commit) ->
return unless commit.refs
@@ -325,5 +334,3 @@ Raphael::textWrap = (t, width) ->
b = t.getBBox()
h = Math.abs(b.y2) - Math.abs(b.y) + 1
t.attr y: b.y + h
-
-@BranchGraph = BranchGraph
diff --git a/app/assets/javascripts/diff.js.coffee b/app/assets/javascripts/diff.js.coffee
new file mode 100644
index 00000000000..78bb385b5bb
--- /dev/null
+++ b/app/assets/javascripts/diff.js.coffee
@@ -0,0 +1,47 @@
+class Diff
+ UNFOLD_COUNT = 20
+ constructor: ->
+ $(document).on('click', '.js-unfold', (event) =>
+ target = $(event.target)
+ unfoldBottom = target.hasClass('js-unfold-bottom')
+ unfold = true
+
+ [old_line, line_number] = @lineNumbers(target.parent())
+ offset = line_number - old_line
+
+ if unfoldBottom
+ line_number += 1
+ since = line_number
+ to = line_number + UNFOLD_COUNT
+ else
+ [prev_old_line, prev_new_line] = @lineNumbers(target.parent().prev())
+ line_number -= 1
+ to = line_number
+ if line_number - UNFOLD_COUNT > prev_new_line + 1
+ since = line_number - UNFOLD_COUNT
+ else
+ since = prev_new_line + 1
+ unfold = false
+
+ link = target.parents('.diff-file').attr('data-blob-diff-path')
+ params =
+ since: since
+ to: to
+ bottom: unfoldBottom
+ offset: offset
+ unfold: unfold
+
+ $.get(link, params, (response) =>
+ target.parent().replaceWith(response)
+ )
+ ).ready =>
+ $(".diff-header").sticky {responsiveWidth:true, getWidthFrom: ".diff-file"}
+
+ lineNumbers: (line) ->
+ return ([0, 0]) unless line.children().length
+ lines = line.children().slice(0, 2)
+ line_numbers = ($(l).attr('data-linenumber') for l in lines)
+ (parseInt(line_number) for line_number in line_numbers)
+
+
+@Diff = Diff
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index ff68b520ad6..ae4cf577179 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -15,39 +15,83 @@ class Dispatcher
return false
path = page.split(':')
+ shortcut_handler = null
switch page
when 'projects:issues:index'
Issues.init()
+ shortcut_handler = new ShortcutsNavigation()
when 'projects:issues:show'
new Issue()
+ shortcut_handler = new ShortcutsIssueable()
when 'projects:milestones:show'
new Milestone()
- when 'projects:issues:new', 'projects:merge_requests:new'
+ when 'projects:issues:new'
GitLab.GfmAutoComplete.setup()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:merge_requests:new'
+ GitLab.GfmAutoComplete.setup()
+ new Diff()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:merge_requests:show'
+ new Diff()
+ shortcut_handler = new ShortcutsIssueable()
+ when "projects:merge_requests:diffs"
+ new Diff()
+ when 'projects:merge_requests:index'
+ shortcut_handler = new ShortcutsNavigation()
when 'dashboard:show'
new Dashboard()
new Activities()
when 'projects:commit:show'
new Commit()
+ new Diff()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:commits:show'
+ shortcut_handler = new ShortcutsNavigation()
when 'groups:show', 'projects:show'
new Activities()
- when 'projects:new', 'projects:edit'
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:new'
+ new Project()
+ when 'projects:edit'
new Project()
+ shortcut_handler = new ShortcutsNavigation()
when 'projects:teams:members:index'
new TeamMembers()
when 'groups:members'
new GroupMembers()
when 'projects:tree:show'
new TreeView()
+ shortcut_handler = new ShortcutsNavigation()
when 'projects:blob:show'
new BlobView()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:labels:new', 'projects:labels:edit'
+ new Labels()
+ when 'projects:network:show'
+ # Ensure we don't create a particular shortcut handler here. This is
+ # already created, where the network graph is created.
+ shortcut_handler = true
switch path.first()
when 'admin' then new Admin()
+ when 'dashboard'
+ shortcut_handler = new ShortcutsDashboardNavigation()
when 'projects'
- new Wikis() if path[1] == 'wikis'
+ switch path[1]
+ when 'wikis'
+ new Wikis()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'snippets', 'labels', 'graphs'
+ shortcut_handler = new ShortcutsNavigation()
+ when 'team_members', 'deploy_keys', 'hooks', 'services', 'protected_branches'
+ shortcut_handler = new ShortcutsNavigation()
+
+ # If we haven't installed a custom shortcut handler, install the default one
+ if not shortcut_handler
+ new Shortcuts()
initSearch: ->
opts = $('.search-autocomplete-opts')
diff --git a/app/assets/javascripts/extensions/array.js b/app/assets/javascripts/extensions/array.js
index 7fccc9c9d5f..24f9e00097c 100644
--- a/app/assets/javascripts/extensions/array.js
+++ b/app/assets/javascripts/extensions/array.js
@@ -4,4 +4,4 @@ Array.prototype.first = function() {
Array.prototype.last = function() {
return this[this.length-1];
-} \ No newline at end of file
+}
diff --git a/app/assets/javascripts/groups.js.coffee b/app/assets/javascripts/groups.js.coffee
index 7850eb14e74..49d6605980b 100644
--- a/app/assets/javascripts/groups.js.coffee
+++ b/app/assets/javascripts/groups.js.coffee
@@ -14,4 +14,4 @@ $ ->
$('.js-group-avatar-input').bind "change", ->
form = $(this).closest("form")
filename = $(this).val().replace(/^.*[\\\/]/, '')
- form.find(".js-avatar-filename").text(filename) \ No newline at end of file
+ form.find(".js-avatar-filename").text(filename)
diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee
index 54de93a4e04..2499ad5ad80 100644
--- a/app/assets/javascripts/issues.js.coffee
+++ b/app/assets/javascripts/issues.js.coffee
@@ -43,25 +43,31 @@
$(".selected_issue").bind "change", Issues.checkChanged
-
+ # Make sure we trigger ajax request only after user stop typing
initSearch: ->
- form = $("#issue_search_form")
- last_terms = ""
+ @timer = null
$("#issue_search").keyup ->
- terms = $(this).val()
- unless terms is last_terms
- last_terms = terms
- if terms.length >= 2 or terms.length is 0
- $.ajax
- type: "GET"
- url: location.href
- data: "issue_search=" + terms
- complete: ->
- $(".loading").hide()
- success: (data) ->
- $('.issues-holder').html(data.html)
- Issues.reload()
- dataType: "json"
+ clearTimeout(@timer);
+ @timer = setTimeout(Issues.filterResults, 500)
+
+ filterResults: =>
+ form = $("#issue_search_form")
+ search = $("#issue_search").val()
+ $('.issues-holder').css("opacity", '0.5')
+ issues_url = form.attr('action') + '? '+ form.serialize()
+
+ $.ajax
+ type: "GET"
+ url: form.attr('action')
+ data: form.serialize()
+ complete: ->
+ $('.issues-holder').css("opacity", '1.0')
+ success: (data) ->
+ $('.issues-holder').html(data.html)
+ # Change url so if user reload a page - search results are saved
+ History.replaceState {page: issues_url}, document.title, issues_url
+ Issues.reload()
+ dataType: "json"
checkChanged: ->
checked_issues = $(".selected_issue:checked")
diff --git a/app/assets/javascripts/labels.js.coffee b/app/assets/javascripts/labels.js.coffee
new file mode 100644
index 00000000000..d306ad64f5b
--- /dev/null
+++ b/app/assets/javascripts/labels.js.coffee
@@ -0,0 +1,35 @@
+class Labels
+ constructor: ->
+ form = $('.label-form')
+ @setupLabelForm(form)
+ @cleanBinding()
+ @addBinding()
+ @updateColorPreview()
+
+ addBinding: ->
+ $(document).on 'click', '.suggest-colors a', @setSuggestedColor
+ $(document).on 'input', 'input#label_color', @updateColorPreview
+
+ cleanBinding: ->
+ $(document).off 'click', '.suggest-colors a'
+ $(document).off 'input', 'input#label_color'
+
+ # Initializes the form to disable the save button if no color or title is entered
+ setupLabelForm: (form) ->
+ disableButtonIfAnyEmptyField form, '.form-control', form.find('.js-save-button')
+
+ # Updates the the preview color with the hex-color input
+ updateColorPreview: =>
+ previewColor = $('input#label_color').val()
+ $('div.label-color-preview').css('background-color', previewColor)
+
+ # Updates the preview color with a click on a suggested color
+ setSuggestedColor: (e) =>
+ color = $(e.currentTarget).data('color')
+ $('input#label_color').val(color)
+ @updateColorPreview()
+ # Notify the form, that color has changed
+ $('.label-form').trigger('keyup')
+ e.preventDefault()
+
+@Labels = Labels
diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee
index def5d12a820..bee2785562d 100644
--- a/app/assets/javascripts/markdown_area.js.coffee
+++ b/app/assets/javascripts/markdown_area.js.coffee
@@ -20,7 +20,9 @@ $(document).ready ->
$(".div-dropzone-hover").append iconPicture
$(".div-dropzone").append divSpinner
$(".div-dropzone-spinner").append iconSpinner
-
+ $(".div-dropzone-spinner").css
+ "opacity": 0
+ "display": "none"
dropzone = $(".div-dropzone").dropzone(
url: project_image_path_upload
@@ -67,19 +69,128 @@ $(document).ready ->
return
sending: ->
- $(".div-dropzone-spinner").css "opacity", 0.7
+ $(".div-dropzone-spinner").css
+ "opacity": 0.7
+ "display": "inherit"
return
complete: ->
$(".dz-preview").remove()
$(".markdown-area").trigger "input"
- $(".div-dropzone-spinner").css "opacity", 0
+ $(".div-dropzone-spinner").css
+ "opacity": 0
+ "display": "none"
return
)
+ child = $(dropzone[0]).children("textarea")
+
+ formatLink = (str) ->
+ "![" + str.alt + "](" + str.url + ")"
+
+ handlePaste = (e) ->
+ e.preventDefault()
+ my_event = e.originalEvent
+
+ if my_event.clipboardData and my_event.clipboardData.items
+ processItem(my_event)
+
+ processItem = (e) ->
+ image = isImage(e)
+ if image
+ filename = getFilename(e) or "image.png"
+ text = "{{" + filename + "}}"
+ pasteText(text)
+ uploadFile image.getAsFile(), filename
+
+ else
+ text = e.clipboardData.getData("text/plain")
+ pasteText(text)
+
+ isImage = (data) ->
+ i = 0
+ while i < data.clipboardData.items.length
+ item = data.clipboardData.items[i]
+ if item.type.indexOf("image") isnt -1
+ return item
+ i++
+ return false
+
+ pasteText = (text) ->
+ caretStart = $(child)[0].selectionStart
+ caretEnd = $(child)[0].selectionEnd
+ textEnd = $(child).val().length
+
+ beforeSelection = $(child).val().substring 0, caretStart
+ afterSelection = $(child).val().substring caretEnd, textEnd
+ $(child).val beforeSelection + text + afterSelection
+ $(".markdown-area").trigger "input"
+
+ getFilename = (e) ->
+ if window.clipboardData and window.clipboardData.getData
+ value = window.clipboardData.getData("Text")
+ else if e.clipboardData and e.clipboardData.getData
+ value = e.clipboardData.getData("text/plain")
+
+ value = value.split("\r")
+ value.first()
+
+ uploadFile = (item, filename) ->
+ formData = new FormData()
+ formData.append "markdown_img", item, filename
+ $.ajax
+ url: project_image_path_upload
+ type: "POST"
+ data: formData
+ dataType: "json"
+ processData: false
+ contentType: false
+ headers:
+ "X-CSRF-Token": $("meta[name=\"csrf-token\"]").attr("content")
+
+ beforeSend: ->
+ showSpinner()
+ closeAlertMessage()
+
+ success: (e, textStatus, response) ->
+ insertToTextArea(filename, formatLink(response.responseJSON.link))
+
+ error: (response) ->
+ showError(response.responseJSON.message)
+
+ complete: ->
+ closeSpinner()
+
+ insertToTextArea = (filename, url) ->
+ $(child).val (index, val) ->
+ val.replace("{{" + filename + "}}", url + "\n")
+
+ appendToTextArea = (url) ->
+ $(child).val (index, val) ->
+ val + url + "\n"
+
+ showSpinner = (e) ->
+ $(".div-dropzone-spinner").css
+ "opacity": 0.7
+ "display": "inherit"
+
+ closeSpinner = ->
+ $(".div-dropzone-spinner").css
+ "opacity": 0
+ "display": "none"
+
+ showError = (message) ->
+ checkIfMsgExists = $(".error-alert").children().length
+ if checkIfMsgExists is 0
+ $(".error-alert").append divAlert
+ $(".div-dropzone-alert").append btnAlert + message
+
+ closeAlertMessage = ->
+ $(".div-dropzone-alert").alert "close"
+
$(".markdown-selector").click (e) ->
e.preventDefault()
- $(".div-dropzone").click()
+ $(@).closest(".div-dropzone-wrapper").find(".div-dropzone").click()
return
- return \ No newline at end of file
+ return
diff --git a/app/assets/javascripts/network.js.coffee b/app/assets/javascripts/network.js.coffee
index cea5986f45a..f4ef07a50a7 100644
--- a/app/assets/javascripts/network.js.coffee
+++ b/app/assets/javascripts/network.js.coffee
@@ -1,11 +1,9 @@
-class Network
+class @Network
constructor: (opts) ->
$("#filter_ref").click ->
$(this).closest('form').submit()
- branch_graph = new BranchGraph($(".network-graph"), opts)
+ @branch_graph = new BranchGraph($(".network-graph"), opts)
vph = $(window).height() - 250
$('.network-graph').css 'height': (vph + 'px')
-
-@Network = Network
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index a41ee67a841..51c617bd584 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -16,13 +16,18 @@ class Notes
$(document).on "ajax:success", ".js-main-target-form", @addNote
$(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote
- # change note in UI after update
+ # change note in UI after update
$(document).on "ajax:success", "form.edit_note", @updateNote
# Edit note link
$(document).on "click", ".js-note-edit", @showEditForm
$(document).on "click", ".note-edit-cancel", @cancelEdit
+ # Reopen and close actions for Issue/MR combined with note form submit
+ $(document).on "click", ".js-note-target-reopen", @targetReopen
+ $(document).on "click", ".js-note-target-close", @targetClose
+ $(document).on "keyup", ".js-note-text", @updateTargetButtons
+
# remove a note (in general)
$(document).on "click", ".js-note-delete", @removeNote
@@ -78,7 +83,9 @@ class Notes
$(document).off "click", ".js-add-diff-note-button"
$(document).off "visibilitychange"
$(document).off "keypress", @notes_forms
-
+ $(document).off "keyup", ".js-note-text"
+ $(document).off "click", ".js-note-target-reopen"
+ $(document).off "click", ".js-note-target-close"
initRefresh: ->
clearInterval(Notes.interval)
@@ -142,8 +149,15 @@ class Notes
# remove the note (will be added again below)
row.next().find(".note").remove()
- # append new note to all matching discussions
- $(".notes[rel='" + note.discussion_id + "']").append note.html
+ # Add note to 'Changes' page discussions
+ $(".notes[rel='" + note.discussion_id + "']").append note.html
+
+ # Init discussion on 'Discussion' page if it is merge request page
+ if $('body').attr('data-page').indexOf('projects:merge_request') == 0
+ $('ul.main-notes-list').append(note.discussion_with_diff_html)
+ else
+ # append new note to all matching discussions
+ $(".notes[rel='" + note.discussion_id + "']").append note.html
# cleanup after successfully creating a diff/discussion note
@removeDiscussionNoteForm(form)
@@ -314,7 +328,9 @@ class Notes
GitLab.GfmAutoComplete.setup()
form = note.find(".note-edit-form")
form.show()
- form.find("textarea").focus()
+ textarea = form.find("textarea")
+ textarea.focus()
+ disableButtonIfEmptyField textarea, form.find(".js-comment-button")
###
Called in response to clicking the edit note link
@@ -369,7 +385,7 @@ class Notes
###
replyToDiscussionNote: (e) =>
form = $(".js-new-note-form")
- replyLink = $(e.target)
+ replyLink = $(e.target).closest(".js-discussion-reply-button")
replyLink.hide()
# insert the form after the button
@@ -398,30 +414,6 @@ class Notes
form.addClass "js-discussion-note-form"
###
- General note form setup.
-
- deactivates the submit button when text is empty
- hides the preview button when text is empty
- setup GFM auto complete
- show the form
- ###
- setupNoteForm: (form) =>
- disableButtonIfEmptyField form.find(".js-note-text"), form.find(".js-comment-button")
- form.removeClass "js-new-note-form"
- form.removeClass "js-new-note-form"
- GitLab.GfmAutoComplete.setup()
-
- # setup preview buttons
- previewButton = form.find(".js-note-preview-button")
- form.find(".js-note-text").on "input", ->
- if $(this).val().trim() isnt ""
- previewButton.removeClass("turn-off").addClass "turn-on"
- else
- previewButton.removeClass("turn-on").addClass "turn-off"
-
- form.show()
-
- ###
Called when clicking on the "add a comment" button on the side of a diff line.
Inserts a temporary row for the form below the line.
@@ -493,4 +485,28 @@ class Notes
visibilityChange: =>
@refresh()
+ targetReopen: (e) =>
+ @submitNoteForm($(e.target).parents('form'))
+
+ targetClose: (e) =>
+ @submitNoteForm($(e.target).parents('form'))
+
+ submitNoteForm: (form) =>
+ noteText = form.find(".js-note-text").val()
+ if noteText.trim().length > 0
+ form.submit()
+
+ updateTargetButtons: (e) =>
+ textarea = $(e.target)
+ form = textarea.parents('form')
+
+ if textarea.val().trim().length > 0
+ form.find('.js-note-target-reopen').text('Comment & reopen')
+ form.find('.js-note-target-close').text('Comment & close')
+ else
+ form.find('.js-note-target-reopen').text('Reopen')
+ form.find('.js-note-target-close').text('Close')
+
+
+
@Notes = Notes
diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee
index 1f763e8b956..fe83dc0410e 100644
--- a/app/assets/javascripts/pager.js.coffee
+++ b/app/assets/javascripts/pager.js.coffee
@@ -1,24 +1,21 @@
@Pager =
- limit: 0
- offset: 0
- disable: false
- init: (limit, preload) ->
- @limit = limit
+ init: (@limit = 0, preload, @disable = false) ->
+ @loading = $(".loading")
if preload
@offset = 0
@getOld()
else
- @offset = limit
+ @offset = @limit
@initLoadMore()
getOld: ->
- $(".loading").show()
+ @loading.show()
$.ajax
type: "GET"
url: location.href
data: "limit=" + @limit + "&offset=" + @offset
- complete: ->
- $(".loading").hide()
+ complete: =>
+ @loading.hide()
success: (data) ->
Pager.append(data.count, data.html)
dataType: "json"
@@ -39,6 +36,7 @@
ceaseFire: ->
Pager.disable
- callback: (i) ->
- $(".loading").show()
- Pager.getOld()
+ callback: (i) =>
+ unless @loading.is(':visible')
+ @loading.show()
+ Pager.getOld()
diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee
index b37a78ac197..0e99921f899 100644
--- a/app/assets/javascripts/profile.js.coffee
+++ b/app/assets/javascripts/profile.js.coffee
@@ -27,4 +27,4 @@ $ ->
filename = $(this).val().replace(/^.*[\\\/]/, '')
form.find(".js-avatar-filename").text(filename)
- $('.profile-groups-avatars').tooltip("placement": "top") \ No newline at end of file
+ $('.profile-groups-avatars').tooltip("placement": "top")
diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee
index 4262418fd5e..d81cc087df9 100644
--- a/app/assets/javascripts/project.js.coffee
+++ b/app/assets/javascripts/project.js.coffee
@@ -46,3 +46,8 @@ $ ->
$.cookie('hide_no_ssh_message', 'false', { path: path })
$(@).parents('.no-ssh-key-message').hide()
e.preventDefault()
+
+ $('.project-home-panel .star').on 'ajax:success', (e, data, status, xhr) ->
+ $(@).toggleClass('on').find('.count').html(data.star_count)
+ .on 'ajax:error', (e, xhr, status, error) ->
+ new Flash('Star toggle failed. Try again later.', 'alert')
diff --git a/app/assets/javascripts/shortcuts.js.coffee b/app/assets/javascripts/shortcuts.js.coffee
index e7e40a066ec..e9aeb1e9525 100644
--- a/app/assets/javascripts/shortcuts.js.coffee
+++ b/app/assets/javascripts/shortcuts.js.coffee
@@ -1,11 +1,30 @@
-class Shortcuts
+class @Shortcuts
constructor: ->
+ @enabledHelp = []
+ Mousetrap.reset()
+ Mousetrap.bind('?', @selectiveHelp)
+ Mousetrap.bind('s', Shortcuts.focusSearch)
+
+ selectiveHelp: (e) =>
+ Shortcuts.showHelp(e, @enabledHelp)
+
+ @showHelp: (e, location) ->
if $('#modal-shortcuts').length > 0
$('#modal-shortcuts').modal('show')
else
$.ajax(
url: '/help/shortcuts',
- dataType: "script"
+ dataType: 'script',
+ success: (e) ->
+ if location and location.length > 0
+ for l in location
+ $(l).show()
+ else
+ $('.hidden-shortcut').show()
+ $('.js-more-help-button').remove()
)
+ e.preventDefault()
-@Shortcuts = Shortcuts
+ @focusSearch: (e) ->
+ $('#search').focus()
+ e.preventDefault()
diff --git a/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee b/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee
new file mode 100644
index 00000000000..d522d9f3b90
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee
@@ -0,0 +1,14 @@
+#= require shortcuts
+
+class @ShortcutsDashboardNavigation extends Shortcuts
+ constructor: ->
+ super()
+ Mousetrap.bind('g a', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-activity'))
+ Mousetrap.bind('g p', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-projects'))
+ Mousetrap.bind('g i', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-issues'))
+ Mousetrap.bind('g m', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-merge_requests'))
+
+ @findAndollowLink: (selector) ->
+ link = $(selector).attr('href')
+ if link
+ window.location = link
diff --git a/app/assets/javascripts/shortcuts_issueable.coffee b/app/assets/javascripts/shortcuts_issueable.coffee
new file mode 100644
index 00000000000..b8dae71e037
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_issueable.coffee
@@ -0,0 +1,19 @@
+#= require shortcuts_navigation
+
+class @ShortcutsIssueable extends ShortcutsNavigation
+ constructor: (isMergeRequest) ->
+ super()
+ Mousetrap.bind('a', ->
+ $('.js-assignee').select2('open')
+ return false
+ )
+ Mousetrap.bind('m', ->
+ $('.js-milestone').select2('open')
+ return false
+ )
+
+ if isMergeRequest
+ @enabledHelp.push('.hidden-shortcut.merge_reuests')
+ else
+ @enabledHelp.push('.hidden-shortcut.issues')
+
diff --git a/app/assets/javascripts/shortcuts_navigation.coffee b/app/assets/javascripts/shortcuts_navigation.coffee
new file mode 100644
index 00000000000..e24a74ea9b6
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_navigation.coffee
@@ -0,0 +1,20 @@
+#= require shortcuts
+
+class @ShortcutsNavigation extends Shortcuts
+ constructor: ->
+ super()
+ Mousetrap.bind('g a', -> ShortcutsNavigation.findAndollowLink('.shortcuts-activity'))
+ Mousetrap.bind('g f', -> ShortcutsNavigation.findAndollowLink('.shortcuts-tree'))
+ Mousetrap.bind('g c', -> ShortcutsNavigation.findAndollowLink('.shortcuts-commits'))
+ Mousetrap.bind('g n', -> ShortcutsNavigation.findAndollowLink('.shortcuts-network'))
+ Mousetrap.bind('g g', -> ShortcutsNavigation.findAndollowLink('.shortcuts-graphs'))
+ Mousetrap.bind('g i', -> ShortcutsNavigation.findAndollowLink('.shortcuts-issues'))
+ Mousetrap.bind('g m', -> ShortcutsNavigation.findAndollowLink('.shortcuts-merge_requests'))
+ Mousetrap.bind('g w', -> ShortcutsNavigation.findAndollowLink('.shortcuts-wiki'))
+ Mousetrap.bind('g s', -> ShortcutsNavigation.findAndollowLink('.shortcuts-snippets'))
+ @enabledHelp.push('.hidden-shortcut.project')
+
+ @findAndollowLink: (selector) ->
+ link = $(selector).attr('href')
+ if link
+ window.location = link
diff --git a/app/assets/javascripts/shortcuts_network.js.coffee b/app/assets/javascripts/shortcuts_network.js.coffee
new file mode 100644
index 00000000000..cc95ad7ebfe
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_network.js.coffee
@@ -0,0 +1,12 @@
+#= require shortcuts_navigation
+
+class @ShortcutsNetwork extends ShortcutsNavigation
+ constructor: (@graph) ->
+ super()
+ Mousetrap.bind(['left', 'h'], @graph.scrollLeft)
+ Mousetrap.bind(['right', 'l'], @graph.scrollRight)
+ Mousetrap.bind(['up', 'k'], @graph.scrollUp)
+ Mousetrap.bind(['down', 'j'], @graph.scrollDown)
+ Mousetrap.bind(['shift+up', 'shift+k'], @graph.scrollTop)
+ Mousetrap.bind(['shift+down', 'shift+j'], @graph.scrollBottom)
+ @enabledHelp.push('.hidden-shortcut.network')
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index b596af38311..0d404f15055 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -59,4 +59,4 @@
/**
* Styles for responsive sidebar
*/
-@import "semantic-ui/modules/sidebar"
+@import "semantic-ui/modules/sidebar";
diff --git a/app/assets/stylesheets/behaviors.scss b/app/assets/stylesheets/behaviors.scss
index 23f206ce3dc..be4c4d07f1c 100644
--- a/app/assets/stylesheets/behaviors.scss
+++ b/app/assets/stylesheets/behaviors.scss
@@ -4,3 +4,9 @@
.js-details-container .content.hide { display: block; }
.js-details-container.open .content { display: block; }
.js-details-container.open .content.hide { display: none; }
+
+// Toggle between two states.
+.js-toggler-container .turn-on { display: block; }
+.js-toggler-container .turn-off { display: none; }
+.js-toggler-container.on .turn-on { display: none; }
+.js-toggler-container.on .turn-off { display: block; }
diff --git a/app/assets/stylesheets/generic/buttons.scss b/app/assets/stylesheets/generic/buttons.scss
index 36fc771a9dc..d098f1ecaa2 100644
--- a/app/assets/stylesheets/generic/buttons.scss
+++ b/app/assets/stylesheets/generic/buttons.scss
@@ -6,7 +6,7 @@
vertical-align: middle;
cursor: pointer;
background-image: none;
- border: 1px solid transparent;
+ border: $btn-border;
white-space: nowrap;
padding: 6px 12px;
font-size: 13px;
@@ -19,7 +19,6 @@
user-select: none;
color: #444444;
background-color: #fff;
- border-color: #ccc;
text-shadow: none;
&.hover,
@@ -152,16 +151,16 @@
}
&.btn-close {
- color: #B94A48;
- font-weight: bold;
+ color: $bg_danger;
+ border-color: $border_danger;
&:hover {
color: #B94A48;
}
}
&.btn-reopen {
- color: #468847;
- font-weight: bold;
+ color: $bg_success;
+ border-color: $border_success;
&:hover {
color: #468847;
}
diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss
index f5f86d0bb50..803219a2e86 100644
--- a/app/assets/stylesheets/generic/common.scss
+++ b/app/assets/stylesheets/generic/common.scss
@@ -16,6 +16,7 @@
.append-bottom-15 { margin-bottom:15px }
.append-bottom-20 { margin-bottom:20px }
.inline { display: inline-block }
+.center { text-align: center }
.underlined-link { text-decoration: underline; }
.hint { font-style: italic; color: #999; }
@@ -127,7 +128,7 @@ p.time {
}
.highlight_word {
- border-bottom: 2px solid #F90;
+ background: #fafe3d;
}
.thin_area{
@@ -256,13 +257,6 @@ li.note {
}
}
-h1.http_status_code {
- font-size: 56px;
- line-height: 100px;
- font-weight: normal;
- color: #456;
-}
-
.control-group {
.controls {
span {
@@ -343,3 +337,22 @@ table {
.wiki .highlight, .note-body .highlight {
margin-bottom: 9px;
}
+
+.footer-links a {
+ margin-right: 15px;
+}
+
+.search_box {
+ position: relative;
+ padding: 30px;
+ text-align: center;
+ background-color: #F9F9F9;
+ border: 1px solid #DDDDDD;
+ border-radius: 0px;
+}
+
+.search_glyph {
+ color: #555;
+ font-size: 42px;
+}
+
diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss
index c468980f64d..0679690c05f 100644
--- a/app/assets/stylesheets/generic/issue_box.scss
+++ b/app/assets/stylesheets/generic/issue_box.scss
@@ -88,6 +88,10 @@
.description {
padding: 0 15px 10px 15px;
+
+ code {
+ white-space: pre-wrap;
+ }
}
.title, .context, .description {
diff --git a/app/assets/stylesheets/generic/lists.scss b/app/assets/stylesheets/generic/lists.scss
index 0cab6c44c91..d347ab2c2e4 100644
--- a/app/assets/stylesheets/generic/lists.scss
+++ b/app/assets/stylesheets/generic/lists.scss
@@ -39,7 +39,7 @@
&:hover {
background: $hover;
- border-bottom: 1px solid #ADF;
+ border-bottom: 1px solid darken($hover, 10%);
}
&:last-child {
diff --git a/app/assets/stylesheets/generic/timeline.scss b/app/assets/stylesheets/generic/timeline.scss
new file mode 100644
index 00000000000..f29cf25fa4c
--- /dev/null
+++ b/app/assets/stylesheets/generic/timeline.scss
@@ -0,0 +1,77 @@
+.timeline {
+ list-style: none;
+ padding: 20px 0 20px;
+ position: relative;
+
+ &:before {
+ top: 0;
+ bottom: 0;
+ position: absolute;
+ content: " ";
+ width: 3px;
+ background-color: #eeeeee;
+ margin-left: 29px;
+ }
+
+ .timeline-entry {
+ position: relative;
+ margin-top: 5px;
+ margin-left: 30px;
+ margin-bottom: 10px;
+ clear: both;
+
+
+ &:target {
+ .timeline-entry-inner .timeline-content {
+ -webkit-animation:target-note 2s linear;
+ background: $hover;
+ }
+ }
+
+ .timeline-entry-inner {
+ position: relative;
+ margin-left: -20px;
+
+ &:before, &:after {
+ content: " ";
+ display: table;
+ }
+
+ .timeline-icon {
+ margin-top: 2px;
+ background: #fff;
+ color: #737881;
+ float: left;
+ @include border-radius(40px);
+ @include box-shadow(0 0 0 3px #EEE);
+ overflow: hidden;
+
+ .avatar {
+ margin: 0;
+ padding: 0;
+ }
+ }
+
+ .timeline-content {
+ position: relative;
+ background: #f5f5f6;
+ padding: 10px 15px;
+ margin-left: 60px;
+
+ &:after {
+ content: '';
+ display: block;
+ position: absolute;
+ width: 0;
+ height: 0;
+ border-style: solid;
+ border-width: 9px 9px 9px 0;
+ border-color: transparent #f5f5f6 transparent transparent;
+ left: 0;
+ top: 10px;
+ margin-left: -9px;
+ }
+ }
+ }
+ }
+}
diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss
index 9aa819d40fc..47802559a2c 100644
--- a/app/assets/stylesheets/generic/typography.scss
+++ b/app/assets/stylesheets/generic/typography.scss
@@ -40,7 +40,7 @@ a {
outline: none;
color: $link_color;
&:hover {
- text-decoration: none;
+ text-decoration: underline;
color: $link_hover_color;
}
diff --git a/app/assets/stylesheets/main/layout.scss b/app/assets/stylesheets/main/layout.scss
index e28da65c01f..2800feb81f2 100644
--- a/app/assets/stylesheets/main/layout.scss
+++ b/app/assets/stylesheets/main/layout.scss
@@ -16,3 +16,4 @@ body {
.container .content {
margin: 0 0;
}
+
diff --git a/app/assets/stylesheets/main/variables.scss b/app/assets/stylesheets/main/variables.scss
index c49f7db788e..72d84226fe7 100644
--- a/app/assets/stylesheets/main/variables.scss
+++ b/app/assets/stylesheets/main/variables.scss
@@ -2,13 +2,15 @@
* General Colors
*/
$style_color: #474D57;
-$hover: #D9EDF7;
+$hover: #FFECDB;
/*
* Link colors
*/
$link_color: #446e9b;
-$link_hover_color: #2FA0BB;
+$link_hover_color: darken($link-color, 10%);
+
+$btn-border: 1px solid #ccc;
/*
* Success colors (green)
diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss
index f00d024f389..0083d01c460 100644
--- a/app/assets/stylesheets/sections/commits.scss
+++ b/app/assets/stylesheets/sections/commits.scss
@@ -112,7 +112,9 @@
.commit-stat-summary {
color: #666;
- line-height: 2;
+ font-size: 14px;
+ font-weight: normal;
+ padding: 10px 0;
}
.commit-info-row {
@@ -177,10 +179,18 @@ li.commit {
.commit-row-description {
font-size: 14px;
- border-left: 1px solid #e5e5e5;
- padding: 0 15px 0 7px;
+ border-left: 1px solid #EEE;
+ padding: 10px 15px;
margin: 5px 0 10px 5px;
+ background: #f9f9f9;
display: none;
+
+ pre {
+ border: none;
+ background: inherit;
+ padding: 0;
+ margin: 0;
+ }
}
.commit-row-info {
@@ -234,6 +244,7 @@ li.commit {
font-family: inherit;
padding-left: $left;
position: relative;
+ resize: vertical;
z-index: 2;
}
}
diff --git a/app/assets/stylesheets/sections/dashboard.scss b/app/assets/stylesheets/sections/dashboard.scss
index 6487e0acd91..d181d83e857 100644
--- a/app/assets/stylesheets/sections/dashboard.scss
+++ b/app/assets/stylesheets/sections/dashboard.scss
@@ -60,12 +60,13 @@
}
.project-row, .group-row {
- padding: 8px 15px !important;
+ padding: 0 !important;
font-size: 14px;
line-height: 24px;
a {
display: block;
+ padding: 8px 15px;
}
.project-name, .group-name {
@@ -89,20 +90,19 @@
}
}
+.project-description {
+ overflow: hidden;
+}
+
.project-access-icon {
margin-left: 10px;
float: left;
margin-right: 15px;
font-size: 20px;
margin-bottom: 15px;
- border: 1px solid #EEE;
- padding: 8px 12px;
- border-radius: 50px;
- background: #f5f5f5;
- text-align: center;
i {
- color: #BBB;
+ color: #888;
}
}
diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss
index f4926e2f523..758f15c8013 100644
--- a/app/assets/stylesheets/sections/diff.scss
+++ b/app/assets/stylesheets/sections/diff.scss
@@ -40,14 +40,17 @@
font-size: 12px;
.old {
span.idiff {
- background-color: #FAA;
+ background-color: #F99;
}
}
.new {
span.idiff {
- background-color: #AFA;
+ background-color: #8F8;
}
}
+ .unfold {
+ cursor: pointer;
+ }
.file-mode-changed {
padding: 10px;
@@ -122,8 +125,6 @@
}
.line_content {
display: block;
- white-space: pre;
- height: 18px;
margin: 0px;
padding: 0px 0.5em;
border: none;
@@ -338,3 +339,12 @@
margin: 0;
border: none;
}
+
+.diff-file .line_content {
+ white-space: pre;
+}
+
+.diff-wrap-lines .line_content {
+ white-space: pre-wrap;
+}
+
diff --git a/app/assets/stylesheets/sections/errors.scss b/app/assets/stylesheets/sections/errors.scss
new file mode 100644
index 00000000000..32d2d7b1dbf
--- /dev/null
+++ b/app/assets/stylesheets/sections/errors.scss
@@ -0,0 +1,14 @@
+.error-page {
+ max-width: 400px;
+ margin: 0 auto;
+
+ h1, h2, h3 {
+ text-align: center;
+ }
+
+ h1 {
+ font-size: 56px;
+ line-height: 100px;
+ font-weight: 300;
+ }
+}
diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss
index 957af62c0ea..656aa5b18a6 100644
--- a/app/assets/stylesheets/sections/events.scss
+++ b/app/assets/stylesheets/sections/events.scss
@@ -156,12 +156,13 @@
.filter_icon {
a {
text-align:center;
- background: #EEE;
+ background: $bg_primary;
margin-bottom: 10px;
float: left;
padding: 9px 6px;
font-size: 18px;
width: 40px;
+ color: #FFF;
@include border-radius(3px);
}
diff --git a/app/assets/stylesheets/sections/explore.scss b/app/assets/stylesheets/sections/explore.scss
new file mode 100644
index 00000000000..9b92128624c
--- /dev/null
+++ b/app/assets/stylesheets/sections/explore.scss
@@ -0,0 +1,8 @@
+.explore-title {
+ text-align: center;
+
+ h3 {
+ font-weight: normal;
+ font-size: 30px;
+ }
+}
diff --git a/app/assets/stylesheets/sections/groups.scss b/app/assets/stylesheets/sections/groups.scss
index 60ec79acadb..e49fe1a9dd6 100644
--- a/app/assets/stylesheets/sections/groups.scss
+++ b/app/assets/stylesheets/sections/groups.scss
@@ -7,3 +7,7 @@
.member-search-form {
float: left;
}
+
+.milestone-row {
+ @include str-truncated(90%);
+}
diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss
index 29cb0f4b87c..e0e0d60c387 100644
--- a/app/assets/stylesheets/sections/header.scss
+++ b/app/assets/stylesheets/sections/header.scss
@@ -53,13 +53,9 @@ header {
font-size: 18px;
.app_logo { margin-left: -15px; }
+
.title {
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- vertical-align: top;
- white-space: nowrap;
- max-width: 70%;
+ @include str-truncated(70%);
}
.navbar-collapse {
@@ -130,6 +126,7 @@ header {
margin: 0;
margin-left: 5px;
@include header-font;
+ @include str-truncated(37%);
}
.profile-pic {
@@ -254,7 +251,7 @@ header {
.search .search-input {
width: 300px;
&:focus {
- width: 400px;
+ width: 330px;
}
}
@@ -262,7 +259,7 @@ header {
.search .search-input {
width: 200px;
&:focus {
- width: 300px;
+ width: 230px;
}
}
}
diff --git a/app/assets/stylesheets/sections/help.scss b/app/assets/stylesheets/sections/help.scss
index 90ed98ba25f..07c62f98c36 100644
--- a/app/assets/stylesheets/sections/help.scss
+++ b/app/assets/stylesheets/sections/help.scss
@@ -17,3 +17,56 @@
}
}
}
+
+
+.shortcut-mappings {
+ font-size: 12px;
+ color: #555;
+
+ tbody:first-child tr:first-child {
+ padding-top: 0
+ }
+
+ th {
+ padding-top: 15px;
+ font-size: 14px;
+ line-height: 1.5;
+ color: #333;
+ text-align: left
+ }
+
+ td {
+ padding-top: 3px;
+ padding-bottom: 3px;
+ vertical-align: top;
+ line-height: 20px
+ }
+
+ .shortcut {
+ padding-right: 10px;
+ color: #999;
+ text-align: right;
+ white-space: nowrap
+ }
+
+ .key {
+ @extend .label;
+ @extend .label-inverse;
+ font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
+ padding: 3px 5px;
+ }
+}
+
+.modal-body {
+ position: relative;
+ overflow-y: auto;
+ padding: 15px;
+}
+
+body.modal-open {
+ overflow: hidden;
+}
+
+.modal .modal-dialog {
+ width: 860px;
+}
diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss
index 495a7cb3113..a7fa715d2e0 100644
--- a/app/assets/stylesheets/sections/issues.scss
+++ b/app/assets/stylesheets/sections/issues.scss
@@ -63,26 +63,10 @@
@media (min-width: 800px) { .issues_bulk_update .select2-container { min-width: 120px; } }
@media (min-width: 1200px) { .issues_bulk_update .select2-container { min-width: 160px; } }
-.issues-holder {
- .issues_filters {
- }
-
- .issues_bulk_update {
- margin: 0;
- form {
- float:left;
- }
-
- .update_selected_issues {
- margin-left: 4px;
- }
-
- .select2-container .select2-choice {
- height: 32px;
- line-height: 28px;
- color: #444 !important;
- font-weight: 500;
- }
+.issues_bulk_update {
+ .select2-container .select2-choice {
+ color: #444 !important;
+ font-weight: 500;
}
}
@@ -110,7 +94,7 @@
}
}
-.issue-show-labels .label {
+.issue-show-labels .color-label {
padding: 6px 10px;
}
diff --git a/app/assets/stylesheets/sections/labels.scss b/app/assets/stylesheets/sections/labels.scss
new file mode 100644
index 00000000000..d1590e42fcb
--- /dev/null
+++ b/app/assets/stylesheets/sections/labels.scss
@@ -0,0 +1,21 @@
+.suggest-colors {
+ margin-top: 5px;
+ a {
+ @include border-radius(4px);
+ width: 30px;
+ height: 30px;
+ display: inline-block;
+ margin-right: 10px;
+ }
+}
+
+.manage-labels-list {
+ .label {
+ padding: 9px;
+ font-size: 14px;
+ }
+}
+
+.color-label {
+ padding: 3px 4px;
+}
diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss
index a78a9cd4879..1bcb1f6d68e 100644
--- a/app/assets/stylesheets/sections/login.scss
+++ b/app/assets/stylesheets/sections/login.scss
@@ -6,20 +6,41 @@
}
.login-box{
- max-width: 304px;
- position: relative;
- @include border-radius(5px);
- margin: auto;
- background: white;
+ padding: 0 15px;
+
+ .login-heading h3 {
+ font-weight: 300;
+ line-height: 2;
+ }
+
+ .login-footer {
+ margin-top: 10px;
+ }
+
+ .btn {
+ padding: 12px !important;
+ @extend .btn-block;
+ }
}
- .login-logo{
+ .brand-image {
+ img {
+ max-width: 100%;
+ margin-bottom: 20px;
+ }
+
+ &.default-brand-image {
+ margin: 0 80px;
+ }
+ }
+
+ .login-logo {
margin: 10px 0 30px 0;
display: block;
}
.form-control {
- background-color: #f1f1f1;
+ background-color: #F5F5F5;
font-size: 16px;
padding: 14px 10px;
width: 100%;
@@ -41,6 +62,10 @@
margin-bottom:0px;
@include border-radius(0);
}
+
+ &:active, &:focus {
+ background-color: #FFF;
+ }
}
.login-box a.forgot {
@@ -54,4 +79,8 @@
color: #a00;
}
}
+
+ .brand-holder {
+ border-right: 1px solid #EEE;
+ }
}
diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss
index 12044db6702..3db6da2a9f9 100644
--- a/app/assets/stylesheets/sections/merge_requests.scss
+++ b/app/assets/stylesheets/sections/merge_requests.scss
@@ -1,6 +1,6 @@
-/**
- * MR -> show: Automerge widget
+ /**
+ * MR -> show: Automerge widget
*
*/
.automerge_widget {
@@ -48,10 +48,10 @@
.label-branch {
@include border-radius(4px);
- padding: 2px 4px;
+ padding: 3px 4px;
border: none;
- background: #555;
- color: #fff;
+ background: $hover;
+ color: #333;
font-family: $monospace_font;
font-weight: normal;
overflow: hidden;
diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss
index f5d09c2df10..778953984d6 100644
--- a/app/assets/stylesheets/sections/nav.scss
+++ b/app/assets/stylesheets/sections/nav.scss
@@ -35,39 +35,31 @@
width: 1%;
&.active {
a {
- color: #333;
+ color: $link_color;
font-weight: bold;
&:after {
content: '';
display: block;
position: relative;
- bottom: 8px;
- left: 50%;
- width: 0;
- height: 0;
- border-color: transparent transparent #333 transparent;
+ bottom: -1px;
+ border-color: $link_color;
border-style: solid;
- border-width: 6px;
- margin-left: -6px;
+ border-width: 2px;
}
}
}
&:hover {
a {
- color: $link_color;
+ color: $link_hover_color;
&:after {
content: '';
display: block;
position: relative;
- bottom: 8px;
- left: 50%;
- width: 0;
- height: 0;
- border-color: transparent transparent $link_color transparent;
+ bottom: -1px;
+ border-color: $link_hover_color;
border-style: solid;
- border-width: 6px;
- margin-left: -6px;
+ border-width: 2px;
}
}
}
@@ -90,7 +82,6 @@
line-height: 34px;
color: #777;
text-shadow: 0 1px 1px white;
- padding: 0 10px;
text-decoration: none;
padding-top: 2px;
}
diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss
index e8d6ec3e29a..4e13e30bac8 100644
--- a/app/assets/stylesheets/sections/notes.scss
+++ b/app/assets/stylesheets/sections/notes.scss
@@ -17,7 +17,6 @@ ul.notes {
.discussion-header,
.note-header {
@extend .cgray;
- padding-top: 5px;
padding-bottom: 15px;
.avatar {
@@ -43,58 +42,19 @@ ul.notes {
}
.discussion {
- padding: 8px 0;
overflow: hidden;
display: block;
position:relative;
-
- .discussion-body {
- margin-left: 50px;
-
- .diff-file,
- .discussion-hidden,
- .notes {
- background-color: #F9F9F9;
- }
- .diff-file .notes {
- /* reset */
- background: inherit;
- border: none;
- @include box-shadow(none);
-
- }
- .discussion-hidden .note {
- @extend .cgray;
- padding: 8px;
- text-align: center;
- }
- .notes .note {
- border-color: #ddd;
- padding: 8px;
- }
- .reply-btn {
- margin-top: 8px;
- }
- }
}
.note {
- padding: 8px 0;
- overflow: hidden;
display: block;
position:relative;
- border-bottom: 1px solid #eee;
- p { color: $style_color; }
-
- .avatar {
- margin-top: 3px;
- }
.attachment {
font-size: 14px;
}
.note-body {
@include md-typography;
- margin-left: 43px;
}
.note-header {
padding-bottom: 3px;
@@ -104,11 +64,6 @@ ul.notes {
border-bottom: none;
}
}
-
- .note:target {
- -webkit-animation:target-note 2s linear;
- background: #fffff0;
- }
}
.diff-file .notes_holder {
@@ -123,7 +78,7 @@ ul.notes {
&.notes_line {
text-align: center;
padding: 10px 0;
- background: #eee;
+ background: #FFF;
}
&.notes_line2 {
text-align: center;
@@ -137,10 +92,6 @@ ul.notes {
vertical-align: top;
}
}
-
- .reply-btn {
- margin: 5px;
- }
}
/**
@@ -376,3 +327,21 @@ ul.notes {
margin-top: 5px;
margin-bottom: 5px;
}
+
+.discussion-body,
+.diff-file {
+ .notes .note {
+ border-color: #ddd;
+ padding: 10px 15px;
+ }
+
+ .discussion-reply-holder {
+ background: #f9f9f9;
+ padding: 10px 15px;
+ border-top: 1px solid #DDD;
+ }
+}
+
+.discussion-notes-count {
+ font-size: 16px;
+}
diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss
index 34dd3448f53..918ac554ea3 100644
--- a/app/assets/stylesheets/sections/projects.scss
+++ b/app/assets/stylesheets/sections/projects.scss
@@ -15,62 +15,64 @@
}
.project-home-panel {
- border-bottom: 1px solid #DDD;
- padding-bottom: 15px;
- margin-bottom: 30px;
+ margin-bottom: 15px;
&.empty-project {
- border-bottom: 0px;
- padding-bottom: 15px;
- margin-bottom: 0px;
+ border-bottom: 0px;
+ padding-bottom: 15px;
+ margin-bottom: 0px;
}
- .project-home-title {
- font-size: 18px;
- color: #444;
- margin: 0;
- line-height: 32px;
- }
.project-home-dropdown {
margin-left: 10px;
float: right;
}
- .project-home-extra {
- margin-top: 15px;
+
+ .project-home-row {
+ @extend .clearfix;
+ margin-bottom: 15px;
.project-home-desc {
float: left;
- color: #777;
- margin-bottom: 10px;
+ color: #666;
+ font-size: 16px;
}
- .project-home-links {
+ .star-fork-buttons {
float: right;
- a {
- margin-left: 10px;
- font-weight: 500;
+ width: 200px;
+ font-size: 14px;
+ font-weight: bold;
+
+ .star-buttons, .fork-buttons {
+ float: right;
+ margin-left: 20px;
+
+ .count {
+ margin-left: 5px;
+ }
}
}
}
.visibility-level-label {
- font-size: 17px;
- background: #f1f1f1;
- border-radius: 4px;
- color: #444;
- position: absolute;
- margin-left: -55px;
- text-shadow: 0 1px 1px #FFF;
- width: 40px;
- text-align: center;
- padding: 6px;
-
+ color: #555;
+ font-weight: bold;
i {
color: inherit;
}
}
}
+.project-home-links {
+ padding: 10px 0px;
+ float: right;
+ a {
+ margin-left: 10px;
+ font-weight: 500;
+ }
+}
+
.git-clone-holder {
.project-home-dropdown + & {
margin-right: 45px;
@@ -159,6 +161,7 @@ ul.nav.nav-projects-tabs {
li {
.project-info {
margin-bottom: 10px;
+ overflow: hidden;
}
.access-icon {
@@ -172,8 +175,8 @@ ul.nav.nav-projects-tabs {
}
.public-clone {
- background: #333;
- color: #f5f5f5;
+ background: #EEE;
+ color: #777;
padding: 6px 10px;
margin: 1px;
font-weight: normal;
@@ -190,28 +193,40 @@ ul.nav.nav-projects-tabs {
.project-side {
.btn-block {
background-image: none;
- .btn,
- &.btn,
- &.btn-group ul.dropdown-menu {
- background-color: #F1f1f1;
- border-color: #EEE;
+
+ .btn, &.btn {
+ white-space: normal;
+ text-align: left;
+ padding: 10px 15px;
+ background-color: #F9F9F9;
+ border-color: #DDD;
+
&:hover {
background-color: #eee;
border-color: #DDD;
}
}
- &.btn-group-justified {
- .btn {
- width: 100%;
- }
- .dropdown-toggle {
- width: 26px;
- }
+
+ .count {
+ float: right;
+ font-weight: 500;
+ text-shadow: 0 1px #FFF;
}
- ul {
+
+ &.btn-group-justified {
+ .btn {
width: 100%;
+ }
+ .dropdown-toggle {
+ width: 30px;
+ padding: 10px;
+ }
+ ul {
+ width: 100%;
+ }
}
}
+
.project-fork-icon {
float: left;
font-size: 26px;
diff --git a/app/assets/stylesheets/sections/search.scss b/app/assets/stylesheets/sections/search.scss
new file mode 100644
index 00000000000..bdaa17ac339
--- /dev/null
+++ b/app/assets/stylesheets/sections/search.scss
@@ -0,0 +1,7 @@
+.search-results {
+ .search-result-row {
+ border-bottom: 1px solid #EEE;
+ padding-bottom: 10px;
+ margin-bottom: 10px;
+ }
+}
diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss
index b08f94f55a0..678a6cd716d 100644
--- a/app/assets/stylesheets/sections/tree.scss
+++ b/app/assets/stylesheets/sections/tree.scss
@@ -28,6 +28,7 @@
}
td {
border-color: #F1F1F1 !important;
+ border-bottom: 1px solid;
}
&:hover {
td {
diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb
index 9a70ef9d199..e1643bb34bf 100644
--- a/app/controllers/admin/broadcast_messages_controller.rb
+++ b/app/controllers/admin/broadcast_messages_controller.rb
@@ -6,7 +6,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
end
def create
- @broadcast_message = BroadcastMessage.new(params[:broadcast_message])
+ @broadcast_message = BroadcastMessage.new(broadcast_message_params)
if @broadcast_message.save
redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully created.'
@@ -29,4 +29,11 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
def broadcast_messages
@broadcast_messages ||= BroadcastMessage.order("starts_at DESC").page(params[:page])
end
+
+ def broadcast_message_params
+ params.require(:broadcast_message).permit(
+ :alert_type, :color, :ends_at, :font,
+ :message, :starts_at
+ )
+ end
end
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index 1a523d081dd..0388997ec69 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -20,7 +20,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
def create
- @group = Group.new(params[:group])
+ @group = Group.new(group_params)
@group.path = @group.name.dup.parameterize if @group.name
if @group.save
@@ -32,7 +32,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
def update
- if @group.update_attributes(params[:group])
+ if @group.update_attributes(group_params)
redirect_to [:admin, @group], notice: 'Group was successfully updated.'
else
render "edit"
@@ -56,4 +56,8 @@ class Admin::GroupsController < Admin::ApplicationController
def group
@group = Group.find_by(path: params[:id])
end
+
+ def group_params
+ params.require(:group).permit(:name, :description, :path, :avatar)
+ end
end
diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb
index c5bf76f8c39..0a463239d74 100644
--- a/app/controllers/admin/hooks_controller.rb
+++ b/app/controllers/admin/hooks_controller.rb
@@ -5,7 +5,7 @@ class Admin::HooksController < Admin::ApplicationController
end
def create
- @hook = SystemHook.new(params[:hook])
+ @hook = SystemHook.new(hook_params)
if @hook.save
redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
@@ -37,4 +37,8 @@ class Admin::HooksController < Admin::ApplicationController
redirect_to :back
end
+
+ def hook_params
+ params.require(:hook).permit(:url)
+ end
end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index f0040bf5e87..f63df27eebd 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -13,7 +13,7 @@ class Admin::UsersController < Admin::ApplicationController
end
def new
- @user = User.build_user
+ @user = User.new
end
def edit
@@ -37,17 +37,15 @@ class Admin::UsersController < Admin::ApplicationController
end
def create
- admin = params[:user].delete("admin")
-
opts = {
force_random_password: true,
- password_expires_at: Time.now
+ password_expires_at: nil
}
- @user = User.build_user(params[:user].merge(opts), as: :admin)
- @user.admin = (admin && admin.to_i > 0)
+ @user = User.new(user_params.merge(opts))
@user.created_by_id = current_user.id
@user.generate_password
+ @user.generate_reset_token
@user.skip_confirmation!
respond_to do |format|
@@ -62,19 +60,17 @@ class Admin::UsersController < Admin::ApplicationController
end
def update
- admin = params[:user].delete("admin")
-
- if params[:user][:password].blank?
- params[:user].delete(:password)
- params[:user].delete(:password_confirmation)
- end
+ user_params_with_pass = user_params.dup
- if admin.present?
- user.admin = !admin.to_i.zero?
+ if params[:user][:password].present?
+ user_params_with_pass.merge!(
+ password: params[:user][:password],
+ password_confirmation: params[:user][:password_confirmation],
+ )
end
respond_to do |format|
- if user.update_attributes(params[:user], as: :admin)
+ if user.update_attributes(user_params_with_pass)
user.confirm!
format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' }
format.json { head :ok }
@@ -115,4 +111,13 @@ class Admin::UsersController < Admin::ApplicationController
def user
@user ||= User.find_by!(username: params[:id])
end
+
+ def user_params
+ params.require(:user).permit(
+ :email, :remember_me, :bio, :name, :username,
+ :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password,
+ :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key,
+ :projects_limit, :can_create_group, :admin
+ )
+ end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d58890fa33b..5ffec7f75bf 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,6 +1,7 @@
require 'gon'
class ApplicationController < ActionController::Base
+ before_filter :authenticate_user_from_token!
before_filter :authenticate_user!
before_filter :reject_blocked!
before_filter :check_password_expiration
@@ -28,6 +29,25 @@ class ApplicationController < ActionController::Base
protected
+ # From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
+ # https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
+ def authenticate_user_from_token!
+ user_token = if params[:authenticity_token].presence
+ params[:authenticity_token].presence
+ elsif params[:private_token].presence
+ params[:private_token].presence
+ end
+ user = user_token && User.find_by_authentication_token(user_token.to_s)
+
+ if user
+ # Notice we are passing store false, so the user is not
+ # actually stored in the session and a token is needed
+ # for every request. If you want the token to work as a
+ # sign in token, you can simply remove store: false.
+ sign_in user, store: false
+ end
+ end
+
def log_exception(exception)
application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace
application_trace.map!{ |t| " #{t}\n" }
@@ -48,7 +68,7 @@ class ApplicationController < ActionController::Base
flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
new_user_session_path
else
- @return_to || root_path
+ stored_location_for(:redirect) || stored_location_for(resource) || root_path
end
end
@@ -181,15 +201,10 @@ class ApplicationController < ActionController::Base
def ldap_security_check
if current_user && current_user.requires_ldap_check?
- gitlab_ldap_access do |access|
- if access.allowed?(current_user)
- current_user.last_credential_check_at = Time.now
- current_user.save
- else
- sign_out current_user
- flash[:alert] = "Access denied for your LDAP account."
- redirect_to new_user_session_path
- end
+ unless Gitlab::LDAP::Access.allowed?(current_user)
+ sign_out current_user
+ flash[:alert] = "Access denied for your LDAP account."
+ redirect_to new_user_session_path
end
end
end
@@ -226,8 +241,7 @@ class ApplicationController < ActionController::Base
end
def configure_permitted_parameters
- devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email, :password, :login, :remember_me) }
- devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :name, :password, :password_confirmation) }
+ devise_parameter_sanitizer.sanitize(:sign_in) { |u| u.permit(:username, :email, :password, :login, :remember_me) }
end
def hexdigest(string)
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index 233b91680f6..5aff526d1b5 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -46,11 +46,11 @@ class DashboardController < ApplicationController
@projects = @projects.where(namespace_id: Group.find_by(name: params[:group])) if params[:group].present?
@projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
@projects = @projects.includes(:namespace)
- @projects = @projects.tagged_with(params[:label]) if params[:label].present?
+ @projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
@projects = @projects.sort(@sort = params[:sort])
@projects = @projects.page(params[:page]).per(30)
- @labels = current_user.authorized_projects.tags_on(:labels)
+ @tags = current_user.authorized_projects.tags_on(:tags)
@groups = current_user.authorized_groups
end
diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb
new file mode 100644
index 00000000000..f8e1a31e0b3
--- /dev/null
+++ b/app/controllers/explore/groups_controller.rb
@@ -0,0 +1,14 @@
+class Explore::GroupsController < ApplicationController
+ skip_before_filter :authenticate_user!,
+ :reject_blocked, :set_current_user_for_observers,
+ :add_abilities
+
+ layout "explore"
+
+ def index
+ @groups = GroupsFinder.new.execute(current_user)
+ @groups = @groups.search(params[:search]) if params[:search].present?
+ @groups = @groups.sort(@sort = params[:sort])
+ @groups = @groups.page(params[:page]).per(20)
+ end
+end
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb
new file mode 100644
index 00000000000..b6fa8b7e387
--- /dev/null
+++ b/app/controllers/explore/projects_controller.rb
@@ -0,0 +1,25 @@
+class Explore::ProjectsController < ApplicationController
+ skip_before_filter :authenticate_user!,
+ :reject_blocked,
+ :add_abilities
+
+ layout 'explore'
+
+ def index
+ @projects = ProjectsFinder.new.execute(current_user)
+ @projects = @projects.search(params[:search]) if params[:search].present?
+ @projects = @projects.sort(@sort = params[:sort])
+ @projects = @projects.includes(:namespace).page(params[:page]).per(20)
+ end
+
+ def trending
+ @trending_projects = TrendingProjectsFinder.new.execute(current_user)
+ @trending_projects = @trending_projects.page(params[:page]).per(10)
+ end
+
+ def starred
+ @starred_projects = ProjectsFinder.new.execute(current_user)
+ @starred_projects = @starred_projects.order('star_count DESC')
+ @starred_projects = @starred_projects.page(params[:page]).per(10)
+ end
+end
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb
new file mode 100644
index 00000000000..860d8e03922
--- /dev/null
+++ b/app/controllers/groups/milestones_controller.rb
@@ -0,0 +1,56 @@
+class Groups::MilestonesController < ApplicationController
+ layout 'group'
+
+ before_filter :authorize_group_milestone!, only: :update
+
+ def index
+ project_milestones = case params[:status]
+ when 'all'; status
+ when 'closed'; status('closed')
+ else status('active')
+ end
+ @group_milestones = Milestones::GroupService.new(project_milestones).execute
+ @group_milestones = Kaminari.paginate_array(@group_milestones).page(params[:page]).per(30)
+ end
+
+ def show
+ project_milestones = Milestone.where(project_id: group.projects).order("due_date ASC")
+ @group_milestone = Milestones::GroupService.new(project_milestones).milestone(title)
+ end
+
+ def update
+ project_milestones = Milestone.where(project_id: group.projects).order("due_date ASC")
+ @group_milestones = Milestones::GroupService.new(project_milestones).milestone(title)
+
+ @group_milestones.milestones.each do |milestone|
+ Milestones::UpdateService.new(milestone.project, current_user, params[:milestone]).execute(milestone)
+ end
+
+ respond_to do |format|
+ format.js
+ format.html do
+ redirect_to group_milestones_path(group)
+ end
+ end
+ end
+
+ private
+
+ def group
+ @group ||= Group.find_by(path: params[:group_id])
+ end
+
+ def title
+ params[:title]
+ end
+
+ def status(state = nil)
+ conditions = { project_id: group.projects }
+ conditions.reverse_merge!(state: state) if state
+ Milestone.where(conditions).order("title ASC")
+ end
+
+ def authorize_group_milestone!
+ return render_404 unless can?(current_user, :manage_group, group)
+ end
+end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index a2629c51384..ddde90d3ee0 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -22,7 +22,7 @@ class GroupsController < ApplicationController
end
def create
- @group = Group.new(params[:group])
+ @group = Group.new(group_params)
@group.path = @group.name.dup.parameterize if @group.name
if @group.save
@@ -84,7 +84,7 @@ class GroupsController < ApplicationController
end
def update
- if @group.update_attributes(params[:group])
+ if @group.update_attributes(group_params)
redirect_to edit_group_path(@group), notice: 'Group was successfully updated.'
else
render action: "edit"
@@ -159,4 +159,8 @@ class GroupsController < ApplicationController
params[:state] = 'opened' if params[:state].blank?
params[:group_id] = @group.id
end
+
+ def group_params
+ params.require(:group).permit(:name, :description, :path, :avatar)
+ end
end
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index 0c87fe0d9ae..3ed6a69c2d8 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -21,16 +21,21 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
@user = Gitlab::LDAP::User.find_or_create(oauth)
@user.remember_me = true if @user.persisted?
- gitlab_ldap_access do |access|
- if access.allowed?(@user)
- sign_in_and_redirect(@user)
- else
- flash[:alert] = "Access denied for your LDAP account."
- redirect_to new_user_session_path
- end
+ # Do additional LDAP checks for the user filter and EE features
+ if Gitlab::LDAP::Access.allowed?(@user)
+ sign_in_and_redirect(@user)
+ else
+ flash[:alert] = "Access denied for your LDAP account."
+ redirect_to new_user_session_path
end
end
+ def omniauth_error
+ @provider = params[:provider]
+ @error = params[:error]
+ render 'errors/omniauth_error', layout: "errors", status: 422
+ end
+
private
def handle_omniauth
@@ -45,14 +50,19 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# Create user if does not exist
# and allow_single_sign_on is true
- if Gitlab.config.omniauth['allow_single_sign_on']
- @user ||= Gitlab::OAuth::User.create(oauth)
+ if Gitlab.config.omniauth['allow_single_sign_on'] && !@user
+ @user, errors = Gitlab::OAuth::User.create(oauth)
end
- if @user
+ if @user && !errors
sign_in_and_redirect(@user)
else
- flash[:notice] = "There's no such user!"
+ if errors
+ error_message = errors.map{ |attribute, message| "#{attribute} #{message}" }.join(", ")
+ redirect_to omniauth_error_path(oauth['provider'], error: error_message) and return
+ else
+ flash[:notice] = "There's no such user!"
+ end
redirect_to new_user_session_path
end
end
diff --git a/app/controllers/profiles/emails_controller.rb b/app/controllers/profiles/emails_controller.rb
index 40c352dab0c..f3f0e69b83a 100644
--- a/app/controllers/profiles/emails_controller.rb
+++ b/app/controllers/profiles/emails_controller.rb
@@ -7,7 +7,7 @@ class Profiles::EmailsController < ApplicationController
end
def create
- @email = current_user.emails.new(params[:email])
+ @email = current_user.emails.new(email_params)
flash[:alert] = @email.errors.full_messages.first unless @email.save
@@ -23,4 +23,10 @@ class Profiles::EmailsController < ApplicationController
format.js { render nothing: true }
end
end
+
+ private
+
+ def email_params
+ params.require(:email).permit(:email)
+ end
end
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
index 6713cd7c8c7..88414b13564 100644
--- a/app/controllers/profiles/keys_controller.rb
+++ b/app/controllers/profiles/keys_controller.rb
@@ -15,7 +15,7 @@ class Profiles::KeysController < ApplicationController
end
def create
- @key = current_user.keys.new(params[:key])
+ @key = current_user.keys.new(key_params)
if @key.save
redirect_to profile_key_path(@key)
@@ -53,4 +53,9 @@ class Profiles::KeysController < ApplicationController
end
end
+ private
+
+ def key_params
+ params.require(:key).permit(:title, :key)
+ end
end
diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb
index df6954554ea..1191ce47eba 100644
--- a/app/controllers/profiles/passwords_controller.rb
+++ b/app/controllers/profiles/passwords_controller.rb
@@ -11,8 +11,13 @@ class Profiles::PasswordsController < ApplicationController
end
def create
- new_password = params[:user][:password]
- new_password_confirmation = params[:user][:password_confirmation]
+ unless @user.valid_password?(user_params[:current_password])
+ redirect_to new_profile_password_path, alert: 'You must provide a valid current password'
+ return
+ end
+
+ new_password = user_params[:password]
+ new_password_confirmation = user_params[:password_confirmation]
result = @user.update_attributes(
password: new_password,
@@ -31,11 +36,11 @@ class Profiles::PasswordsController < ApplicationController
end
def update
- password_attributes = params[:user].select do |key, value|
+ password_attributes = user_params.select do |key, value|
%w(password password_confirmation).include?(key.to_s)
end
- unless @user.valid_password?(params[:user][:current_password])
+ unless @user.valid_password?(user_params[:current_password])
redirect_to edit_profile_password_path, alert: 'You must provide a valid current password'
return
end
@@ -74,4 +79,8 @@ class Profiles::PasswordsController < ApplicationController
def authorize_change_password!
return render_404 if @user.ldap_user?
end
+
+ def user_params
+ params.require(:user).permit(:current_password, :password, :password_confirmation)
+ end
end
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index 9c9a129b26b..e877f9b9049 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -14,9 +14,9 @@ class ProfilesController < ApplicationController
end
def update
- params[:user].delete(:email) if @user.ldap_user?
+ user_params.except!(:email) if @user.ldap_user?
- if @user.update_attributes(params[:user])
+ if @user.update_attributes(user_params)
flash[:notice] = "Profile was successfully updated"
else
flash[:alert] = "Failed to update profile"
@@ -41,7 +41,7 @@ class ProfilesController < ApplicationController
end
def update_username
- @user.update_attributes(username: params[:user][:username])
+ @user.update_attributes(username: user_params[:username])
respond_to do |format|
format.js
@@ -57,4 +57,12 @@ class ProfilesController < ApplicationController
def authorize_change_username!
return render_404 unless @user.can_change_username?
end
+
+ def user_params
+ params.require(:user).permit(
+ :email, :password, :password_confirmation, :bio, :name, :username,
+ :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id,
+ :avatar, :hide_no_ssh_key,
+ )
+ end
end
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index a1a8bed09f4..7009e3b1bc8 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -25,13 +25,32 @@ class Projects::BlobController < Projects::ApplicationController
end
end
+ def diff
+ @form = UnfoldForm.new(params)
+ @lines = @blob.data.lines[@form.since - 1..@form.to - 1]
+
+ if @form.bottom?
+ @match_line = ''
+ else
+ lines_length = @lines.length - 1
+ line = [@form.since, lines_length].join(',')
+ @match_line = "@@ -#{line}+#{line} @@"
+ end
+
+ render layout: false
+ end
+
private
def blob
@blob ||= @repository.blob_at(@commit.id, @path)
- return not_found! unless @blob
-
- @blob
+ if @blob
+ @blob
+ elsif tree.entries.any?
+ redirect_to project_tree_path(@project, File.join(@ref, @path)) and return
+ else
+ return not_found!
+ end
end
end
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 3c8e7ec73f6..6845fc5e6e6 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -17,9 +17,17 @@ class Projects::BranchesController < Projects::ApplicationController
end
def create
- @branch = CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user)
-
- redirect_to project_tree_path(@project, @branch.name)
+ result = CreateBranchService.new.execute(project,
+ params[:branch_name],
+ params[:ref],
+ current_user)
+ if result[:status] == :success
+ @branch = result[:branch]
+ redirect_to project_tree_path(@project, @branch.name)
+ else
+ @error = result[:message]
+ render action: 'new'
+ end
end
def destroy
diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb
index 860ab408299..c344297ba8a 100644
--- a/app/controllers/projects/commit_controller.rb
+++ b/app/controllers/projects/commit_controller.rb
@@ -20,11 +20,10 @@ class Projects::CommitController < Projects::ApplicationController
end
begin
- @suppress_diff = true if commit.diff_suppress? && !params[:force_show_diff]
- @force_suppress_diff = commit.diff_force_suppress?
+ @diffs = @commit.diffs
rescue Grit::Git::GitTimeout
- @suppress_diff = true
- @status = :huge_commit
+ @diffs = []
+ @diff_timeout = true
end
@note = project.build_commit_note(commit)
@@ -38,12 +37,7 @@ class Projects::CommitController < Projects::ApplicationController
}
respond_to do |format|
- format.html do
- if @status == :huge_commit
- render "huge_commit" and return
- end
- end
-
+ format.html
format.diff { render text: @commit.to_diff }
format.patch { render text: @commit.to_patch }
end
diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb
index 12856191c26..038645aa497 100644
--- a/app/controllers/projects/commits_controller.rb
+++ b/app/controllers/projects/commits_controller.rb
@@ -13,6 +13,8 @@ class Projects::CommitsController < Projects::ApplicationController
@limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
@commits = @repo.commits(@ref, @path, @limit, @offset)
+ @note_counts = Note.where(commit_id: @commits.map(&:id)).
+ group(:commit_id).count
respond_to do |format|
format.html # index.html.erb
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb
index 234b6058ff0..7a671e8455d 100644
--- a/app/controllers/projects/compare_controller.rb
+++ b/app/controllers/projects/compare_controller.rb
@@ -8,18 +8,21 @@ class Projects::CompareController < Projects::ApplicationController
end
def show
- compare = Gitlab::Git::Compare.new(@repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE)
+ base_ref = params[:from]
+ head_ref = params[:to]
- @commits = compare.commits
- @commit = compare.commit
- @diffs = compare.diffs
- @refs_are_same = compare.same
- @line_notes = []
- @timeout = compare.timeout
+ compare_result = CompareService.new.execute(
+ current_user,
+ @project,
+ head_ref,
+ @project,
+ base_ref
+ )
- diff_line_count = Commit::diff_line_count(@diffs)
- @suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count) && !params[:force_show_diff]
- @force_suppress_diff = Commit::diff_force_suppress?(@diffs, diff_line_count)
+ @commits = compare_result.commits
+ @diffs = compare_result.diffs
+ @commit = @commits.last
+ @line_notes = []
end
def create
diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb
index 6e1a76ff417..d20937ea8ea 100644
--- a/app/controllers/projects/deploy_keys_controller.rb
+++ b/app/controllers/projects/deploy_keys_controller.rb
@@ -22,7 +22,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
end
def create
- @key = DeployKey.new(params[:deploy_key])
+ @key = DeployKey.new(deploy_key_params)
if @key.valid? && @project.deploy_keys << @key
redirect_to project_deploy_keys_path(@project)
@@ -58,4 +58,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
def available_keys
@available_keys ||= current_user.accessible_deploy_keys
end
+
+ def deploy_key_params
+ params.require(:deploy_key).permit(:key, :title)
+ end
end
diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb
index be611892bb0..ca83b21f429 100644
--- a/app/controllers/projects/edit_tree_controller.rb
+++ b/app/controllers/projects/edit_tree_controller.rb
@@ -28,8 +28,6 @@ class Projects::EditTreeController < Projects::BaseTreeController
def preview
@content = params[:content]
- #FIXME workaround https://github.com/gitlabhq/gitlabhq/issues/5936
- @content += "\n" if @blob.data.end_with?("\n")
diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3',
include_diff_info: true)
diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb
index c43d26385f7..cab8fd76e6c 100644
--- a/app/controllers/projects/hooks_controller.rb
+++ b/app/controllers/projects/hooks_controller.rb
@@ -12,7 +12,7 @@ class Projects::HooksController < Projects::ApplicationController
end
def create
- @hook = @project.hooks.new(params[:hook])
+ @hook = @project.hooks.new(hook_params)
@hook.save
if @hook.valid?
@@ -24,7 +24,17 @@ class Projects::HooksController < Projects::ApplicationController
end
def test
- TestHookService.new.execute(hook, current_user)
+ if !@project.empty_repo?
+ status = TestHookService.new.execute(hook, current_user)
+ if status
+ flash[:notice] = 'Hook successfully executed.'
+ else
+ flash[:alert] = 'Hook execution failed. '\
+ 'Ensure hook URL is correct and service is up.'
+ end
+ else
+ flash[:alert] = 'Hook execution failed. Ensure the project has commits.'
+ end
redirect_to :back
end
@@ -40,4 +50,8 @@ class Projects::HooksController < Projects::ApplicationController
def hook
@hook ||= @project.hooks.find(params[:id])
end
+
+ def hook_params
+ params.require(:hook).permit(:url, :push_events, :issues_events, :merge_requests_events, :tag_push_events)
+ end
end
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index ddea8901f9b..0b49803cfec 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -20,7 +20,7 @@ class Projects::IssuesController < Projects::ApplicationController
terms = params['issue_search']
@issues = issues_filtered
- @issues = @issues.where("title LIKE ?", "%#{terms}%") if terms.present?
+ @issues = @issues.full_search(terms) if terms.present?
@issues = @issues.page(params[:page]).per(20)
assignee_id, milestone_id = params[:assignee_id], params[:milestone_id]
@@ -42,7 +42,11 @@ class Projects::IssuesController < Projects::ApplicationController
end
def new
- @issue = @project.issues.new(params[:issue])
+ params[:issue] ||= ActionController::Parameters.new(
+ assignee_id: ""
+ )
+
+ @issue = @project.issues.new(issue_params)
respond_with(@issue)
end
@@ -59,7 +63,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
def create
- @issue = Issues::CreateService.new(project, current_user, params[:issue]).execute
+ @issue = Issues::CreateService.new(project, current_user, issue_params).execute
respond_to do |format|
format.html do
@@ -76,7 +80,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
def update
- @issue = Issues::UpdateService.new(project, current_user, params[:issue]).execute(issue)
+ @issue = Issues::UpdateService.new(project, current_user, issue_params).execute(issue)
respond_to do |format|
format.js
@@ -144,4 +148,11 @@ class Projects::IssuesController < Projects::ApplicationController
raise ActiveRecord::RecordNotFound.new
end
end
+
+ def issue_params
+ params.require(:issue).permit(
+ :title, :assignee_id, :position, :description,
+ :milestone_id, :state_event, label_ids: []
+ )
+ end
end
diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb
index 30fcb64cbb2..6c7bde9c5d5 100644
--- a/app/controllers/projects/labels_controller.rb
+++ b/app/controllers/projects/labels_controller.rb
@@ -1,12 +1,38 @@
class Projects::LabelsController < Projects::ApplicationController
before_filter :module_enabled
-
+ before_filter :label, only: [:edit, :update, :destroy]
before_filter :authorize_labels!
+ before_filter :authorize_admin_labels!, except: [:index]
respond_to :js, :html
def index
- @labels = @project.issues_labels
+ @labels = @project.labels.order_by_name.page(params[:page]).per(20)
+ end
+
+ def new
+ @label = @project.labels.new
+ end
+
+ def create
+ @label = @project.labels.create(label_params)
+
+ if @label.valid?
+ redirect_to project_labels_path(@project)
+ else
+ render 'new'
+ end
+ end
+
+ def edit
+ end
+
+ def update
+ if @label.update_attributes(label_params)
+ redirect_to project_labels_path(@project)
+ else
+ render 'edit'
+ end
end
def generate
@@ -21,6 +47,15 @@ class Projects::LabelsController < Projects::ApplicationController
end
end
+ def destroy
+ @label.destroy
+
+ respond_to do |format|
+ format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
+ format.js
+ end
+ end
+
protected
def module_enabled
@@ -28,4 +63,16 @@ class Projects::LabelsController < Projects::ApplicationController
return render_404
end
end
+
+ def label_params
+ params.require(:label).permit(:title, :color)
+ end
+
+ def label
+ @label = @project.labels.find(params[:id])
+ end
+
+ def authorize_admin_labels!
+ return render_404 unless can?(current_user, :admin_label, @project)
+ end
end
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 1abedc1f272..8dca0400693 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -32,6 +32,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def show
+ @note_counts = Note.where(commit_id: @merge_request.commits.map(&:id)).
+ group(:commit_id).count
+
respond_to do |format|
format.html
format.diff { render text: @merge_request.to_diff(current_user) }
@@ -41,16 +44,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def diffs
@commit = @merge_request.last_commit
-
@comments_allowed = @reply_allowed = true
- @comments_target = {noteable_type: 'MergeRequest',
- noteable_id: @merge_request.id}
+ @comments_target = {
+ noteable_type: 'MergeRequest',
+ noteable_id: @merge_request.id
+ }
@line_notes = @merge_request.notes.where("line_code is not null")
- diff_line_count = Commit::diff_line_count(@merge_request.diffs)
- @suppress_diff = Commit::diff_suppress?(@merge_request.diffs, diff_line_count) && !params[:force_show_diff]
- @force_suppress_diff = Commit::diff_force_suppress?(@merge_request.diffs, diff_line_count)
-
respond_to do |format|
format.html
format.json { render json: { html: view_to_html_string("projects/merge_requests/show/_diffs") } }
@@ -58,43 +58,22 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def new
- @merge_request = MergeRequest.new(params[:merge_request])
- @merge_request.source_project = @project unless @merge_request.source_project
- @merge_request.target_project ||= (@project.forked_from_project || @project)
- @target_branches = @merge_request.target_project.nil? ? [] : @merge_request.target_project.repository.branch_names
- @merge_request.target_branch ||= @merge_request.target_project.default_branch
- @source_project = @merge_request.source_project
-
- if @merge_request.target_branch && @merge_request.source_branch
- compare_action = Gitlab::Satellite::CompareAction.new(
- current_user,
- @merge_request.target_project,
- @merge_request.target_branch,
- @merge_request.source_project,
- @merge_request.source_branch
- )
-
- @compare_failed = false
- @commits = compare_action.commits
-
- if @commits
- @commits.map! { |commit| Commit.new(commit) }
- @commit = @commits.first
- else
- # false value because failed to get commits from satellite
- @commits = []
- @compare_failed = true
- end
+ params[:merge_request] ||= ActionController::Parameters.new(source_project: @project)
+ @merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute
- @diffs = compare_action.diffs
- @merge_request.title = @merge_request.source_branch.titleize.humanize
- @target_project = @merge_request.target_project
- @target_repo = @target_project.repository
+ @target_branches = if @merge_request.target_project
+ @merge_request.target_project.repository.branch_names
+ else
+ []
+ end
- diff_line_count = Commit::diff_line_count(@diffs)
- @suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count)
- @force_suppress_diff = @suppress_diff
- end
+ @target_project = merge_request.target_project
+ @source_project = merge_request.source_project
+ @commits = @merge_request.compare_commits
+ @commit = @merge_request.compare_commits.last
+ @diffs = @merge_request.compare_diffs
+ @note_counts = Note.where(commit_id: @commits.map(&:id)).
+ group(:commit_id).count
end
def edit
@@ -105,7 +84,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def create
@target_branches ||= []
- @merge_request = MergeRequests::CreateService.new(project, current_user, params[:merge_request]).execute
+ @merge_request = MergeRequests::CreateService.new(project, current_user, merge_request_params).execute
if @merge_request.valid?
redirect_to project_merge_request_path(@merge_request.target_project, @merge_request), notice: 'Merge request was successfully created.'
@@ -117,7 +96,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def update
- @merge_request = MergeRequests::UpdateService.new(project, current_user, params[:merge_request]).execute(@merge_request)
+ @merge_request = MergeRequests::UpdateService.new(project, current_user, merge_request_params).execute(@merge_request)
if @merge_request.valid?
respond_to do |format|
@@ -258,4 +237,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
can?(current_user, action, project)
end
+
+ def merge_request_params
+ params.require(:merge_request).permit(
+ :title, :assignee_id, :source_project_id, :source_branch,
+ :target_project_id, :target_branch, :milestone_id,
+ :state_event, :description, label_ids: []
+ )
+ end
end
diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb
index c38c77d6b85..d338cdedfaf 100644
--- a/app/controllers/projects/milestones_controller.rb
+++ b/app/controllers/projects/milestones_controller.rb
@@ -37,7 +37,7 @@ class Projects::MilestonesController < Projects::ApplicationController
end
def create
- @milestone = Milestones::CreateService.new(project, current_user, params[:milestone]).execute
+ @milestone = Milestones::CreateService.new(project, current_user, milestone_params).execute
if @milestone.save
redirect_to project_milestone_path(@project, @milestone)
@@ -47,7 +47,7 @@ class Projects::MilestonesController < Projects::ApplicationController
end
def update
- @milestone = Milestones::UpdateService.new(project, current_user, params[:milestone]).execute(milestone)
+ @milestone = Milestones::UpdateService.new(project, current_user, milestone_params).execute(milestone)
respond_to do |format|
format.js
@@ -105,4 +105,8 @@ class Projects::MilestonesController < Projects::ApplicationController
def module_enabled
return render_404 unless @project.issues_enabled
end
+
+ def milestone_params
+ params.require(:milestone).permit(:title, :description, :due_date, :state_event)
+ end
end
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 5df92b29eda..7b08b79d236 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -21,7 +21,7 @@ class Projects::NotesController < Projects::ApplicationController
end
def create
- @note = Notes::CreateService.new(project, current_user, params[:note]).execute
+ @note = Notes::CreateService.new(project, current_user, note_params).execute
respond_to do |format|
format.json { render_note_json(@note) }
@@ -30,8 +30,10 @@ class Projects::NotesController < Projects::ApplicationController
end
def update
- note.update_attributes(params[:note])
- note.reset_events_cache
+ if note.editable?
+ note.update_attributes(note_params)
+ note.reset_events_cache
+ end
respond_to do |format|
format.json { render_note_json(note) }
@@ -40,8 +42,10 @@ class Projects::NotesController < Projects::ApplicationController
end
def destroy
- note.destroy
- note.reset_events_cache
+ if note.editable?
+ note.destroy
+ note.reset_events_cache
+ end
respond_to do |format|
format.js { render nothing: true }
@@ -85,16 +89,35 @@ class Projects::NotesController < Projects::ApplicationController
)
end
+ def note_to_discussion_with_diff_html(note)
+ return unless note.for_diff_line?
+
+ render_to_string(
+ "projects/notes/_discussion",
+ layout: false,
+ formats: [:html],
+ locals: { discussion_notes: [note] }
+ )
+ end
+
def render_note_json(note)
render json: {
id: note.id,
discussion_id: note.discussion_id,
html: note_to_html(note),
- discussion_html: note_to_discussion_html(note)
+ discussion_html: note_to_discussion_html(note),
+ discussion_with_diff_html: note_to_discussion_with_diff_html(note)
}
end
def authorize_admin_note!
return access_denied! unless can?(current_user, :admin_note, note)
end
+
+ def note_params
+ params.require(:note).permit(
+ :note, :noteable, :noteable_id, :noteable_type, :project_id,
+ :attachment, :line_code, :commit_id
+ )
+ end
end
diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb
index e39e97af8dd..bd31b1d3c54 100644
--- a/app/controllers/projects/protected_branches_controller.rb
+++ b/app/controllers/projects/protected_branches_controller.rb
@@ -11,7 +11,7 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
end
def create
- @project.protected_branches.create(params[:protected_branch])
+ @project.protected_branches.create(protected_branch_params)
redirect_to project_protected_branches_path(@project)
end
@@ -23,4 +23,10 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
format.js { render nothing: true }
end
end
+
+ private
+
+ def protected_branch_params
+ params.require(:protected_branch).permit(:name)
+ end
end
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb
index a6b7ae3f127..5ec9c576a66 100644
--- a/app/controllers/projects/raw_controller.rb
+++ b/app/controllers/projects/raw_controller.rb
@@ -29,12 +29,10 @@ class Projects::RawController < Projects::ApplicationController
private
def get_blob_type
- if @blob.mime_type =~ /html|javascript/
+ if @blob.text?
'text/plain; charset=utf-8'
- elsif @blob.name =~ /(?:msi|exe|rar|r0\d|7z|7zip|zip)$/
- 'application/octet-stream'
else
- @blob.mime_type
+ 'application/octet-stream'
end
end
end
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index 8834a995081..7997c726fbb 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -37,7 +37,7 @@ class Projects::RefsController < Projects::ApplicationController
0
end
- @limit = 10
+ @limit = 25
@path = params[:path]
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb
index 28fed8b0e3f..f30eaadd928 100644
--- a/app/controllers/projects/repositories_controller.rb
+++ b/app/controllers/projects/repositories_controller.rb
@@ -14,14 +14,11 @@ class Projects::RepositoriesController < Projects::ApplicationController
render_404 and return
end
- storage_path = Gitlab.config.gitlab.repository_downloads_path
-
- @repository.clean_old_archives
-
- file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase)
+ file_path = ArchiveRepositoryService.new.execute(@project, params[:ref], params[:format])
if file_path
# Send file to user
+ response.headers["Content-Length"] = File.open(file_path).size.to_s
send_file file_path
else
render_404
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
index 6db22186c14..b143dec3a93 100644
--- a/app/controllers/projects/services_controller.rb
+++ b/app/controllers/projects/services_controller.rb
@@ -16,7 +16,7 @@ class Projects::ServicesController < Projects::ApplicationController
end
def update
- if @service.update_attributes(params[:service])
+ if @service.update_attributes(service_params)
redirect_to edit_project_service_path(@project, @service.to_param)
else
render 'edit'
@@ -36,4 +36,11 @@ class Projects::ServicesController < Projects::ApplicationController
def service
@service ||= @project.services.find { |service| service.to_param == params[:id] }
end
+
+ def service_params
+ params.require(:service).permit(
+ :title, :token, :type, :active, :api_key, :subdomain,
+ :room, :recipients, :project_url
+ )
+ end
end
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb
index f93f2d5f9bb..cba058fe214 100644
--- a/app/controllers/projects/snippets_controller.rb
+++ b/app/controllers/projects/snippets_controller.rb
@@ -25,7 +25,7 @@ class Projects::SnippetsController < Projects::ApplicationController
end
def create
- @snippet = @project.snippets.build(params[:project_snippet])
+ @snippet = @project.snippets.build(snippet_params)
@snippet.author = current_user
if @snippet.save
@@ -39,7 +39,7 @@ class Projects::SnippetsController < Projects::ApplicationController
end
def update
- if @snippet.update_attributes(params[:project_snippet])
+ if @snippet.update_attributes(snippet_params)
redirect_to project_snippet_path(@project, @snippet)
else
respond_with(@snippet)
@@ -63,7 +63,7 @@ class Projects::SnippetsController < Projects::ApplicationController
def raw
send_data(
@snippet.content,
- type: "text/plain",
+ type: 'text/plain; charset=utf-8',
disposition: 'inline',
filename: @snippet.file_name
)
@@ -86,4 +86,8 @@ class Projects::SnippetsController < Projects::ApplicationController
def module_enabled
return render_404 unless @project.snippets_enabled
end
+
+ def snippet_params
+ params.require(:project_snippet).permit(:title, :content, :file_name, :private)
+ end
end
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb
index e03a9f4d66d..86788b9963b 100644
--- a/app/controllers/projects/tags_controller.rb
+++ b/app/controllers/projects/tags_controller.rb
@@ -13,10 +13,16 @@ class Projects::TagsController < Projects::ApplicationController
end
def create
- @tag = CreateTagService.new.execute(@project, params[:tag_name],
- params[:ref], current_user)
-
- redirect_to project_tags_path(@project)
+ result = CreateTagService.new.execute(@project, params[:tag_name],
+ params[:ref], params[:message],
+ current_user)
+ if result[:status] == :success
+ @tag = result[:tag]
+ redirect_to project_tags_path(@project)
+ else
+ @error = result[:message]
+ render action: 'new'
+ end
end
def destroy
diff --git a/app/controllers/projects/team_members_controller.rb b/app/controllers/projects/team_members_controller.rb
index 44068878cd1..1de5bac9ee8 100644
--- a/app/controllers/projects/team_members_controller.rb
+++ b/app/controllers/projects/team_members_controller.rb
@@ -27,7 +27,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
def update
@user_project_relation = project.users_projects.find_by(user_id: member)
- @user_project_relation.update_attributes(params[:team_member])
+ @user_project_relation.update_attributes(member_params)
unless @user_project_relation.valid?
flash[:alert] = "User should have at least one role"
@@ -67,4 +67,8 @@ class Projects::TeamMembersController < Projects::ApplicationController
def member
@member ||= User.find_by(username: params[:id])
end
+
+ def member_params
+ params.require(:team_member).permit(:user_id, :project_access)
+ end
end
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index 30c94ec6da0..4d033b36848 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -1,7 +1,14 @@
# Controller for viewing a repository's file structure
class Projects::TreeController < Projects::BaseTreeController
def show
- return not_found! if tree.entries.empty?
+
+ if tree.entries.empty?
+ if @repository.blob_at(@commit.id, @path)
+ redirect_to project_blob_path(@project, File.join(@ref, @path)) and return
+ else
+ return not_found!
+ end
+ end
respond_to do |format|
format.html
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index 496064c9a65..0e03956e738 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -12,12 +12,10 @@ class Projects::WikisController < Projects::ApplicationController
def show
@page = @project_wiki.find_page(params[:id], params[:version_id])
- gollum_wiki = @project_wiki.wiki
- file = gollum_wiki.file(params[:id], gollum_wiki.ref, true)
if @page
render 'show'
- elsif file
+ elsif file = @project_wiki.find_file(params[:id], params[:version_id])
if file.on_disk?
send_file file.on_disk_path, disposition: 'inline'
else
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 2dcc19bed07..f23afaf28fa 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -20,7 +20,7 @@ class ProjectsController < ApplicationController
end
def create
- @project = ::Projects::CreateService.new(current_user, params[:project]).execute
+ @project = ::Projects::CreateService.new(current_user, project_params).execute
flash[:notice] = 'Project was successfully created.' if @project.saved?
respond_to do |format|
@@ -29,7 +29,7 @@ class ProjectsController < ApplicationController
end
def update
- status = ::Projects::UpdateService.new(@project, current_user, params).execute
+ status = ::Projects::UpdateService.new(@project, current_user, project_params).execute
respond_to do |format|
if status
@@ -44,7 +44,7 @@ class ProjectsController < ApplicationController
end
def transfer
- ::Projects::TransferService.new(project, current_user, params[:project]).execute
+ ::Projects::TransferService.new(project, current_user, project_params).execute
end
def show
@@ -60,6 +60,8 @@ class ProjectsController < ApplicationController
@events = event_filter.apply_filter(@events)
@events = @events.limit(limit).offset(params[:offset] || 0)
+ @show_star = !(current_user && current_user.starred?(@project))
+
respond_to do |format|
format.html do
if @project.empty_repo?
@@ -85,7 +87,7 @@ class ProjectsController < ApplicationController
redirect_to import_project_path(@project)
end
- @project.import_url = params[:project][:import_url]
+ @project.import_url = project_params[:import_url]
if @project.save
@project.reload
@@ -124,18 +126,12 @@ class ProjectsController < ApplicationController
def autocomplete_sources
note_type = params['type']
note_id = params['type_id']
- participating = if note_type && note_id
- participants_in(note_type, note_id)
- else
- []
- end
- team_members = sorted(@project.team.members)
- participants = team_members + participating
+ participants = ::Projects::ParticipantsService.new(@project).execute(note_type, note_id)
@suggestions = {
emojis: Emoji.names.map { |e| { name: e, path: view_context.image_url("emoji/#{e}.png") } },
issues: @project.issues.select([:iid, :title, :description]),
mergerequests: @project.merge_requests.select([:iid, :title, :description]),
- members: participants.uniq
+ members: participants
}
respond_to do |format|
@@ -173,6 +169,12 @@ class ProjectsController < ApplicationController
end
end
+ def toggle_star
+ current_user.toggle_star(@project)
+ @project.reload
+ render json: { star_count: @project.star_count }
+ end
+
private
def upload_path
@@ -192,24 +194,11 @@ class ProjectsController < ApplicationController
current_user ? "projects" : "public_projects"
end
- def participants_in(type, id)
- users = case type
- when "Issue"
- issue = @project.issues.find_by_iid(id)
- issue ? issue.participants : []
- when "MergeRequest"
- merge_request = @project.merge_requests.find_by_iid(id)
- merge_request ? merge_request.participants : []
- when "Commit"
- author_ids = Note.for_commit_id(id).pluck(:author_id).uniq
- User.where(id: author_ids)
- else
- []
- end
- sorted(users)
- end
-
- def sorted(users)
- users.uniq.to_a.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } }
+ def project_params
+ params.require(:project).permit(
+ :name, :path, :description, :issues_tracker, :tag_list,
+ :issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch,
+ :wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id
+ )
end
end
diff --git a/app/controllers/public/projects_controller.rb b/app/controllers/public/projects_controller.rb
deleted file mode 100644
index d6238f79547..00000000000
--- a/app/controllers/public/projects_controller.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class Public::ProjectsController < ApplicationController
- skip_before_filter :authenticate_user!,
- :reject_blocked, :set_current_user_for_observers,
- :add_abilities
-
- layout 'public'
-
- def index
- @projects = Project.publicish(current_user)
- @projects = @projects.search(params[:search]) if params[:search].present?
- @projects = @projects.sort(@sort = params[:sort])
- @projects = @projects.includes(:namespace).page(params[:page]).per(20)
- end
-end
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 5f18bac82ed..9e70978992f 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -13,7 +13,14 @@ class RegistrationsController < Devise::RegistrationsController
def build_resource(hash=nil)
super
- self.resource.with_defaults
+ end
+
+ def after_sign_up_path_for resource
+ new_user_session_path
+ end
+
+ def after_inactive_sign_up_path_for resource
+ new_user_session_path
end
private
@@ -21,4 +28,8 @@ class RegistrationsController < Devise::RegistrationsController
def signup_enabled?
redirect_to new_user_session_path unless Gitlab.config.gitlab.signup_enabled
end
+
+ def sign_up_params
+ params.require(:user).permit(:username, :email, :name, :password, :password_confirmation)
+ end
end
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 8df84e9884a..a58b24de643 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -4,14 +4,25 @@ class SearchController < ApplicationController
def show
@project = Project.find_by(id: params[:project_id]) if params[:project_id].present?
@group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
+ @scope = params[:scope]
- if @project
- return access_denied! unless can?(current_user, :download_code, @project)
+ @search_results = if @project
+ return access_denied! unless can?(current_user, :download_code, @project)
- @search_results = Search::ProjectService.new(@project, current_user, params).execute
- else
- @search_results = Search::GlobalService.new(current_user, params).execute
- end
+ unless %w(blobs notes issues merge_requests).include?(@scope)
+ @scope = 'blobs'
+ end
+
+ Search::ProjectService.new(@project, current_user, params).execute
+ else
+ unless %w(projects issues merge_requests).include?(@scope)
+ @scope = 'projects'
+ end
+
+ Search::GlobalService.new(current_user, params).execute
+ end
+
+ @objects = @search_results.objects(@scope, params[:page])
end
def autocomplete
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
new file mode 100644
index 00000000000..1bdba75c5e7
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,27 @@
+class SessionsController < Devise::SessionsController
+
+ def new
+ redirect_path = if request.referer.present? && (params['redirect_to_referer'] == 'yes')
+ referer_uri = URI(request.referer)
+ if referer_uri.host == Gitlab.config.gitlab.host
+ referer_uri.path
+ else
+ request.fullpath
+ end
+ else
+ request.fullpath
+ end
+
+ # Prevent a 'you are already signed in' message directly after signing:
+ # we should never redirect to '/users/sign_in' after signing in successfully.
+ unless redirect_path == '/users/sign_in'
+ store_location_for(:redirect, redirect_path)
+ end
+
+ super
+ end
+
+ def create
+ super
+ end
+end
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 4fe98f804dc..3927584235e 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -51,7 +51,7 @@ class SnippetsController < ApplicationController
end
def create
- @snippet = PersonalSnippet.new(params[:personal_snippet])
+ @snippet = PersonalSnippet.new(snippet_params)
@snippet.author = current_user
if @snippet.save
@@ -65,7 +65,7 @@ class SnippetsController < ApplicationController
end
def update
- if @snippet.update_attributes(params[:personal_snippet])
+ if @snippet.update_attributes(snippet_params)
redirect_to snippet_path(@snippet)
else
respond_with @snippet
@@ -86,7 +86,7 @@ class SnippetsController < ApplicationController
def raw
send_data(
@snippet.content,
- type: "text/plain",
+ type: 'text/plain; charset=utf-8',
disposition: 'inline',
filename: @snippet.file_name
)
@@ -109,4 +109,8 @@ class SnippetsController < ApplicationController
def set_title
@title = 'Snippets'
end
+
+ def snippet_params
+ params.require(:personal_snippet).permit(:title, :content, :file_name, :private)
+ end
end
diff --git a/app/controllers/users_groups_controller.rb b/app/controllers/users_groups_controller.rb
index b9bdc189522..a35a12a866b 100644
--- a/app/controllers/users_groups_controller.rb
+++ b/app/controllers/users_groups_controller.rb
@@ -14,7 +14,7 @@ class UsersGroupsController < ApplicationController
def update
@member = @group.users_groups.find(params[:id])
- @member.update_attributes(params[:users_group])
+ @member.update_attributes(member_params)
end
def destroy
@@ -41,4 +41,8 @@ class UsersGroupsController < ApplicationController
return render_404
end
end
+
+ def member_params
+ params.require(:users_group).permit(:group_access, :user_id)
+ end
end
diff --git a/app/controllers/users_sessions_controller.rb b/app/controllers/users_sessions_controller.rb
deleted file mode 100644
index 656c92376fd..00000000000
--- a/app/controllers/users_sessions_controller.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class UsersSessionsController < Devise::SessionsController
- def create
- @return_to = params[:return_to]
- super
- end
-end
diff --git a/app/finders/base_finder.rb b/app/finders/issuable_finder.rb
index 7150bb2e31b..56c4f22120d 100644
--- a/app/finders/base_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -1,4 +1,4 @@
-# BaseFinder
+# IssuableFinder
#
# Used to filter Issues and MergeRequests collections by set of params
#
@@ -16,7 +16,9 @@
# label_name: string
# sort: string
#
-class BaseFinder
+require_relative 'projects_finder'
+
+class IssuableFinder
attr_accessor :current_user, :params
def execute(current_user, params)
@@ -125,7 +127,13 @@ class BaseFinder
def by_label(items)
if params[:label_name].present?
- items = items.tagged_with(params[:label_name])
+ label_names = params[:label_name].split(",")
+
+ item_ids = LabelLink.joins(:label).
+ where('labels.title in (?)', label_names).
+ where(target_type: klass.name).pluck(:target_id)
+
+ items = items.where(id: item_ids)
end
items
diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb
index 8e0c606249e..20a2b0ce8f0 100644
--- a/app/finders/issues_finder.rb
+++ b/app/finders/issues_finder.rb
@@ -15,7 +15,7 @@
# label_name: string
# sort: string
#
-class IssuesFinder < BaseFinder
+class IssuesFinder < IssuableFinder
def klass
Issue
end
diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb
index 3727149c8fb..b258216d0d4 100644
--- a/app/finders/merge_requests_finder.rb
+++ b/app/finders/merge_requests_finder.rb
@@ -15,7 +15,7 @@
# label_name: string
# sort: string
#
-class MergeRequestsFinder < BaseFinder
+class MergeRequestsFinder < IssuableFinder
def klass
MergeRequest
end
diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb
index ea055694cd7..bef82d7f0fd 100644
--- a/app/finders/notes_finder.rb
+++ b/app/finders/notes_finder.rb
@@ -14,7 +14,7 @@ class NotesFinder
project.issues.find(target_id).notes.inc_author.fresh
when "merge_request"
project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh
- when "snippet"
+ when "snippet", "project_snippet"
project.snippets.find(target_id).notes.fresh
else
raise 'invalid target_type'
diff --git a/app/finders/trending_projects_finder.rb b/app/finders/trending_projects_finder.rb
new file mode 100644
index 00000000000..32d7968924a
--- /dev/null
+++ b/app/finders/trending_projects_finder.rb
@@ -0,0 +1,19 @@
+class TrendingProjectsFinder
+ def execute(current_user, start_date = nil)
+ start_date ||= Date.today - 1.month
+
+ projects = projects_for(current_user)
+
+ # Determine trending projects based on comments count
+ # for period of time - ex. month
+ projects.joins(:notes).where('notes.created_at > ?', start_date).
+ select("projects.*, count(notes.id) as ncount").
+ group("projects.id").order("ncount DESC")
+ end
+
+ private
+
+ def projects_for(current_user)
+ ProjectsFinder.new.execute(current_user)
+ end
+end
diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb
new file mode 100644
index 00000000000..96e5d43a369
--- /dev/null
+++ b/app/helpers/appearances_helper.rb
@@ -0,0 +1,17 @@
+module AppearancesHelper
+ def brand_item
+ nil
+ end
+
+ def brand_title
+ 'GitLab Community Edition'
+ end
+
+ def brand_image
+ nil
+ end
+
+ def brand_text
+ nil
+ end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c3d89eb1b82..e6d50bea4d1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -221,7 +221,18 @@ module ApplicationHelper
end
def render_markup(file_name, file_content)
- GitHub::Markup.render(file_name, file_content).html_safe
+ GitHub::Markup.render(file_name, file_content).
+ force_encoding(file_content.encoding).html_safe
+ rescue RuntimeError
+ simple_format(file_content)
+ end
+
+ def markup?(filename)
+ Gitlab::MarkdownHelper.markup?(filename)
+ end
+
+ def gitlab_markdown?(filename)
+ Gitlab::MarkdownHelper.gitlab_markdown?(filename)
end
def spinner(text = nil, visible = false)
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index 4d27cf2851e..f61aa259154 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
module CommitsHelper
# Returns a link to the commit author. If the author has a matching user and
# is a member of the current @project it will link to the team member page.
@@ -180,6 +181,17 @@ module CommitsHelper
return old_lines, new_lines
end
+ def link_to_browse_code(project, commit)
+ if current_controller?(:projects, :commits)
+ if @repo.blob_at(commit.id, @path)
+ return link_to "Browse File »", project_blob_path(project, tree_join(commit.id, @path)), class: "pull-right"
+ elsif @path.present?
+ return link_to "Browse Dir »", project_tree_path(project, tree_join(commit.id, @path)), class: "pull-right"
+ end
+ end
+ link_to "Browse Code »", project_tree_path(project, commit), class: "pull-right"
+ end
+
protected
# Private: Returns a link to a person. If the person has a matching user and
@@ -220,4 +232,16 @@ module CommitsHelper
def diff_file_mode_changed?(diff)
diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
end
+
+ def unfold_bottom_class(bottom)
+ (bottom) ? 'js-unfold-bottom' : ''
+ end
+
+ def view_file_btn(commit_sha, diff, project)
+ link_to project_blob_path(project, tree_join(commit_sha, diff.new_path)),
+ class: 'btn btn-small view-file js-view-file' do
+ raw('View file @') + content_tag(:span, commit_sha[0..6],
+ class: 'commit-short-id')
+ end
+ end
end
diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb
index d5712ab3374..c4e33e3308f 100644
--- a/app/helpers/dashboard_helper.rb
+++ b/app/helpers/dashboard_helper.rb
@@ -35,4 +35,42 @@ module DashboardHelper
path << "?#{options.to_param}"
path
end
+
+ def assigned_entities_count(current_user, entity, scope = nil)
+ items = current_user.send("assigned_" + entity.pluralize).opened
+
+ if scope.kind_of?(Group)
+ items = items.of_group(scope)
+ elsif scope.kind_of?(Project)
+ items = items.of_projects(scope)
+ end
+
+ items.count
+ end
+
+ def authored_entities_count(current_user, entity, scope = nil)
+ items = current_user.send(entity.pluralize).opened
+
+ if scope.kind_of?(Group)
+ items = items.of_group(scope)
+ elsif scope.kind_of?(Project)
+ items = items.of_projects(scope)
+ end
+
+ items.count
+ end
+
+ def authorized_entities_count(current_user, entity, scope = nil)
+ items = entity.classify.constantize.opened
+
+ if scope.kind_of?(Group)
+ items = items.of_group(scope)
+ elsif scope.kind_of?(Project)
+ items = items.of_projects(scope)
+ else
+ items = items.of_projects(current_user.authorized_projects)
+ end
+
+ items.count
+ end
end
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
new file mode 100644
index 00000000000..ee4d4fbdff5
--- /dev/null
+++ b/app/helpers/diff_helper.rb
@@ -0,0 +1,22 @@
+module DiffHelper
+ def safe_diff_files(diffs)
+ if diff_hard_limit_enabled?
+ diffs.first(Commit::DIFF_HARD_LIMIT_FILES)
+ else
+ diffs.first(Commit::DIFF_SAFE_FILES)
+ end
+ end
+
+ def show_diff_size_warninig?(diffs)
+ safe_diff_files(diffs).size < diffs.size
+ end
+
+ def diff_hard_limit_enabled?
+ # Enabling hard limit allows user to see more diff information
+ if params[:force_show_diff].present?
+ true
+ else
+ false
+ end
+ end
+end
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index d3904e16c11..a4f93689a7b 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -45,15 +45,17 @@ module EventsHelper
def event_feed_title(event)
if event.issue?
- "#{event.author_name} #{event.action_name} issue ##{event.target_id}: #{event.issue_title} at #{event.project_name}"
+ "#{event.author_name} #{event.action_name} issue ##{event.target_iid}: #{event.issue_title} at #{event.project_name}"
elsif event.merge_request?
- "#{event.author_name} #{event.action_name} MR ##{event.target_id}: #{event.merge_request_title} at #{event.project_name}"
+ "#{event.author_name} #{event.action_name} MR ##{event.target_iid}: #{event.merge_request_title} at #{event.project_name}"
elsif event.push?
"#{event.author_name} #{event.push_action_name} #{event.ref_type} #{event.ref_name} at #{event.project_name}"
elsif event.membership_changed?
"#{event.author_name} #{event.action_name} #{event.project_name}"
+ elsif event.note? && event.note_commit?
+ "#{event.author_name} commented on #{event.note_target_type} #{event.note_short_commit_id} at #{event.project_name}"
elsif event.note?
- "#{event.author_name} commented on #{event.note_target_type} ##{truncate event.note_target_id} at #{event.project_name}"
+ "#{event.author_name} commented on #{event.note_target_type} ##{truncate event.note_target_iid} at #{event.project_name}"
else
""
end
@@ -64,7 +66,18 @@ module EventsHelper
project_issue_url(event.project, event.issue)
elsif event.merge_request?
project_merge_request_url(event.project, event.merge_request)
-
+ elsif event.note? && event.note_commit?
+ project_commit_url(event.project, event.note_target)
+ elsif event.note?
+ if event.note_target
+ if event.note_commit?
+ project_commit_path(event.project, event.note_commit_id, anchor: dom_id(event.target))
+ elsif event.note_project_snippet?
+ project_snippet_path(event.project, event.note_target)
+ else
+ event_note_target_path(event)
+ end
+ end
elsif event.push?
if event.push_with_commits?
if event.commits_count > 1
@@ -83,6 +96,12 @@ module EventsHelper
render "events/event_issue", issue: event.issue
elsif event.push?
render "events/event_push", event: event
+ elsif event.merge_request?
+ render "events/event_merge_request", merge_request: event.merge_request
+ elsif event.push?
+ render "events/event_push", event: event
+ elsif event.note?
+ render "events/event_note", note: event.note
end
end
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index db5b4eacd1f..e4aa90154fb 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -63,10 +63,14 @@ module GitlabMarkdownHelper
paths = extract_paths(text)
paths.uniq.each do |file_path|
- new_path = rebuild_path(file_path)
- # Finds quoted path so we don't replace other mentions of the string
- # eg. "doc/api" will be replaced and "/home/doc/api/text" won't
- text.gsub!("\"#{file_path}\"", "\"/#{new_path}\"")
+ # If project does not have repository
+ # its nothing to rebuild
+ if @repository.exists? && !@repository.empty?
+ new_path = rebuild_path(file_path)
+ # Finds quoted path so we don't replace other mentions of the string
+ # eg. "doc/api" will be replaced and "/home/doc/api/text" won't
+ text.gsub!("\"#{file_path}\"", "\"/#{new_path}\"")
+ end
end
text
@@ -91,7 +95,12 @@ module GitlabMarkdownHelper
end
def link_to_ignore?(link)
- ignored_protocols.map{ |protocol| link.include?(protocol) }.any?
+ if link =~ /\#\w+/
+ # ignore anchors like <a href="#my-header">
+ true
+ else
+ ignored_protocols.map{ |protocol| link.include?(protocol) }.any?
+ end
end
def ignored_protocols
@@ -129,7 +138,7 @@ module GitlabMarkdownHelper
# If we are at doc/api/README.md and the README.md contains relative links like [Users](users.md)
# this takes the request path(doc/api/README.md), and replaces the README.md with users.md so the path looks like doc/api/users.md
# If we are at doc/api and the README.md shown in below the tree view
- # this takes the rquest path(doc/api) and adds users.md so the path looks like doc/api/users.md
+ # this takes the request path(doc/api) and adds users.md so the path looks like doc/api/users.md
def build_nested_path(path, request_path)
return request_path if path == ""
return path unless request_path
@@ -169,8 +178,12 @@ module GitlabMarkdownHelper
def current_sha
if @commit
@commit.id
- else
- @repository.head_commit.sha
+ elsif @repository && !@repository.empty?
+ if @ref
+ @repository.commit(@ref).try(:sha)
+ else
+ @repository.head_commit.sha
+ end
end
end
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index cfc9a572cac..0dc53dedeb7 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -31,6 +31,17 @@ module GroupsHelper
end
title
+ end
+
+ def group_filter_path(entity, options={})
+ exist_opts = {
+ status: params[:status]
+ }
+
+ options = exist_opts.merge(options)
+ path = request.path
+ path << "?#{options.to_param}"
+ path
end
end
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 4d20b827a0d..19d688c4bb8 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -1,28 +1,37 @@
module LabelsHelper
- def issue_label_names
- @project.issues_labels.map(&:name)
+ def project_label_names
+ @project.labels.pluck(:title)
end
- def labels_autocomplete_source
- labels = @project.issues_labels
- labels = labels.map{ |l| { label: l.name, value: l.name } }
- labels.to_json
+ def render_colored_label(label)
+ label_color = label.color || Label::DEFAULT_COLOR
+ text_color = text_color_for_bg(label_color)
+
+ content_tag :span, class: 'label color-label', style: "background:#{label_color};color:#{text_color}" do
+ label.name
+ end
+ end
+
+ def suggested_colors
+ [
+ '#D9534F',
+ '#F0AD4E',
+ '#428BCA',
+ '#5CB85C',
+ '#34495E',
+ '#7F8C8D',
+ '#8E44AD',
+ '#FFECDB'
+ ]
end
- def label_css_class(name)
- klass = Gitlab::IssuesLabels
+ def text_color_for_bg(bg_color)
+ r, g, b = bg_color.slice(1,7).scan(/.{2}/).map(&:hex)
- case name.downcase
- when *klass.warning_labels
- 'label-warning'
- when *klass.neutral_labels
- 'label-primary'
- when *klass.positive_labels
- 'label-success'
- when *klass.important_labels
- 'label-danger'
+ if (r + g + b) > 500
+ "#333"
else
- 'label-info'
+ "#FFF"
end
end
end
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 9ed38ba84b2..53ac5febd61 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -15,12 +15,6 @@ module NotesHelper
end
end
- def link_to_merge_request_diff_line_note(note)
- if note.for_merge_request_diff_line? and note.diff
- link_to "#{note.diff_file_name}:L#{note.diff_new_line}", diffs_project_merge_request_path(note.project, note.noteable, anchor: note.line_code)
- end
- end
-
def note_timestamp(note)
# Shows the created at time and the updated at time if different
ts = "#{time_ago_with_tooltip(note.created_at, 'bottom', 'note_created_ago')}"
@@ -61,4 +55,23 @@ module NotesHelper
link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button",
data: data, title: "Add a comment to this line"
end
+
+ def link_to_reply_diff(note)
+ return unless current_user
+
+ data = {
+ noteable_type: note.noteable_type,
+ noteable_id: note.noteable_id,
+ commit_id: note.commit_id,
+ line_code: note.line_code,
+ discussion_id: note.discussion_id
+ }
+
+ link_to "javascript:;", class: "btn reply-btn js-discussion-reply-button",
+ data: data, title: "Add a reply" do
+ link_text = ""
+ link_text < content_tag(:i, nil, class: 'icon-comment')
+ link_text << "Reply"
+ end
+ end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index ba4c7068e90..d22526947dd 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -122,6 +122,40 @@ module ProjectsHelper
options_for_select(values, current_tracker)
end
+ def link_to_toggle_star(title, starred, signed_in)
+ cls = 'star-btn'
+ cls += ' disabled' unless signed_in
+
+ toggle_html = content_tag('span', class: 'toggle') do
+ toggle_text = if starred
+ 'Unstar'
+ else
+ 'Star'
+ end
+
+ content_tag('i', ' ', class: 'icon-star') + toggle_text
+ end
+
+ count_html = content_tag('span', class: 'count') do
+ @project.star_count.to_s
+ end
+
+ link_opts = {
+ title: title,
+ class: cls,
+ method: :post,
+ remote: true,
+ data: {type: 'json'}
+ }
+
+
+ content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do
+ link_to toggle_star_project_path(@project), link_opts do
+ toggle_html + ' ' + count_html
+ end
+ end
+ end
+
private
def get_project_nav_tabs(project, current_user)
@@ -221,4 +255,16 @@ module ProjectsHelper
"Never"
end
end
+
+ def contribution_guide_url(project)
+ if project && project.repository.contribution_guide
+ project_blob_path(project, tree_join(project.default_branch, project.repository.contribution_guide.name))
+ end
+ end
+
+ def hidden_pass_url(original_url)
+ result = URI(original_url)
+ result.password = '*****' if result.password.present?
+ result
+ end
end
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index ecd8d3994d0..94e15c0f81c 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -91,4 +91,21 @@ module SearchHelper
def search_result_sanitize(str)
Sanitize.clean(str)
end
+
+ def search_filter_path(options={})
+ exist_opts = {
+ search: params[:search],
+ project_id: params[:project_id],
+ group_id: params[:group_id],
+ scope: params[:scope]
+ }
+
+ options = exist_opts.merge(options)
+ search_path(options)
+ end
+
+ # Sanitize html generated after parsing markdown from issue description or comment
+ def search_md_sanitize(html)
+ sanitize(html, tags: %w(a p ol ul li pre code))
+ end
end
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 2d82b6a0b47..d815257a4e3 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -21,6 +21,16 @@ module TreeHelper
tree.html_safe
end
+ def render_readme(readme)
+ if gitlab_markdown?(readme.name)
+ preserve(markdown(readme.data))
+ elsif markup?(readme.name)
+ render_markup(readme.name, readme.data)
+ else
+ simple_format(readme.data)
+ end
+ end
+
# Return an image icon depending on the file type
#
# type - String type of the tree item; either 'folder' or 'file'
@@ -38,24 +48,6 @@ module TreeHelper
"file_#{hexdigest(content.name)}"
end
- # Public: Determines if a given filename is compatible with GitHub::Markup.
- #
- # filename - Filename string to check
- #
- # Returns boolean
- def markup?(filename)
- filename.downcase.end_with?(*%w(.textile .rdoc .org .creole
- .mediawiki .rst .adoc .asciidoc .pod))
- end
-
- def gitlab_markdown?(filename)
- filename.downcase.end_with?(*%w(.mdown .md .markdown))
- end
-
- def plain_text_readme? filename
- filename =~ /^README(.txt)?$/i
- end
-
# Simple shortcut to File.join
def tree_join(*args)
File.join(*args)
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb
index a096df9dc0d..e5346235963 100644
--- a/app/mailers/emails/issues.rb
+++ b/app/mailers/emails/issues.rb
@@ -4,10 +4,10 @@ module Emails
@issue = Issue.find(issue_id)
@project = @issue.project
@target_url = project_issue_url(@project, @issue)
- set_message_id("issue_#{issue_id}")
- mail(from: sender(@issue.author_id),
- to: recipient(recipient_id),
- subject: subject("#{@issue.title} (##{@issue.iid})"))
+ mail_new_thread(@issue,
+ from: sender(@issue.author_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@issue.title} (##{@issue.iid})"))
end
def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id, updated_by_user_id)
@@ -15,10 +15,10 @@ module Emails
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
@project = @issue.project
@target_url = project_issue_url(@project, @issue)
- set_reference("issue_#{issue_id}")
- mail(from: sender(updated_by_user_id),
- to: recipient(recipient_id),
- subject: subject("#{@issue.title} (##{@issue.iid})"))
+ mail_answer_thread(@issue,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@issue.title} (##{@issue.iid})"))
end
def closed_issue_email(recipient_id, issue_id, updated_by_user_id)
@@ -26,10 +26,10 @@ module Emails
@project = @issue.project
@updated_by = User.find updated_by_user_id
@target_url = project_issue_url(@project, @issue)
- set_reference("issue_#{issue_id}")
- mail(from: sender(updated_by_user_id),
- to: recipient(recipient_id),
- subject: subject("#{@issue.title} (##{@issue.iid})"))
+ mail_answer_thread(@issue,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@issue.title} (##{@issue.iid})"))
end
def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
@@ -38,10 +38,10 @@ module Emails
@project = @issue.project
@updated_by = User.find updated_by_user_id
@target_url = project_issue_url(@project, @issue)
- set_reference("issue_#{issue_id}")
- mail(from: sender(updated_by_user_id),
- to: recipient(recipient_id),
- subject: subject("#{@issue.title} (##{@issue.iid})"))
+ mail_answer_thread(@issue,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@issue.title} (##{@issue.iid})"))
end
end
end
diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb
index ea5671c4502..9ecdac87d72 100644
--- a/app/mailers/emails/merge_requests.rb
+++ b/app/mailers/emails/merge_requests.rb
@@ -4,10 +4,10 @@ module Emails
@merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
- set_message_id("merge_request_#{merge_request_id}")
- mail(from: sender(@merge_request.author_id),
- to: recipient(recipient_id),
- subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
+ mail_new_thread(@merge_request,
+ from: sender(@merge_request.author_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
end
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id, updated_by_user_id)
@@ -15,10 +15,10 @@ module Emails
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
- set_reference("merge_request_#{merge_request_id}")
- mail(from: sender(updated_by_user_id),
- to: recipient(recipient_id),
- subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
+ mail_answer_thread(@merge_request,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
end
def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id)
@@ -26,20 +26,33 @@ module Emails
@updated_by = User.find updated_by_user_id
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
- set_reference("merge_request_#{merge_request_id}")
- mail(from: sender(updated_by_user_id),
- to: recipient(recipient_id),
- subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
+ mail_answer_thread(@merge_request,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
end
def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id)
@merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
+ mail_answer_thread(@merge_request,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
+ end
+
+ def merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id)
+ @merge_request = MergeRequest.find(merge_request_id)
+ @mr_status = status
+ @project = @merge_request.project
+ @updated_by = User.find updated_by_user_id
+ @target_url = project_merge_request_url(@project, @merge_request)
set_reference("merge_request_#{merge_request_id}")
- mail(from: sender(updated_by_user_id),
- to: recipient(recipient_id),
- subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
+ mail_answer_thread(@merge_request,
+ from: sender(updated_by_user_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@merge_request.title} (##{@merge_request.iid}) #{@mr_status}"))
end
end
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb
index b7fedbd3707..ef9af726a6c 100644
--- a/app/mailers/emails/notes.rb
+++ b/app/mailers/emails/notes.rb
@@ -5,9 +5,10 @@ module Emails
@commit = @note.noteable
@project = @note.project
@target_url = project_commit_url(@project, @commit, anchor: "note_#{@note.id}")
- mail(from: sender(@note.author_id),
- to: recipient(recipient_id),
- subject: subject("#{@commit.title} (#{@commit.short_id})"))
+ mail_answer_thread(@commit,
+ from: sender(@note.author_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@commit.title} (#{@commit.short_id})"))
end
def note_issue_email(recipient_id, note_id)
@@ -15,10 +16,10 @@ module Emails
@issue = @note.noteable
@project = @note.project
@target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}")
- set_reference("issue_#{@issue.id}")
- mail(from: sender(@note.author_id),
- to: recipient(recipient_id),
- subject: subject("#{@issue.title} (##{@issue.iid})"))
+ mail_answer_thread(@issue,
+ from: sender(@note.author_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@issue.title} (##{@issue.iid})"))
end
def note_merge_request_email(recipient_id, note_id)
@@ -26,10 +27,10 @@ module Emails
@merge_request = @note.noteable
@project = @note.project
@target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}")
- set_reference("merge_request_#{@merge_request.id}")
- mail(from: sender(@note.author_id),
- to: recipient(recipient_id),
- subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
+ mail_answer_thread(@merge_request,
+ from: sender(@note.author_id),
+ to: recipient(recipient_id),
+ subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
end
end
end
diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb
index f02d95fd557..f8a7d133d1d 100644
--- a/app/mailers/emails/profile.rb
+++ b/app/mailers/emails/profile.rb
@@ -1,9 +1,10 @@
module Emails
module Profile
- def new_user_email(user_id, password)
+ def new_user_email(user_id, password, token = nil)
@user = User.find(user_id)
@password = password
@target_url = user_url(@user)
+ @token = token
mail(to: @user.email, subject: subject("Account was created for you"))
end
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 84a0da0129d..bd438bab89a 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -1,4 +1,6 @@
class Notify < ActionMailer::Base
+ include ActionDispatch::Routing::PolymorphicRoutes
+
include Emails::Issues
include Emails::MergeRequests
include Emails::Notes
@@ -53,14 +55,6 @@ class Notify < ActionMailer::Base
end
end
- # Set the Message-ID header field
- #
- # local_part - The local part of the message ID
- #
- def set_message_id(local_part)
- headers["Message-ID"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>"
- end
-
# Set the References header field
#
# local_part - The local part of the referenced message ID
@@ -93,4 +87,40 @@ class Notify < ActionMailer::Base
subject << extra.join(' | ') if extra.present?
subject
end
+
+ # Return a string suitable for inclusion in the 'Message-Id' mail header.
+ #
+ # The message-id is generated from the unique URL to a model object.
+ def message_id(model)
+ model_name = model.class.model_name.singular_route_key
+ "<#{model_name}_#{model.id}@#{Gitlab.config.gitlab.host}>"
+ end
+
+ # Send an email that starts a new conversation thread,
+ # with headers suitable for grouping by thread in email clients.
+ #
+ # See: mail_answer_thread
+ def mail_new_thread(model, headers = {}, &block)
+ headers['Message-ID'] = message_id(model)
+ mail(headers, &block)
+ end
+
+ # Send an email that responds to an existing conversation thread,
+ # with headers suitable for grouping by thread in email clients.
+ #
+ # For grouping emails by thread, email clients heuristics require the answers to:
+ #
+ # * have a subject that begin by 'Re: '
+ # * have a 'In-Reply-To' or 'References' header that references the original 'Message-ID'
+ #
+ def mail_answer_thread(model, headers = {}, &block)
+ headers['In-Reply-To'] = message_id(model)
+ headers['References'] = message_id(model)
+
+ if (headers[:subject])
+ headers[:subject].prepend('Re: ')
+ end
+
+ mail(headers, &block)
+ end
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 234578b5e18..f1d57de63bb 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -67,40 +67,42 @@ class Ability
def project_abilities(user, project)
rules = []
+ key = "/user/#{user.id}/project/#{project.id}"
+ RequestStore.store[key] ||= begin
+ team = project.team
- team = project.team
+ # Rules based on role in project
+ if team.master?(user)
+ rules += project_master_rules
- # Rules based on role in project
- if team.master?(user)
- rules += project_master_rules
+ elsif team.developer?(user)
+ rules += project_dev_rules
- elsif team.developer?(user)
- rules += project_dev_rules
+ elsif team.reporter?(user)
+ rules += project_report_rules
- elsif team.reporter?(user)
- rules += project_report_rules
+ elsif team.guest?(user)
+ rules += project_guest_rules
+ end
- elsif team.guest?(user)
- rules += project_guest_rules
- end
+ if project.public? || project.internal?
+ rules += public_project_rules
+ end
- if project.public? || project.internal?
- rules += public_project_rules
- end
+ if project.owner == user || user.admin?
+ rules += project_admin_rules
+ end
- if project.owner == user || user.admin?
- rules += project_admin_rules
- end
+ if project.group && project.group.has_owner?(user)
+ rules += project_admin_rules
+ end
- if project.group && project.group.has_owner?(user)
- rules += project_admin_rules
- end
+ if project.archived?
+ rules -= project_archived_rules
+ end
- if project.archived?
- rules -= project_archived_rules
+ rules
end
-
- rules
end
def public_project_rules
@@ -140,6 +142,7 @@ class Ability
:write_wiki,
:modify_issue,
:admin_issue,
+ :admin_label,
:push_code
]
end
diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb
index ce8b7973cd9..4d0c04bcc3d 100644
--- a/app/models/broadcast_message.rb
+++ b/app/models/broadcast_message.rb
@@ -14,8 +14,6 @@
#
class BroadcastMessage < ActiveRecord::Base
- attr_accessible :alert_type, :color, :ends_at, :font, :message, :starts_at
-
validates :message, presence: true
validates :starts_at, presence: true
validates :ends_at, presence: true
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 82876e10446..ff5392957ce 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -12,6 +12,7 @@ class Commit
# User can force display of diff above this size
DIFF_SAFE_FILES = 100
DIFF_SAFE_LINES = 5000
+
# Commits above this size will not be rendered in HTML
DIFF_HARD_LIMIT_FILES = 1000
DIFF_HARD_LIMIT_LINES = 50000
@@ -23,23 +24,7 @@ class Commit
# Calculate number of lines to render for diffs
def diff_line_count(diffs)
- diffs.reduce(0){|sum, d| sum + d.diff.lines.count}
- end
-
- def diff_suppress?(diffs, line_count = nil)
- # optimize - check file count first
- return true if diffs.size > DIFF_SAFE_FILES
-
- line_count ||= Commit::diff_line_count(diffs)
- line_count > DIFF_SAFE_LINES
- end
-
- def diff_force_suppress?(diffs, line_count = nil)
- # optimize - check file count first
- return true if diffs.size > DIFF_HARD_LIMIT_FILES
-
- line_count ||= Commit::diff_line_count(diffs)
- line_count > DIFF_HARD_LIMIT_LINES
+ diffs.reduce(0) { |sum, d| sum + d.diff.lines.count }
end
end
@@ -60,14 +45,6 @@ class Commit
@diff_line_count
end
- def diff_suppress?
- Commit::diff_suppress?(self.diffs, diff_line_count)
- end
-
- def diff_force_suppress?
- Commit::diff_force_suppress?(self.diffs, diff_line_count)
- end
-
# Returns a string describing the commit for use in a link title
#
# Example
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 9a227fcef59..698b5b8c30a 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -13,6 +13,8 @@ module Issuable
belongs_to :assignee, class_name: "User"
belongs_to :milestone
has_many :notes, as: :noteable, dependent: :destroy
+ has_many :label_links, as: :target, dependent: :destroy
+ has_many :labels, through: :label_links
validates :author, presence: true
validates :title, presence: true, length: { within: 0..255 }
@@ -47,6 +49,10 @@ module Issuable
where("LOWER(title) like :query", query: "%#{query.downcase}%")
end
+ def full_search(query)
+ where("LOWER(title) like :query OR LOWER(description) like :query", query: "%#{query.downcase}%")
+ end
+
def sort(method)
case method.to_s
when 'newest' then reorder("#{table_name}.created_at DESC")
@@ -131,4 +137,20 @@ module Issuable
object_attributes: self.attributes
}
end
+
+ def label_names
+ labels.order('title ASC').pluck(:title)
+ end
+
+ def remove_labels
+ labels.delete_all
+ end
+
+ def add_labels_by_names(label_names)
+ label_names.each do |label_name|
+ label = project.labels.create_with(
+ color: Label::DEFAULT_COLOR).find_or_create_by(title: label_name.strip)
+ self.labels << label
+ end
+ end
end
diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb
index a46a593c6e3..81414959f3b 100644
--- a/app/models/concerns/mentionable.rb
+++ b/app/models/concerns/mentionable.rb
@@ -49,12 +49,16 @@ module Mentionable
matches = mentionable_text.scan(/@[a-zA-Z][a-zA-Z0-9_\-\.]*/)
matches.each do |match|
identifier = match.delete "@"
- if has_project
- id = project.team.members.find_by(username: identifier).try(:id)
+ if identifier == "all"
+ users += project.team.members.flatten
else
- id = User.where(username: identifier).pluck(:id).first
+ if has_project
+ id = project.team.members.find_by(username: identifier).try(:id)
+ else
+ id = User.find_by(username: identifier).try(:id)
+ end
+ users << User.find(id) unless id.blank?
end
- users << User.find(id) unless id.blank?
end
users.uniq
end
diff --git a/app/models/concerns/token_authenticatable.rb b/app/models/concerns/token_authenticatable.rb
new file mode 100644
index 00000000000..9b88ec1cc38
--- /dev/null
+++ b/app/models/concerns/token_authenticatable.rb
@@ -0,0 +1,31 @@
+module TokenAuthenticatable
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+ def find_by_authentication_token(authentication_token = nil)
+ if authentication_token
+ where(authentication_token: authentication_token).first
+ end
+ end
+ end
+
+ def ensure_authentication_token
+ if authentication_token.blank?
+ self.authentication_token = generate_authentication_token
+ end
+ end
+
+ def reset_authentication_token!
+ self.authentication_token = generate_authentication_token
+ save
+ end
+
+ private
+
+ def generate_authentication_token
+ loop do
+ token = Devise.friendly_token
+ break token unless self.class.unscoped.where(authentication_token: token).first
+ end
+ end
+end
diff --git a/app/models/deploy_keys_project.rb b/app/models/deploy_keys_project.rb
index 739d749830a..f23d8205ddc 100644
--- a/app/models/deploy_keys_project.rb
+++ b/app/models/deploy_keys_project.rb
@@ -10,13 +10,10 @@
#
class DeployKeysProject < ActiveRecord::Base
- attr_accessible :key_id, :project_id
-
belongs_to :project
belongs_to :deploy_key
validates :deploy_key_id, presence: true
validates :deploy_key_id, uniqueness: { scope: [:project_id], message: "already exists in project" }
-
validates :project_id, presence: true
end
diff --git a/app/models/email.rb b/app/models/email.rb
index 9068c2b87b6..57f476bd519 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -10,16 +10,8 @@
#
class Email < ActiveRecord::Base
- attr_accessible :email, :user_id
-
- #
- # Relations
- #
belongs_to :user
- #
- # Validations
- #
validates :user_id, presence: true
validates :email, presence: true, email: { strict_mode: true }, uniqueness: true
validate :unique_email, if: ->(email) { email.email_changed? }
diff --git a/app/models/event.rb b/app/models/event.rb
index 1a8d55c54b4..9e296c00281 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -15,9 +15,6 @@
#
class Event < ActiveRecord::Base
- attr_accessible :project, :action, :data, :author_id, :project_id,
- :target_id, :target_type
-
default_scope { where.not(author_id: nil) }
CREATED = 1
@@ -33,6 +30,7 @@ class Event < ActiveRecord::Base
delegate :name, :email, to: :author, prefix: true, allow_nil: true
delegate :title, to: :issue, prefix: true, allow_nil: true
delegate :title, to: :merge_request, prefix: true, allow_nil: true
+ delegate :title, to: :note, prefix: true, allow_nil: true
belongs_to :author, class_name: "User"
belongs_to :project
@@ -72,6 +70,12 @@ class Event < ActiveRecord::Base
author_id: user.id
)
end
+
+ def reset_event_cache_for(target)
+ Event.where(target_id: target.id, target_type: target.class.to_s).
+ order('id DESC').limit(100).
+ update_all(updated_at: Time.now)
+ end
end
def proper?
@@ -150,6 +154,10 @@ class Event < ActiveRecord::Base
target if target_type == "MergeRequest"
end
+ def note
+ target if target_type == "Note"
+ end
+
def action_name
if closed?
"closed"
diff --git a/app/models/forked_project_link.rb b/app/models/forked_project_link.rb
index 17add270f67..9b0c6263a96 100644
--- a/app/models/forked_project_link.rb
+++ b/app/models/forked_project_link.rb
@@ -10,10 +10,6 @@
#
class ForkedProjectLink < ActiveRecord::Base
- attr_accessible :forked_from_project_id, :forked_to_project_id
-
- # Relations
belongs_to :forked_to_project, class_name: Project
belongs_to :forked_from_project, class_name: Project
-
end
diff --git a/app/models/group.rb b/app/models/group.rb
index e51e19ab60c..66239f7fe6f 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -20,8 +20,6 @@ class Group < Namespace
has_many :users_groups, dependent: :destroy
has_many :users, through: :users_groups
- attr_accessible :avatar
-
validate :avatar_type, if: ->(user) { user.avatar_changed? }
validates :avatar, file_size: { maximum: 100.kilobytes.to_i }
@@ -75,4 +73,20 @@ class Group < Namespace
def public_profile?
projects.public_only.any?
end
+
+ class << self
+ def search(query)
+ where("LOWER(namespaces.name) LIKE :query", query: "%#{query.downcase}%")
+ end
+
+ def sort(method)
+ case method.to_s
+ when "newest" then reorder("namespaces.created_at DESC")
+ when "oldest" then reorder("namespaces.created_at ASC")
+ when "recently_updated" then reorder("namespaces.updated_at DESC")
+ when "last_updated" then reorder("namespaces.updated_at ASC")
+ else reorder("namespaces.path, namespaces.name ASC")
+ end
+ end
+ end
end
diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb
new file mode 100644
index 00000000000..33915313789
--- /dev/null
+++ b/app/models/group_milestone.rb
@@ -0,0 +1,95 @@
+class GroupMilestone
+
+ def initialize(title, milestones)
+ @title = title
+ @milestones = milestones
+ end
+
+ def title
+ @title
+ end
+
+ def safe_title
+ @title.parameterize
+ end
+
+ def milestones
+ @milestones
+ end
+
+ def projects
+ milestones.map { |milestone| milestone.project }
+ end
+
+ def issue_count
+ milestones.map { |milestone| milestone.issues.count }.sum
+ end
+
+ def merge_requests_count
+ milestones.map { |milestone| milestone.merge_requests.count }.sum
+ end
+
+ def open_items_count
+ milestones.map { |milestone| milestone.open_items_count }.sum
+ end
+
+ def closed_items_count
+ milestones.map { |milestone| milestone.closed_items_count }.sum
+ end
+
+ def total_items_count
+ milestones.map { |milestone| milestone.total_items_count }.sum
+ end
+
+ def percent_complete
+ ((closed_items_count * 100) / total_items_count).abs
+ rescue ZeroDivisionError
+ 100
+ end
+
+ def state
+ state = milestones.map { |milestone| milestone.state }
+
+ if state.count('closed') == state.size
+ 'closed'
+ else
+ 'active'
+ end
+ end
+
+ def active?
+ state == 'active'
+ end
+
+ def closed?
+ state == 'closed'
+ end
+
+ def issues
+ @group_issues ||= milestones.map { |milestone| milestone.issues }.flatten.group_by(&:state)
+ end
+
+ def merge_requests
+ @group_merge_requests ||= milestones.map { |milestone| milestone.merge_requests }.flatten.group_by(&:state)
+ end
+
+ def participants
+ milestones.map { |milestone| milestone.participants.uniq }.reject(&:empty?).flatten
+ end
+
+ def opened_issues
+ issues.values_at("opened", "reopened").compact.flatten
+ end
+
+ def closed_issues
+ issues['closed']
+ end
+
+ def opened_merge_requests
+ merge_requests.values_at("opened", "reopened").compact.flatten
+ end
+
+ def closed_merge_requests
+ merge_requests.values_at("closed", "merged", "locked").compact.flatten
+ end
+end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index f0c2e552273..45a8e43b03d 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -15,7 +15,6 @@
# milestone_id :integer
# state :string(255)
# iid :integer
-# attachment :string(255)
#
require 'carrierwave/orm/activerecord'
@@ -32,12 +31,6 @@ class Issue < ActiveRecord::Base
scope :of_group, ->(group) { where(project_id: group.project_ids) }
scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) }
-
- attr_accessible :title, :assignee_id, :position, :description,
- :milestone_id, :label_list, :state_event
-
- acts_as_taggable_on :labels
-
scope :cared, ->(user) { where(assignee_id: user) }
scope :open_for, ->(user) { opened.assigned_to(user) }
@@ -70,8 +63,6 @@ class Issue < ActiveRecord::Base
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def reset_events_cache
- Event.where(target_id: self.id, target_type: 'Issue').
- order('id DESC').limit(100).
- update_all(updated_at: Time.now)
+ Event.reset_event_cache_for(self)
end
end
diff --git a/app/models/key.rb b/app/models/key.rb
index 035c9efa016..095c73d8baf 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -19,8 +19,6 @@ class Key < ActiveRecord::Base
belongs_to :user
- attr_accessible :key, :title
-
before_validation :strip_white_space, :generate_fingerpint
validates :title, presence: true, length: { within: 0..255 }
@@ -31,7 +29,9 @@ class Key < ActiveRecord::Base
after_create :add_to_shell
after_create :notify_user
+ after_create :post_create_hook
after_destroy :remove_from_shell
+ after_destroy :post_destroy_hook
def strip_white_space
self.key = key.strip unless key.blank?
@@ -58,6 +58,10 @@ class Key < ActiveRecord::Base
NotificationService.new.new_key(self)
end
+ def post_create_hook
+ SystemHooksService.new.execute_hooks_for(self, :create)
+ end
+
def remove_from_shell
GitlabShellWorker.perform_async(
:remove_key,
@@ -66,6 +70,10 @@ class Key < ActiveRecord::Base
)
end
+ def post_destroy_hook
+ SystemHooksService.new.execute_hooks_for(self, :destroy)
+ end
+
private
def generate_fingerpint
diff --git a/app/models/label.rb b/app/models/label.rb
new file mode 100644
index 00000000000..2b2b02e0645
--- /dev/null
+++ b/app/models/label.rb
@@ -0,0 +1,38 @@
+# == Schema Information
+#
+# Table name: labels
+#
+# id :integer not null, primary key
+# title :string(255)
+# color :string(255)
+# project_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
+class Label < ActiveRecord::Base
+ DEFAULT_COLOR = '#428BCA'
+
+ belongs_to :project
+ has_many :label_links, dependent: :destroy
+ has_many :issues, through: :label_links, source: :target, source_type: 'Issue'
+
+ validates :color,
+ format: { with: /\A#[0-9A-Fa-f]{6}\Z/ },
+ allow_blank: false
+ validates :project, presence: true
+
+ # Don't allow '?', '&', and ',' for label titles
+ validates :title,
+ presence: true,
+ format: { with: /\A[^&\?,&]+\z/ },
+ uniqueness: { scope: :project_id }
+
+ scope :order_by_name, -> { reorder("labels.title ASC") }
+
+ alias_attribute :name, :title
+
+ def open_issues_count
+ issues.opened.count
+ end
+end
diff --git a/app/models/label_link.rb b/app/models/label_link.rb
new file mode 100644
index 00000000000..b94c9c777af
--- /dev/null
+++ b/app/models/label_link.rb
@@ -0,0 +1,19 @@
+# == Schema Information
+#
+# Table name: label_links
+#
+# id :integer not null, primary key
+# label_id :integer
+# target_id :integer
+# target_type :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
+class LabelLink < ActiveRecord::Base
+ belongs_to :target, polymorphic: true
+ belongs_to :label
+
+ validates :target, presence: true
+ validates :label, presence: true
+end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index bfea209bf6d..10bd76b1c35 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -17,6 +17,7 @@
# target_project_id :integer not null
# iid :integer
# description :text
+# position :integer default(0)
#
require Rails.root.join("app/models/commit")
@@ -36,18 +37,16 @@ class MergeRequest < ActiveRecord::Base
delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil
- attr_accessible :title, :assignee_id, :source_project_id, :source_branch,
- :target_project_id, :target_branch, :milestone_id,
- :state_event, :description, :label_list
-
attr_accessor :should_remove_source_branch
# When this attribute is true some MR validation is ignored
# It allows us to close or modify broken merge requests
attr_accessor :allow_broken
- ActsAsTaggableOn.strict_case_match = true
- acts_as_taggable_on :labels
+ # Temporary fields to store compare vars
+ # when creating new merge request
+ attr_accessor :can_be_created, :compare_failed,
+ :compare_commits, :compare_diffs
state_machine :state, initial: :opened do
event :close do
@@ -62,11 +61,11 @@ class MergeRequest < ActiveRecord::Base
transition closed: :reopened
end
- event :lock do
+ event :lock_mr do
transition [:reopened, :opened] => :locked
end
- event :unlock do
+ event :unlock_mr do
transition locked: :reopened
end
@@ -286,9 +285,7 @@ class MergeRequest < ActiveRecord::Base
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def reset_events_cache
- Event.where(target_id: self.id, target_type: 'MergeRequest').
- order('id DESC').limit(100).
- update_all(updated_at: Time.now)
+ Event.reset_event_cache_for(self)
end
def merge_commit_message
@@ -297,6 +294,8 @@ class MergeRequest < ActiveRecord::Base
message << title.to_s
message << "\n\n"
message << description.to_s
+ message << "\n\n"
+ message << "See merge request !#{iid}"
message
end
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 7dce71a677b..409e82ed1ef 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -3,7 +3,7 @@
# Table name: merge_request_diffs
#
# id :integer not null, primary key
-# state :string(255) default("collected"), not null
+# state :string(255)
# st_commits :text
# st_diffs :text
# merge_request_id :integer not null
@@ -22,8 +22,6 @@ class MergeRequestDiff < ActiveRecord::Base
belongs_to :merge_request
- attr_accessible :state, :st_commits, :st_diffs
-
delegate :target_branch, :source_branch, to: :merge_request, prefix: nil
state_machine :state, initial: :empty do
@@ -85,11 +83,7 @@ class MergeRequestDiff < ActiveRecord::Base
# Collect array of Git::Commit objects
# between target and source branches
def unmerged_commits
- commits = if merge_request.for_fork?
- compare_action.commits
- else
- repository.commits_between(target_branch, source_branch)
- end
+ commits = compare_result.commits
if commits.present?
commits = Commit.decorate(commits).
@@ -149,12 +143,7 @@ class MergeRequestDiff < ActiveRecord::Base
# Collect array of Git::Diff objects
# between target and source branches
def unmerged_diffs
- diffs = if merge_request.for_fork?
- compare_action.diffs
- else
- Gitlab::Git::Diff.between(repository, source_branch, target_branch)
- end
-
+ diffs = compare_result.diffs
diffs ||= []
diffs
rescue Gitlab::Git::Diff::TimeoutError => ex
@@ -168,13 +157,13 @@ class MergeRequestDiff < ActiveRecord::Base
private
- def compare_action
- Gitlab::Satellite::CompareAction.new(
+ def compare_result
+ @compare_result ||= CompareService.new.execute(
merge_request.author,
+ merge_request.source_project,
+ merge_request.source_branch,
merge_request.target_project,
merge_request.target_branch,
- merge_request.source_project,
- merge_request.source_branch
)
end
end
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 39ab0b536a3..8fd3e56d2ee 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -16,8 +16,6 @@
class Milestone < ActiveRecord::Base
include InternalId
- attr_accessible :title, :description, :due_date, :state_event
-
belongs_to :project
has_many :issues
has_many :merge_requests
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 446e5f04c63..b19b72906e7 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -16,8 +16,6 @@
class Namespace < ActiveRecord::Base
include Gitlab::ShellAdapter
- attr_accessible :name, :description, :path
-
has_many :projects, dependent: :destroy
belongs_to :owner, class_name: "User"
@@ -25,12 +23,12 @@ class Namespace < ActiveRecord::Base
validates :name, presence: true, uniqueness: true,
length: { within: 0..255 },
format: { with: Gitlab::Regex.name_regex,
- message: "only letters, digits, spaces & '_' '-' '.' allowed." }
+ message: Gitlab::Regex.name_regex_message }
validates :description, length: { within: 0..255 }
validates :path, uniqueness: { case_sensitive: false }, presence: true, length: { within: 1..255 },
exclusion: { in: Gitlab::Blacklist.path },
format: { with: Gitlab::Regex.path_regex,
- message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
+ message: Gitlab::Regex.path_regex_message }
delegate :name, to: :owner, allow_nil: true, prefix: true
diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb
index 424819f3501..9c95470beb1 100644
--- a/app/models/network/graph.rb
+++ b/app/models/network/graph.rb
@@ -178,12 +178,6 @@ module Network
space = find_free_space(time_range, 2, space_base)
leaves.each do |l|
l.spaces << space
- # Also add space to parent
- l.parents(@map).each do |parent|
- if 0 < parent.space && parent.space < space
- parent.spaces << space
- end
- end
end
# and mark it as reserved
diff --git a/app/models/note.rb b/app/models/note.rb
index 01026cd3994..7cbab1130ea 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -25,8 +25,6 @@ class Note < ActiveRecord::Base
default_value_for :system, false
- attr_accessible :note, :noteable, :noteable_id, :noteable_type, :project_id,
- :attachment, :line_code, :commit_id
attr_mentionable :note
belongs_to :project
@@ -63,13 +61,13 @@ class Note < ActiveRecord::Base
def create_status_change_note(noteable, project, author, status, source)
body = "_Status changed to #{status}#{' by ' + source.gfm_reference if source}_"
- create({
+ create(
noteable: noteable,
project: project,
author: author,
note: body,
system: true
- }, without_protection: true)
+ )
end
# +noteable+ was referenced from +mentioner+, by including GFM in either +mentioner+'s description or an associated Note.
@@ -88,7 +86,7 @@ class Note < ActiveRecord::Base
note_options.merge!(noteable: noteable)
end
- create(note_options, without_protection: true)
+ create(note_options)
end
def create_milestone_change_note(noteable, project, author, milestone)
@@ -98,13 +96,13 @@ class Note < ActiveRecord::Base
"_Milestone changed to #{milestone.title}_"
end
- create({
+ create(
noteable: noteable,
project: project,
author: author,
note: body,
system: true
- }, without_protection: true)
+ )
end
def create_assignee_change_note(noteable, project, author, assignee)
@@ -116,7 +114,26 @@ class Note < ActiveRecord::Base
author: author,
note: body,
system: true
- }, without_protection: true)
+ })
+ end
+
+ def create_new_commits_note(noteable, project, author, commits)
+ commits_text = ActionController::Base.helpers.pluralize(commits.size, 'new commit')
+ body = "Added #{commits_text}:\n\n"
+
+ commits.each do |commit|
+ message = "* #{commit.short_id} - #{commit.title}"
+ body << message
+ body << "\n"
+ end
+
+ create(
+ noteable: noteable,
+ project: project,
+ author: author,
+ note: body,
+ system: true
+ )
end
def discussions_from_notes(notes)
@@ -148,6 +165,10 @@ class Note < ActiveRecord::Base
def cross_reference_exists?(noteable, mentioner)
where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any?
end
+
+ def search(query)
+ where("note like :query", query: "%#{query}%")
+ end
end
def commit_author
@@ -179,10 +200,28 @@ class Note < ActiveRecord::Base
@diff ||= Gitlab::Git::Diff.new(st_diff) if st_diff.respond_to?(:map)
end
+ # Check if such line of code exists in merge request diff
+ # If exists - its active discussion
+ # If not - its outdated diff
def active?
- # TODO: determine if discussion is outdated
- # according to recent MR diff or not
- true
+ return true unless self.diff
+
+ noteable.diffs.each do |mr_diff|
+ next unless mr_diff.new_path == self.diff.new_path
+
+ Gitlab::DiffParser.new(mr_diff.diff.lines.to_a, mr_diff.new_path).
+ each do |full_line, type, line_code, line_new, line_old|
+ if full_line == diff_line
+ return true
+ end
+ end
+ end
+
+ false
+ end
+
+ def outdated?
+ !active?
end
def diff_file_index
@@ -311,12 +350,14 @@ class Note < ActiveRecord::Base
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def reset_events_cache
- Event.where(target_id: self.id, target_type: 'Note').
- order('id DESC').limit(100).
- update_all(updated_at: Time.now)
+ Event.reset_event_cache_for(self)
end
def set_references
notice_added_references(project, author)
end
+
+ def editable?
+ !system
+ end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 762b540b7a3..114e40983f8 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -22,29 +22,27 @@
# visibility_level :integer default(0), not null
# archived :boolean default(FALSE), not null
# import_status :string(255)
+# repository_size :float default(0.0)
+# star_count :integer default(0), not null
#
class Project < ActiveRecord::Base
include Gitlab::ShellAdapter
include Gitlab::VisibilityLevel
+ include Gitlab::ConfigHelper
+ extend Gitlab::ConfigHelper
extend Enumerize
default_value_for :archived, false
- default_value_for :issues_enabled, true
- default_value_for :merge_requests_enabled, true
- default_value_for :wiki_enabled, true
+ default_value_for :visibility_level, gitlab_config_features.visibility_level
+ default_value_for :issues_enabled, gitlab_config_features.issues
+ default_value_for :merge_requests_enabled, gitlab_config_features.merge_requests
+ default_value_for :wiki_enabled, gitlab_config_features.wiki
default_value_for :wall_enabled, false
- default_value_for :snippets_enabled, true
+ default_value_for :snippets_enabled, gitlab_config_features.snippets
ActsAsTaggableOn.strict_case_match = true
-
- attr_accessible :name, :path, :description, :issues_tracker, :label_list,
- :issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id,
- :wiki_enabled, :visibility_level, :import_url, :last_activity_at, as: [:default, :admin]
-
- attr_accessible :namespace_id, :creator_id, as: :admin
-
- acts_as_taggable_on :labels, :issues_default_labels
+ acts_as_taggable_on :tags
attr_accessor :new_default_branch
@@ -72,7 +70,8 @@ class Project < ActiveRecord::Base
has_many :merge_requests, dependent: :destroy, foreign_key: "target_project_id"
# Merge requests from source project should be kept when source project was removed
has_many :fork_merge_requests, foreign_key: "source_project_id", class_name: MergeRequest
- has_many :issues, -> { order "state DESC, created_at DESC" }, dependent: :destroy
+ has_many :issues, -> { order 'issues.state DESC, issues.created_at DESC' }, dependent: :destroy
+ has_many :labels, dependent: :destroy
has_many :services, dependent: :destroy
has_many :events, dependent: :destroy
has_many :milestones, dependent: :destroy
@@ -84,6 +83,8 @@ class Project < ActiveRecord::Base
has_many :users, through: :users_projects
has_many :deploy_keys_projects, dependent: :destroy
has_many :deploy_keys, through: :deploy_keys_projects
+ has_many :users_star_projects, dependent: :destroy
+ has_many :starrers, through: :users_star_projects, source: :user
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :members, to: :team, prefix: true
@@ -93,13 +94,16 @@ class Project < ActiveRecord::Base
validates :description, length: { maximum: 2000 }, allow_blank: true
validates :name, presence: true, length: { within: 0..255 },
format: { with: Gitlab::Regex.project_name_regex,
- message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first" }
+ message: Gitlab::Regex.project_regex_message }
validates :path, presence: true, length: { within: 0..255 },
exclusion: { in: Gitlab::Blacklist.path },
format: { with: Gitlab::Regex.path_regex,
- message: "only letters, digits & '_' '-' '.' allowed. Letter or digit should be first" }
+ message: Gitlab::Regex.path_regex_message }
validates :issues_enabled, :merge_requests_enabled,
:wiki_enabled, inclusion: { in: [true, false] }
+ validates :visibility_level,
+ exclusion: { in: gitlab_config.restricted_visibility_levels },
+ if: -> { gitlab_config.restricted_visibility_levels.any? }
validates :issues_tracker_id, length: { maximum: 255 }, allow_blank: true
validates :namespace, presence: true
validates_uniqueness_of :name, scope: :namespace_id
@@ -107,6 +111,7 @@ class Project < ActiveRecord::Base
validates :import_url,
format: { with: URI::regexp(%w(git http https)), message: "should be a valid url" },
if: :import?
+ validates :star_count, numericality: { greater_than_or_equal_to: 0 }
validate :check_limit, on: :create
# Scopes
@@ -172,11 +177,11 @@ class Project < ActiveRecord::Base
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
end
- def search query
+ def search(query)
joins(:namespace).where("projects.archived = ?", false).where("projects.name LIKE :query OR projects.path LIKE :query OR namespaces.name LIKE :query OR projects.description LIKE :query", query: "%#{query}%")
end
- def search_by_title query
+ def search_by_title(query)
where("projects.archived = ?", false).where("LOWER(projects.name) LIKE :query", query: "%#{query.downcase}%")
end
@@ -243,7 +248,7 @@ class Project < ActiveRecord::Base
end
def check_limit
- unless creator.can_create_project?
+ unless creator.can_create_project? or namespace.kind == 'group'
errors[:limit_reached] << ("Your project limit is #{creator.projects_limit} projects! Please contact your administrator to increase it")
end
rescue
@@ -255,7 +260,7 @@ class Project < ActiveRecord::Base
end
def web_url
- [Gitlab.config.gitlab.url, path_with_namespace].join("/")
+ [gitlab_config.url, path_with_namespace].join("/")
end
def web_url_without_protocol
@@ -278,13 +283,6 @@ class Project < ActiveRecord::Base
self.id
end
- # Tags are shared by issues and merge requests
- def issues_labels
- @issues_labels ||= (issues_default_labels +
- merge_requests.tags_on(:labels) +
- issues.tags_on(:labels)).uniq.sort_by(&:name)
- end
-
def issue_exists?(issue_id)
if used_default_issues_tracker?
self.issues.where(iid: issue_id).first.present?
@@ -391,25 +389,46 @@ class Project < ActiveRecord::Base
services.each do |service|
# Call service hook only if it is active
- service.execute(data) if service.active
+ begin
+ service.execute(data) if service.active
+ rescue => e
+ logger.error(e)
+ end
end
end
def update_merge_requests(oldrev, newrev, ref, user)
return true unless ref =~ /heads/
branch_name = ref.gsub("refs/heads/", "")
- c_ids = self.repository.commits_between(oldrev, newrev).map(&:id)
+ commits = self.repository.commits_between(oldrev, newrev)
+ c_ids = commits.map(&:id)
# Close merge requests
mrs = self.merge_requests.opened.where(target_branch: branch_name).to_a
mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
- mrs.each { |merge_request| MergeRequests::MergeService.new.execute(merge_request, user, nil) }
+
+ mrs.uniq.each do |merge_request|
+ MergeRequests::MergeService.new.execute(merge_request, user, nil)
+ end
# Update code for merge requests into project between project branches
mrs = self.merge_requests.opened.by_branch(branch_name).to_a
# Update code for merge requests between project and project fork
mrs += self.fork_merge_requests.opened.by_branch(branch_name).to_a
- mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
+
+ mrs.uniq.each do |merge_request|
+ merge_request.reload_code
+ merge_request.mark_as_unchecked
+ end
+
+ # Add comment about pushing new commits to merge requests
+ mrs = self.merge_requests.opened.where(source_branch: branch_name).to_a
+ mrs += self.fork_merge_requests.opened.where(source_branch: branch_name).to_a
+
+ mrs.uniq.each do |merge_request|
+ Note.create_new_commits_note(merge_request, merge_request.project,
+ user, commits)
+ end
true
end
@@ -476,7 +495,7 @@ class Project < ActiveRecord::Base
end
def http_url_to_repo
- [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('')
+ [gitlab_config.url, "/", path_with_namespace, ".git"].join('')
end
# Check if current branch name is marked as protected in the system
@@ -493,6 +512,7 @@ class Project < ActiveRecord::Base
end
def rename_repo
+ path_was = previous_changes['path'].first
old_path_with_namespace = File.join(namespace_dir, path_was)
new_path_with_namespace = File.join(namespace_dir, path)
@@ -571,4 +591,12 @@ class Project < ActiveRecord::Base
def update_repository_size
update_attribute(:repository_size, repository.size)
end
+
+ def forks_count
+ ForkedProjectLink.where(forked_from_project_id: self.id).count
+ end
+
+ def find_label(name)
+ labels.find_by(name: name)
+ end
end
diff --git a/app/models/project_hook.rb b/app/models/project_hook.rb
index 6db6767a88d..21867a9316c 100644
--- a/app/models/project_hook.rb
+++ b/app/models/project_hook.rb
@@ -18,8 +18,6 @@
class ProjectHook < WebHook
belongs_to :project
- attr_accessible :push_events, :issues_events, :merge_requests_events, :tag_push_events
-
scope :push_hooks, -> { where(push_events: true) }
scope :tag_push_hooks, -> { where(tag_push_events: true) }
scope :issue_hooks, -> { where(issues_events: true) }
diff --git a/app/models/project_services/assembla_service.rb b/app/models/project_services/assembla_service.rb
index 06e9d6118d2..9a8cbb32ac1 100644
--- a/app/models/project_services/assembla_service.rb
+++ b/app/models/project_services/assembla_service.rb
@@ -18,8 +18,6 @@
#
class AssemblaService < Service
- attr_accessible :subdomain
-
include HTTParty
validates :token, presence: true, if: :activated?
diff --git a/app/models/project_services/campfire_service.rb b/app/models/project_services/campfire_service.rb
index 19030ecffa2..83e1bac1ef2 100644
--- a/app/models/project_services/campfire_service.rb
+++ b/app/models/project_services/campfire_service.rb
@@ -18,8 +18,6 @@
#
class CampfireService < Service
- attr_accessible :subdomain, :room
-
validates :token, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/ci_service.rb b/app/models/project_services/ci_service.rb
index fd34a2a35ea..1a107f92c93 100644
--- a/app/models/project_services/ci_service.rb
+++ b/app/models/project_services/ci_service.rb
@@ -1,3 +1,22 @@
+# == Schema Information
+#
+# Table name: services
+#
+# id :integer not null, primary key
+# type :string(255)
+# title :string(255)
+# token :string(255)
+# project_id :integer not null
+# created_at :datetime
+# updated_at :datetime
+# active :boolean default(FALSE), not null
+# project_url :string(255)
+# subdomain :string(255)
+# room :string(255)
+# recipients :text
+# api_key :string(255)
+#
+
# Base class for CI services
# List methods you need to implement to get your CI service
# working with GitLab Merge Requests
diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb
index 04775c4f2b2..be5bab4ec32 100644
--- a/app/models/project_services/emails_on_push_service.rb
+++ b/app/models/project_services/emails_on_push_service.rb
@@ -18,8 +18,6 @@
#
class EmailsOnPushService < Service
- attr_accessible :recipients
-
validates :recipients, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index ef395e0ec68..58ddce45288 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -18,8 +18,6 @@
#
class GitlabCiService < CiService
- attr_accessible :project_url
-
validates :project_url, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index d62f61856d1..256debffc51 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -18,7 +18,7 @@
#
class HipchatService < Service
- attr_accessible :room
+ MAX_COMMITS = 3
validates :token, presence: true, if: :activated?
@@ -59,15 +59,24 @@ class HipchatService < Service
message = ""
message << "#{push[:user_name]} "
if before =~ /000000/
- message << "pushed new branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> to <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a>\n"
+ message << "pushed new branch <a href=\""\
+ "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\
+ " to <a href=\"#{project.web_url}\">"\
+ "#{project.name_with_namespace.gsub!(/\s/, "")}</a>\n"
elsif after =~ /000000/
message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n"
else
- message << "pushed to branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> "
+ message << "pushed to branch <a href=\""\
+ "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a> "
message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> "
message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)"
- for commit in push[:commits] do
- message << "<br /> - #{commit[:message]} (<a href=\"#{commit[:url]}\">#{commit[:id][0..5]}</a>)"
+
+ push[:commits].take(MAX_COMMITS).each do |commit|
+ message << "<br /> - #{commit[:message].lines.first} (<a href=\"#{commit[:url]}\">#{commit[:id][0..5]}</a>)"
+ end
+
+ if push[:commits].count > MAX_COMMITS
+ message << "<br />... #{push[:commits].count - MAX_COMMITS} more commits"
end
end
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb
index 50fd62def1d..7e54188abf7 100644
--- a/app/models/project_services/slack_service.rb
+++ b/app/models/project_services/slack_service.rb
@@ -18,9 +18,6 @@
#
class SlackService < Service
- attr_accessible :room
- attr_accessible :subdomain
-
validates :room, presence: true, if: :activated?
validates :subdomain, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 08a52782475..a82a300a672 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -2,8 +2,9 @@ class ProjectWiki
include Gitlab::ShellAdapter
MARKUPS = {
- "Markdown" => :markdown,
- "RDoc" => :rdoc
+ 'Markdown' => :markdown,
+ 'RDoc' => :rdoc,
+ 'AsciiDoc' => :asciidoc
}
class CouldNotCreateWikiError < StandardError; end
@@ -72,6 +73,15 @@ class ProjectWiki
end
end
+ def find_file(name, version = nil, try_on_disk = true)
+ version = wiki.ref if version.nil? # Gollum::Wiki#file ?
+ if wiki_file = wiki.file(name, version, try_on_disk)
+ wiki_file
+ else
+ nil
+ end
+ end
+
def create_page(title, content, format = :markdown, message = nil)
commit = commit_details(:created, message, title)
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index d2b2b1218d1..1b06dd77523 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -12,8 +12,6 @@
class ProtectedBranch < ActiveRecord::Base
include Gitlab::ShellAdapter
- attr_accessible :name
-
belongs_to :project
validates :name, presence: true
validates :project, presence: true
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 00a1032b6c4..9dd8603621f 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -10,8 +10,11 @@ class Repository
nil
end
+ # Return absolute path to repository
def path_to_repo
- @path_to_repo ||= File.join(Gitlab.config.gitlab_shell.repos_path, path_with_namespace + ".git")
+ @path_to_repo ||= File.expand_path(
+ File.join(Gitlab.config.gitlab_shell.repos_path, path_with_namespace + ".git")
+ )
end
def exists?
@@ -61,10 +64,10 @@ class Repository
gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
end
- def add_tag(tag_name, ref)
+ def add_tag(tag_name, ref, message = nil)
Rails.cache.delete(cache_key(:tag_names))
- gitlab_shell.add_tag(path_with_namespace, tag_name, ref)
+ gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
end
def rm_branch(branch_name)
@@ -128,12 +131,13 @@ class Repository
Rails.cache.delete(cache_key(:commit_count))
Rails.cache.delete(cache_key(:graph_log))
Rails.cache.delete(cache_key(:readme))
+ Rails.cache.delete(cache_key(:version))
Rails.cache.delete(cache_key(:contribution_guide))
end
def graph_log
Rails.cache.fetch(cache_key(:graph_log)) do
- stats = Gitlab::Git::GitStats.new(raw, root_ref)
+ stats = Gitlab::Git::GitStats.new(raw, root_ref, Gitlab.config.git.timeout)
stats.parsed_log
end
end
@@ -156,12 +160,24 @@ class Repository
Gitlab::Git::Blob.find(self, sha, path)
end
+ def blob_by_oid(oid)
+ Gitlab::Git::Blob.raw(self, oid)
+ end
+
def readme
Rails.cache.fetch(cache_key(:readme)) do
tree(:head).readme
end
end
+ def version
+ Rails.cache.fetch(cache_key(:version)) do
+ tree(:head).blobs.find do |file|
+ file.name.downcase == 'version'
+ end
+ end
+ end
+
def contribution_guide
Rails.cache.fetch(cache_key(:contribution_guide)) do
tree(:head).contribution_guide
@@ -229,4 +245,41 @@ class Repository
branches
end
end
+
+ def contributors
+ log = graph_log.group_by { |i| i[:author_email] }
+
+ log.map do |email, contributions|
+ contributor = Gitlab::Contributor.new
+ contributor.email = email
+
+ contributions.each do |contribution|
+ if contributor.name.blank?
+ contributor.name = contribution[:author_name]
+ end
+
+ contributor.commits += 1
+ contributor.additions += contribution[:additions] || 0
+ contributor.deletions += contribution[:deletions] || 0
+ end
+
+ contributor
+ end
+ end
+
+ def blob_for_diff(commit, diff)
+ file = blob_at(commit.id, diff.new_path)
+
+ unless file
+ file = prev_blob_for_diff(commit, diff)
+ end
+
+ file
+ end
+
+ def prev_blob_for_diff(commit, diff)
+ if commit.parent_id
+ blob_at(commit.parent_id, diff.old_path)
+ end
+ end
end
diff --git a/app/models/service.rb b/app/models/service.rb
index d655937079d..0dc6d514b46 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -22,8 +22,6 @@
class Service < ActiveRecord::Base
default_value_for :active, false
- attr_accessible :title, :token, :type, :active, :api_key
-
belongs_to :project
has_one :service_hook
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 9e4409daa1a..2c38e7939bd 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -18,8 +18,6 @@
class Snippet < ActiveRecord::Base
include Linguist::BlobHelper
- attr_accessible :title, :content, :file_name, :expires_at, :private
-
default_value_for :private, true
belongs_to :author, class_name: "User"
diff --git a/app/models/tree.rb b/app/models/tree.rb
index ac2183be44b..07c9a825e24 100644
--- a/app/models/tree.rb
+++ b/app/models/tree.rb
@@ -1,4 +1,6 @@
class Tree
+ include Gitlab::MarkdownHelper
+
attr_accessor :entries, :readme, :contribution_guide
def initialize(repository, sha, path = '/')
@@ -6,7 +8,23 @@ class Tree
git_repo = repository.raw_repository
@entries = Gitlab::Git::Tree.where(git_repo, sha, path)
- if readme_tree = @entries.find(&:readme?)
+ available_readmes = @entries.select(&:readme?)
+
+ if available_readmes.count > 0
+ # If there is more than 1 readme in tree, find readme which is supported
+ # by markup renderer.
+ if available_readmes.length > 1
+ supported_readmes = available_readmes.select do |readme|
+ gitlab_markdown?(readme.name) || markup?(readme.name)
+ end
+
+ # Take the first supported readme, or the first available readme, if we
+ # don't support any of them
+ readme_tree = supported_readmes.first || available_readmes.first
+ else
+ readme_tree = available_readmes.first
+ end
+
readme_path = path == '/' ? readme_tree.name : File.join(path, readme_tree.name)
@readme = Gitlab::Git::Blob.find(git_repo, sha, readme_path)
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 8c2045444f0..f1ff76edd15 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -50,31 +50,25 @@ require 'carrierwave/orm/activerecord'
require 'file_size_validator'
class User < ActiveRecord::Base
+ include Gitlab::ConfigHelper
+ extend Gitlab::ConfigHelper
+ include TokenAuthenticatable
+
default_value_for :admin, false
- default_value_for :can_create_group, true
+ default_value_for :can_create_group, gitlab_config.default_can_create_group
default_value_for :can_create_team, false
default_value_for :hide_no_ssh_key, false
+ default_value_for :projects_limit, gitlab_config.default_projects_limit
+ default_value_for :theme_id, gitlab_config.default_theme
- devise :database_authenticatable, :token_authenticatable, :lockable, :async,
+ devise :database_authenticatable, :lockable, :async,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable
- attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
- :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password,
- :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key,
- as: [:default, :admin]
-
- attr_accessible :projects_limit, :can_create_group,
- as: :admin
-
attr_accessor :force_random_password
# Virtual attribute for authenticating by either username or email
attr_accessor :login
- # Add login to attr_accessible
- attr_accessible :login
-
-
#
# Relations
#
@@ -97,6 +91,8 @@ class User < ActiveRecord::Base
has_many :personal_projects, through: :namespace, source: :projects
has_many :projects, through: :users_projects
has_many :created_projects, foreign_key: :creator_id, class_name: 'Project'
+ has_many :users_star_projects, dependent: :destroy
+ has_many :starred_projects, through: :users_star_projects, source: :project
has_many :snippets, dependent: :destroy, foreign_key: :author_id, class_name: "Snippet"
has_many :users_projects, dependent: :destroy
@@ -120,7 +116,7 @@ class User < ActiveRecord::Base
validates :username, presence: true, uniqueness: { case_sensitive: false },
exclusion: { in: Gitlab::Blacklist.path },
format: { with: Gitlab::Regex.username_regex,
- message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
+ message: Gitlab::Regex.username_regex_message }
validates :notification_level, inclusion: { in: Notification.notification_levels }, presence: true
validate :namespace_uniq, if: ->(user) { user.username_changed? }
@@ -223,20 +219,8 @@ class User < ActiveRecord::Base
where('users.username = ? OR users.id = ?', name_or_id.to_s, name_or_id.to_i).first
end
- def build_user(attrs = {}, options= {})
- if options[:as] == :admin
- User.new(defaults.merge(attrs.symbolize_keys), options)
- else
- User.new(attrs, options).with_defaults
- end
- end
-
- def defaults
- {
- projects_limit: Gitlab.config.gitlab.default_projects_limit,
- can_create_group: Gitlab.config.gitlab.default_can_create_group,
- theme_id: Gitlab.config.gitlab.default_theme
- }
+ def build_user(attrs = {})
+ User.new(attrs)
end
end
@@ -258,6 +242,15 @@ class User < ActiveRecord::Base
end
end
+ def generate_reset_token
+ @reset_token, enc = Devise.token_generator.generate(self.class, :reset_password_token)
+
+ self.reset_password_token = enc
+ self.reset_password_sent_at = Time.now.utc
+
+ @reset_token
+ end
+
def namespace_uniq
namespace_name = self.username
if Namespace.find_by(path: namespace_name)
@@ -314,7 +307,7 @@ class User < ActiveRecord::Base
end
def can_change_username?
- Gitlab.config.gitlab.username_changing_enabled
+ gitlab_config.username_changing_enabled
end
def can_create_project?
@@ -372,7 +365,7 @@ class User < ActiveRecord::Base
end
def several_namespaces?
- owned_groups.any?
+ owned_groups.any? || masters_groups.any?
end
def namespace_id
@@ -421,7 +414,9 @@ class User < ActiveRecord::Base
end
def requires_ldap_check?
- if ldap_user?
+ if !Gitlab.config.ldap.enabled
+ false
+ elsif ldap_user?
!last_credential_check_at || (last_credential_check_at + 1.hour) < Time.now
else
false
@@ -489,7 +484,7 @@ class User < ActiveRecord::Base
def avatar_url(size = nil)
if avatar.present?
- URI::join(Gitlab.config.gitlab.url, avatar.url).to_s
+ [gitlab_config.url, avatar.url].join("/")
else
GravatarService.new.execute(email, size)
end
@@ -506,7 +501,7 @@ class User < ActiveRecord::Base
def post_create_hook
log_info("User \"#{self.name}\" (#{self.email}) was created")
- notification_service.new_user(self)
+ notification_service.new_user(self, @reset_token)
system_hook_service.execute_hooks_for(self, :create)
end
@@ -526,4 +521,18 @@ class User < ActiveRecord::Base
def system_hook_service
SystemHooksService.new
end
+
+ def starred?(project)
+ starred_projects.exists?(project)
+ end
+
+ def toggle_star(project)
+ user_star_project = users_star_projects.
+ where(project: project, user: self).take
+ if user_star_project
+ user_star_project.destroy
+ else
+ UsersStarProject.create!(project: project, user: self)
+ end
+ end
end
diff --git a/app/models/users_group.rb b/app/models/users_group.rb
index 242c8abb3ca..270f968ef61 100644
--- a/app/models/users_group.rb
+++ b/app/models/users_group.rb
@@ -19,8 +19,6 @@ class UsersGroup < ActiveRecord::Base
Gitlab::Access.options_with_owner
end
- attr_accessible :group_access, :user_id
-
belongs_to :user
belongs_to :group
diff --git a/app/models/users_project.rb b/app/models/users_project.rb
index 6495bed4e61..60bdf7a3cfb 100644
--- a/app/models/users_project.rb
+++ b/app/models/users_project.rb
@@ -16,8 +16,6 @@ class UsersProject < ActiveRecord::Base
include Notifiable
include Gitlab::Access
- attr_accessible :user, :user_id, :project_access
-
belongs_to :user
belongs_to :project
@@ -126,7 +124,7 @@ class UsersProject < ActiveRecord::Base
author_id: self.user.id
)
- notification_service.new_team_member(self)
+ notification_service.new_team_member(self) unless owner?
system_hook_service.execute_hooks_for(self, :create)
end
diff --git a/app/models/users_star_project.rb b/app/models/users_star_project.rb
new file mode 100644
index 00000000000..3d49cb05949
--- /dev/null
+++ b/app/models/users_star_project.rb
@@ -0,0 +1,19 @@
+# == Schema Information
+#
+# Table name: users_star_projects
+#
+# id :integer not null, primary key
+# project_id :integer not null
+# user_id :integer not null
+# created_at :datetime
+# updated_at :datetime
+#
+
+class UsersStarProject < ActiveRecord::Base
+ belongs_to :project, counter_cache: :star_count
+ belongs_to :user
+
+ validates :user, presence: true
+ validates :user_id, uniqueness: { scope: [:project_id] }
+ validates :project, presence: true
+end
diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb
index 76854da5c38..6cf0c1f683e 100644
--- a/app/models/web_hook.rb
+++ b/app/models/web_hook.rb
@@ -22,8 +22,6 @@ class WebHook < ActiveRecord::Base
default_value_for :issues_events, false
default_value_for :merge_requests_events, false
- attr_accessible :url
-
# HTTParty timeout
default_timeout 10
diff --git a/app/services/archive_repository_service.rb b/app/services/archive_repository_service.rb
new file mode 100644
index 00000000000..8823f6fdc67
--- /dev/null
+++ b/app/services/archive_repository_service.rb
@@ -0,0 +1,14 @@
+class ArchiveRepositoryService
+ def execute(project, ref, format)
+ storage_path = Gitlab.config.gitlab.repository_downloads_path
+
+ unless File.directory?(storage_path)
+ FileUtils.mkdir_p(storage_path)
+ end
+
+ format ||= 'tar.gz'
+ repository = project.repository
+ repository.clean_old_archives
+ repository.archive_repo(ref, storage_path, format.downcase)
+ end
+end
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb
new file mode 100644
index 00000000000..6aa9df4b194
--- /dev/null
+++ b/app/services/compare_service.rb
@@ -0,0 +1,27 @@
+# Compare 2 branches for one repo or between repositories
+# and return Gitlab::CompareResult object that responds to commits and diffs
+class CompareService
+ def execute(current_user, source_project, source_branch, target_project, target_branch)
+ # Try to compare branches to get commits list and diffs
+ #
+ # Note: Use satellite only when need to compare between two repos
+ # because satellites are slower than operations on bare repo
+ if target_project == source_project
+ Gitlab::CompareResult.new(
+ Gitlab::Git::Compare.new(
+ target_project.repository.raw_repository,
+ target_branch,
+ source_branch,
+ )
+ )
+ else
+ Gitlab::Satellite::CompareAction.new(
+ current_user,
+ target_project,
+ target_branch,
+ source_project,
+ source_branch
+ ).result
+ end
+ end
+end
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index 98beeee8354..79b8239602e 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -1,13 +1,38 @@
class CreateBranchService
def execute(project, branch_name, ref, current_user)
+ valid_branch = Gitlab::GitRefValidator.validate(branch_name)
+ if valid_branch == false
+ return error('Branch name invalid')
+ end
+
repository = project.repository
+ existing_branch = repository.find_branch(branch_name)
+ if existing_branch
+ return error('Branch already exists')
+ end
+
repository.add_branch(branch_name, ref)
new_branch = repository.find_branch(branch_name)
if new_branch
Event.create_ref_event(project, current_user, new_branch, 'add')
+ return success(new_branch)
+ else
+ return error('Invalid reference name')
end
+ end
+
+ def error(message)
+ {
+ message: message,
+ status: :error
+ }
+ end
- new_branch
+ def success(branch)
+ {
+ branch: branch,
+ status: :success
+ }
end
end
diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb
index 97766677405..3716abd4b2b 100644
--- a/app/services/create_tag_service.rb
+++ b/app/services/create_tag_service.rb
@@ -1,13 +1,42 @@
class CreateTagService
- def execute(project, tag_name, ref, current_user)
+ def execute(project, tag_name, ref, message, current_user)
+ valid_tag = Gitlab::GitRefValidator.validate(tag_name)
+ if valid_tag == false
+ return error('Tag name invalid')
+ end
+
repository = project.repository
- repository.add_tag(tag_name, ref)
+ existing_tag = repository.find_tag(tag_name)
+ if existing_tag
+ return error('Tag already exists')
+ end
+
+ if message
+ message.gsub!(/^\s+|\s+$/, '')
+ end
+
+ repository.add_tag(tag_name, ref, message)
new_tag = repository.find_tag(tag_name)
if new_tag
Event.create_ref_event(project, current_user, new_tag, 'add', 'refs/tags')
+ return success(new_tag)
+ else
+ return error('Invalid reference name')
end
+ end
+
+ def error(message)
+ {
+ message: message,
+ status: :error
+ }
+ end
- new_tag
+ def success(branch)
+ {
+ tag: branch,
+ status: :success
+ }
end
end
diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb
index ce2d8093dff..a94dabcdfc0 100644
--- a/app/services/delete_branch_service.rb
+++ b/app/services/delete_branch_service.rb
@@ -5,21 +5,21 @@ class DeleteBranchService
# No such branch
unless branch
- return error('No such branch')
+ return error('No such branch', 404)
end
if branch_name == repository.root_ref
- return error('Cannot remove HEAD branch')
+ return error('Cannot remove HEAD branch', 405)
end
# Dont allow remove of protected branch
if project.protected_branch?(branch_name)
- return error('Protected branch cant be removed')
+ return error('Protected branch cant be removed', 405)
end
# Dont allow user to remove branch if he is not allowed to push
unless current_user.can?(:push_code, project)
- return error('You dont have push access to repo')
+ return error('You dont have push access to repo', 405)
end
if repository.rm_branch(branch_name)
@@ -30,9 +30,10 @@ class DeleteBranchService
end
end
- def error(message)
+ def error(message, return_code = 400)
{
message: message,
+ return_code: return_code,
state: :error
}
end
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index 1998fb79e7d..82e4d7b684f 100644
--- a/app/services/files/create_service.rb
+++ b/app/services/files/create_service.rb
@@ -21,7 +21,10 @@ module Files
file_path = path
unless file_name =~ Gitlab::Regex.path_regex
- return error("Your changes could not be committed, because file name contains not allowed characters")
+ return error(
+ 'Your changes could not be committed, because the file name ' +
+ Gitlab::Regex.path_regex_message
+ )
end
blob = repository.blob_at_branch(ref, file_path)
diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb
index c631f28749c..a0f40154db0 100644
--- a/app/services/files/update_service.rb
+++ b/app/services/files/update_service.rb
@@ -33,7 +33,7 @@ module Files
if created_successfully
success
else
- error("Your changes could not be committed, because the file has been changed")
+ error("Your changes could not be committed. Maybe the file was changed by another process or there was nothing to commit?")
end
end
end
diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb
index eac774210ae..71b9ffc3489 100644
--- a/app/services/issues/base_service.rb
+++ b/app/services/issues/base_service.rb
@@ -7,8 +7,11 @@ module Issues
Note.create_assignee_change_note(issue, issue.project, current_user, issue.assignee)
end
- def execute_hooks(issue)
- issue.project.execute_hooks(issue.to_hook_data, :issue_hooks)
+ def execute_hooks(issue, action = 'open')
+ issue_data = issue.to_hook_data
+ issue_url = Gitlab::UrlBuilder.new(:issue).build(issue.id)
+ issue_data[:object_attributes].merge!(url: issue_url, action: action)
+ issue.project.execute_hooks(issue_data, :issue_hooks)
end
def create_milestone_note(issue)
diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb
index 85c0226ccab..ffed13a12e1 100644
--- a/app/services/issues/close_service.rb
+++ b/app/services/issues/close_service.rb
@@ -5,7 +5,7 @@ module Issues
notification_service.close_issue(issue, current_user)
event_service.close_issue(issue, current_user)
create_note(issue, commit)
- execute_hooks(issue)
+ execute_hooks(issue, 'close')
end
issue
diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb
index d6137833bb9..d5c17906a55 100644
--- a/app/services/issues/create_service.rb
+++ b/app/services/issues/create_service.rb
@@ -1,14 +1,16 @@
module Issues
class CreateService < Issues::BaseService
def execute
- issue = project.issues.new(params)
+ label_params = params[:label_ids]
+ issue = project.issues.new(params.except(:label_ids))
issue.author = current_user
if issue.save
+ issue.update_attributes(label_ids: label_params)
notification_service.new_issue(issue, current_user)
event_service.open_issue(issue, current_user)
issue.create_cross_references!(issue.project, current_user)
- execute_hooks(issue)
+ execute_hooks(issue, 'open')
end
issue
diff --git a/app/services/issues/reopen_service.rb b/app/services/issues/reopen_service.rb
index a931398aff6..1e5c398516d 100644
--- a/app/services/issues/reopen_service.rb
+++ b/app/services/issues/reopen_service.rb
@@ -4,7 +4,8 @@ module Issues
if issue.reopen
event_service.reopen_issue(issue, current_user)
create_note(issue)
- execute_hooks(issue)
+ notification_service.reopen_issue(issue, current_user)
+ execute_hooks(issue, 'reopen')
end
issue
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index b4a742b0037..a0e57144435 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -1,7 +1,7 @@
module Issues
class UpdateService < Issues::BaseService
def execute(issue)
- state = params.delete('state_event') || params.delete(:state_event)
+ state = params[:state_event]
case state
when 'reopen'
@@ -10,7 +10,7 @@ module Issues
Issues::CloseService.new(project, current_user, {}).execute(issue)
end
- if params.present? && issue.update_attributes(params)
+ if params.present? && issue.update_attributes(params.except(:state_event))
issue.reset_events_cache
if issue.previous_changes.include?('milestone_id')
@@ -23,7 +23,7 @@ module Issues
end
issue.notice_added_references(issue.project, current_user)
- execute_hooks(issue)
+ execute_hooks(issue, 'update')
end
issue
diff --git a/app/services/merge_requests/auto_merge_service.rb b/app/services/merge_requests/auto_merge_service.rb
index e35c03275f2..20b88d1510c 100644
--- a/app/services/merge_requests/auto_merge_service.rb
+++ b/app/services/merge_requests/auto_merge_service.rb
@@ -6,7 +6,7 @@ module MergeRequests
# Called when you do merge via GitLab UI
class AutoMergeService < BaseMergeService
def execute(merge_request, current_user, commit_message)
- merge_request.lock
+ merge_request.lock_mr
if Gitlab::Satellite::MergeAction.new(current_user, merge_request).merge!(commit_message)
merge_request.merge
@@ -17,11 +17,11 @@ module MergeRequests
true
else
- merge_request.unlock
+ merge_request.unlock_mr
false
end
rescue
- merge_request.unlock if merge_request.locked?
+ merge_request.unlock_mr if merge_request.locked?
merge_request.mark_as_unmergeable
false
end
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
new file mode 100644
index 00000000000..1475973e543
--- /dev/null
+++ b/app/services/merge_requests/build_service.rb
@@ -0,0 +1,68 @@
+module MergeRequests
+ class BuildService < MergeRequests::BaseService
+ def execute
+ merge_request = MergeRequest.new(params)
+
+ # Set MR attributes
+ merge_request.can_be_created = false
+ merge_request.compare_failed = false
+ merge_request.compare_commits = []
+ merge_request.compare_diffs = []
+ merge_request.source_project = project unless merge_request.source_project
+ merge_request.target_project ||= (project.forked_from_project || project)
+ merge_request.target_branch ||= merge_request.target_project.default_branch
+
+ unless merge_request.target_branch && merge_request.source_branch
+ return build_failed(merge_request, "You must select source and target branches")
+ end
+
+ # Generate suggested MR title based on source branch name
+ merge_request.title = merge_request.source_branch.titleize.humanize
+
+ compare_result = CompareService.new.execute(
+ current_user,
+ merge_request.source_project,
+ merge_request.source_branch,
+ merge_request.target_project,
+ merge_request.target_branch,
+ )
+
+ commits = compare_result.commits
+
+ # At this point we decide if merge request can be created
+ # If we have at least one commit to merge -> creation allowed
+ if commits.present?
+ merge_request.compare_commits = Commit.decorate(commits)
+ merge_request.can_be_created = true
+ merge_request.compare_failed = false
+
+ # Try to collect diff for merge request.
+ diffs = compare_result.diffs
+
+ if diffs.present?
+ merge_request.compare_diffs = diffs
+
+ elsif diffs == false
+ # satellite timeout return false
+ merge_request.can_be_created = false
+ merge_request.compare_failed = true
+ end
+ else
+ merge_request.can_be_created = false
+ merge_request.compare_failed = false
+ end
+
+ merge_request
+
+ rescue Gitlab::Satellite::BranchesWithoutParent
+ return build_failed(merge_request, "Selected branches have no common commit so they cannot be merged.")
+ end
+
+ def build_failed(merge_request, message)
+ merge_request.errors.add(:base, message)
+ merge_request.compare_commits = []
+ merge_request.can_be_created = false
+ merge_request
+ end
+ end
+end
diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb
index d1bf827f3fc..ca8d80f6c0c 100644
--- a/app/services/merge_requests/create_service.rb
+++ b/app/services/merge_requests/create_service.rb
@@ -1,12 +1,14 @@
module MergeRequests
class CreateService < MergeRequests::BaseService
def execute
- merge_request = MergeRequest.new(params)
+ label_params = params[:label_ids]
+ merge_request = MergeRequest.new(params.except(:label_ids))
merge_request.source_project = project
merge_request.target_project ||= project
merge_request.author = current_user
if merge_request.save
+ merge_request.update_attributes(label_ids: label_params)
event_service.open_mr(merge_request, current_user)
notification_service.new_merge_request(merge_request, current_user)
merge_request.create_cross_references!(merge_request.project, current_user)
diff --git a/app/services/merge_requests/reopen_service.rb b/app/services/merge_requests/reopen_service.rb
index 2eb13d3e0e1..bd68919a550 100644
--- a/app/services/merge_requests/reopen_service.rb
+++ b/app/services/merge_requests/reopen_service.rb
@@ -3,6 +3,7 @@ module MergeRequests
def execute(merge_request)
if merge_request.reopen
event_service.reopen_mr(merge_request, current_user)
+ notification_service.reopen_mr(merge_request, current_user)
create_note(merge_request)
execute_hooks(merge_request)
merge_request.reload_code
diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb
index f1aa8b73930..6e416a0080c 100644
--- a/app/services/merge_requests/update_service.rb
+++ b/app/services/merge_requests/update_service.rb
@@ -7,10 +7,10 @@ module MergeRequests
def execute(merge_request)
# We dont allow change of source/target projects
# after merge request was created
- params.delete(:source_project_id)
- params.delete(:target_project_id)
+ params.except!(:source_project_id)
+ params.except!(:target_project_id)
- state = params.delete('state_event') || params.delete(:state_event)
+ state = params[:state_event]
case state
when 'reopen'
@@ -19,7 +19,7 @@ module MergeRequests
MergeRequests::CloseService.new(project, current_user, {}).execute(merge_request)
end
- if params.present? && merge_request.update_attributes(params)
+ if params.present? && merge_request.update_attributes(params.except(:state_event))
merge_request.reset_events_cache
if merge_request.previous_changes.include?('milestone_id')
diff --git a/app/services/milestones/group_service.rb b/app/services/milestones/group_service.rb
new file mode 100644
index 00000000000..11d702f1e7b
--- /dev/null
+++ b/app/services/milestones/group_service.rb
@@ -0,0 +1,26 @@
+module Milestones
+ class GroupService < Milestones::BaseService
+ def initialize(project_milestones)
+ @project_milestones = project_milestones.group_by(&:title)
+ end
+
+ def execute
+ build(@project_milestones)
+ end
+
+ def milestone(title)
+ if title
+ group_milestone = @project_milestones[title].group_by(&:title)
+ build(group_milestone).first
+ else
+ nil
+ end
+ end
+
+ private
+
+ def build(milestone)
+ milestone.map{ |title, milestones| GroupMilestone.new(title, milestones) }
+ end
+ end
+end
diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb
index 307e96a2b36..ed64847f429 100644
--- a/app/services/milestones/update_service.rb
+++ b/app/services/milestones/update_service.rb
@@ -1,7 +1,7 @@
module Milestones
class UpdateService < Milestones::BaseService
def execute(milestone)
- state = params.delete('state_event') || params.delete(:state_event)
+ state = params[:state_event]
case state
when 'activate'
@@ -11,7 +11,7 @@ module Milestones
end
if params.present?
- milestone.update_attributes(params)
+ milestone.update_attributes(params.except(:state_event))
end
milestone
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 650b6008db8..36d33e0d7ca 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -80,6 +80,10 @@ class NotificationService
close_resource_email(merge_request, merge_request.target_project, current_user, 'closed_merge_request_email')
end
+ def reopen_issue(issue, current_user)
+ reopen_resource_email(issue, issue.project, current_user, 'issue_status_changed_email', 'reopened')
+ end
+
# When we merge a merge request we should send next emails:
#
# * merge_request author if their notification level is not Disabled
@@ -89,16 +93,21 @@ class NotificationService
def merge_mr(merge_request, current_user)
recipients = reject_muted_users([merge_request.author, merge_request.assignee], merge_request.target_project)
recipients = recipients.concat(project_watchers(merge_request.target_project)).uniq
+ recipients.delete(current_user)
recipients.each do |recipient|
mailer.merged_merge_request_email(recipient.id, merge_request.id, current_user.id)
end
end
+ def reopen_mr(merge_request, current_user)
+ reopen_resource_email(merge_request, merge_request.target_project, current_user, 'merge_request_status_email', 'reopened')
+ end
+
# Notify new user with email after creation
- def new_user(user)
+ def new_user(user, token = nil)
# Don't email omniauth created users
- mailer.new_user_email(user.id, user.password) unless user.extern_uid?
+ mailer.new_user_email(user.id, user.password, token) unless user.extern_uid?
end
# Notify users on new note in system
@@ -301,7 +310,9 @@ class NotificationService
end
def reassign_resource_email(target, project, current_user, method)
- recipients = User.where(id: [target.assignee_id, target.assignee_id_was])
+ assignee_id_was = previous_record(target, "assignee_id")
+
+ recipients = User.where(id: [target.assignee_id, assignee_id_was])
# Add watchers to email list
recipients = recipients.concat(project_watchers(project))
@@ -313,11 +324,29 @@ class NotificationService
recipients.delete(current_user)
recipients.each do |recipient|
- mailer.send(method, recipient.id, target.id, target.assignee_id_was, current_user.id)
+ mailer.send(method, recipient.id, target.id, assignee_id_was, current_user.id)
+ end
+ end
+
+ def reopen_resource_email(target, project, current_user, method, status)
+ recipients = reject_muted_users([target.author, target.assignee], project)
+ recipients = recipients.concat(project_watchers(project)).uniq
+ recipients.delete(current_user)
+
+ recipients.each do |recipient|
+ mailer.send(method, recipient.id, target.id, status, current_user.id)
end
end
def mailer
Notify.delay
end
+
+ def previous_record(object, attribute)
+ if object && attribute
+ if object.previous_changes.include?(attribute)
+ object.previous_changes[attribute].first
+ end
+ end
+ end
end
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index dfadcfd296a..2bfb0f28d95 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -5,27 +5,13 @@ module Projects
end
def execute
- # get namespace id
- namespace_id = params.delete(:namespace_id)
+ @project = Project.new(params)
- # check that user is allowed to set specified visibility_level
+ # Reset visibility levet if is not allowed to set it
unless Gitlab::VisibilityLevel.allowed_for?(current_user, params[:visibility_level])
- params.delete(:visibility_level)
+ @project.visibility_level = default_features.visibility_level
end
- # Load default feature settings
- default_features = Gitlab.config.gitlab.default_projects_features
-
- default_opts = {
- issues_enabled: default_features.issues,
- wiki_enabled: default_features.wiki,
- snippets_enabled: default_features.snippets,
- merge_requests_enabled: default_features.merge_requests,
- visibility_level: default_features.visibility_level
- }.stringify_keys
-
- @project = Project.new(default_opts.merge(params))
-
# Parametrize path for project
#
# Ex.
@@ -33,13 +19,14 @@ module Projects
#
@project.path = @project.name.dup.parameterize unless @project.path.present?
+ # get namespace id
+ namespace_id = params[:namespace_id]
if namespace_id
# Find matching namespace and check if it allowed
# for current user if namespace_id passed.
- if allowed_namespace?(current_user, namespace_id)
- @project.namespace_id = namespace_id
- else
+ unless allowed_namespace?(current_user, namespace_id)
+ @project.namespace_id = nil
deny_namespace
return @project
end
@@ -70,7 +57,6 @@ module Projects
:add_repository,
@project.path_with_namespace
)
-
end
if @project.wiki_enabled?
diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb
index 2f1c7b18aa0..66f0a02f0af 100644
--- a/app/services/projects/fork_service.rb
+++ b/app/services/projects/fork_service.rb
@@ -7,7 +7,12 @@ module Projects
end
def execute
- project = @from_project.dup
+ project_params = {
+ visibility_level: @from_project.visibility_level,
+ description: @from_project.description,
+ }
+
+ project = Project.new(project_params)
project.name = @from_project.name
project.path = @from_project.path
project.namespace = current_user.namespace
diff --git a/app/services/projects/participants_service.rb b/app/services/projects/participants_service.rb
new file mode 100644
index 00000000000..c4d2c0963b7
--- /dev/null
+++ b/app/services/projects/participants_service.rb
@@ -0,0 +1,43 @@
+module Projects
+ class ParticipantsService < BaseService
+ def initialize(project)
+ @project = project
+ end
+
+ def execute(note_type, note_id)
+ participating = if note_type && note_id
+ participants_in(note_type, note_id)
+ else
+ []
+ end
+ team_members = sorted(@project.team.members)
+ participants = all_members + team_members + participating
+ participants.uniq
+ end
+
+ def participants_in(type, id)
+ users = case type
+ when "Issue"
+ issue = @project.issues.find_by_iid(id)
+ issue ? issue.participants : []
+ when "MergeRequest"
+ merge_request = @project.merge_requests.find_by_iid(id)
+ merge_request ? merge_request.participants : []
+ when "Commit"
+ author_ids = Note.for_commit_id(id).pluck(:author_id).uniq
+ User.where(id: author_ids)
+ else
+ []
+ end
+ sorted(users)
+ end
+
+ def sorted(users)
+ users.uniq.to_a.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } }
+ end
+
+ def all_members
+ [{ username: "all", name: "Project and Group Members" }]
+ end
+ end
+end
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb
index d115e92a105..e39fe882cb1 100644
--- a/app/services/projects/transfer_service.rb
+++ b/app/services/projects/transfer_service.rb
@@ -12,7 +12,7 @@ module Projects
class TransferError < StandardError; end
def execute
- namespace_id = params.delete(:namespace_id)
+ namespace_id = params[:namespace_id]
namespace = Namespace.find_by(id: namespace_id)
if allowed_transfer?(current_user, project, namespace)
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb
index 551a3653cad..36877a61679 100644
--- a/app/services/projects/update_service.rb
+++ b/app/services/projects/update_service.rb
@@ -1,23 +1,18 @@
module Projects
class UpdateService < BaseService
- def execute(role = :default)
- params[:project].delete(:namespace_id)
+ def execute
# check that user is allowed to set specified visibility_level
- unless can?(current_user, :change_visibility_level, project) && Gitlab::VisibilityLevel.allowed_for?(current_user, params[:project][:visibility_level])
- params[:project].delete(:visibility_level)
+ unless can?(current_user, :change_visibility_level, project) && Gitlab::VisibilityLevel.allowed_for?(current_user, params[:visibility_level])
+ params[:visibility_level] = project.visibility_level
end
- new_branch = params[:project].delete(:default_branch)
+ new_branch = params[:default_branch]
if project.repository.exists? && new_branch && new_branch != project.default_branch
project.change_head(new_branch)
end
- if project.update_attributes(params[:project], as: role)
- if project.previous_changes.include?('namespace_id')
- project.send_move_instructions
- end
-
+ if project.update_attributes(params.except(:default_branch))
if project.previous_changes.include?('path')
project.rename_repo
end
diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb
index 21214511182..0bcc50c81a7 100644
--- a/app/services/search/global_service.rb
+++ b/app/services/search/global_service.rb
@@ -7,29 +7,12 @@ module Search
end
def execute
- query = params[:search]
- query = Shellwords.shellescape(query) if query.present?
- return result unless query.present?
-
group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
projects = ProjectsFinder.new.execute(current_user)
projects = projects.where(namespace_id: group.id) if group
project_ids = projects.pluck(:id)
- result[:projects] = projects.search(query).limit(20)
- result[:merge_requests] = MergeRequest.in_projects(project_ids).search(query).order('updated_at DESC').limit(20)
- result[:issues] = Issue.where(project_id: project_ids).search(query).order('updated_at DESC').limit(20)
- result[:total_results] = %w(projects issues merge_requests).sum { |items| result[items.to_sym].size }
- result
- end
-
- def result
- @result ||= {
- projects: [],
- merge_requests: [],
- issues: [],
- total_results: 0,
- }
+ Gitlab::SearchResults.new(project_ids, params[:search])
end
end
end
diff --git a/app/services/search/project_service.rb b/app/services/search/project_service.rb
index 3ebaafc752c..f630c0a3790 100644
--- a/app/services/search/project_service.rb
+++ b/app/services/search/project_service.rb
@@ -7,31 +7,9 @@ module Search
end
def execute
- query = params[:search]
- query = Shellwords.shellescape(query) if query.present?
- return result unless query.present?
-
- if params[:search_code].present?
- blobs = project.repository.search_files(query, params[:repository_ref]) unless project.empty_repo?
- blobs = Kaminari.paginate_array(blobs).page(params[:page]).per(20)
- result[:blobs] = blobs
- result[:total_results] = blobs.total_count
- else
- result[:merge_requests] = project.merge_requests.search(query).order('updated_at DESC').limit(20)
- result[:issues] = project.issues.search(query).order('updated_at DESC').limit(20)
- result[:total_results] = %w(issues merge_requests).sum { |items| result[items.to_sym].size }
- end
-
- result
- end
-
- def result
- @result ||= {
- merge_requests: [],
- issues: [],
- blobs: [],
- total_results: 0,
- }
+ Gitlab::ProjectSearchResults.new(project.id,
+ params[:search],
+ params[:repository_ref])
end
end
end
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index 41014f199d5..bfc725e5eb5 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -22,6 +22,16 @@ class SystemHooksService
}
case model
+ when Key
+ data.merge!(
+ key: model.key,
+ id: model.id
+ )
+ if model.user
+ data.merge!(
+ username: model.user.username
+ )
+ end
when Project
owner = model.owner
diff --git a/app/services/test_hook_service.rb b/app/services/test_hook_service.rb
index 17d86a7a274..b6b1ef29b51 100644
--- a/app/services/test_hook_service.rb
+++ b/app/services/test_hook_service.rb
@@ -2,5 +2,8 @@ class TestHookService
def execute(hook, current_user)
data = GitPushService.new.sample_data(hook.project, current_user)
hook.execute(data)
+ true
+ rescue SocketError
+ false
end
end
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index 41760f8b1e3..7427cea7e8b 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -94,7 +94,7 @@
%span.light.pull-right
= Milestone.count
%p
- Monthly active users
+ Active users last 30 days
%span.light.pull-right
= User.where("current_sign_in_at > ?", 30.days.ago).count
.col-md-4
diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml
index d00772d4dfe..e18dd9bc905 100644
--- a/app/views/admin/users/_form.html.haml
+++ b/app/views/admin/users/_form.html.haml
@@ -31,9 +31,9 @@
= f.label :password, class: 'control-label'
.col-sm-10
%strong
- A temporary password will be generated and sent to user.
+ Reset link will be generated and sent to the user.
%br
- User will be forced to change it after first sign in
+ User will be forced to set the password on first sign in.
- else
%fieldset
%legend Password
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index 3c30ccd78b3..f60d40b5334 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -71,6 +71,14 @@
No
%li
+ %span.light Current sign-in at:
+ %strong
+ - if @user.current_sign_in_at
+ = @user.current_sign_in_at.stamp("Nov 12, 2031")
+ - else
+ never
+
+ %li
%span.light Last sign-in at:
%strong
- if @user.last_sign_in_at
diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml
index cb9c18b7966..9bcc77b8d8e 100644
--- a/app/views/dashboard/_groups.html.haml
+++ b/app/views/dashboard/_groups.html.haml
@@ -2,10 +2,9 @@
.panel-heading.clearfix
= search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter form-control'
- if current_user.can_create_group?
- %span.pull-right
- = link_to new_group_path, class: "btn btn-new" do
- %i.icon-plus
- New group
+ = link_to new_group_path, class: "btn btn-new pull-right" do
+ %i.icon-plus
+ New group
%ul.well-list.dash-list
- groups.each do |group|
%li.group-row
diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml
index 5a49bf0c6b1..0cc253a8dd1 100644
--- a/app/views/dashboard/_projects.html.haml
+++ b/app/views/dashboard/_projects.html.haml
@@ -2,10 +2,9 @@
.panel-heading.clearfix
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-filter form-control'
- if current_user.can_create_project?
- %span.pull-right
- = link_to new_project_path, class: "btn btn-new" do
- %i.icon-plus
- New project
+ = link_to new_project_path, class: "btn btn-new pull-right" do
+ %i.icon-plus
+ New project
%ul.well-list.dash-list
- projects.each do |project|
diff --git a/app/views/dashboard/_projects_filter.html.haml b/app/views/dashboard/_projects_filter.html.haml
index 8c9893ba84f..e4fa2d59e8a 100644
--- a/app/views/dashboard/_projects_filter.html.haml
+++ b/app/views/dashboard/_projects_filter.html.haml
@@ -44,12 +44,12 @@
-- if @labels.present?
+- if @tags.present?
%fieldset
- %legend Labels
+ %legend Tags
%ul.nav.nav-pills.nav-stacked.nav-small
- - @labels.each do |label|
- %li{ class: (label.name == params[:label]) ? 'active' : 'light' }
- = link_to projects_dashboard_filter_path(scope: params[:scope], label: label.name) do
+ - @tags.each do |tag|
+ %li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
+ = link_to projects_dashboard_filter_path(scope: params[:scope], tag: tag.name) do
%i.icon-tag
- = label.name
+ = tag.name
diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml
index ee086d88e3e..ff85e32bc4e 100644
--- a/app/views/dashboard/_zero_authorized_projects.html.haml
+++ b/app/views/dashboard/_zero_authorized_projects.html.haml
@@ -46,5 +46,5 @@
%br
Public projects are an easy way to allow everyone to have read-only access.
.link_holder
- = link_to public_projects_path, class: "btn btn-new" do
+ = link_to explore_projects_path, class: "btn btn-new" do
Browse public projects »
diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml
index 9888da2f7f2..d3ff291eaa8 100644
--- a/app/views/dashboard/issues.html.haml
+++ b/app/views/dashboard/issues.html.haml
@@ -1,6 +1,5 @@
%h3.page-title
Issues
- %span.pull-right #{@issues.total_count} issues
%p.light
List all issues from all projects you have access to.
diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml
index ee3bec2849d..7a9ea9f6f90 100644
--- a/app/views/dashboard/merge_requests.html.haml
+++ b/app/views/dashboard/merge_requests.html.haml
@@ -1,6 +1,5 @@
%h3.page-title
Merge Requests
- %span.pull-right #{@merge_requests.total_count} merge requests
%p.light
diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml
index e1c9a5941e9..2714ebc53de 100644
--- a/app/views/dashboard/projects.html.haml
+++ b/app/views/dashboard/projects.html.haml
@@ -54,10 +54,10 @@
%span.label
%i.icon-archive
Archived
- - project.labels.each do |label|
+ - project.tags.each do |tag|
%span.label.label-info
%i.icon-tag
- = label.name
+ = tag.name
- if project.description.present?
%p= truncate project.description, length: 100
.last-activity
diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml
index bf634d9de60..8d17f39eba2 100755
--- a/app/views/devise/confirmations/new.html.haml
+++ b/app/views/devise/confirmations/new.html.haml
@@ -1,15 +1,13 @@
.login-box
- %h3.page-title Resend confirmation instructions
- = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
- .devise-errors
- = devise_error_messages!
- .clearfix.append-bottom-20
- = f.email_field :email, placeholder: 'Email', class: "form-control", required: true
- .clearfix.append-bottom-10
- = f.submit "Resend confirmation instructions", class: 'btn btn-success'
- %hr
- %p
- %span.light
- Already have login and password?
- %strong
- = link_to "Sign in", new_session_path(resource_name)
+ .login-heading
+ %h3 Resend confirmation instructions
+ .login-body
+ = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
+ .devise-errors
+ = devise_error_messages!
+ .clearfix.append-bottom-20
+ = f.email_field :email, placeholder: 'Email', class: "form-control", required: true
+ .clearfix.append-bottom-10
+ = f.submit "Resend confirmation instructions", class: 'btn btn-success'
+ .login-footer
+ = render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb
index 553d08369e9..cb1291cf3bf 100644
--- a/app/views/devise/mailer/confirmation_instructions.html.erb
+++ b/app/views/devise/mailer/confirmation_instructions.html.erb
@@ -6,4 +6,4 @@
<p>You can confirm your account through the link below:</p>
<% end %>
-<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @resource.confirmation_token) %></p>
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb
index e1144e943b4..7913e88beb6 100644
--- a/app/views/devise/mailer/reset_password_instructions.html.erb
+++ b/app/views/devise/mailer/reset_password_instructions.html.erb
@@ -2,7 +2,7 @@
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
-<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @resource.reset_password_token) %></p>
+<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb
index 0429883f05b..8c2a4f0c2d9 100644
--- a/app/views/devise/mailer/unlock_instructions.html.erb
+++ b/app/views/devise/mailer/unlock_instructions.html.erb
@@ -4,4 +4,4 @@
<p>Click the link below to unlock your account:</p>
-<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @resource.unlock_token) %></p>
+<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml
index 95c52608e1f..1326cc0aac9 100644
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
@@ -1,15 +1,18 @@
-= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "login-box" }) do |f|
- %h3 Change your password
- .devise-errors
- = devise_error_messages!
- = f.hidden_field :reset_password_token
- %div
- = f.password_field :password, class: "form-control top", placeholder: "New password", required: true
- %div
- = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true
- %div
- .clearfix.append-bottom-10
- = f.submit "Change my password", class: "btn btn-primary"
- = link_to "Sign in", new_session_path(resource_name), class: "btn pull-right"
- %div
- = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
+.login-box
+ .login-heading
+ %h3 Change your password
+ .login-body
+ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
+ .devise-errors
+ = devise_error_messages!
+ = f.hidden_field :reset_password_token
+ %div
+ = f.password_field :password, class: "form-control top", placeholder: "New password", required: true
+ %div
+ = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true
+ .clearfix.append-bottom-10
+ = f.submit "Change my password", class: "btn btn-primary"
+ .login-footer
+ %p
+ = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
+ = render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml
index 040821ca32a..b8af1b8693a 100755
--- a/app/views/devise/passwords/new.html.haml
+++ b/app/views/devise/passwords/new.html.haml
@@ -1,14 +1,13 @@
-= form_for(resource, as: resource_name, url: password_path(resource_name), html: { class: "login-box", method: :post }) do |f|
- %h3.page-title Reset password
- .devise-errors
- = devise_error_messages!
- .clearfix.append-bottom-20
- = f.email_field :email, placeholder: "Email", class: "form-control", required: true
- .clearfix.append-bottom-10
- = f.submit "Reset password", class: "btn-primary btn"
- %hr
- %p
- %span.light
- Already have login and password?
- %strong
- = link_to "Sign in", new_session_path(resource_name)
+.login-box
+ .login-heading
+ %h3 Reset password
+ .login-body
+ = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
+ .devise-errors
+ = devise_error_messages!
+ .clearfix.append-bottom-20
+ = f.email_field :email, placeholder: "Email", class: "form-control", required: true
+ .clearfix.append-bottom-10
+ = f.submit "Reset password", class: "btn-primary btn"
+ .login-footer
+ = render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml
index 24bc0406544..d6a952f3dc5 100644
--- a/app/views/devise/registrations/new.html.haml
+++ b/app/views/devise/registrations/new.html.haml
@@ -1,24 +1,27 @@
-= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "login-box" }) do |f|
- %h3.page-title Sign Up
- .devise-errors
- = devise_error_messages!
- %div
- = f.text_field :name, class: "form-control top", placeholder: "Name", required: true
- %div
- = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true
- %div
- = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true
- %div
- = f.password_field :password, class: "form-control middle", placeholder: "Password", required: true
- %div
- = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true
- %div
- = f.submit "Sign up", class: "btn-create btn"
- %hr
- %p
- %span.light
- Have an account?
- %strong
- = link_to "Sign in", new_session_path(resource_name)
- %p
- = link_to "Forgot your password?", new_password_path(resource_name)
+.login-box
+ .login-heading
+ %h3 Sign up
+ .login-body
+ = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
+ .devise-errors
+ = devise_error_messages!
+ %div
+ = f.text_field :name, class: "form-control top", placeholder: "Name", required: true
+ %div
+ = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true
+ %div
+ = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true
+ %div
+ = f.password_field :password, class: "form-control middle", placeholder: "Password", required: true
+ %div
+ = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true
+ %div
+ = f.submit "Sign up", class: "btn-create btn"
+ .login-footer
+ %p
+ %span.light
+ Have an account?
+ %strong
+ = link_to "Sign in", new_session_path(resource_name)
+ %p
+ = link_to "Forgot your password?", new_password_path(resource_name)
diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml
index 989fcb4a63f..e819847e5ea 100644
--- a/app/views/devise/sessions/_new_base.html.haml
+++ b/app/views/devise/sessions/_new_base.html.haml
@@ -6,9 +6,7 @@
%label.checkbox.remember_me{for: "user_remember_me"}
= f.check_box :remember_me
%span Remember me
+ .pull-right
+ = link_to "Forgot your password?", new_password_path(resource_name)
%div
- = hidden_field_tag 'return_to', params[:return_to]
- = f.submit "Sign in", class: "btn-create btn"
-
- .pull-right
- = link_to "Forgot your password?", new_password_path(resource_name), class: "btn"
+ = f.submit "Sign in", class: "btn btn-save"
diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml
index bb1d0a4001f..6c5a878e904 100644
--- a/app/views/devise/sessions/_new_ldap.html.haml
+++ b/app/views/devise/sessions/_new_ldap.html.haml
@@ -2,4 +2,4 @@
= text_field_tag :username, nil, {class: "form-control top", placeholder: "LDAP Login", autofocus: "autofocus"}
= password_field_tag :password, nil, {class: "form-control bottom", placeholder: "Password"}
%br/
- = submit_tag "LDAP Sign in", class: "btn-create btn"
+ = submit_tag "LDAP Sign in", class: "btn-save btn"
diff --git a/app/views/devise/sessions/_oauth_providers.html.haml b/app/views/devise/sessions/_oauth_providers.html.haml
index 935bc6af505..15048a78063 100644
--- a/app/views/devise/sessions/_oauth_providers.html.haml
+++ b/app/views/devise/sessions/_oauth_providers.html.haml
@@ -1,7 +1,6 @@
- providers = (enabled_oauth_providers - [:ldap])
- if providers.present?
- %hr
- %div{:'data-no-turbolink' => 'data-no-turbolink'}
+ .bs-callout.bs-callout-info{:'data-no-turbolink' => 'data-no-turbolink'}
%span Sign in with: &nbsp;
- providers.each do |provider|
%span
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index 31221ae9c37..b70b0d66172 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -1,43 +1,42 @@
.login-box
- %h3.page-title Sign in
- - if ldap_enabled? && gitlab_config.signin_enabled
- %ul.nav.nav-tabs
- %li.active
- = link_to 'LDAP', '#tab-ldap', 'data-toggle' => 'tab'
- %li
- = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab'
- .tab-content
- %div#tab-ldap.tab-pane.active
- = render partial: 'devise/sessions/new_ldap'
- %div#tab-signin.tab-pane
- = render partial: 'devise/sessions/new_base'
+ .login-heading
+ %h3 Sign in
+ .login-body
+ - if ldap_enabled? && gitlab_config.signin_enabled
+ %ul.nav.nav-tabs
+ %li.active
+ = link_to 'LDAP', '#tab-ldap', 'data-toggle' => 'tab'
+ %li
+ = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab'
+ .tab-content
+ %div#tab-ldap.tab-pane.active
+ = render partial: 'devise/sessions/new_ldap'
+ %div#tab-signin.tab-pane
+ = render partial: 'devise/sessions/new_base'
+
+ - elsif ldap_enabled?
+ = render partial: 'devise/sessions/new_ldap'
+ - elsif gitlab_config.signin_enabled
+ = render partial: 'devise/sessions/new_base'
+ - else
+ %div
+ No authentication methods configured.
+
+ = render 'devise/sessions/oauth_providers' if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
+
+ .login-footer
+ - if gitlab_config.signup_enabled
+ %p
+ %span.light
+ Don't have an account?
+ %strong
+ = link_to "Sign up", new_registration_path(resource_name)
- - elsif ldap_enabled?
- = render partial: 'devise/sessions/new_ldap'
-
- - elsif gitlab_config.signin_enabled
- = render partial: 'devise/sessions/new_base'
-
- - else
- %div
- No authentication methods configured.
-
-
- = render 'devise/sessions/oauth_providers' if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
- %hr
-
- - if gitlab_config.signup_enabled
%p
- %span.light
- Don't have an account?
- %strong
- = link_to "Sign up", new_registration_path(resource_name)
-
- %p
- %span.light Did not receive confirmation email?
- = link_to "Send again", new_confirmation_path(resource_name)
+ %span.light Did not receive confirmation email?
+ = link_to "Send again", new_confirmation_path(resource_name)
- - if extra_config.has_key?('sign_in_text')
- %hr
- = markdown(extra_config.sign_in_text)
+ - if extra_config.has_key?('sign_in_text')
+ %hr
+ = markdown(extra_config.sign_in_text)
diff --git a/app/views/devise/shared/_sign_in_link.html.haml b/app/views/devise/shared/_sign_in_link.html.haml
new file mode 100644
index 00000000000..fafc4b82f53
--- /dev/null
+++ b/app/views/devise/shared/_sign_in_link.html.haml
@@ -0,0 +1,5 @@
+%p
+ %span.light
+ Already have login and password?
+ %strong
+ = link_to "Sign in", new_session_path(resource_name)
diff --git a/app/views/errors/access_denied.html.haml b/app/views/errors/access_denied.html.haml
index e005a7c4409..a1d8664c4ce 100644
--- a/app/views/errors/access_denied.html.haml
+++ b/app/views/errors/access_denied.html.haml
@@ -1,5 +1,5 @@
-%h1.http_status_code 403
-%h3.page-title Access Denied
+%h1 403
+%h3 Access Denied
%hr
%p You are not allowed to access this page.
%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "vlink"}
diff --git a/app/views/errors/encoding.html.haml b/app/views/errors/encoding.html.haml
index 7021f06dd7f..64c7451a8da 100644
--- a/app/views/errors/encoding.html.haml
+++ b/app/views/errors/encoding.html.haml
@@ -1,4 +1,4 @@
-%h1.http_status_code 500
-%h3.page-title Encoding Error
+%h1 500
+%h3 Encoding Error
%hr
%p Page can't be loaded because of an encoding error.
diff --git a/app/views/errors/git_not_found.html.haml b/app/views/errors/git_not_found.html.haml
index d8ed7773207..189e53bca55 100644
--- a/app/views/errors/git_not_found.html.haml
+++ b/app/views/errors/git_not_found.html.haml
@@ -1,5 +1,5 @@
-%h1.http_status_code 404
-%h3.page-title Git Resource Not found
+%h1 404
+%h3 Git Resource Not found
%hr
%p
Application can't get access to some branch or commit in your repository. It
diff --git a/app/views/errors/not_found.html.haml b/app/views/errors/not_found.html.haml
index 4b97ddefc72..7bf88f592cf 100644
--- a/app/views/errors/not_found.html.haml
+++ b/app/views/errors/not_found.html.haml
@@ -1,4 +1,4 @@
-%h1.http_status_code 404
-%h3.page-title The resource you were looking for doesn't exist.
+%h1 404
+%h3 The resource you were looking for doesn't exist.
%hr
%p You may have mistyped the address or the page may have moved.
diff --git a/app/views/errors/omniauth_error.html.haml b/app/views/errors/omniauth_error.html.haml
new file mode 100644
index 00000000000..f3c8221a9d9
--- /dev/null
+++ b/app/views/errors/omniauth_error.html.haml
@@ -0,0 +1,12 @@
+%h1 422
+%h3 Sign-in using #{@provider} auth failed
+%hr
+%p Sign-in failed because #{@error}.
+%p There are couple of steps you can take:
+
+%ul
+ %li Try logging in using your email
+ %li Try logging in using your username
+ %li If you have forgotten your password, try recovering it using #{ link_to "Password recovery", new_password_path(resource_name) }
+
+%p If none of the options work, try contacting the GitLab administrator.
diff --git a/app/views/events/_event_issue.atom.haml b/app/views/events/_event_issue.atom.haml
index 64dc02e3f56..030c961c355 100644
--- a/app/views/events/_event_issue.atom.haml
+++ b/app/views/events/_event_issue.atom.haml
@@ -1,2 +1,2 @@
-%div{:xmlns => "http://www.w3.org/1999/xhtml"}
- %p= simple_format issue.description
+%div{xmlns: "http://www.w3.org/1999/xhtml"}
+ = markdown issue.description
diff --git a/app/views/events/_event_merge_request.atom.haml b/app/views/events/_event_merge_request.atom.haml
new file mode 100644
index 00000000000..ab3a485e908
--- /dev/null
+++ b/app/views/events/_event_merge_request.atom.haml
@@ -0,0 +1,2 @@
+%div{xmlns: "http://www.w3.org/1999/xhtml"}
+ = markdown merge_request.description
diff --git a/app/views/events/_event_note.atom.haml b/app/views/events/_event_note.atom.haml
new file mode 100644
index 00000000000..be0e05481ed
--- /dev/null
+++ b/app/views/events/_event_note.atom.haml
@@ -0,0 +1,2 @@
+%div{xmlns: "http://www.w3.org/1999/xhtml"}
+ = markdown note.note
diff --git a/app/views/events/_event_push.atom.haml b/app/views/events/_event_push.atom.haml
index e44b366040f..17228c430ca 100644
--- a/app/views/events/_event_push.atom.haml
+++ b/app/views/events/_event_push.atom.haml
@@ -6,7 +6,7 @@
%i
at
= commit[:timestamp].to_time.to_s(:short)
- %blockquote= simple_format(escape_once(commit[:message]))
+ %blockquote= markdown(escape_once(commit[:message]))
- if event.commits_count > 15
%p
%i
diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml
new file mode 100644
index 00000000000..80ddd5c1bde
--- /dev/null
+++ b/app/views/explore/groups/index.html.haml
@@ -0,0 +1,51 @@
+.clearfix
+ .pull-left
+ = form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f|
+ .form-group
+ = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "groups_search"
+ .form-group
+ = submit_tag 'Search', class: "btn btn-primary wide"
+
+ .pull-right
+ .dropdown.inline
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %span.light sort:
+ - if @sort.present?
+ = @sort.humanize
+ - else
+ Name
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to explore_groups_path(sort: nil) do
+ Name
+ = link_to explore_groups_path(sort: 'newest') do
+ Newest
+ = link_to explore_groups_path(sort: 'oldest') do
+ Oldest
+ = link_to explore_groups_path(sort: 'recently_updated') do
+ Recently updated
+ = link_to explore_groups_path(sort: 'last_updated') do
+ Last updated
+
+%hr
+
+%ul.bordered-list
+ - @groups.each do |group|
+ %li
+ .clearfix
+ %h4
+ = link_to group_path(id: group.path) do
+ %i.icon-group
+ = group.name
+ .clearfix
+ %p
+ = truncate group.description, length: 150
+ .clearfix
+ %p.light
+ #{pluralize(group.members.size, 'member')}, #{pluralize(group.projects.count, 'project')}
+ - unless @groups.present?
+ .nothing-here-block No public groups
+
+
+= paginate @groups, theme: "gitlab"
diff --git a/app/views/explore/projects/_project.html.haml b/app/views/explore/projects/_project.html.haml
new file mode 100644
index 00000000000..fd5aacbfdb4
--- /dev/null
+++ b/app/views/explore/projects/_project.html.haml
@@ -0,0 +1,25 @@
+%li
+ %h4.project-title
+ .project-access-icon
+ = visibility_level_icon(project.visibility_level)
+ = link_to project.name_with_namespace, project
+
+ - if current_page?(starred_explore_projects_path)
+ %strong.pull-right
+ = pluralize project.star_count, 'star'
+
+ .project-info
+ - if project.description.present?
+ %p.project-description.str-truncated
+ = project.description
+
+ .repo-info
+ - unless project.empty_repo?
+ = link_to pluralize(project.repository.round_commit_count, 'commit'), project_commits_path(project, project.default_branch)
+ &middot;
+ = link_to pluralize(project.repository.branch_names.count, 'branch'), project_branches_path(project)
+ &middot;
+ = link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project)
+ - else
+ %i.icon-warning-sign
+ Empty repository
diff --git a/app/views/explore/projects/index.html.haml b/app/views/explore/projects/index.html.haml
new file mode 100644
index 00000000000..c8bf78385e8
--- /dev/null
+++ b/app/views/explore/projects/index.html.haml
@@ -0,0 +1,38 @@
+.clearfix
+ .pull-left
+ = form_tag explore_projects_path, method: :get, class: 'form-inline form-tiny' do |f|
+ .form-group
+ = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "projects_search"
+ .form-group
+ = submit_tag 'Search', class: "btn btn-primary wide"
+
+ .pull-right
+ .dropdown.inline
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %span.light sort:
+ - if @sort.present?
+ = @sort.humanize
+ - else
+ Name
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to explore_projects_path(sort: nil) do
+ Name
+ = link_to explore_projects_path(sort: 'newest') do
+ Newest
+ = link_to explore_projects_path(sort: 'oldest') do
+ Oldest
+ = link_to explore_projects_path(sort: 'recently_updated') do
+ Recently updated
+ = link_to explore_projects_path(sort: 'last_updated') do
+ Last updated
+
+%hr
+.public-projects
+ %ul.bordered-list.top-list
+ = render @projects
+ - unless @projects.present?
+ .nothing-here-block No public projects
+
+ = paginate @projects, theme: "gitlab"
diff --git a/app/views/explore/projects/starred.html.haml b/app/views/explore/projects/starred.html.haml
new file mode 100644
index 00000000000..9c793d4050c
--- /dev/null
+++ b/app/views/explore/projects/starred.html.haml
@@ -0,0 +1,10 @@
+.explore-trending-block
+ %p.lead
+ %i.icon-comments-alt
+ See most starred projects
+ %hr
+ .public-projects
+ %ul.bordered-list
+ = render @starred_projects
+
+ = paginate @starred_projects, theme: 'gitlab'
diff --git a/app/views/explore/projects/trending.html.haml b/app/views/explore/projects/trending.html.haml
new file mode 100644
index 00000000000..18bb1ac0ba4
--- /dev/null
+++ b/app/views/explore/projects/trending.html.haml
@@ -0,0 +1,11 @@
+.explore-trending-block
+ %p.lead
+ %i.icon-comments-alt
+ See most discussed projects for last month
+ %hr
+ .public-projects
+ %ul.bordered-list
+ = render @trending_projects
+
+ .center
+ = link_to 'Show all projects', explore_projects_path, class: 'btn btn-primary'
diff --git a/app/views/groups/_filter.html.haml b/app/views/groups/_filter.html.haml
index fe8c0669c0e..393be3f1d12 100644
--- a/app/views/groups/_filter.html.haml
+++ b/app/views/groups/_filter.html.haml
@@ -1,29 +1,12 @@
= form_tag group_filter_path(entity), method: 'get' do
%fieldset
%ul.nav.nav-pills.nav-stacked
- %li{class: ("active" if !params[:status])}
- = link_to group_filter_path(entity, status: nil) do
- Open
+ %li{class: ("active" if (params[:status] == 'active' || !params[:status]))}
+ = link_to group_filter_path(entity, status: 'active') do
+ Active
%li{class: ("active" if params[:status] == 'closed')}
= link_to group_filter_path(entity, status: 'closed') do
Closed
%li{class: ("active" if params[:status] == 'all')}
= link_to group_filter_path(entity, status: 'all') do
All
-
- %fieldset
- %legend Projects:
- %ul.nav.nav-pills.nav-stacked
- - @projects.each do |project|
- - unless entities_per_project(project, entity).zero?
- %li{class: ("active" if params[:project_id] == project.id.to_s)}
- = link_to group_filter_path(entity, project_id: project.id) do
- = project.name_with_namespace
- %small.pull-right= entities_per_project(project, entity)
- - if @projects.blank?
- .nothing-here-block This group has no projects yet
-
- %fieldset
- %hr
- = link_to "Reset", group_filter_path(entity), class: 'btn pull-right'
-
diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml
index 0eec2d6be0b..0152ae86833 100644
--- a/app/views/groups/issues.html.haml
+++ b/app/views/groups/issues.html.haml
@@ -1,6 +1,5 @@
%h3.page-title
Issues
- %span.pull-right #{@issues.total_count} issues
%p.light
Only issues from
diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml
index 71adb2c5516..71d346d0469 100644
--- a/app/views/groups/merge_requests.html.haml
+++ b/app/views/groups/merge_requests.html.haml
@@ -1,6 +1,5 @@
%h3.page-title
Merge Requests
- %span.pull-right #{@merge_requests.total_count} merge requests
%p.light
Only merge requests from
diff --git a/app/views/groups/milestones/_issue.html.haml b/app/views/groups/milestones/_issue.html.haml
new file mode 100644
index 00000000000..c95c2e89670
--- /dev/null
+++ b/app/views/groups/milestones/_issue.html.haml
@@ -0,0 +1,10 @@
+%li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid }
+ %span.milestone-row
+ - project = issue.project
+ %strong #{project.name} &middot;
+ = link_to [project, issue] do
+ %span.cgray ##{issue.iid}
+ = link_to_gfm issue.title, [project, issue], title: issue.title
+ .pull-right.assignee-icon
+ - if issue.assignee
+ = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16"
diff --git a/app/views/groups/milestones/_issues.html.haml b/app/views/groups/milestones/_issues.html.haml
new file mode 100644
index 00000000000..9f350b772bd
--- /dev/null
+++ b/app/views/groups/milestones/_issues.html.haml
@@ -0,0 +1,6 @@
+.panel.panel-default
+ .panel-heading= title
+ %ul{ class: "well-list issues-sortable-list" }
+ - if issues
+ - issues.each do |issue|
+ = render 'issue', issue: issue
diff --git a/app/views/groups/milestones/_merge_request.html.haml b/app/views/groups/milestones/_merge_request.html.haml
new file mode 100644
index 00000000000..e0c903bfdb2
--- /dev/null
+++ b/app/views/groups/milestones/_merge_request.html.haml
@@ -0,0 +1,10 @@
+%li{ id: dom_id(merge_request, 'sortable'), class: 'mr-row', 'data-iid' => merge_request.iid }
+ %span.milestone-row
+ - project = merge_request.project
+ %strong #{project.name} &middot;
+ = link_to [project, merge_request] do
+ %span.cgray ##{merge_request.iid}
+ = link_to_gfm merge_request.title, [project, merge_request], title: merge_request.title
+ .pull-right.assignee-icon
+ - if merge_request.assignee
+ = image_tag avatar_icon(merge_request.assignee.email, 16), class: "avatar s16"
diff --git a/app/views/groups/milestones/_merge_requests.html.haml b/app/views/groups/milestones/_merge_requests.html.haml
new file mode 100644
index 00000000000..50057e2c636
--- /dev/null
+++ b/app/views/groups/milestones/_merge_requests.html.haml
@@ -0,0 +1,6 @@
+.panel.panel-default
+ .panel-heading= title
+ %ul{ class: "well-list merge_requests-sortable-list" }
+ - if merge_requests
+ - merge_requests.each do |merge_request|
+ = render 'merge_request', merge_request: merge_request
diff --git a/app/views/groups/milestones/index.html.haml b/app/views/groups/milestones/index.html.haml
new file mode 100644
index 00000000000..54e901173f0
--- /dev/null
+++ b/app/views/groups/milestones/index.html.haml
@@ -0,0 +1,50 @@
+%h3.page-title
+ Milestones
+ %span.pull-right #{@group_milestones.count} milestones
+
+%p.light
+ Only milestones from
+ %strong #{@group.name}
+ group are listed here.
+
+%hr
+
+.row
+ .fixed.sidebar-expand-button.hidden-lg.hidden-md
+ %i.icon-list.icon-2x
+ .col-md-3.responsive-side
+ = render 'groups/filter', entity: 'milestone'
+ .col-md-9
+ .panel.panel-default
+ %ul.well-list
+ - if @group_milestones.blank?
+ %li
+ .nothing-here-block No milestones to show
+ - else
+ - @group_milestones.each do |milestone|
+ %li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) }
+ .pull-right
+ - if can?(current_user, :manage_group, @group)
+ - if milestone.closed?
+ = link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen"
+ - else
+ = link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-close"
+ %h4
+ = link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title)
+ %div
+ %div
+ = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
+ = pluralize milestone.issue_count, 'Issue'
+ &nbsp;
+ = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
+ = pluralize milestone.merge_requests_count, 'Merge Request'
+ &nbsp;
+ %span.light #{milestone.percent_complete}% complete
+ .progress.progress-info
+ .progress-bar{style: "width: #{milestone.percent_complete}%;"}
+ %div
+ %br
+ - milestone.projects.each do |project|
+ %span.label.label-default
+ = project.name
+ = paginate @group_milestones, theme: "gitlab"
diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml
new file mode 100644
index 00000000000..411d1822be0
--- /dev/null
+++ b/app/views/groups/milestones/show.html.haml
@@ -0,0 +1,88 @@
+%h3.page-title
+ Milestone #{@group_milestone.title}
+ .pull-right
+ - if can?(current_user, :manage_group, @group)
+ - if @group_milestone.active?
+ = link_to 'Close Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-close"
+ - else
+ = link_to 'Reopen Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen"
+
+- if (@group_milestone.total_items_count == @group_milestone.closed_items_count) && @group_milestone.active?
+ .alert.alert-success
+ %span All issues for this milestone are closed. You may close the milestone now.
+
+.back-link
+ = link_to group_milestones_path(@group) do
+ &larr; To milestones list
+
+.issue-box{ class: "issue-box-#{@group_milestone.closed? ? 'closed' : 'open'}" }
+ .state.clearfix
+ .state-label
+ - if @group_milestone.closed?
+ Closed
+ - else
+ Open
+
+ %h4.title
+ = gfm escape_once(@group_milestone.title)
+
+ .description
+ - @group_milestone.milestones.each do |milestone|
+ %hr
+ %h4
+ = link_to "#{milestone.project.name} - #{milestone.title}", project_milestone_path(milestone.project, milestone)
+ %span.pull-right= milestone.expires_at
+ - if milestone.closed?
+ %span.label.label-danger #{milestone.state}
+ = preserve do
+ - if milestone.description.present?
+ = milestone.description
+
+ .context
+ %p
+ Progress:
+ #{@group_milestone.closed_items_count} closed
+ &ndash;
+ #{@group_milestone.open_items_count} open
+
+ .progress.progress-info
+ .progress-bar{style: "width: #{@group_milestone.percent_complete}%;"}
+
+%ul.nav.nav-tabs
+ %li.active
+ = link_to '#tab-issues', 'data-toggle' => 'tab' do
+ Issues
+ %span.badge= @group_milestone.issue_count
+ %li
+ = link_to '#tab-merge-requests', 'data-toggle' => 'tab' do
+ Merge Requests
+ %span.badge= @group_milestone.merge_requests_count
+ %li
+ = link_to '#tab-participants', 'data-toggle' => 'tab' do
+ Participants
+ %span.badge= @group_milestone.participants.count
+
+.tab-content
+ .tab-pane.active#tab-issues
+ .row
+ .col-md-6
+ = render 'issues', title: "Open", issues: @group_milestone.opened_issues
+ .col-md-6
+ = render 'issues', title: "Closed", issues: @group_milestone.closed_issues
+
+ .tab-pane#tab-merge-requests
+ .row
+ .col-md-6
+ = render 'merge_requests', title: "Open", merge_requests: @group_milestone.opened_merge_requests
+ .col-md-6
+ = render 'merge_requests', title: "Closed", merge_requests: @group_milestone.closed_merge_requests
+
+ .tab-pane#tab-participants
+ %ul.bordered-list
+ - @group_milestone.participants.each do |user|
+ %li
+ = link_to user, title: user.name, class: "darken" do
+ = image_tag avatar_icon(user.email, 32), class: "avatar s32"
+ %strong= truncate(user.name, lenght: 40)
+ %br
+ %small.cgray= user.username
diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml
index ebf5e8571aa..cdc087f949a 100644
--- a/app/views/groups/new.html.haml
+++ b/app/views/groups/new.html.haml
@@ -6,12 +6,12 @@
= f.label :name, class: 'control-label' do
Group name
.col-sm-10
- = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control"
+ = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control", tabindex: 1, autofocus: true
.form-group.group-description-holder
= f.label :description, "Details", class: 'control-label'
.col-sm-10
- = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4
+ = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4, tabindex: 2
.form-group.group-description-holder
= f.label :avatar, "Group avatar", class: 'control-label'
@@ -35,6 +35,4 @@
%li Existing projects may be moved into a group
.form-actions
- = f.submit 'Create group', class: "btn btn-create"
-
-
+ = f.submit 'Create group', class: "btn btn-create", tabindex: 3
diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml
index 500e5dc65e1..4301a6eafc1 100644
--- a/app/views/help/_shortcuts.html.haml
+++ b/app/views/help/_shortcuts.html.haml
@@ -3,30 +3,207 @@
.modal-content
.modal-header
%a.close{href: "#", "data-dismiss" => "modal"} ×
- %h3 Keyboard Shortcuts
- .modal-body
- %h5 Global Shortcuts
- %p
- %span.label.label-inverse s
- &ndash;
- Focus Search
- %p
- %span.label.label-inverse ?
- &ndash;
- Show this dialog
+ %h4
+ Keyboard Shortcuts
+ %small
+ = link_to '(Show all)', '#', class: 'js-more-help-button'
+ .modal-body.shortcuts-cheatsheet
+ .col-lg-4
+ %table.shortcut-mappings
+ %tbody
+ %tr
+ %th
+ %th Global Shortcuts
+ %tr
+ %td.shortcut
+ .key s
+ %td Focus Search
+ %tr
+ %td.shortcut
+ .key ?
+ %td Show this dialog
+ %tbody
+ %tr
+ %th
+ %th Project Files browsing
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-up
+ %td Move selection up
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-down
+ %td Move selection down
+ %tr
+ %td.shortcut
+ .key enter
+ %td Open Selection
- %h5 Project Files browsing
- %p
- %span.label.label-inverse
- %i.icon-arrow-up
- &ndash;
- Move selection up
- %p
- %span.label.label-inverse
- %i.icon-arrow-down
- &ndash;
- Move selection down
- %p
- %span.label.label-inverse Enter
- &ndash;
- Open selection
+ .col-lg-4
+ %table.shortcut-mappings
+ %tbody{ class: 'hidden-shortcut project', style: 'display:none' }
+ %tr
+ %th
+ %th Global Dashboard
+ %tr
+ %td.shortcut
+ .key g
+ .key a
+ %td
+ Go to the activity feed
+ %tr
+ %td.shortcut
+ .key g
+ .key p
+ %td
+ Go to projects
+ %tr
+ %td.shortcut
+ .key g
+ .key i
+ %td
+ Go to issues
+ %tr
+ %td.shortcut
+ .key g
+ .key m
+ %td
+ Go to merge requests
+ %tbody
+ %tr
+ %th
+ %th Project
+ %tr
+ %td.shortcut
+ .key g
+ .key a
+ %td
+ Go to the activity feed
+ %tr
+ %td.shortcut
+ .key g
+ .key f
+ %td
+ Go to files
+ %tr
+ %td.shortcut
+ .key g
+ .key c
+ %td
+ Go to commits
+ %tr
+ %td.shortcut
+ .key g
+ .key n
+ %td
+ Go to network graph
+ %tr
+ %td.shortcut
+ .key g
+ .key g
+ %td
+ Go to graphs
+ %tr
+ %td.shortcut
+ .key g
+ .key i
+ %td
+ Go to issues
+ %tr
+ %td.shortcut
+ .key g
+ .key m
+ %td
+ Go to merge requests
+ %tr
+ %td.shortcut
+ .key g
+ .key s
+ %td
+ Go to snippets
+ .col-lg-4
+ %table.shortcut-mappings
+ %tbody{ class: 'hidden-shortcut network', style: 'display:none' }
+ %tr
+ %th
+ %th Network Graph
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-left
+ \/
+ .key h
+ %td Scroll left
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-right
+ \/
+ .key l
+ %td Scroll right
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-up
+ \/
+ .key k
+ %td Scroll up
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-down
+ \/
+ .key j
+ %td Scroll down
+ %tr
+ %td.shortcut
+ .key
+ shift
+ %i.icon-arrow-up
+ \/
+ .key
+ shift k
+ %td Scroll to top
+ %tr
+ %td.shortcut
+ .key
+ shift
+ %i.icon-arrow-down
+ \/
+ .key
+ shift j
+ %td Scroll to bottom
+ %tbody{ class: 'hidden-shortcut issues', style: 'display:none' }
+ %tr
+ %th
+ %th Issues
+ %tr
+ %td.shortcut
+ .key a
+ %td Change assignee
+ %tr
+ %td.shortcut
+ .key m
+ %td Change milestone
+ %tbody{ class: 'hidden-shortcut merge_reuests', style: 'display:none' }
+ %tr
+ %th
+ %th Merge Requests
+ %tr
+ %td.shortcut
+ .key a
+ %td Change assignee
+ %tr
+ %td.shortcut
+ .key m
+ %td Change milestone
+
+
+:javascript
+ $('.js-more-help-button').click(function(e){
+ $(this).remove()
+ $('.hidden-shortcut').show()
+ e.preventDefault()
+ });
diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml
index a89ccde7924..903e093e5fc 100644
--- a/app/views/help/index.html.haml
+++ b/app/views/help/index.html.haml
@@ -1,5 +1,5 @@
-.jumbotron
- %h2
+%div
+ %h1
GitLab
%span= Gitlab::VERSION
%small= Gitlab::REVISION
@@ -16,7 +16,17 @@
%br
Read more about GitLab at #{link_to "www.gitlab.com", "https://www.gitlab.com/", target: "_blank"}.
+%hr
+
.row
+ .col-md-8
+ .documentation-index
+ = preserve do
+ - readme_text = File.read(Rails.root.join("doc", "README.md"))
+ - text = readme_text.dup
+ - readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") }
+ = markdown text
+
.col-md-4
.panel.panel-default
.panel-heading
@@ -27,18 +37,8 @@
= link_to "getting help", "https://www.gitlab.com/getting-help/"
%li
Use the
- = link_to "search bar", '#', onclick: "$('#search').focus();"
+ = link_to 'search bar', '#', onclick: 'Shortcuts.focusSearch(event)'
on the top of this page
%li
Use
- = link_to "shortcuts", '#', onclick: "new Shortcuts()"
-
- .col-md-8
- .panel.panel-default.documentation-index
- .panel-heading Documentation
- .panel-body
- = preserve do
- - readme_text = File.read(Rails.root.join("doc", "README.md"))
- - text = readme_text.dup
- - readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") }
- = markdown text
+ = link_to 'shortcuts', '#', onclick: 'Shortcuts.showHelp(event)'
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index 32dff0c6708..0c27f679dee 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -7,6 +7,7 @@
-# https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-45397555
- if controller_name == 'projects' && action_name == 'show'
%meta{name: "go-import", content: "#{@project.web_url_without_protocol} git #{@project.web_url}.git"}
+ %meta{content: "GitLab Community Edition", name: "description"}
%title
= "#{title} | " if defined?(title)
diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml
index fba56b5dc3b..7c727aca785 100644
--- a/app/views/layouts/_head_panel.html.haml
+++ b/app/views/layouts/_head_panel.html.haml
@@ -24,7 +24,7 @@
'data-original-title' => 'Help' do
%i.icon-question-sign
%li
- = link_to public_root_path, title: "Public area", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do
+ = link_to explore_root_path, title: "Explore", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do
%i.icon-globe
%li
= link_to user_snippets_path(current_user), title: "My snippets", class: 'has_bottom_tooltip', 'data-original-title' => 'My snippets' do
diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml
index 25984df0444..945c66e2adf 100644
--- a/app/views/layouts/_public_head_panel.html.haml
+++ b/app/views/layouts/_public_head_panel.html.haml
@@ -3,7 +3,7 @@
.container
%div.app_logo
%span.separator
- = link_to public_root_path, class: "home" do
+ = link_to explore_root_path, class: "home" do
%h1 GITLAB
%span.separator
%h1.title= title
@@ -13,10 +13,10 @@
%i.icon-reorder
.pull-right.hidden-xs
- = link_to "Sign in", new_session_path(:user, return_to: request.fullpath), class: 'btn btn-sign-in btn-new'
+ = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-new'
.navbar-collapse.collapse
%ul.nav.navbar-nav
%li.visible-xs
- = link_to "Sign in", new_session_path(:user, return_to: request.fullpath)
+ = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes')
diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml
index caf0e39234a..f485aee1e1a 100644
--- a/app/views/layouts/_search.html.haml
+++ b/app/views/layouts/_search.html.haml
@@ -8,3 +8,10 @@
= hidden_field_tag :repository_ref, @ref
= submit_tag 'Go' if ENV['RAILS_ENV'] == 'test'
.search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }
+
+:javascript
+ $('.search-input').on('keyup', function(e) {
+ if (e.keyCode == 27) {
+ $('.search-input').blur()
+ }
+ })
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml
index c7a827555a7..1ea91a1914f 100644
--- a/app/views/layouts/admin.html.haml
+++ b/app/views/layouts/admin.html.haml
@@ -10,4 +10,4 @@
.container
.content= yield
- = yield :embedded_scripts \ No newline at end of file
+ = yield :embedded_scripts
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 5d93ffa50ad..ffa48a68b42 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -5,13 +5,34 @@
= render "layouts/flash"
.container
.content
- %center
- %h1 GitLab
- %p.light
- GitLab is open source software to collaborate on code.
- %br
- Sign in or browse for #{link_to "public projects", public_projects_path}.
+ .login-title
+ %h1= brand_title
%hr
.container
.content
- = yield
+ .row
+ .col-md-7.brand-holder
+ - if brand_item
+ .brand-image
+ = brand_image
+ .brand_text
+ = brand_text
+ - else
+ .brand-image.default-brand-image.hidden-sm.hidden-xs
+ = image_tag 'brand_logo.png'
+ .brand_text.hidden-xs
+ %h2 Open source software to collaborate on code
+
+ %p.lead
+ Manage git repositories with fine grained access controls that keep your code secure.
+ Perform code reviews and enhance collaboration with merge requests.
+ Each project can also have an issue tracker and a wiki.
+
+ .col-md-5
+ = yield
+ %hr
+ .container
+ .footer-links
+ = link_to "Explore", explore_root_path
+ = link_to "Documentation", "http://doc.gitlab.com/"
+ = link_to "About GitLab", "https://about.gitlab.com/"
diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml
index df2350b1535..d0e276d751a 100644
--- a/app/views/layouts/errors.html.haml
+++ b/app/views/layouts/errors.html.haml
@@ -4,7 +4,6 @@
%body{class: "#{app_theme} application"}
= render "layouts/head_panel", title: "" if current_user
= render "layouts/flash"
- .container
- .content
- %center.padded.prepend-top-20
- = yield
+ .container.navless-container
+ .error-page
+ = yield
diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml
new file mode 100644
index 00000000000..d023846c5eb
--- /dev/null
+++ b/app/views/layouts/explore.html.haml
@@ -0,0 +1,30 @@
+- page_title = 'Explore'
+!!! 5
+%html{ lang: "en"}
+ = render "layouts/head", title: page_title
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ = render "layouts/broadcast"
+ - if current_user
+ = render "layouts/head_panel", title: page_title
+ - else
+ = render "layouts/public_head_panel", title: page_title
+ .container.navless-container
+ .content
+ .explore-title
+ %h3
+ Explore GitLab
+ %p.lead
+ Discover projects and groups. Share your projects with others
+
+
+ %ul.nav.nav-tabs
+ = nav_link(path: 'projects#trending') do
+ = link_to 'Trending Projects', explore_root_path
+ = nav_link(path: 'projects#starred') do
+ = link_to 'Most Starred Projects', starred_explore_projects_path
+ = nav_link(path: 'projects#index') do
+ = link_to 'All Projects', explore_projects_path
+ = nav_link(controller: :groups) do
+ = link_to 'All Groups', explore_groups_path
+
+ = yield
diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml
index 48c569f8684..c57216f01c8 100644
--- a/app/views/layouts/nav/_admin.html.haml
+++ b/app/views/layouts/nav/_admin.html.haml
@@ -1,13 +1,13 @@
%ul
= nav_link(controller: :dashboard, html_options: {class: 'home'}) do
= link_to admin_root_path, title: "Stats" do
- %i.icon-home
+ Overview
= nav_link(controller: :projects) do
= link_to "Projects", admin_projects_path
- = nav_link(controller: :groups) do
- = link_to "Groups", admin_groups_path
= nav_link(controller: :users) do
= link_to "Users", admin_users_path
+ = nav_link(controller: :groups) do
+ = link_to "Groups", admin_groups_path
= nav_link(controller: :logs) do
= link_to "Logs", admin_logs_path
= nav_link(controller: :broadcast_messages) do
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index 12fd49e609f..a6e9772d93f 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -1,16 +1,16 @@
%ul
= nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
- = link_to root_path, title: "Home" do
- %i.icon-home
+ = link_to root_path, title: 'Home', class: 'shortcuts-activity' do
+ Activity
= nav_link(path: 'dashboard#projects') do
- = link_to projects_dashboard_path do
+ = link_to projects_dashboard_path, class: 'shortcuts-projects' do
Projects
= nav_link(path: 'dashboard#issues') do
- = link_to issues_dashboard_path do
+ = link_to issues_dashboard_path, class: 'shortcuts-issues' do
Issues
%span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do
- = link_to merge_requests_dashboard_path do
+ = link_to merge_requests_dashboard_path, class: 'shortcuts-merge_requests' do
Merge Requests
%span.count= current_user.assigned_merge_requests.opened.count
= nav_link(controller: :help) do
diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml
index 36b102dc25a..9095a843c9f 100644
--- a/app/views/layouts/nav/_group.html.haml
+++ b/app/views/layouts/nav/_group.html.haml
@@ -1,7 +1,10 @@
%ul
= nav_link(path: 'groups#show', html_options: {class: 'home'}) do
= link_to group_path(@group), title: "Home" do
- %i.icon-home
+ Activity
+ = nav_link(controller: [:group, :milestones]) do
+ = link_to group_milestones_path(@group) do
+ Milestones
= nav_link(path: 'groups#issues') do
= link_to issues_group_path(@group) do
Issues
diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml
index 35d0d417502..1de5ee99cf4 100644
--- a/app/views/layouts/nav/_profile.html.haml
+++ b/app/views/layouts/nav/_profile.html.haml
@@ -1,7 +1,7 @@
%ul
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: "Profile" do
- %i.icon-home
+ Profile
= nav_link(controller: :accounts) do
= link_to "Account", profile_account_path
= nav_link(controller: :emails) do
diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml
index dd48ff6ce38..aadbb31dc96 100644
--- a/app/views/layouts/nav/_project.html.haml
+++ b/app/views/layouts/nav/_project.html.haml
@@ -1,44 +1,43 @@
-%ul
+%ul.project-navigation
= nav_link(path: 'projects#show', html_options: {class: "home"}) do
- = link_to project_path(@project), title: "Project" do
- %i.icon-home
-
+ = link_to project_path(@project), title: 'Project', class: 'shortcuts-activity' do
+ Project
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
- = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref)
+ = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref), class: 'shortcuts-tree'
- if project_nav_tab? :commits
= nav_link(controller: %w(commit commits compare repositories tags branches)) do
- = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref)
+ = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref), class: 'shortcuts-commits'
- if project_nav_tab? :network
= nav_link(controller: %w(network)) do
- = link_to "Network", project_network_path(@project, @ref || @repository.root_ref)
+ = link_to "Network", project_network_path(@project, @ref || @repository.root_ref), class: 'shortcuts-network'
- if project_nav_tab? :graphs
= nav_link(controller: %w(graphs)) do
- = link_to "Graphs", project_graph_path(@project, @ref || @repository.root_ref)
+ = link_to "Graphs", project_graph_path(@project, @ref || @repository.root_ref), class: 'shortcuts-graphs'
- if project_nav_tab? :issues
= nav_link(controller: %w(issues milestones labels)) do
- = link_to url_for_project_issues do
+ = link_to url_for_project_issues, class: 'shortcuts-issues' do
Issues
- if @project.used_default_issues_tracker?
%span.count.issue_counter= @project.issues.opened.count
- if project_nav_tab? :merge_requests
= nav_link(controller: :merge_requests) do
- = link_to project_merge_requests_path(@project) do
+ = link_to project_merge_requests_path(@project), class: 'shortcuts-merge_requests' do
Merge Requests
%span.count.merge_counter= @project.merge_requests.opened.count
- if project_nav_tab? :wiki
= nav_link(controller: :wikis) do
- = link_to 'Wiki', project_wiki_path(@project, :home)
+ = link_to 'Wiki', project_wiki_path(@project, :home), class: 'shortcuts-wiki'
- if project_nav_tab? :snippets
= nav_link(controller: :snippets) do
- = link_to 'Snippets', project_snippets_path(@project)
+ = link_to 'Snippets', project_snippets_path(@project), class: 'shortcuts-snippets'
- if project_nav_tab? :settings
= nav_link(html_options: {class: "#{project_tab_class}"}) do
diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml
index 991d4f0c6d8..ab421d63f1a 100644
--- a/app/views/layouts/notify.html.haml
+++ b/app/views/layouts/notify.html.haml
@@ -4,6 +4,10 @@
%title
GitLab
:css
+ img {
+ max-width: 100%;
+ height: auto;
+ }
p.details {
font-style:italic;
color:#777
diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml
index 11c815c52a7..f02eca6bd7c 100644
--- a/app/views/layouts/projects.html.haml
+++ b/app/views/layouts/projects.html.haml
@@ -14,4 +14,4 @@
.container
.content= yield
- = yield :embedded_scripts \ No newline at end of file
+ = yield :embedded_scripts
diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml
deleted file mode 100644
index 3c76bbb9575..00000000000
--- a/app/views/layouts/public.html.haml
+++ /dev/null
@@ -1,11 +0,0 @@
-!!! 5
-%html{ lang: "en"}
- = render "layouts/head", title: "Public Projects"
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
- = render "layouts/broadcast"
- - if current_user
- = render "layouts/head_panel", title: "Public Projects"
- - else
- = render "layouts/public_head_panel", title: "Public Projects"
- .container.navless-container
- .content= yield
diff --git a/app/views/notify/_reassigned_issuable_email.html.haml b/app/views/notify/_reassigned_issuable_email.html.haml
new file mode 100644
index 00000000000..56d81b2ed2e
--- /dev/null
+++ b/app/views/notify/_reassigned_issuable_email.html.haml
@@ -0,0 +1,10 @@
+%p
+ Assignee changed
+ - if @previous_assignee
+ from
+ %strong #{@previous_assignee.name}
+ to
+ - if issuable.assignee_id
+ %strong #{issuable.assignee_name}
+ - else
+ %strong Unassigned
diff --git a/app/views/notify/_reassigned_issuable_email.text.erb b/app/views/notify/_reassigned_issuable_email.text.erb
new file mode 100644
index 00000000000..817d030c362
--- /dev/null
+++ b/app/views/notify/_reassigned_issuable_email.text.erb
@@ -0,0 +1,6 @@
+Reassigned <%= issuable.class.model_name.human.titleize %> <%= issuable.iid %>
+
+<%= url_for([issuable.project, issuable, {only_path: false}]) %>
+
+Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee -%>
+ to <%= "#{issuable.assignee_id ? issuable.assignee_name : 'Unassigned'}" %>
diff --git a/app/views/notify/merge_request_status_email.html.haml b/app/views/notify/merge_request_status_email.html.haml
new file mode 100644
index 00000000000..c9bf04f514e
--- /dev/null
+++ b/app/views/notify/merge_request_status_email.html.haml
@@ -0,0 +1,2 @@
+%p
+ = "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}"
diff --git a/app/views/notify/merge_request_status_email.text.haml b/app/views/notify/merge_request_status_email.text.haml
new file mode 100644
index 00000000000..8750bf86e2c
--- /dev/null
+++ b/app/views/notify/merge_request_status_email.text.haml
@@ -0,0 +1,8 @@
+= "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}"
+
+Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)}
+
+= merge_path_description(@merge_request, 'to')
+
+Author: #{@merge_request.author_name}
+Assignee: #{@merge_request.assignee_name}
diff --git a/app/views/notify/new_user_email.html.haml b/app/views/notify/new_user_email.html.haml
index 09518cd3c7f..ebbe98dd472 100644
--- a/app/views/notify/new_user_email.html.haml
+++ b/app/views/notify/new_user_email.html.haml
@@ -11,11 +11,4 @@
- if @user.created_by_id
%p
- password..................................
- %code= @password
-
- %p
- You will be forced to change this password immediately after login.
-
-%p
- = link_to "Click here to login", root_url
+ = link_to "Click here to set your password", edit_password_url(@user, :reset_password_token => @token)
diff --git a/app/views/notify/new_user_email.text.erb b/app/views/notify/new_user_email.text.erb
index c21c95d3047..96b26879a77 100644
--- a/app/views/notify/new_user_email.text.erb
+++ b/app/views/notify/new_user_email.text.erb
@@ -4,10 +4,5 @@ The Administrator created an account for you. Now you are a member of the compan
login.................. <%= @user.email %>
<% if @user.created_by_id %>
- password............... <%= @password %>
-
- You will be forced to change this password immediately after login.
+ <%= link_to "Click here to set your password", edit_password_url(@user, :reset_password_token => @token) %>
<% end %>
-
-
-Click here to login: <%= url_for(root_url) %>
diff --git a/app/views/notify/project_was_moved_email.html.haml b/app/views/notify/project_was_moved_email.html.haml
index 3e761c43435..fe248584e55 100644
--- a/app/views/notify/project_was_moved_email.html.haml
+++ b/app/views/notify/project_was_moved_email.html.haml
@@ -1,11 +1,15 @@
%p
- = "Project was moved to another location"
+ Project was moved to another location
%p
The project is now located under
= link_to project_url(@project) do
= @project.name_with_namespace
%p
- To update the remote url in your local repository run:
+ To update the remote url in your local repository run (for ssh):
%p{ style: "background:#f5f5f5; padding:10px; border:1px solid #ddd" }
git remote set-url origin #{@project.ssh_url_to_repo}
+%p
+ or for http(s):
+%p{ style: "background:#f5f5f5; padding:10px; border:1px solid #ddd" }
+ git remote set-url origin #{@project.http_url_to_repo}
%br
diff --git a/app/views/notify/project_was_moved_email.text.erb b/app/views/notify/project_was_moved_email.text.erb
index 7889c7b9cc4..664148fb3ba 100644
--- a/app/views/notify/project_was_moved_email.text.erb
+++ b/app/views/notify/project_was_moved_email.text.erb
@@ -4,5 +4,7 @@ The project is now located under
<%= project_url(@project) %>
-To update the remote url in your local repository run:
+To update the remote url in your local repository run (for ssh):
git remote set-url origin <%= @project.ssh_url_to_repo %>
+or for http(s):
+ git remote set-url origin <%= @project.http_url_to_repo %>
diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml
index 07227a3e68c..498ba8b8365 100644
--- a/app/views/notify/reassigned_issue_email.html.haml
+++ b/app/views/notify/reassigned_issue_email.html.haml
@@ -1,8 +1 @@
-%p
- Assignee changed
- - if @previous_assignee
- from
- %strong #{@previous_assignee.name}
- to
- %strong #{@issue.assignee_name}
-
+= render 'reassigned_issuable_email', issuable: @issue
diff --git a/app/views/notify/reassigned_issue_email.text.erb b/app/views/notify/reassigned_issue_email.text.erb
index bc0d0567922..710253be984 100644
--- a/app/views/notify/reassigned_issue_email.text.erb
+++ b/app/views/notify/reassigned_issue_email.text.erb
@@ -1,5 +1 @@
-Reassigned Issue <%= @issue.iid %>
-
-<%= url_for(project_issue_url(@issue.project, @issue)) %>
-
-Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @issue.assignee_name %>
+<%= render 'reassigned_issuable_email', issuable: @issue %>
diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml
index 00aee6bc952..2a650130f59 100644
--- a/app/views/notify/reassigned_merge_request_email.html.haml
+++ b/app/views/notify/reassigned_merge_request_email.html.haml
@@ -1,7 +1 @@
-%p
- Assignee changed
- - if @previous_assignee
- from
- %strong #{@previous_assignee.name}
- to
- %strong #{@merge_request.assignee_name}
+= render 'reassigned_issuable_email', issuable: @merge_request
diff --git a/app/views/notify/reassigned_merge_request_email.text.erb b/app/views/notify/reassigned_merge_request_email.text.erb
index 87a7847e06d..b5b4f1ff99a 100644
--- a/app/views/notify/reassigned_merge_request_email.text.erb
+++ b/app/views/notify/reassigned_merge_request_email.text.erb
@@ -1,7 +1 @@
-Reassigned Merge Request #<%= @merge_request.iid %>
-
-<%= url_for(project_merge_request_url(@merge_request.target_project, @merge_request)) %>
-
-
-Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @merge_request.assignee_name %>
-
+<%= render 'reassigned_issuable_email', issuable: @merge_request %>
diff --git a/app/views/notify/repository_push_email.html.haml b/app/views/notify/repository_push_email.html.haml
index 85a01a567f3..0358810afdc 100644
--- a/app/views/notify/repository_push_email.html.haml
+++ b/app/views/notify/repository_push_email.html.haml
@@ -5,7 +5,9 @@
%ul
- @commits.each do |commit|
%li
- #{commit.short_id} - #{commit.title}
+ %strong #{commit.short_id}
+ %span by #{commit.author_name}
+ %pre #{commit.safe_message}
%h4 Changes:
- @diffs.each do |diff|
@@ -23,6 +25,4 @@
%br
- if @compare.timeout
- %h5 To prevent performance issues changes are hidden
-- elsif @compare.commits_over_limit?
- %h5 Changes are not shown due to large amount of commits
+ %h5 Huge diff. To prevent performance issues changes are hidden
diff --git a/app/views/notify/repository_push_email.text.haml b/app/views/notify/repository_push_email.text.haml
index a15b8efe1f7..4d7c972a16a 100644
--- a/app/views/notify/repository_push_email.text.haml
+++ b/app/views/notify/repository_push_email.text.haml
@@ -3,7 +3,9 @@
\
Commits:
- @commits.each do |commit|
- #{commit.short_id} - #{truncate(commit.title, length: 40)}
+ #{commit.short_id} by #{commit.author_name}
+ #{commit.safe_message}
+ \- - - - -
\
\
Changes:
@@ -21,5 +23,3 @@ Changes:
\
- if @compare.timeout
Huge diff. To prevent performance issues it was hidden
-- elsif @compare.commits_over_limit?
- Changes are not shown due to large amount of commits
diff --git a/app/views/profiles/keys/new.html.haml b/app/views/profiles/keys/new.html.haml
index 126afa55540..46b7fc72869 100644
--- a/app/views/profiles/keys/new.html.haml
+++ b/app/views/profiles/keys/new.html.haml
@@ -5,7 +5,7 @@
= render 'form'
:javascript
- $('#key_key').on('keyup', function(){
+ $('#key_key').on('focusout', function(){
var title = $('#key_title'),
val = $('#key_key').val(),
key_mail = val.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+|\.[a-zA-Z0-9._-]+)/gi);
@@ -13,4 +13,4 @@
if( key_mail && key_mail.length > 0 && title.val() == '' ){
$('#key_title').val( key_mail );
}
- });
+ }); \ No newline at end of file
diff --git a/app/views/profiles/passwords/new.html.haml b/app/views/profiles/passwords/new.html.haml
index b72232ee36b..aef7348fd20 100644
--- a/app/views/profiles/passwords/new.html.haml
+++ b/app/views/profiles/passwords/new.html.haml
@@ -12,6 +12,9 @@
%li= msg
.form-group
+ = f.label :current_password, class: 'control-label'
+ .col-sm-10= f.password_field :current_password, required: true, class: 'form-control'
+ .form-group
= f.label :password, class: 'control-label'
.col-sm-10= f.password_field :password, required: true, class: 'form-control'
.form-group
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 9a4c13af975..e03a43cbf1f 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -68,12 +68,14 @@
%p.light
- if @user.avatar?
You can change your avatar here
- %br
- or remove the current avatar to revert to #{link_to "gravatar.com", "http://gravatar.com"}
+ - if Gitlab.config.gravatar.enabled
+ %br
+ or remove the current avatar to revert to #{link_to "gravatar.com", "http://gravatar.com"}
- else
You can upload an avatar here
- %br
- or change it at #{link_to "gravatar.com", "http://gravatar.com"}
+ - if Gitlab.config.gravatar.enabled
+ %br
+ or change it at #{link_to "gravatar.com", "http://gravatar.com"}
%hr
%a.choose-btn.btn.btn-small.js-choose-user-avatar-button
%i.icon-paper-clip
diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml
index 81bb0e20a35..1627a61d236 100644
--- a/app/views/projects/_home_panel.html.haml
+++ b/app/views/projects/_home_panel.html.haml
@@ -1,31 +1,48 @@
- empty_repo = @project.empty_repo?
.project-home-panel{:class => ("empty-project" if empty_repo)}
- .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(@project.visibility_level)} project" }
- = visibility_level_icon(@project.visibility_level)
- .row
- .col-sm-6
- %h4.project-home-title
- = @project.name_with_namespace
+ .project-home-row
+ .project-home-desc
+ - if @project.description.present?
+ = auto_link ERB::Util.html_escape(@project.description), link: :urls
+ - if can?(current_user, :admin_project, @project)
+ &ndash;
+ = link_to 'Edit', edit_project_path
+ - elsif !@project.empty_repo? && @repository.readme
+ - readme = @repository.readme
+ &ndash;
+ = link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do
+ = readme.name
+ .star-fork-buttons
+ - unless @project.empty_repo?
+ .fork-buttons
+ - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
+ - if current_user.already_forked?(@project)
+ = link_to project_path(current_user.fork_of(@project)), title: 'Got to my fork' do
+ %i.icon-code-fork
+ Fork
+ %span.count
+ = @project.forks_count
+ - else
+ = link_to fork_project_path(@project), title: "Fork project", method: "POST" do
+ %i.icon-code-fork
+ Fork
+ %span.count
+ = @project.forks_count
- .col-sm-6
- - if current_user && !empty_repo
- .project-home-dropdown
- = render "dropdown"
- = render "shared/clone_panel"
+ .star-buttons
+ %span.star.js-toggler-container{class: @show_star ? 'on' : ''}
+ - if current_user
+ = link_to_toggle_star('Star this project.', false, true)
+ = link_to_toggle_star('Unstar this project.', true, true)
+ - else
+ = link_to_toggle_star('You must sign in to star a project.', false, false)
- .project-home-extra.row
- .col-md-7
- .project-home-desc
- - if @project.description.present?
- = auto_link @project.description, link: :urls
- - if can?(current_user, :admin_project, @project)
- &ndash;
- %strong= link_to 'Edit', edit_project_path
-
- - unless empty_repo
- .col-md-5
- .project-home-links
- = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref)
- = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project)
- = link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project)
- %span.light.prepend-left-20= repository_size
+ .project-home-row
+ - if current_user && !empty_repo
+ .project-home-dropdown
+ = render "dropdown"
+ - unless @project.empty_repo?
+ - if can? current_user, :download_code, @project
+ .pull-right.prepend-left-10
+ = render 'projects/repositories/download_archive', split_button: true
+ = render "shared/clone_panel"
diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml
new file mode 100644
index 00000000000..f7c4673b52d
--- /dev/null
+++ b/app/views/projects/_issuable_form.html.haml
@@ -0,0 +1,39 @@
+.form-group
+ = f.label :title, class: 'control-label' do
+ %strong= 'Title *'
+ .col-sm-10
+ = f.text_field :title, maxlength: 255, autofocus: true,
+ class: 'form-control pad js-gfm-input', required: true
+.form-group
+ = f.label :description, 'Description', class: 'control-label'
+ .col-sm-10
+ = f.text_area :description, rows: 14,
+ class: 'form-control js-gfm-input markdown-area'
+ .col-sm-12.hint
+ .pull-left
+ Parsed with
+ #{link_to 'GitLab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}.
+ .pull-right
+ Attach images (JPG, PNG, GIF) by dragging &amp; dropping
+ or #{link_to 'selecting them', '#', class: 'markdown-selector' }.
+ .clearfix
+ .error-alert
+%hr
+.form-group
+ .issue-assignee
+ = f.label :assignee_id, class: 'control-label' do
+ %i.icon-user
+ Assign to
+ .col-sm-10
+ = project_users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
+ placeholder: 'Select a user', class: 'custom-form-control',
+ selected: issuable.assignee_id)
+ &nbsp;
+ = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
+.form-group
+ .issue-milestone
+ = f.label :milestone_id, class: 'control-label' do
+ %i.icon-time
+ Milestone
+ .col-sm-10= f.select(:milestone_id, milestone_options(issuable),
+ { include_blank: 'Select milestone' }, { class: 'select2' })
diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml
index cdca8b2e634..64bbd495102 100644
--- a/app/views/projects/blame/show.html.haml
+++ b/app/views/projects/blame/show.html.haml
@@ -8,7 +8,7 @@
= @path
%small= number_to_human_size @blob.size
%span.options= render "projects/blob/actions"
- .file-content.blame
+ .file-content.blame.highlight
%table
- current_line = 1
- @blame.each do |commit, lines|
@@ -33,7 +33,8 @@
- current_line += 1
%td.lines
%pre
- :erb
- <% lines.each do |line| %>
- <%= line %>
- <% end %>
+ %code{ class: highlightjs_class(@blob.name) }
+ :erb
+ <% lines.each do |line| %>
+ <%= line %>
+ <% end %>
diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml
index cabef3c19fe..8587dc4bc6d 100644
--- a/app/views/projects/blob/_actions.html.haml
+++ b/app/views/projects/blob/_actions.html.haml
@@ -13,6 +13,9 @@
- else
= link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty?
= link_to "history", project_commits_path(@project, @id), class: "btn btn-small"
+ - if @ref != @commit.sha
+ = link_to 'permalink', project_blob_path(@project,
+ tree_join(@commit.sha, @path)), class: 'btn btn-small'
- if allowed_tree_edit?
= link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do
diff --git a/app/views/projects/blob/_download.html.haml b/app/views/projects/blob/_download.html.haml
index ff317f90209..cdbfee7cc68 100644
--- a/app/views/projects/blob/_download.html.haml
+++ b/app/views/projects/blob/_download.html.haml
@@ -1,5 +1,5 @@
.file-content.blob_file.blob-no-preview
- %center
+ .center
= link_to project_raw_path(@project, @id) do
%h1.light
%i.icon-download-alt
diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml
new file mode 100644
index 00000000000..cfb91d6568a
--- /dev/null
+++ b/app/views/projects/blob/diff.html.haml
@@ -0,0 +1,19 @@
+- if @lines.present?
+ - if @form.unfold? && @form.since != 1 && !@form.bottom?
+ %tr.line_holder{ id: @form.since }
+ = render "projects/commits/diffs/match_line", {line: @match_line,
+ line_old: @form.since, line_new: @form.since, bottom: false}
+
+ - @lines.each_with_index do |line, index|
+ - line_new = index + @form.since
+ - line_old = line_new - @form.offset
+ %tr.line_holder
+ %td.old_line.diff-line-num{data: {linenumber: line_old}}
+ = link_to raw(line_old), "#"
+ %td.new_line= link_to raw(line_new) , "#"
+ %td.line_content.noteable_line= line
+
+ - if @form.unfold? && @form.bottom? && @form.to < @blob.loc
+ %tr.line_holder{ id: @form.to }
+ = render "projects/commits/diffs/match_line", {line: @match_line,
+ line_old: @form.to, line_new: @form.to, bottom: true}
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 54a7b934dd7..08a537e0541 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -2,7 +2,7 @@
%li(class="js-branch-#{branch.name}")
%h4
= link_to project_tree_path(@project, branch.name) do
- %strong= truncate(branch.name, length: 60)
+ %strong.str-truncated= branch.name
- if branch.name == @repository.root_ref
%span.label.label-info default
- if @project.protected_branch? branch.name
diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml
index ec1661c0aaa..882a4d0c5e2 100644
--- a/app/views/projects/branches/destroy.js.haml
+++ b/app/views/projects/branches/destroy.js.haml
@@ -1,3 +1 @@
-:plain
- $(".js-branch-#{@branch_name}").remove();
- $('.js-totalbranch-count').html("#{@repository.branches.size}")
+$('.js-totalbranch-count').html("#{@repository.branches.size}")
diff --git a/app/views/projects/branches/new.html.haml b/app/views/projects/branches/new.html.haml
index 5da2ede2937..3f202f7ea6b 100644
--- a/app/views/projects/branches/new.html.haml
+++ b/app/views/projects/branches/new.html.haml
@@ -1,3 +1,7 @@
+- if @error
+ .alert.alert-danger
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"} &times;
+ = @error
%h3.page-title
%i.icon-code-fork
New branch
@@ -5,11 +9,11 @@
.form-group
= label_tag :branch_name, 'Name for new branch', class: 'control-label'
.col-sm-10
- = text_field_tag :branch_name, nil, placeholder: 'enter new branch name', required: true, tabindex: 1, class: 'form-control'
+ = text_field_tag :branch_name, params[:branch_name], placeholder: 'enter new branch name', required: true, tabindex: 1, class: 'form-control'
.form-group
= label_tag :ref, 'Create from', class: 'control-label'
.col-sm-10
- = text_field_tag :ref, nil, placeholder: 'existing branch name, tag or commit SHA', required: true, tabindex: 2, class: 'form-control'
+ = text_field_tag :ref, params[:ref], placeholder: 'existing branch name, tag or commit SHA', required: true, tabindex: 2, class: 'form-control'
.form-actions
= submit_tag 'Create branch', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', project_branches_path(@project), class: 'btn btn-cancel'
diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml
index f2b0699f136..2bc9048b2ad 100644
--- a/app/views/projects/commit/_commit_box.html.haml
+++ b/app/views/projects/commit/_commit_box.html.haml
@@ -55,4 +55,4 @@
= gfm escape_once(@commit.title)
- if @commit.description.present?
%pre.commit-description
- = gfm escape_once(@commit.description)
+ = preserve(gfm(escape_once(@commit.description)))
diff --git a/app/views/projects/commit/huge_commit.html.haml b/app/views/projects/commit/huge_commit.html.haml
deleted file mode 100644
index 398ce771426..00000000000
--- a/app/views/projects/commit/huge_commit.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render "projects/commit/commit_box"
-.alert.alert-danger
- %h4 Commit diffs are too big to be displayed
diff --git a/app/views/projects/commit/show.html.haml b/app/views/projects/commit/show.html.haml
index da1b4c10f87..0a15aef6cb7 100644
--- a/app/views/projects/commit/show.html.haml
+++ b/app/views/projects/commit/show.html.haml
@@ -1,3 +1,3 @@
= render "commit_box"
-= render "projects/commits/diffs", diffs: @commit.diffs, project: @project
+= render "projects/commits/diffs", diffs: @diffs, project: @project
= render "projects/notes/notes_with_form"
diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml
index a0606662807..8e73663939f 100644
--- a/app/views/projects/commits/_commit.html.haml
+++ b/app/views/projects/commits/_commit.html.haml
@@ -7,17 +7,23 @@
- if commit.description?
%a.text-expander.js-toggle-button ...
- = link_to "Browse Code »", project_tree_path(project, commit), class: "pull-right"
+ = link_to_browse_code(project, commit)
+
.notes_count
- - notes = project.notes.for_commit_id(commit.id)
- - if notes.any?
+ - if @note_counts
+ - note_count = @note_counts.fetch(commit.id, 0)
+ - else
+ - notes = project.notes.for_commit_id(commit.id)
+ - note_count = notes.count
+
+ - if note_count > 0
%span.label.label-gray
- %i.icon-comment
- = notes.count
+ %i.icon-comment= note_count
- if commit.description?
.commit-row-description.js-toggle-content
- = simple_format(commit.description)
+ %pre
+ = preserve(gfm(escape_once(commit.description)))
.commit-row-info
= commit_author_link(commit, avatar: true, size: 16)
diff --git a/app/views/projects/commits/_diff_file.html.haml b/app/views/projects/commits/_diff_file.html.haml
new file mode 100644
index 00000000000..31208a227ce
--- /dev/null
+++ b/app/views/projects/commits/_diff_file.html.haml
@@ -0,0 +1,48 @@
+- file = project.repository.blob_for_diff(@commit, diff)
+- return unless file
+- blob_diff_path = diff_project_blob_path(project,
+ tree_join(@commit.id, diff.new_path))
+.diff-file{id: "diff-#{i}", data: {blob_diff_path: blob_diff_path }}
+ .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"}
+ - if diff.deleted_file
+ %span= diff.old_path
+
+ .diff-btn-group
+ - if @commit.parent_ids.present?
+ = view_file_btn(@commit.parent_id, diff, project)
+ - else
+ %span= diff.new_path
+ - if diff_file_mode_changed?(diff)
+ %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
+
+ .diff-btn-group
+ %label
+ = check_box_tag nil, 1, false, class: "js-toggle-diff-line-wrap"
+ Wrap text
+ &nbsp;
+ = link_to "#", class: "js-toggle-diff-comments btn btn-small" do
+ %i.icon-chevron-down
+ Diff comments
+ &nbsp;
+
+ - if @merge_request && @merge_request.source_project
+ = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do
+ Edit
+ &nbsp;
+
+ = view_file_btn(@commit.id, diff, project)
+
+ .diff-content
+ -# Skipp all non non-supported blobs
+ - return unless file.respond_to?('text?')
+ - if file.text?
+ - if params[:view] == 'parallel'
+ = render "projects/commits/parallel_view", diff: diff, project: project, file: file, index: i
+ - else
+ = render "projects/commits/text_file", diff: diff, index: i
+ - elsif file.image?
+ - old_file = project.repository.prev_blob_for_diff(@commit, diff)
+ = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
+ - else
+ .nothing-here-block No preview for this file type
+
diff --git a/app/views/projects/commits/_diff_head.html.haml b/app/views/projects/commits/_diff_head.html.haml
deleted file mode 100644
index 5aa542287fe..00000000000
--- a/app/views/projects/commits/_diff_head.html.haml
+++ /dev/null
@@ -1,26 +0,0 @@
-%ul.bordered-list
- - diffs.each_with_index do |diff, i|
- %li
- - if diff.deleted_file
- %span.deleted-file
- %a{href: "#diff-#{i}"}
- %i.icon-minus
- = diff.old_path
- - elsif diff.renamed_file
- %span.renamed-file
- %a{href: "#diff-#{i}"}
- %i.icon-minus
- = diff.old_path
- = "->"
- = diff.new_path
- - elsif diff.new_file
- %span.new-file
- %a{href: "#diff-#{i}"}
- %i.icon-plus
- = diff.new_path
- - else
- %span.edit-file
- %a{href: "#diff-#{i}"}
- %i.icon-adjust
- = diff.new_path
-
diff --git a/app/views/projects/commits/_diff_stats.html.haml b/app/views/projects/commits/_diff_stats.html.haml
new file mode 100644
index 00000000000..8ef7cc6e086
--- /dev/null
+++ b/app/views/projects/commits/_diff_stats.html.haml
@@ -0,0 +1,41 @@
+.js-toggle-container
+ .commit-stat-summary
+ Showing
+ %strong.cdark #{pluralize(diffs.count, "changed file")}
+ - if current_controller?(:commit)
+ - unless @commit.has_zero_stats?
+ with
+ %strong.cgreen #{@commit.stats.additions} additions
+ and
+ %strong.cred #{@commit.stats.deletions} deletions
+ &nbsp;
+ = link_to '#', class: 'btn btn-small js-toggle-button' do
+ Show diff stats
+ %i.icon-chevron-down
+ .file-stats.js-toggle-content.hide
+ %ul.bordered-list
+ - diffs.each_with_index do |diff, i|
+ %li
+ - if diff.deleted_file
+ %span.deleted-file
+ %a{href: "#diff-#{i}"}
+ %i.icon-minus
+ = diff.old_path
+ - elsif diff.renamed_file
+ %span.renamed-file
+ %a{href: "#diff-#{i}"}
+ %i.icon-minus
+ = diff.old_path
+ \->
+ = diff.new_path
+ - elsif diff.new_file
+ %span.new-file
+ %a{href: "#diff-#{i}"}
+ %i.icon-plus
+ = diff.new_path
+ - else
+ %span.edit-file
+ %a{href: "#diff-#{i}"}
+ %i.icon-adjust
+ = diff.new_path
+
diff --git a/app/views/projects/commits/_diff_warning.html.haml b/app/views/projects/commits/_diff_warning.html.haml
new file mode 100644
index 00000000000..05d516efa11
--- /dev/null
+++ b/app/views/projects/commits/_diff_warning.html.haml
@@ -0,0 +1,19 @@
+.bs-callout.bs-callout-warning
+ %h4
+ Too many changes.
+ .pull-right
+ - unless diff_hard_limit_enabled?
+ = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true)), class: "btn btn-small btn-warning"
+
+ - if current_controller?(:commit) or current_controller?(:merge_requests)
+ - if current_controller?(:commit)
+ = link_to "Plain diff", project_commit_path(@project, @commit, format: :diff), class: "btn btn-warning btn-small"
+ = link_to "Email patch", project_commit_path(@project, @commit, format: :patch), class: "btn btn-warning btn-small"
+ - elsif @merge_request && @merge_request.persisted?
+ = link_to "Plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "btn btn-warning btn-small"
+ = link_to "Email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "btn btn-warning btn-small"
+ %p
+ To preserve performance only
+ %strong #{safe_diff_files(diffs).size} of #{diffs.size}
+ files displayed.
+
diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml
index a62f50776fa..17efa8debe1 100644
--- a/app/views/projects/commits/_diffs.html.haml
+++ b/app/views/projects/commits/_diffs.html.haml
@@ -1,91 +1,26 @@
-- @suppress_diff ||= @suppress_diff || @force_suppress_diff
-- if @suppress_diff
- .alert.alert-warning
- %p
- %strong Warning! This is a large diff.
- %p
- To preserve performance the diff is not shown.
- - if current_controller?(:commit) or current_controller?(:merge_requests)
- - if current_controller?(:commit)
- Please, download the diff as
- = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link"
- or
- = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link"
- instead.
- - elsif @merge_request && @merge_request.persisted?
- Please, download the diff as
- = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link"
- or
- = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link"
- instead.
- - unless @force_suppress_diff
- %p
- If you still want to see the diff
- = link_to "click this link", url_for(force_show_diff: true), class: "underlined-link"
-
-%p.commit-stat-summary
- Showing
- %strong.cdark #{pluralize(diffs.count, "changed file")}
- - if current_controller?(:commit)
- - unless @commit.has_zero_stats?
- with
- %strong.cgreen #{@commit.stats.additions} additions
- and
- %strong.cred #{@commit.stats.deletions} deletions
- - if params[:view] == 'parallel'
- = link_to "Inline Diff", url_for(view: 'inline'), {id: "commit-diff-viewtype", class: 'btn btn-tiny pull-right'}
- - else
- = link_to "Side-by-side Diff", url_for(view: 'parallel'), {id: "commit-diff-viewtype", class: 'btn btn-tiny pull-right'}
-.file-stats
- = render "projects/commits/diff_head", diffs: diffs
+.row
+ .col-md-8
+ = render 'projects/commits/diff_stats', diffs: diffs
+ .col-md-4
+ %ul.nav.nav-tabs
+ %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''}
+ - params_copy = params.dup
+ - params_copy[:view] = 'parallel'
+ = link_to "Side-by-side Diff", url_for(params_copy), {id: "commit-diff-viewtype"}
+ %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''}
+ - params_copy[:view] = 'inline'
+ = link_to "Inline Diff", url_for(params_copy), {id: "commit-diff-viewtype"}
+
+- if show_diff_size_warninig?(diffs)
+ = render 'projects/commits/diff_warning', diffs: diffs
.files
- - unless @suppress_diff
- - diffs.each_with_index do |diff, i|
- - file = project.repository.blob_at(@commit.id, diff.new_path)
- - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file
- - next unless file
- .diff-file.js-toggle-container{id: "diff-#{i}"}
- .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"}
- - if diff.deleted_file
- %span= diff.old_path
-
- .diff-btn-group
- - if @commit.parent_ids.present?
- = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do
- View file @
- %span.commit-short-id= @commit.short_id(6)
- - else
- %span= diff.new_path
- - if diff_file_mode_changed?(diff)
- %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
-
- .diff-btn-group
- = link_to "#", class: "js-toggle-button btn btn-small" do
- %i.icon-chevron-down
- Diff comments
- &nbsp;
+ - safe_diff_files(diffs).each_with_index do |diff, i|
+ = render 'projects/commits/diff_file', diff: diff, i: i, project: project
- - if @merge_request && @merge_request.source_project
- = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do
- Edit
- &nbsp;
-
- = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do
- View file @
- %span.commit-short-id= @commit.short_id(6)
-
-
- .diff-content
- -# Skipp all non non-supported blobs
- - next unless file.respond_to?('text?')
- - if file.text?
- - if params[:view] == 'parallel'
- = render "projects/commits/parallel_view", diff: diff, project: project, file: file, index: i
- - else
- = render "projects/commits/text_file", diff: diff, index: i
- - elsif file.image?
- - old_file = project.repository.blob_at(@commit.parent_id, diff.old_path) if @commit.parent_id
- = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
- - else
- .nothing-here-block No preview for this file type
+- if @diff_timeout
+ .alert.alert-danger
+ %h4
+ Failed to collect changes
+ %p
+ Maybe diff is really big and operation failed with timeout. Try to get diff localy
diff --git a/app/views/projects/commits/_text_file.html.haml b/app/views/projects/commits/_text_file.html.haml
index 8ced4133294..756481c1b21 100644
--- a/app/views/projects/commits/_text_file.html.haml
+++ b/app/views/projects/commits/_text_file.html.haml
@@ -1,20 +1,22 @@
-- too_big = diff.diff.lines.count > 1000
+- too_big = diff.diff.lines.count > Commit::DIFF_SAFE_LINES
- if too_big
%a.supp_diff_link Changes suppressed. Click to show
%table.text-file{class: "#{'hide' if too_big}"}
+ - last_line = 0
- each_diff_line(diff, index) do |line, type, line_code, line_new, line_old, raw_line|
+ - last_line = line_new
%tr.line_holder{ id: line_code, class: "#{type}" }
- if type == "match"
- %td.old_line= "..."
- %td.new_line= "..."
- %td.line_content.matched= line
+ = render "projects/commits/diffs/match_line", {line: line,
+ line_old: line_old, line_new: line_new, bottom: false}
- else
%td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
- if @comments_allowed
= link_to_new_diff_note(line_code)
- %td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
+ %td.new_line{data: {linenumber: line_new}}
+ = link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
- if @reply_allowed
@@ -22,6 +24,10 @@
- unless comments.empty?
= render "projects/notes/diff_notes_with_reply", notes: comments, line: line
+ - if last_line > 0
+ = render "projects/commits/diffs/match_line", {line: "",
+ line_old: last_line, line_new: last_line, bottom: true}
+
- if diff.diff.blank? && diff_file_mode_changed?(diff)
.file-mode-changed
File mode changed
diff --git a/app/views/projects/commits/diffs/_match_line.html.haml b/app/views/projects/commits/diffs/_match_line.html.haml
new file mode 100644
index 00000000000..4ebe3379733
--- /dev/null
+++ b/app/views/projects/commits/diffs/_match_line.html.haml
@@ -0,0 +1,7 @@
+%td.old_line.diff-line-num.unfold.js-unfold{data: {linenumber: line_old},
+ class: unfold_bottom_class(bottom)}
+ \...
+%td.new_line.diff-line-num.unfold.js-unfold{data: {linenumber: line_new},
+ class: unfold_bottom_class(bottom)}
+ \...
+%td.line_content.matched= line
diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml
index 88122a73bba..aa79d08509b 100644
--- a/app/views/projects/compare/show.html.haml
+++ b/app/views/projects/compare/show.html.haml
@@ -18,29 +18,18 @@
- else
%ul.well-list= render Commit.decorate(@commits), project: @project
- %h4 Changes
- - if @diffs.present?
- = render "projects/commits/diffs", diffs: @diffs, project: @project
- - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
- .bs-callout.bs-callout-danger
- %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
- %p To preserve performance the line changes are not shown.
- - elsif @timeout
- .bs-callout.bs-callout-danger
- %h4 Number of changed files for this comparison is extremely large.
- %p Use command line to browse through changes for this comparison.
-
+ = render "projects/commits/diffs", diffs: @diffs, project: @project
- else
.light-well
- %center
+ .center
%h4
There isn't anything to compare.
%p.slead
- if params[:to] == params[:from]
- You'll need to use different branch names to get a valid comparison.
- - else
%span.label-branch #{params[:from]}
and
%span.label-branch #{params[:to]}
are the same.
+ - else
+ You'll need to use different branch names to get a valid comparison.
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 4195a491a0f..d9acb685517 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -33,12 +33,12 @@
%fieldset.features
%legend
- Labels:
+ Tags:
.form-group
- = f.label :label_list, "Labels", class: 'control-label'
+ = f.label :tag_list, "Tags", class: 'control-label'
.col-sm-10
- = f.text_field :label_list, maxlength: 2000, class: "form-control"
- %p.hint Separate labels with commas.
+ = f.text_field :tag_list, maxlength: 2000, class: "form-control"
+ %p.hint Separate tags with commas.
%fieldset.features
%legend
@@ -114,7 +114,7 @@
%br
%strong Once active this project shows up in the search and on the dashboard.
= link_to 'Unarchive', unarchive_project_path(@project),
- data: { confirm: "Are you sure that you want to unarchive this project?\nWhen this project is unarchived it is active and can be comitted to again." },
+ data: { confirm: "Are you sure that you want to unarchive this project?\nWhen this project is unarchived it is active and can be committed to again." },
method: :post, class: "btn btn-remove"
- else
%p
@@ -183,7 +183,7 @@
.nothing-here-block Only project owner can remove a project
.save-project-loader.hide
- %center
+ .center
%h2
%i.icon-spinner.icon-spin
Saving project.
diff --git a/app/views/projects/edit_tree/preview.html.haml b/app/views/projects/edit_tree/preview.html.haml
index 340f68cc05c..87ce5dc31d3 100644
--- a/app/views/projects/edit_tree/preview.html.haml
+++ b/app/views/projects/edit_tree/preview.html.haml
@@ -6,7 +6,7 @@
= markdown(@content)
- elsif markup?(@blob.name)
.file-content.wiki
- = raw GitHub::Markup.render(@blob.name, @content)
+ = raw render_markup(@blob.name, @content)
- else
.file-content.code
- unless @diff.empty?
diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml
index 32a6d4ef36e..62798b51d82 100644
--- a/app/views/projects/edit_tree/show.html.haml
+++ b/app/views/projects/edit_tree/show.html.haml
@@ -16,9 +16,9 @@
.btn-group.tree-btn-group
= link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message }
.file-content.code
- %pre.js-edit-mode-pane#editor= @blob.data
+ %pre.js-edit-mode-pane#editor
.js-edit-mode-pane#preview.hide
- %center
+ .center
%h2
%i.icon-spinner.icon-spin
@@ -41,8 +41,10 @@
:javascript
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace")
+ ace.config.loadModule("ace/ext/searchbox");
var ace_mode = "#{@blob.language.try(:ace_mode)}";
var editor = ace.edit("editor");
+ editor.setValue("#{escape_javascript(@blob.data)}");
if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}
diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml
index 97dc73bce14..c0baa3f90e4 100644
--- a/app/views/projects/empty.html.haml
+++ b/app/views/projects/empty.html.haml
@@ -17,7 +17,7 @@
git init
touch README
git add README
- git commit -m 'first commit'
+ git commit -m "first commit"
git remote add origin #{ content_tag(:span, default_url_to_repo, class: 'clone')}
git push -u origin master
diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml
index 27348232ba2..8e4548f26d0 100644
--- a/app/views/projects/graphs/show.html.haml
+++ b/app/views/projects/graphs/show.html.haml
@@ -1,5 +1,5 @@
.loading-graph
- %center
+ .center
%h3.page-title
%i.icon-spinner.icon-spin
Building repository graph.
diff --git a/app/views/projects/import.html.haml b/app/views/projects/import.html.haml
index d11372be61b..649dd56a8d9 100644
--- a/app/views/projects/import.html.haml
+++ b/app/views/projects/import.html.haml
@@ -1,17 +1,17 @@
- if @project.import_in_progress?
.save-project-loader
- %center
+ .center
%h2
%i.icon-spinner.icon-spin
Import in progress.
- %p.monospace git clone --bare #{@project.import_url}
+ %p.monospace git clone --bare #{hidden_pass_url(@project.import_url)}
%p Please wait while we import the repository for you. Refresh at will.
:javascript
new ProjectImport();
- elsif @project.import_failed?
.save-project-loader
- %center
+ .center
%h2
Import failed. Retry?
%hr
@@ -25,6 +25,6 @@
.bs-callout.bs-callout-info
This url must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git.
%br
- The import will time out after 2 minutes. For big repositories, use a clone/push combination.
+ The import will time out after 4 minutes. For big repositories, use a clone/push combination.
.form-actions
= f.submit 'Retry import', class: "btn btn-create", tabindex: 4
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index d29a7973100..d063f92e87f 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -3,55 +3,26 @@
%hr
- if @repository.exists? && !@repository.empty? && @repository.contribution_guide && !@issue.persisted?
- contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name))
- .alert.alert-info.col-sm-10.col-sm-offset-2
- ="Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe
+ .row
+ .col-sm-10.col-sm-offset-2
+ .alert.alert-info
+ = "Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe
= form_for [@project, @issue], html: { class: 'form-horizontal issue-form' } do |f|
-if @issue.errors.any?
- .alert.alert-danger
- - @issue.errors.full_messages.each do |msg|
- %span= msg
- %br
+ .row
+ .col-sm-10.col-sm-offset-2
+ .alert.alert-danger
+ - @issue.errors.full_messages.each do |msg|
+ %span= msg
+ %br
+ = render 'projects/issuable_form', f: f, issuable: @issue
.form-group
- = f.label :title, class: 'control-label' do
- %strong= 'Title *'
- .col-sm-10
- = f.text_field :title, maxlength: 255, class: "form-control js-gfm-input", autofocus: true, required: true
- .form-group
- = f.label :description, 'Description', class: 'control-label'
- .col-sm-10
- = f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 14
- .col-sm-12.hint
- .pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
- .pull-right Attach images (JPG, PNG, GIF) by dragging &amp; dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
- .clearfix
- .error-alert
- %hr
- .form-group
- .issue-assignee
- = f.label :assignee_id, class: 'control-label' do
- %i.icon-user
- Assign to
- .col-sm-10
- = project_users_select_tag('issue[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @issue.assignee_id)
- &nbsp;
- = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
- .form-group
- .issue-milestone
- = f.label :milestone_id, class: 'control-label' do
- %i.icon-time
- Milestone
- .col-sm-10= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2'})
-
- .form-group
- = f.label :label_list, class: 'control-label' do
+ = f.label :label_ids, class: 'control-label' do
%i.icon-tag
Labels
.col-sm-10
- = f.text_field :label_list, maxlength: 2000, class: "form-control"
- %p.hint Separate labels with commas.
-
-
+ = f.collection_select :label_ids, @project.labels.all, :id, :name, { selected: @issue.label_ids }, multiple: true, class: 'select2'
.form-actions
- if @issue.new_record?
@@ -63,35 +34,6 @@
= link_to "Cancel", cancel_path, class: 'btn btn-cancel'
:javascript
- $("#issue_label_list")
- .bind( "keydown", function( event ) {
- if ( event.keyCode === $.ui.keyCode.TAB &&
- $( this ).data( "autocomplete" ).menu.active ) {
- event.preventDefault();
- }
- })
- .bind("click", function(event) {
- $(this).autocomplete("search", "");
- })
- .autocomplete({
- minLength: 0,
- source: function( request, response ) {
- response( $.ui.autocomplete.filter(
- #{raw labels_autocomplete_source}, extractLast( request.term ) ) );
- },
- focus: function() {
- return false;
- },
- select: function(event, ui) {
- var terms = split( this.value );
- terms.pop();
- terms.push( ui.item.value );
- terms.push( "" );
- this.value = terms.join( ", " );
- return false;
- }
- });
-
$('.assign-to-me-link').on('click', function(e){
$('#issue_assignee_id').val("#{current_user.id}").trigger("change");
e.preventDefault();
diff --git a/app/views/projects/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml
index 716ea7cefed..82cde14e05d 100644
--- a/app/views/projects/issues/_head.html.haml
+++ b/app/views/projects/issues/_head.html.haml
@@ -2,8 +2,6 @@
= nav_link(controller: :issues) do
= link_to project_issues_path(@project), class: "tab" do
Browse Issues
- - if current_controller?(:issues)
- %span.badge.issue_counter #{@issues.total_count}
= nav_link(controller: :milestones) do
= link_to 'Milestones', project_milestones_path(@project), class: "tab"
= nav_link(controller: :labels) do
@@ -26,7 +24,7 @@
%i.icon.icon-list
= form_tag project_issues_path(@project), method: :get, id: "issue_search_form", class: 'pull-left issue-search-form' do
.append-right-10.hidden-xs.hidden-sm
- = search_field_tag :issue_search, nil, { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input input-mn-300' }
+ = search_field_tag :issue_search, params[:issue_search], { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input input-mn-300' }
= hidden_field_tag :state, params['state']
= hidden_field_tag :scope, params['scope']
= hidden_field_tag :assignee_id, params['assignee_id']
diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml
index 3fc04c26cf2..e257f317b95 100644
--- a/app/views/projects/issues/_issue.html.haml
+++ b/app/views/projects/issues/_issue.html.haml
@@ -9,7 +9,7 @@
= link_to_gfm issue.title, project_issue_path(issue.project, issue), class: "row_title"
- if issue.closed?
%small.pull-right
- = "CLOSED"
+ CLOSED
.issue-info
- if issue.assignee
@@ -31,16 +31,14 @@
.issue-labels
- issue.labels.each do |label|
- %span{class: "label #{label_css_class(label.name)}"}
- %i.icon-tag
- = label.name
+ = render_colored_label(label)
.issue-actions
- if can? current_user, :modify_issue, issue
- if issue.closed?
- = link_to 'Reopen', project_issue_path(issue.project, issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-small btn-grouped reopen_issue", remote: true
+ = link_to 'Reopen', project_issue_path(issue.project, issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-small btn-grouped reopen_issue btn-reopen", remote: true
- else
- = link_to 'Close', project_issue_path(issue.project, issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-small btn-grouped close_issue", remote: true
+ = link_to 'Close', project_issue_path(issue.project, issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-small btn-grouped close_issue btn-close", remote: true
= link_to edit_project_issue_path(issue.project, issue), class: "btn btn-small edit-issue-link btn-grouped" do
%i.icon-edit
Edit
diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml
index d7987f43fbb..8c3f0823386 100644
--- a/app/views/projects/issues/_issue_context.html.haml
+++ b/app/views/projects/issues/_issue_context.html.haml
@@ -5,7 +5,7 @@
Assignee:
- if can?(current_user, :modify_issue, @issue)
- = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id)
+ = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @issue.assignee_id)
- elsif issue.assignee
= link_to_member(@project, @issue.assignee)
- else
@@ -15,7 +15,7 @@
%strong.append-right-10
Milestone:
- if can?(current_user, :modify_issue, @issue)
- = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact'})
+ = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
= hidden_field_tag :issue_context
= f.submit class: 'btn'
- elsif issue.milestone
diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml
index 2e66d059565..5de77b8bf32 100644
--- a/app/views/projects/issues/index.html.haml
+++ b/app/views/projects/issues/index.html.haml
@@ -4,6 +4,6 @@
%i.icon-list.icon-2x
.col-md-3.responsive-side
= render 'shared/project_filter', project_entities_path: project_issues_path(@project),
- labels: true, redirect: 'issues'
+ labels: true, redirect: 'issues', entity: 'issue'
.col-md-9.issues-holder
= render "issues"
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index 695eb225754..fd0f5446b34 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -57,9 +57,9 @@
- content_for :note_actions do
- if can?(current_user, :modify_issue, @issue)
- if @issue.closed?
- = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen"
+ = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen js-note-target-reopen", title: 'Reopen Issue'
- else
- = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close", title: "Close Issue"
+ = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"
.participants
%cite.cgray #{@issue.participants.count} participants
@@ -68,9 +68,6 @@
.issue-show-labels.pull-right
- @issue.labels.each do |label|
- %span{class: "label #{label_css_class(label.name)}"}
- %i.icon-tag
- = label.name
- &nbsp;
+ = render_colored_label(label)
.voting_notes#notes= render "projects/notes/notes_with_form"
diff --git a/app/views/projects/labels/_form.html.haml b/app/views/projects/labels/_form.html.haml
new file mode 100644
index 00000000000..72a01e1c271
--- /dev/null
+++ b/app/views/projects/labels/_form.html.haml
@@ -0,0 +1,33 @@
+= form_for [@project, @label], html: { class: 'form-horizontal label-form' } do |f|
+ -if @label.errors.any?
+ .row
+ .col-sm-10.col-sm-offset-2
+ .bs-callout.bs-callout-danger
+ - @label.errors.full_messages.each do |msg|
+ %span= msg
+ %br
+
+ .form-group
+ = f.label :title, class: 'control-label'
+ .col-sm-10
+ = f.text_field :title, class: "form-control", required: true
+ .form-group
+ = f.label :color, "Background Color", class: 'control-label'
+ .col-sm-10
+ .input-group
+ .input-group-addon.label-color-preview &nbsp;
+ = f.text_field :color, placeholder: "#AA33EE", class: "form-control"
+ .help-block
+ 6 character hex values starting with a # sign.
+ %br
+ Or you can choose one of suggested colors below
+
+ .suggest-colors
+ - suggested_colors.each do |color|
+ = link_to '#', style: "background-color: #{color}", data: { color: color } do
+ &nbsp;
+
+ .form-actions
+ = f.submit 'Save', class: 'btn btn-save js-save-button'
+ = link_to "Cancel", project_labels_path(@project), class: 'btn btn-cancel'
+
diff --git a/app/views/projects/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml
index 6e1ca0d8f2f..03a8f0921b7 100644
--- a/app/views/projects/labels/_label.html.haml
+++ b/app/views/projects/labels/_label.html.haml
@@ -1,13 +1,10 @@
-- frequency = @project.issues.tagged_with(label.name).count
-%li
- %span{class: "label #{label_css_class(label.name)}"}
- %i.icon-tag
- - if frequency.zero?
- %span.light= label.name
- - else
- = label.name
+%li{id: dom_id(label)}
+ = render_colored_label(label)
.pull-right
- - unless frequency.zero?
- = link_to project_issues_path(label_name: label.name) do
- = pluralize(frequency, 'issue')
- = "»"
+ %strong.append-right-20
+ = link_to project_issues_path(@project, label_name: label.name) do
+ = pluralize label.open_issues_count, 'open issue'
+
+ - if can? current_user, :admin_label, @project
+ = link_to 'Edit', edit_project_label_path(@project, label), class: 'btn'
+ = link_to 'Remove', project_label_path(@project, label), class: 'btn btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"}
diff --git a/app/views/projects/labels/destroy.js.haml b/app/views/projects/labels/destroy.js.haml
new file mode 100644
index 00000000000..1b4c83ab097
--- /dev/null
+++ b/app/views/projects/labels/destroy.js.haml
@@ -0,0 +1,2 @@
+- if @project.labels.size == 0
+ $('.labels').load(document.URL + ' .light-well').hide().fadeIn(1000)
diff --git a/app/views/projects/labels/edit.html.haml b/app/views/projects/labels/edit.html.haml
new file mode 100644
index 00000000000..52435c5d892
--- /dev/null
+++ b/app/views/projects/labels/edit.html.haml
@@ -0,0 +1,8 @@
+%h3
+ Edit label
+ %span.light #{@label.name}
+.back-link
+ = link_to project_labels_path(@project) do
+ &larr; To labels list
+%hr
+= render 'form'
diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml
index 329cf9ceba8..06568278de8 100644
--- a/app/views/projects/labels/index.html.haml
+++ b/app/views/projects/labels/index.html.haml
@@ -1,10 +1,17 @@
= render "projects/issues/head"
-- if @labels.present?
- %ul.bordered-list.labels-table
- - @labels.each do |label|
- = render 'label', label: label
+- if can? current_user, :admin_label, @project
+ = link_to new_project_label_path(@project), class: "pull-right btn btn-new" do
+ New label
+%h3.page-title
+ Labels
+%hr
-- else
- .light-well
- .nothing-here-block Add first label to your issues or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels
+.labels
+ - if @labels.present?
+ %ul.bordered-list.manage-labels-list
+ = render @labels
+ = paginate @labels, theme: 'gitlab'
+ - else
+ .light-well
+ .nothing-here-block Create first label or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels
diff --git a/app/views/projects/labels/new.html.haml b/app/views/projects/labels/new.html.haml
new file mode 100644
index 00000000000..850da0b192b
--- /dev/null
+++ b/app/views/projects/labels/new.html.haml
@@ -0,0 +1,6 @@
+%h3 New label
+.back-link
+ = link_to project_labels_path(@project) do
+ &larr; To labels list
+%hr
+= render 'form'
diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml
index 9ef232b5268..a97547aabec 100644
--- a/app/views/projects/merge_requests/_form.html.haml
+++ b/app/views/projects/merge_requests/_form.html.haml
@@ -15,45 +15,13 @@
%div= msg
.merge-request-form-info
+ = render 'projects/issuable_form', f: f, issuable: @merge_request
.form-group
- = f.label :title, class: 'control-label' do
- %strong= "Title *"
- .col-sm-10= f.text_field :title, class: "form-control pad js-gfm-input", maxlength: 255, rows: 5, required: true
- .form-group
- = f.label :description, "Description", class: 'control-label'
+ = f.label :label_ids, class: 'control-label' do
+ %i.icon-tag
+ Labels
.col-sm-10
- = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 14
- .col-sm-12.hint
- .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
- .pull-right Attach images (JPG, PNG, GIF) by dragging &amp; dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
- .clearfix
- .error-alert
- %hr
- .form-group
- .issue-assignee
- = f.label :assignee_id, class: 'control-label' do
- %i.icon-user
- Assign to
- .col-sm-10
- = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id)
- &nbsp;
- = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
- .form-group
- .issue-milestone
- = f.label :milestone_id, class: 'control-label' do
- %i.icon-time
- Milestone
- .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'})
-
-
- - if @merge_request.persisted? # Only allow labels on edit to avoid fork vs upstream repo labels issue
- .form-group
- = f.label :label_list, class: 'control-label' do
- %i.icon-tag
- Labels
- .col-sm-10
- = f.text_field :label_list, maxlength: 2000, class: "form-control"
- %p.hint Separate labels with commas.
+ = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, { selected: @merge_request.label_ids }, multiple: true, class: 'select2'
.form-actions
- if @merge_request.new_record?
@@ -74,33 +42,4 @@
e.preventDefault();
});
- $("#merge_request_label_list")
- .bind( "keydown", function( event ) {
- if ( event.keyCode === $.ui.keyCode.TAB &&
- $( this ).data( "autocomplete" ).menu.active ) {
- event.preventDefault();
- }
- })
- .bind("click", function(event) {
- $(this).autocomplete("search", "");
- })
- .autocomplete({
- minLength: 0,
- source: function( request, response ) {
- response( $.ui.autocomplete.filter(
- #{raw labels_autocomplete_source}, extractLast( request.term ) ) );
- },
- focus: function() {
- return false;
- },
- select: function(event, ui) {
- var terms = split( this.value );
- terms.pop();
- terms.push( ui.item.value );
- terms.push( "" );
- this.value = terms.join( ", " );
- return false;
- }
- });
-
window.project_image_path_upload = "#{upload_image_project_path @project}";
diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml
index c9a80ec22ef..06cf390fbde 100644
--- a/app/views/projects/merge_requests/_merge_request.html.haml
+++ b/app/views/projects/merge_requests/_merge_request.html.haml
@@ -5,7 +5,7 @@
- if merge_request.merged?
%small.pull-right
%i.icon-ok
- = "MERGED"
+ MERGED
- else
%span.pull-right
- if merge_request.for_fork?
@@ -34,6 +34,4 @@
.merge-request-labels
- merge_request.labels.each do |label|
- %span{class: "label #{label_css_class(label.name)}"}
- %i.icon-tag
- = label.name
+ = render_colored_label(label)
diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml
index f8f14a71a11..99726172154 100644
--- a/app/views/projects/merge_requests/_new_compare.html.haml
+++ b/app/views/projects/merge_requests/_new_compare.html.haml
@@ -27,19 +27,19 @@
.panel-footer
.mr_target_commit
- -if @merge_request.errors.any?
+ - if @merge_request.errors.any?
.alert.alert-danger
- @merge_request.errors.full_messages.each do |msg|
%div= msg
- - if @merge_request.source_branch.present? && @merge_request.target_branch.present?
- - if @compare_failed
+ - elsif @merge_request.source_branch.present? && @merge_request.target_branch.present?
+ - if @merge_request.compare_failed
.alert.alert-danger
%h4 Compare failed
%p We can't compare selected branches. It may be because of huge diff or satellite timeout. Please try again or select different branches.
- else
.light-well
- %center
+ .center
%h4
There isn't anything to merge.
%p.slead
diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml
index 34a30975e07..dc3f9d592f6 100644
--- a/app/views/projects/merge_requests/_new_submit.html.haml
+++ b/app/views/projects/merge_requests/_new_submit.html.haml
@@ -2,11 +2,9 @@
New merge request
%p.slead
From
- %strong.monospace
- #{@merge_request.source_project_namespace}:#{@merge_request.source_branch}
- into
- %strong.monospace
- #{@merge_request.target_project_namespace}:#{@merge_request.target_branch}
+ %strong.label-branch #{@merge_request.source_project_namespace}:#{@merge_request.source_branch}
+ %span into
+ %strong.label-branch #{@merge_request.target_project_namespace}:#{@merge_request.target_branch}
%span.pull-right
= link_to 'Change branches', new_project_merge_request_path(@project)
@@ -18,7 +16,7 @@
.form-group
.light
= f.label :title do
- = "Title *"
+ Title *
= f.text_field :title, class: "form-control input-lg js-gfm-input", maxlength: 255, rows: 5, required: true
.form-group
.light
@@ -43,12 +41,18 @@
%i.icon-time
Milestone
%div= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'})
+ .form-group
+ = f.label :label_ids do
+ %i.icon-tag
+ Labels
+ %div
+ = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, { selected: @merge_request.label_ids }, multiple: true, class: 'select2'
+
.panel-footer
- - if @target_repo.contribution_guide
- - contribution_guide_url = project_blob_path(@target_project, tree_join(@target_repo.root_ref, @target_repo.contribution_guide.name))
+ - if contribution_guide_url(@target_project)
%p
Please review the
- %strong #{link_to "guidelines for contribution", contribution_guide_url}
+ %strong #{link_to "guidelines for contribution", contribution_guide_url(@target_project)}
to this repository.
= f.hidden_field :source_project_id
= f.hidden_field :target_project_id
@@ -76,6 +80,10 @@
.bs-callout.bs-callout-danger
%h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
%p To preserve performance the line changes are not shown.
+ - else
+ .bs-callout.bs-callout-danger
+ %h4 This comparison includes huge diff.
+ %p To preserve performance the line changes are not shown.
:javascript
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 8fca9f0212b..4323c8f65a4 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -22,9 +22,9 @@
- content_for :note_actions do
- if can?(current_user, :modify_merge_request, @merge_request)
- unless @merge_request.closed? || @merge_request.merged?
- = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link", title: "Close merge request"
+ = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request"
- if @merge_request.closed?
- = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link", title: "Close merge request"
+ = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request"
.diffs.tab-content
- if current_page?(action: 'diffs')
diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml
index 4bb803eb6df..0954fa8fcea 100644
--- a/app/views/projects/merge_requests/index.html.haml
+++ b/app/views/projects/merge_requests/index.html.haml
@@ -4,14 +4,13 @@
New Merge Request
%h3.page-title
Merge Requests
- %span (#{@merge_requests.total_count})
%hr
.row
.fixed.sidebar-expand-button.hidden-lg.hidden-md
%i.icon-list.icon-2x
.col-md-3.responsive-side
= render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project),
- labels: true, redirect: 'merge_requests'
+ labels: true, redirect: 'merge_requests', entity: 'merge_request'
.col-md-9
.mr-filters.append-bottom-10
.dropdown.inline
diff --git a/app/views/projects/merge_requests/new.html.haml b/app/views/projects/merge_requests/new.html.haml
index c24e5916721..4756903d0e0 100644
--- a/app/views/projects/merge_requests/new.html.haml
+++ b/app/views/projects/merge_requests/new.html.haml
@@ -1,4 +1,4 @@
-- if @commits.present?
+- if @merge_request.can_be_created
= render 'new_submit'
- else
= render 'new_compare'
diff --git a/app/views/projects/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml
index 92a7bb927e4..ede709ea1df 100644
--- a/app/views/projects/merge_requests/show/_commits.html.haml
+++ b/app/views/projects/merge_requests/show/_commits.html.haml
@@ -17,7 +17,7 @@
- @commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE).each do |commit|
= render "projects/commits/inline_commit", commit: commit, project: @merge_request.source_project
%li
- other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden top prevent performance issues.
+ other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues.
- else
%ul.all-commits.hide.well-list
- @commits.each do |commit|
diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml
index ab00b34242a..089302e3588 100644
--- a/app/views/projects/merge_requests/show/_context.html.haml
+++ b/app/views/projects/merge_requests/show/_context.html.haml
@@ -5,7 +5,7 @@
Assignee:
- if can?(current_user, :modify_merge_request, @merge_request)
- = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id)
+ = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id)
- elsif merge_request.assignee
= link_to_member(@project, @merge_request.assignee)
- else
@@ -15,7 +15,7 @@
%strong.append-right-10
Milestone:
- if can?(current_user, :modify_merge_request, @merge_request)
- = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact'})
+ = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
= hidden_field_tag :merge_request_context
= f.submit class: 'btn'
- elsif merge_request.milestone
diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml
index 07e05f55012..d7d5f970c95 100644
--- a/app/views/projects/merge_requests/show/_mr_accept.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml
@@ -15,34 +15,35 @@
= form_for [:automerge, @project, @merge_request], remote: true, method: :post do |f|
%h4
You can accept this request automatically.
- %div
- If you still want to do it manually -
- %strong
- = link_to "click here", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
- for instructions.
+ .accept-merge-holder.clearfix
+ .js-toggle-container
+ %p
+ You can
+ %strong= link_to "modify merge commit message", "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message"
+ before accepting merge request
+ .js-toggle-content.hide
+ .form-group
+ = label_tag :merge_commit_message, "Commit message", class: 'control-label'
+ .col-sm-10
+ = render 'shared/commit_message_container', {textarea: text_area_tag(:merge_commit_message,
+ @merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true)}
+ %p.hint
+ The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines.
- .js-toggle-container
- %p
- If you want to modify merge commit message -
- %strong
- = link_to "click here", "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message"
- .js-toggle-content.hide
- .form-group
- = label_tag :merge_commit_message, "Commit message", class: 'control-label'
- .col-sm-10
- = render 'shared/commit_message_container', {textarea: text_area_tag(:merge_commit_message,
- @merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true)}
- %p.hint
- The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines.
+ .accept-group
+ .pull-left
+ = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
+ - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
+ .remove_branch_holder.pull-left
+ = label_tag :should_remove_source_branch, class: "checkbox" do
+ = check_box_tag :should_remove_source_branch
+ Remove source-branch
- .accept-group
- .pull-left
- = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
- - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch)
- .remove_branch_holder.pull-left
- = label_tag :should_remove_source_branch, class: "checkbox" do
- = check_box_tag :should_remove_source_branch
- Remove source-branch
+ %hr
+ .light
+ If you still want to merge this request manually - use
+ %strong
+ = link_to "command line", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
.automerge_widget.no_satellite.hide
diff --git a/app/views/projects/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml
index 507a9e507f1..b77eeac6123 100644
--- a/app/views/projects/merge_requests/show/_mr_ci.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_ci.html.haml
@@ -1,21 +1,21 @@
- if @commits.any?
.ci_widget.ci-success{style: "display:none"}
%i.icon-ok
- %strong CI build passed
+ %span CI build passed
for #{@merge_request.last_commit_short_sha}.
= link_to "Build page", ci_build_details_path(@merge_request)
.ci_widget.ci-failed{style: "display:none"}
%i.icon-remove
- %strong CI build failed
+ %span CI build failed
for #{@merge_request.last_commit_short_sha}.
= link_to "Build page", ci_build_details_path(@merge_request)
- [:running, :pending].each do |status|
.ci_widget{class: "ci-#{status}", style: "display:none"}
%i.icon-time
- %strong CI build #{status}
+ %span CI build #{status}
for #{@merge_request.last_commit_short_sha}.
= link_to "Build page", ci_build_details_path(@merge_request)
@@ -26,4 +26,4 @@
.ci_widget.ci-error{style: "display:none"}
%i.icon-remove
- %strong Cannot connect to the CI server. Please check your settings and try again.
+ %span Cannot connect to the CI server. Please check your settings and try again.
diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml
index 2c905413bc3..563a5244993 100644
--- a/app/views/projects/merge_requests/show/_mr_title.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_title.html.haml
@@ -28,15 +28,13 @@
= link_to project_merge_requests_path(@project) do
&larr; To merge requests
- %span.prepend-left-20.monospace
- -if @merge_request.for_fork?
- %span
- %strong
- #{truncate(@merge_request.source_project_path, length: 25)}:
- #{@merge_request.source_branch}
- &rarr;
- %span= @merge_request.target_branch
+ %span.prepend-left-20
+ %span From
+ - if @merge_request.for_fork?
+ %strong.label-branch #{@merge_request.source_project_namespace}:#{@merge_request.source_branch}
+ %span into
+ %strong.label-branch #{@merge_request.target_project_namespace}:#{@merge_request.target_branch}
- else
- %span= @merge_request.source_branch
- &rarr;
- %span= @merge_request.target_branch
+ %strong.label-branch #{@merge_request.source_branch}
+ %span into
+ %strong.label-branch #{@merge_request.target_branch}
diff --git a/app/views/projects/merge_requests/show/_participants.html.haml b/app/views/projects/merge_requests/show/_participants.html.haml
index 0dabd965e52..007c111f7fb 100644
--- a/app/views/projects/merge_requests/show/_participants.html.haml
+++ b/app/views/projects/merge_requests/show/_participants.html.haml
@@ -5,7 +5,4 @@
.merge-request-show-labels.pull-right
- @merge_request.labels.each do |label|
- %span{class: "label #{label_css_class(label.name)}"}
- %i.icon-tag
- = label.name
- &nbsp;
+ = render_colored_label(label)
diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml
index 979c27daa2b..df79125eae6 100644
--- a/app/views/projects/milestones/_form.html.haml
+++ b/app/views/projects/milestones/_form.html.haml
@@ -21,7 +21,7 @@
.form-group
= f.label :description, "Description", class: "control-label"
.col-sm-10
- = f.text_area :description, maxlength: 2000, class: "form-control markdown-area", rows: 10
+ = f.text_area :description, maxlength: 65535, class: "form-control markdown-area", rows: 10
.hint
.pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-left Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
diff --git a/app/views/projects/milestones/_issue.html.haml b/app/views/projects/milestones/_issue.html.haml
index 08ccd0cdc8a..b5ec0fc9882 100644
--- a/app/views/projects/milestones/_issue.html.haml
+++ b/app/views/projects/milestones/_issue.html.haml
@@ -2,7 +2,7 @@
%span.str-truncated
= link_to [@project, issue] do
%span.cgray ##{issue.iid}
- = link_to_gfm issue.title, [@project, issue]
+ = link_to_gfm issue.title, [@project, issue], title: issue.title
.pull-right.assignee-icon
- if issue.assignee
= image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16"
diff --git a/app/views/projects/milestones/_merge_request.html.haml b/app/views/projects/milestones/_merge_request.html.haml
index d630c4518dd..d54cb3f8e74 100644
--- a/app/views/projects/milestones/_merge_request.html.haml
+++ b/app/views/projects/milestones/_merge_request.html.haml
@@ -2,4 +2,4 @@
%span.str-truncated
= link_to [@project, merge_request] do
%span.cgray ##{merge_request.iid}
- = link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request]
+ = link_to_gfm merge_request.title, [@project, merge_request], title: merge_request.title
diff --git a/app/views/projects/milestones/_milestone.html.haml b/app/views/projects/milestones/_milestone.html.haml
index 5579659d60e..4018d132a55 100644
--- a/app/views/projects/milestones/_milestone.html.haml
+++ b/app/views/projects/milestones/_milestone.html.haml
@@ -4,7 +4,7 @@
= link_to edit_project_milestone_path(milestone.project, milestone), class: "btn btn-small edit-milestone-link btn-grouped" do
%i.icon-edit
Edit
- = link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-small btn-remove"
+ = link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-small btn-close"
%h4
= link_to_gfm truncate(milestone.title, length: 100), project_milestone_path(milestone.project, milestone)
- if milestone.expired? and not milestone.closed?
diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml
index 5cf7f332118..1a495aa1c40 100644
--- a/app/views/projects/milestones/show.html.haml
+++ b/app/views/projects/milestones/show.html.haml
@@ -7,9 +7,9 @@
%i.icon-edit
Edit
- if @milestone.active?
- = link_to 'Close Milestone', project_milestone_path(@project, @milestone, milestone: {state_event: :close }), method: :put, class: "btn btn-remove btn-grouped"
+ = link_to 'Close Milestone', project_milestone_path(@project, @milestone, milestone: {state_event: :close }), method: :put, class: "btn btn-close btn-grouped"
- else
- = link_to 'Reopen Milestone', project_milestone_path(@project, @milestone, milestone: {state_event: :activate }), method: :put, class: "btn btn-grouped"
+ = link_to 'Reopen Milestone', project_milestone_path(@project, @milestone, milestone: {state_event: :activate }), method: :put, class: "btn btn-reopen btn-grouped"
- if @milestone.issues.any? && @milestone.can_be_closed?
.alert.alert-success
@@ -47,6 +47,8 @@
#{@milestone.closed_items_count} closed
&ndash;
#{@milestone.open_items_count} open
+ &nbsp;
+ %span.light #{@milestone.percent_complete}% complete
%span.pull-right= @milestone.expires_at
.progress.progress-info
.progress-bar{style: "width: #{@milestone.percent_complete}%;"}
diff --git a/app/views/projects/network/show.html.haml b/app/views/projects/network/show.html.haml
index 5310822823d..8356bef28b0 100644
--- a/app/views/projects/network/show.html.haml
+++ b/app/views/projects/network/show.html.haml
@@ -15,9 +15,10 @@
= spinner nil, true
:javascript
- new Network({
+ network_graph = new Network({
url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}',
commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}',
ref: '#{@ref}',
commit_id: '#{@commit.id}'
})
+ new ShortcutsNetwork(network_graph.branch_graph)
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 5d5637c1588..7efaf5a087b 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -72,7 +72,7 @@
Create a group
.save-project-loader.hide
- %center
+ .center
%h2
%i.icon-spinner.icon-spin
Creating project &amp; repository.
diff --git a/app/views/projects/notes/_commit_discussion.html.haml b/app/views/projects/notes/_commit_discussion.html.haml
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/app/views/projects/notes/_commit_discussion.html.haml
diff --git a/app/views/projects/notes/_diff_notes_with_reply.html.haml b/app/views/projects/notes/_diff_notes_with_reply.html.haml
index 9acadc6a14e..a01056b7166 100644
--- a/app/views/projects/notes/_diff_notes_with_reply.html.haml
+++ b/app/views/projects/notes/_diff_notes_with_reply.html.haml
@@ -1,13 +1,13 @@
- note = notes.first # example note
-# Check if line want not changed since comment was left
- if !defined?(line) || line == note.diff_line
- %tr.notes_holder.js-toggle-content
+ %tr.notes_holder
%td.notes_line{ colspan: 2 }
- %span.btn.disabled
+ %span.discussion-notes-count
%i.icon-comment
= notes.count
%td.notes_content
%ul.notes{ rel: note.discussion_id }
= render notes
-
- = render "projects/notes/discussion_reply_button", note: note
+ .discussion-reply-holder
+ = link_to_reply_diff(note)
diff --git a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml
index 399ce30d1a9..8adf903a9a1 100644
--- a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml
+++ b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml
@@ -2,7 +2,7 @@
- note2 = notes2.first # example note
-# Check if line want not changed since comment was left
/- if !defined?(line) || line == note.diff_line
-%tr.notes_holder.js-toggle-content
+%tr.notes_holder
- if note1
%td.notes_line
%span.btn.disabled
@@ -12,7 +12,8 @@
%ul.notes{ rel: note1.discussion_id }
= render notes1
- = render "projects/notes/discussion_reply_button", note: note1
+ .discussion-reply-holder
+ = link_to_reply_diff(note1)
- else
%td= ""
%td= ""
@@ -26,7 +27,8 @@
%ul.notes{ rel: note2.discussion_id }
= render notes2
- = render "projects/notes/discussion_reply_button", note: note2
+ .discussion-reply-holder
+ = link_to_reply_diff(note2)
- else
%td= ""
%td= ""
diff --git a/app/views/projects/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml
index 78793eb860f..f4c6fad2fed 100644
--- a/app/views/projects/notes/_discussion.html.haml
+++ b/app/views/projects/notes/_discussion.html.haml
@@ -1,46 +1,13 @@
- note = discussion_notes.first
-.discussion.js-toggle-container{ class: note.discussion_id }
- .discussion-header
- .discussion-actions
- = link_to "#", class: "js-toggle-button" do
- %i.icon-chevron-up
- Show/hide discussion
- = image_tag avatar_icon(note.author_email), class: "avatar s32"
- %div
- = link_to_member(@project, note.author, avatar: false)
+.timeline-entry
+ .timeline-entry-inner
+ .timeline-icon
+ = image_tag avatar_icon(note.author_email), class: "avatar s40"
+ .timeline-content
- if note.for_merge_request?
- - if note.diff
- started a discussion on this merge request diff
- = link_to_merge_request_diff_line_note(note)
+ - if note.outdated?
+ = render "projects/notes/discussions/outdated", discussion_notes: discussion_notes
- else
- started
- %strong
- %i.icon-remove
- outdated
- discussion on this merge request diff
- - elsif note.for_commit?
- started a discussion on commit
- #{link_to note.noteable.short_id, project_commit_path(note.project, note.noteable)}
- = link_to_commit_diff_line_note(note) if note.for_diff_line?
+ = render "projects/notes/discussions/active", discussion_notes: discussion_notes
- else
- %cite.cgray started a discussion
- %div
- - last_note = discussion_notes.last
- last updated by
- = link_to_member(@project, last_note.author, avatar: false)
- %span.discussion-last-update
- #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
- .discussion-body.js-toggle-content
- - if note.for_diff_line?
- - if note.active?
- = render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note
- - else
- = link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion'
- %div.hide.outdated-discussion
- .notes{ rel: discussion_notes.first.discussion_id }
- = render discussion_notes
-
- - else
- .notes{ rel: discussion_notes.first.discussion_id }
- = render discussion_notes
- = render "projects/notes/discussion_reply_button", note: discussion_notes.first
+ = render "projects/notes/discussions/commit", discussion_notes: discussion_notes
diff --git a/app/views/projects/notes/_discussion_reply_button.html.haml b/app/views/projects/notes/_discussion_reply_button.html.haml
deleted file mode 100644
index d1c5ccc29db..00000000000
--- a/app/views/projects/notes/_discussion_reply_button.html.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-= link_to "javascript:;",
- class: "btn reply-btn js-discussion-reply-button",
- data: { noteable_type: note.noteable_type,
- noteable_id: note.noteable_id,
- commit_id: note.commit_id,
- line_code: note.line_code,
- discussion_id: note.discussion_id },
- title: "Add a reply" do
- %i.icon-comment
- Reply
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 2fd8cb6d489..394fa88e045 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -1,66 +1,69 @@
-%li{ id: dom_id(note), class: dom_class(note), data: { discussion: note.discussion_id } }
- .note-header
- .note-actions
- = link_to "##{dom_id(note)}", name: dom_id(note) do
- %i.icon-link
- Link here
- &nbsp;
- - if(note.author_id == current_user.try(:id)) || can?(current_user, :admin_note, @project)
- = link_to "#", title: "Edit comment", class: "js-note-edit" do
- %i.icon-edit
- Edit
- &nbsp;
- = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do
- %i.icon-trash.cred
- Remove
- = image_tag avatar_icon(note.author_email), class: "avatar s32"
- = link_to_member(@project, note.author, avatar: false)
- %span.note-last-update
- = note_timestamp(note)
+%li.timeline-entry{ id: dom_id(note), class: dom_class(note), data: { discussion: note.discussion_id } }
+ .timeline-entry-inner
+ .timeline-icon
+ = image_tag avatar_icon(note.author_email), class: "avatar s40"
+ .timeline-content
+ .note-header
+ .note-actions
+ = link_to "##{dom_id(note)}", name: dom_id(note) do
+ %i.icon-link
+ Link here
+ &nbsp;
+ - if can?(current_user, :admin_note, note) && note.editable?
+ = link_to "#", title: "Edit comment", class: "js-note-edit" do
+ %i.icon-edit
+ Edit
+ &nbsp;
+ = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do
+ %i.icon-trash.cred
+ Remove
+ = link_to_member(@project, note.author, avatar: false)
+ %span.note-last-update
+ = note_timestamp(note)
- - if note.upvote?
- %span.vote.upvote.label.label-success
- %i.icon-thumbs-up
- \+1
- - if note.downvote?
- %span.vote.downvote.label.label-danger
- %i.icon-thumbs-down
- \-1
+ - if note.upvote?
+ %span.vote.upvote.label.label-success
+ %i.icon-thumbs-up
+ \+1
+ - if note.downvote?
+ %span.vote.downvote.label.label-danger
+ %i.icon-thumbs-down
+ \-1
- .note-body
- .note-text
- = preserve do
- = markdown(note.note, {no_header_anchors: true})
+ .note-body
+ .note-text
+ = preserve do
+ = markdown(note.note, {no_header_anchors: true})
- .note-edit-form
- = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
- = f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
+ .note-edit-form
+ = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
+ = f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
- .form-actions.clearfix
- = f.submit 'Save changes', class: "btn btn-primary btn-save"
+ .form-actions.clearfix
+ = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button"
- .note-form-option
- %a.choose-btn.btn.btn-small.js-choose-note-attachment-button
- %i.icon-paper-clip
- %span Choose File ...
- &nbsp;
- %span.file_name.js-attachment-filename File name...
- = f.file_field :attachment, class: "js-note-attachment-input hidden"
+ .note-form-option
+ %a.choose-btn.btn.js-choose-note-attachment-button
+ %i.icon-paper-clip
+ %span Choose File ...
+ &nbsp;
+ %span.file_name.js-attachment-filename File name...
+ = f.file_field :attachment, class: "js-note-attachment-input hidden"
- = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
+ = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
- - if note.attachment.url
- .note-attachment
- - if note.attachment.image?
- = link_to note.attachment.secure_url, target: '_blank' do
- = image_tag note.attachment.secure_url, class: 'note-image-attach'
- .attachment.pull-right
- = link_to note.attachment.secure_url, target: "_blank" do
- %i.icon-paper-clip
- = note.attachment_identifier
- = link_to delete_attachment_project_note_path(@project, note),
- title: "Delete this attachment", method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: "danger js-note-attachment-delete" do
- %i.icon-trash.cred
- .clear
+ - if note.attachment.url
+ .note-attachment
+ - if note.attachment.image?
+ = link_to note.attachment.secure_url, target: '_blank' do
+ = image_tag note.attachment.secure_url, class: 'note-image-attach'
+ .attachment.pull-right
+ = link_to note.attachment.secure_url, target: "_blank" do
+ %i.icon-paper-clip
+ = note.attachment_identifier
+ = link_to delete_attachment_project_note_path(@project, note),
+ title: "Delete this attachment", method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: "danger js-note-attachment-delete" do
+ %i.icon-trash.cred
+ .clear
diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml
index 052661962e4..04ee17a40a0 100644
--- a/app/views/projects/notes/_notes_with_form.html.haml
+++ b/app/views/projects/notes/_notes_with_form.html.haml
@@ -1,4 +1,4 @@
-%ul#notes-list.notes.main-notes-list
+%ul#notes-list.notes.main-notes-list.timeline
= render "projects/notes/notes"
.js-notes-busy
diff --git a/app/views/projects/notes/discussions/_active.html.haml b/app/views/projects/notes/discussions/_active.html.haml
new file mode 100644
index 00000000000..eb416c5b5f0
--- /dev/null
+++ b/app/views/projects/notes/discussions/_active.html.haml
@@ -0,0 +1,20 @@
+- note = discussion_notes.first
+.discussion.js-toggle-container{ class: note.discussion_id }
+ .discussion-header
+ .discussion-actions
+ = link_to "#", class: "js-toggle-button" do
+ %i.icon-chevron-up
+ Show/hide discussion
+ %div
+ = link_to_member(@project, note.author, avatar: false)
+ started a discussion
+ = link_to diffs_project_merge_request_path(note.project, note.noteable, anchor: note.line_code) do
+ %strong on the diff
+ .last-update.hide.js-toggle-content
+ - last_note = discussion_notes.last
+ last updated by
+ = link_to_member(@project, last_note.author, avatar: false)
+ %span.discussion-last-update
+ #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
+ .discussion-body.js-toggle-content
+ = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note
diff --git a/app/views/projects/notes/discussions/_commit.html.haml b/app/views/projects/notes/discussions/_commit.html.haml
new file mode 100644
index 00000000000..a928029a5e5
--- /dev/null
+++ b/app/views/projects/notes/discussions/_commit.html.haml
@@ -0,0 +1,27 @@
+- note = discussion_notes.first
+.discussion.js-toggle-container{ class: note.discussion_id }
+ .discussion-header
+ .discussion-actions
+ = link_to "#", class: "js-toggle-button" do
+ %i.icon-chevron-up
+ Show/hide discussion
+ %div
+ = link_to_member(@project, note.author, avatar: false)
+ started a discussion on commit
+ = link_to(note.noteable.short_id, project_commit_path(note.project, note.noteable), class: 'monospace')
+ .last-update.hide.js-toggle-content
+ - last_note = discussion_notes.last
+ last updated by
+ = link_to_member(@project, last_note.author, avatar: false)
+ %span.discussion-last-update
+ #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
+ .discussion-body.js-toggle-content
+ - if note.for_diff_line?
+ = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note
+ - else
+ .panel.panel-default
+ .notes{ rel: discussion_notes.first.discussion_id }
+ = render discussion_notes
+ .discussion-reply-holder
+ = link_to_reply_diff(discussion_notes.first)
+
diff --git a/app/views/projects/notes/_discussion_diff.html.haml b/app/views/projects/notes/discussions/_diff.html.haml
index 26c5494f466..26c5494f466 100644
--- a/app/views/projects/notes/_discussion_diff.html.haml
+++ b/app/views/projects/notes/discussions/_diff.html.haml
diff --git a/app/views/projects/notes/discussions/_outdated.html.haml b/app/views/projects/notes/discussions/_outdated.html.haml
new file mode 100644
index 00000000000..4ae914c107b
--- /dev/null
+++ b/app/views/projects/notes/discussions/_outdated.html.haml
@@ -0,0 +1,19 @@
+- note = discussion_notes.first
+.discussion.js-toggle-container{ class: note.discussion_id }
+ .discussion-header
+ .discussion-actions
+ = link_to "#", class: "js-toggle-button" do
+ %i.icon-chevron-down
+ Show/hide discussion
+ %div
+ = link_to_member(@project, note.author, avatar: false)
+ started a discussion on the
+ %strong outdated diff
+ %div
+ - last_note = discussion_notes.last
+ last updated by
+ = link_to_member(@project, last_note.author, avatar: false)
+ %span.discussion-last-update
+ #{time_ago_with_tooltip(last_note.updated_at, 'bottom', 'discussion_updated_ago')}
+ .discussion-body.js-toggle-content.hide
+ = render "projects/notes/discussions/diff", discussion_notes: discussion_notes, note: note
diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml
index a51a4cc224a..7925e800305 100644
--- a/app/views/projects/protected_branches/index.html.haml
+++ b/app/views/projects/protected_branches/index.html.haml
@@ -5,7 +5,7 @@
.bs-callout.bs-callout-info
%p Protected branches designed to
%ul
- %li prevent push for all except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"}.
+ %li prevent push for all except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"}
%li prevent branch from force push
%li prevent branch from removal
%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "underlined-link"}
diff --git a/app/views/projects/repositories/_download_archive.html.haml b/app/views/projects/repositories/_download_archive.html.haml
index 88c1cfa28e0..0bf59a20384 100644
--- a/app/views/projects/repositories/_download_archive.html.haml
+++ b/app/views/projects/repositories/_download_archive.html.haml
@@ -34,4 +34,4 @@
%span zip
= link_to archive_project_repository_path(@project, ref: ref, format: 'tar.gz'), class: 'btn', rel: 'nofollow' do
%i.icon-download-alt
- %span tar.gz \ No newline at end of file
+ %span tar.gz
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 9484dc9464c..7902f51f72f 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -1,5 +1,16 @@
= render "home_panel"
+%ul.nav.nav-tabs
+ %li.active
+ = link_to project_path(@project) do
+ Activity
+ .project-home-links
+ - unless @project.empty_repo?
+ = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref)
+ = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project)
+ = link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project)
+ %span.light.prepend-left-20= repository_size
+
.row
%section.col-md-9
= render "events/event_last_push", event: @last_push
@@ -15,27 +26,14 @@
Archived project!
%p Repository is read-only
-
- if @project.forked_from_project
.alert.alert-success
%i.icon-code-fork.project-fork-icon
Forked from:
%br
= link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project)
- - unless @project.empty_repo?
- - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
- - if current_user.already_forked?(@project)
- = link_to project_path(current_user.fork_of(@project)), class: 'btn btn-block' do
- %i.icon-compass
- Go to fork
- - else
- = link_to fork_project_path(@project), title: "Fork", class: "btn btn-block", method: "POST" do
- %i.icon-code-fork
- Fork repository
-
- - if can? current_user, :download_code, @project
- = render 'projects/repositories/download_archive', btn_class: 'btn-block btn-group-justified', split_button: true
+ - unless @project.empty_repo?
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
Compare code
@@ -44,6 +42,13 @@
= link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)), class: 'btn btn-block' do
= readme.name
+ - if @repository.version
+ - version = @repository.version
+ = link_to project_blob_path(@project, tree_join(@repository.root_ref, version.name)), class: 'btn btn-block' do
+ Version:
+ %span.count
+ = @repository.blob_by_oid(version.id).data
+
.prepend-top-10
%p
%span.light Created on
diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml
index a9fd97f8915..45ee61caf68 100644
--- a/app/views/projects/tags/new.html.haml
+++ b/app/views/projects/tags/new.html.haml
@@ -1,3 +1,7 @@
+- if @error
+ .alert.alert-danger
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"} &times;
+ = @error
%h3.page-title
%i.icon-code-fork
New tag
@@ -5,12 +9,17 @@
.form-group
= label_tag :tag_name, 'Name for new tag', class: 'control-label'
.col-sm-10
- = text_field_tag :tag_name, nil, placeholder: 'v3.0.1', required: true, tabindex: 1, class: 'form-control'
+ = text_field_tag :tag_name, params[:tag_name], placeholder: 'v3.0.1', required: true, tabindex: 1, class: 'form-control'
.form-group
= label_tag :ref, 'Create from', class: 'control-label'
.col-sm-10
- = text_field_tag :ref, nil, placeholder: 'master', required: true, tabindex: 2, class: 'form-control'
+ = text_field_tag :ref, params[:ref], placeholder: 'master', required: true, tabindex: 2, class: 'form-control'
.light Branch name or commit SHA
+ .form-group
+ = label_tag :message, 'Message', class: 'control-label'
+ .col-sm-10
+ = text_field_tag :message, nil, placeholder: 'Enter message.', required: false, tabindex: 3, class: 'form-control'
+ .light (Optional) Entering a message will create an annotated tag.
.form-actions
= submit_tag 'Create tag', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', project_tags_path(@project), class: 'btn btn-cancel'
diff --git a/app/views/projects/team_members/_form.html.haml b/app/views/projects/team_members/_form.html.haml
index dd059fb99d3..5998e4c6b42 100644
--- a/app/views/projects/team_members/_form.html.haml
+++ b/app/views/projects/team_members/_form.html.haml
@@ -1,5 +1,5 @@
%h3.page-title
- = "New project member(s)"
+ New project member(s)
= form_for @user_project_relation, as: :team_member, url: project_team_members_path(@project), html: { class: "form-horizontal users-project-form" } do |f|
-if @user_project_relation.errors.any?
diff --git a/app/views/projects/team_members/import.html.haml b/app/views/projects/team_members/import.html.haml
index d3e4a762018..510b579fe2f 100644
--- a/app/views/projects/team_members/import.html.haml
+++ b/app/views/projects/team_members/import.html.haml
@@ -1,5 +1,5 @@
%h3.page-title
- = "Import members from another project"
+ Import members from another project
%p.light
Only project members will be imported. Group members will be skipped.
%hr
diff --git a/app/views/projects/tree/_blob_item.html.haml b/app/views/projects/tree/_blob_item.html.haml
index 0971a426527..393ef0e24bd 100644
--- a/app/views/projects/tree/_blob_item.html.haml
+++ b/app/views/projects/tree/_blob_item.html.haml
@@ -5,4 +5,4 @@
= link_to blob_item.name, project_blob_path(@project, tree_join(@id || @commit.id, blob_item.name))
%td.tree_time_ago.cgray
= render 'spinner'
- %td.hidden-xs.tree_commit{ colspan: 2 }
+ %td.hidden-xs.tree_commit
diff --git a/app/views/projects/tree/_readme.html.haml b/app/views/projects/tree/_readme.html.haml
index c066b7102fd..9d0292059d6 100644
--- a/app/views/projects/tree/_readme.html.haml
+++ b/app/views/projects/tree/_readme.html.haml
@@ -3,11 +3,4 @@
%i.icon-file
= readme.name
.wiki
- - if gitlab_markdown?(readme.name)
- = preserve do
- = markdown(readme.data)
- - elsif plain_text_readme?(readme.name)
- %pre.clean
- = readme.data
- - elsif markup?(readme.name)
- = render_markup(readme.name, readme.data)
+ = render_readme(readme)
diff --git a/app/views/projects/tree/_tree_item.html.haml b/app/views/projects/tree/_tree_item.html.haml
index 760e95e84f0..f8cecf9be1f 100644
--- a/app/views/projects/tree/_tree_item.html.haml
+++ b/app/views/projects/tree/_tree_item.html.haml
@@ -5,4 +5,4 @@
= link_to tree_item.name, project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
%td.tree_time_ago.cgray
= render 'spinner'
- %td.hidden-xs.tree_commit{ colspan: 2 }
+ %td.hidden-xs.tree_commit
diff --git a/app/views/public/projects/index.html.haml b/app/views/public/projects/index.html.haml
deleted file mode 100644
index 624ec0b9b95..00000000000
--- a/app/views/public/projects/index.html.haml
+++ /dev/null
@@ -1,68 +0,0 @@
-%h3.page-title
- Projects (#{@projects.total_count})
-.light
- You can browse public projects in read-only mode until signed in.
-%hr
-.clearfix
- .pull-left
- = form_tag public_projects_path, method: :get, class: 'form-inline form-tiny' do |f|
- .form-group
- = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "projects_search"
- .form-group
- = submit_tag 'Search', class: "btn btn-primary wide"
-
- .pull-right
- .dropdown.inline
- %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
- %span.light sort:
- - if @sort.present?
- = @sort.humanize
- - else
- Name
- %b.caret
- %ul.dropdown-menu
- %li
- = link_to public_projects_path(sort: nil) do
- Name
- = link_to public_projects_path(sort: 'newest') do
- Newest
- = link_to public_projects_path(sort: 'oldest') do
- Oldest
- = link_to public_projects_path(sort: 'recently_updated') do
- Recently updated
- = link_to public_projects_path(sort: 'last_updated') do
- Last updated
-
-%hr
-.public-projects
- %ul.bordered-list.top-list
- - @projects.each do |project|
- %li
- %h4
- = link_to project_path(project) do
- = project.name_with_namespace
- - if project.internal?
- %small.access-icon
- = internal_icon
- Internal
- .pull-right
- %pre.public-clone git clone #{project.http_url_to_repo}
-
- - if project.description.present?
- %p
- = project.description
-
- .repo-info
- - unless project.empty_repo?
- = link_to pluralize(project.repository.round_commit_count, 'commit'), project_commits_path(project, project.default_branch)
- &middot;
- = link_to pluralize(project.repository.branch_names.count, 'branch'), project_branches_path(project)
- &middot;
- = link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project)
- - else
- %i.icon-warning-sign
- Empty repository
- - unless @projects.present?
- .nothing-here-block No public projects
-
- = paginate @projects, theme: "gitlab"
diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml
index 979b18e3856..049aff0bc9b 100644
--- a/app/views/search/_filter.html.haml
+++ b/app/views/search/_filter.html.haml
@@ -9,14 +9,14 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to search_path(group_id: nil, search: params[:search]) do
+ = link_to search_filter_path(group_id: nil) do
Any
- current_user.authorized_groups.sort_by(&:name).each do |group|
%li
- = link_to search_path(group_id: group.id, search: params[:search]) do
+ = link_to search_filter_path(group_id: group.id, project_id: nil) do
= group.name
-.dropdown.inline.prepend-left-10
+.dropdown.inline.prepend-left-10.project-filter
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%i.icon-tags
%span.light Project:
@@ -27,9 +27,9 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to search_path(project_id: nil, search: params[:search]) do
+ = link_to search_filter_path(project_id: nil) do
Any
- current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project|
%li
- = link_to search_path(project_id: project.id, search: params[:search]) do
+ = link_to search_filter_path(project_id: project.id, group_id: nil) do
= project.name_with_namespace
diff --git a/app/views/search/_global_filter.html.haml b/app/views/search/_global_filter.html.haml
new file mode 100644
index 00000000000..442bd84f930
--- /dev/null
+++ b/app/views/search/_global_filter.html.haml
@@ -0,0 +1,16 @@
+%ul.nav.nav-pills.nav-stacked.search-filter
+ %li{class: ("active" if @scope == 'projects')}
+ = link_to search_filter_path(scope: 'projects') do
+ Projects
+ .pull-right
+ = @search_results.projects_count
+ %li{class: ("active" if @scope == 'issues')}
+ = link_to search_filter_path(scope: 'issues') do
+ Issues
+ .pull-right
+ = @search_results.issues_count
+ %li{class: ("active" if @scope == 'merge_requests')}
+ = link_to search_filter_path(scope: 'merge_requests') do
+ Merge requests
+ .pull-right
+ = @search_results.merge_requests_count
diff --git a/app/views/search/_global_results.html.haml b/app/views/search/_global_results.html.haml
deleted file mode 100644
index 7f4f0e5e000..00000000000
--- a/app/views/search/_global_results.html.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-.search_results
- %ul.bordered-list
- = render partial: "search/results/project", collection: @search_results[:projects]
- = render partial: "search/results/merge_request", collection: @search_results[:merge_requests]
- = render partial: "search/results/issue", collection: @search_results[:issues]
diff --git a/app/views/search/_project_filter.html.haml b/app/views/search/_project_filter.html.haml
new file mode 100644
index 00000000000..36947675d18
--- /dev/null
+++ b/app/views/search/_project_filter.html.haml
@@ -0,0 +1,25 @@
+%ul.nav.nav-pills.nav-stacked.search-filter
+ %li{class: ("active" if @scope == 'blobs')}
+ = link_to search_filter_path(scope: 'blobs') do
+ %i.icon-code
+ Code
+ .pull-right
+ = @search_results.blobs_count
+ %li{class: ("active" if @scope == 'issues')}
+ = link_to search_filter_path(scope: 'issues') do
+ %i.icon-exclamation-sign
+ Issues
+ .pull-right
+ = @search_results.issues_count
+ %li{class: ("active" if @scope == 'merge_requests')}
+ = link_to search_filter_path(scope: 'merge_requests') do
+ %i.icon-code-fork
+ Merge requests
+ .pull-right
+ = @search_results.merge_requests_count
+ %li{class: ("active" if @scope == 'notes')}
+ = link_to search_filter_path(scope: 'notes') do
+ %i.icon-comments
+ Comments
+ .pull-right
+ = @search_results.notes_count
diff --git a/app/views/search/_project_results.html.haml b/app/views/search/_project_results.html.haml
deleted file mode 100644
index f285bda5736..00000000000
--- a/app/views/search/_project_results.html.haml
+++ /dev/null
@@ -1,17 +0,0 @@
-%ul.nav.nav-tabs
- %li{class: ("active" if params[:search_code].present?)}
- = link_to search_path(params.merge(search_code: true)) do
- Repository Code
- %li{class: ("active" if params[:search_code].blank?)}
- = link_to search_path(params.merge(search_code: nil)) do
- Issues and Merge requests
-
-.search_results
- - if params[:search_code].present?
- .blob-results
- = render partial: "search/results/blob", collection: @search_results[:blobs]
- = paginate @search_results[:blobs], theme: 'gitlab'
- - else
- %ul.bordered-list
- = render partial: "search/results/merge_request", collection: @search_results[:merge_requests]
- = render partial: "search/results/issue", collection: @search_results[:issues]
diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml
index 2336d0f71d5..f9c0a6d61ff 100644
--- a/app/views/search/_results.html.haml
+++ b/app/views/search/_results.html.haml
@@ -1,5 +1,5 @@
%h4
- #{@search_results[:total_results]} results found
+ #{@search_results.total_count} results found
- if @project
for #{link_to @project.name_with_namespace, @project}
- elsif @group
@@ -7,11 +7,19 @@
%hr
-- if @project
- = render "project_results"
-- else
- = render "global_results"
+.row
+ .col-sm-3
+ - if @project
+ = render "project_filter"
+ - else
+ = render "global_filter"
+ .col-sm-9
+ .search-results
+ - if @search_results.empty?
+ = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
+ - else
+ = render partial: "search/results/#{@scope.singularize}", collection: @objects
+ = paginate @objects, theme: 'gitlab'
:javascript
- $(".search_results .term").highlight("#{escape_javascript(params[:search])}");
-
+ $(".search-results .term").highlight("#{escape_javascript(params[:search])}");
diff --git a/app/views/search/results/_empty.html.haml b/app/views/search/results/_empty.html.haml
new file mode 100644
index 00000000000..3615f6ae52a
--- /dev/null
+++ b/app/views/search/results/_empty.html.haml
@@ -0,0 +1,4 @@
+.search_box
+ .search_glyph
+ %span.icon-search
+ %h4 #{message}
diff --git a/app/views/search/results/_issue.html.haml b/app/views/search/results/_issue.html.haml
index 7a24b76bced..7868f958261 100644
--- a/app/views/search/results/_issue.html.haml
+++ b/app/views/search/results/_issue.html.haml
@@ -1,9 +1,14 @@
-%li
- issue:
- = link_to [issue.project, issue] do
- %span ##{issue.iid}
- %strong.term
- = truncate issue.title, length: 50
- %span.light (#{issue.project.name_with_namespace})
+.search-result-row
+ %h4
+ = link_to [issue.project, issue] do
+ %span.term.str-truncated= issue.title
+ .pull-right ##{issue.iid}
+ - if issue.description.present?
+ .description.term
+ = preserve do
+ = search_md_sanitize(markdown(issue.description))
+ %span.light
+ #{issue.project.name_with_namespace}
- if issue.closed?
- %span.label Closed
+ .pull-right
+ %span.label.label-danger Closed
diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml
index 22d7587f6c1..56b185283bd 100644
--- a/app/views/search/results/_merge_request.html.haml
+++ b/app/views/search/results/_merge_request.html.haml
@@ -1,12 +1,16 @@
-%li
- merge request:
- = link_to [merge_request.target_project, merge_request] do
- %span ##{merge_request.iid}
- %strong.term
- = truncate merge_request.title, length: 50
- - if merge_request.for_fork?
- %span.light (#{merge_request.source_project.name_with_namespace}:#{merge_request.source_branch} &rarr; #{merge_request.target_project.name_with_namespace}:#{merge_request.target_branch})
- - else
- %span.light (#{merge_request.source_branch} &rarr; #{merge_request.target_branch})
- - if merge_request.closed?
- %span.label Closed
+.search-result-row
+ %h4
+ = link_to [merge_request.target_project, merge_request] do
+ %span.term.str-truncated= merge_request.title
+ .pull-right ##{merge_request.iid}
+ - if merge_request.description.present?
+ .description.term
+ = preserve do
+ = search_md_sanitize(markdown(merge_request.description))
+ %span.light
+ #{merge_request.project.name_with_namespace}
+ .pull-right
+ - if merge_request.merged?
+ %span.label.label-primary Merged
+ - elsif merge_request.closed?
+ %span.label.label-danger Closed
diff --git a/app/views/search/results/_note.html.haml b/app/views/search/results/_note.html.haml
new file mode 100644
index 00000000000..6a446538574
--- /dev/null
+++ b/app/views/search/results/_note.html.haml
@@ -0,0 +1,26 @@
+- project = note.project
+.search-result-row
+ %h5.note-search-caption.str-truncated
+ %i.icon-comment
+ = link_to_member(project, note.author, avatar: false)
+ commented on
+
+ - if note.for_commit?
+ = link_to project do
+ = project.name_with_namespace
+ &middot;
+ = link_to project_commit_path(project, note.commit_id, anchor: dom_id(note)) do
+ Commit #{note.commit_id[0..8]}
+ - else
+ = link_to project do
+ = project.name_with_namespace
+ &middot;
+ %span #{note.noteable_type.titleize} ##{note.noteable.iid}
+ &middot;
+ = link_to [project, note.noteable, anchor: dom_id(note)] do
+ = note.noteable.title
+
+ .note-search-result
+ .term
+ = preserve do
+ = search_md_sanitize(markdown(note.note, {no_header_anchors: true}))
diff --git a/app/views/search/results/_project.html.haml b/app/views/search/results/_project.html.haml
index abc86c72bef..301b65eca29 100644
--- a/app/views/search/results/_project.html.haml
+++ b/app/views/search/results/_project.html.haml
@@ -1,7 +1,6 @@
-%li
- project:
- = link_to project do
- %strong.term= project.name_with_namespace
+.search-result-row
+ %h4
+ = link_to project do
+ %span.term= project.name_with_namespace
- if project.description.present?
- &ndash;
%span.light.term= project.description
diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml
index 3b6f10d4d9c..8d1614bfbd4 100644
--- a/app/views/search/show.html.haml
+++ b/app/views/search/show.html.haml
@@ -13,7 +13,7 @@
= render 'filter', f: f
= hidden_field_tag :project_id, params[:project_id]
= hidden_field_tag :group_id, params[:group_id]
- = hidden_field_tag :search_code, params[:search_code]
+ = hidden_field_tag :scope, params[:scope]
.results.prepend-top-10
- if params[:search].present?
diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml
index 8cd426c71e6..1cc6043f56b 100644
--- a/app/views/shared/_clone_panel.html.haml
+++ b/app/views/shared/_clone_panel.html.haml
@@ -4,3 +4,8 @@
%button{class: "btn #{ 'active' if default_clone_protocol == 'ssh' }", :"data-clone" => project.ssh_url_to_repo} SSH
%button{class: "btn #{ 'active' if default_clone_protocol == 'http' }", :"data-clone" => project.http_url_to_repo}= gitlab_config.protocol.upcase
= text_field_tag :project_clone, default_url_to_repo(project), class: "one_click_select form-control", readonly: true
+ - if project.kind_of?(Project)
+ .input-group-addon
+ .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" }
+ = visibility_level_icon(project.visibility_level)
+ = visibility_level_label(project.visibility_level).downcase
diff --git a/app/views/shared/_file_hljs.html.haml b/app/views/shared/_file_hljs.html.haml
index ceee2c7527d..7dd97c2b25c 100644
--- a/app/views/shared/_file_hljs.html.haml
+++ b/app/views/shared/_file_hljs.html.haml
@@ -9,4 +9,4 @@
.highlight
%pre
%code{ class: highlightjs_class(blob.name) }
- = blob.data
+ #{blob.data}
diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml
index 19ecc458e29..9e65ce11ade 100644
--- a/app/views/shared/_filter.html.haml
+++ b/app/views/shared/_filter.html.haml
@@ -6,12 +6,18 @@
%li{class: ("active" if params[:scope] == 'assigned-to-me')}
= link_to filter_path(entity, scope: 'assigned-to-me') do
Assigned to me
+ %span.pull-right
+ = assigned_entities_count(current_user, entity, @group)
%li{class: ("active" if params[:scope] == 'authored')}
= link_to filter_path(entity, scope: 'authored') do
Created by me
+ %span.pull-right
+ = authored_entities_count(current_user, entity, @group)
%li{class: ("active" if params[:scope] == 'all')}
= link_to filter_path(entity, scope: 'all') do
Everyone's
+ %span.pull-right
+ = authorized_entities_count(current_user, entity, @group)
%fieldset.status-filter
%legend State
diff --git a/app/views/shared/_project_filter.html.haml b/app/views/shared/_project_filter.html.haml
index 743b4fba542..5e7d1c2c885 100644
--- a/app/views/shared/_project_filter.html.haml
+++ b/app/views/shared/_project_filter.html.haml
@@ -6,12 +6,18 @@
%li{class: ("active" if params[:scope] == 'all')}
= link_to project_filter_path(scope: 'all') do
Everyone's
+ %span.pull-right
+ = authorized_entities_count(current_user, entity, @project)
%li{class: ("active" if params[:scope] == 'assigned-to-me')}
= link_to project_filter_path(scope: 'assigned-to-me') do
Assigned to me
+ %span.pull-right
+ = assigned_entities_count(current_user, entity, @project)
%li{class: ("active" if params[:scope] == 'created-by-me')}
= link_to project_filter_path(scope: 'created-by-me') do
Created by me
+ %span.pull-right
+ = authored_entities_count(current_user, entity, @project)
%fieldset
%legend State
@@ -28,23 +34,26 @@
- if defined?(labels)
%fieldset
- %legend Labels
+ %legend
+ Labels
+ %small.pull-right
+ = link_to project_labels_path(@project), class: 'light' do
+ %i.icon-edit
%ul.nav.nav-pills.nav-stacked.nav-small.labels-filter
- - issue_label_names.each do |label_name|
- %li{class: label_filter_class(label_name)}
- = link_to labels_filter_path(label_name) do
- %span{class: "label #{label_css_class(label_name)}"}
- %i.icon-tag
- = label_name
- - if selected_label?(label_name)
+ - @project.labels.order_by_name.each do |label|
+ %li{class: label_filter_class(label.name)}
+ = link_to labels_filter_path(label.name) do
+ = render_colored_label(label)
+ - if selected_label?(label.name)
.pull-right
%i.icon-remove
- - if issue_label_names.empty?
- .light-well
- Add first label to your issues
- %br
- or #{link_to 'generate', generate_project_labels_path(@project, redirect: redirect), method: :post} default set of labels
+ - if @project.labels.empty?
+ .light-well
+ Create first label at
+ = link_to 'labels page', project_labels_path(@project)
+ %br
+ or #{link_to 'generate', generate_project_labels_path(@project, redirect: redirect), method: :post} default set of labels
%fieldset
- if %w(state scope milestone_id assignee_id label_name).select { |k| params[k].present? }.any?
diff --git a/app/views/users/_groups.html.haml b/app/views/users/_groups.html.haml
index 412df943fcc..09b2985d498 100644
--- a/app/views/users/_groups.html.haml
+++ b/app/views/users/_groups.html.haml
@@ -1,3 +1,3 @@
- groups.each do |group|
= link_to group, class: 'profile-groups-avatars', :title => group.name do
- = image_tag group_icon(group.path) \ No newline at end of file
+ = image_tag group_icon(group.path)
diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb
index 5e81810cbdb..2947c8e3ecd 100644
--- a/app/workers/emails_on_push_worker.rb
+++ b/app/workers/emails_on_push_worker.rb
@@ -13,7 +13,7 @@ class EmailsOnPushWorker
return true
end
- compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha, MergeRequestDiff::COMMITS_SAFE_SIZE)
+ compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha)
# Do not send emails if git compare failed
return false unless compare && compare.commits.present?
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index 3b0cf77d42e..1406cba2db3 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -4,15 +4,14 @@ class PostReceive
sidekiq_options queue: :post_receive
- def perform(repo_path, oldrev, newrev, ref, identifier)
-
+ def perform(repo_path, identifier, changes)
if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
else
log("Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"")
end
- repo_path.gsub!(/.git$/, "")
+ repo_path.gsub!(/\.git$/, "")
repo_path.gsub!(/^\//, "")
project = Project.find_with_namespace(repo_path)
@@ -22,17 +21,23 @@ class PostReceive
return false
end
- user = identify(identifier, project, newrev)
+ changes = changes.lines if changes.kind_of?(String)
- unless user
- log("Triggered hook for non-existing user \"#{identifier} \"")
- return false
- end
+ changes.each do |change|
+ oldrev, newrev, ref = change.strip.split(' ')
- if tag?(ref)
- GitTagPushService.new.execute(project, user, oldrev, newrev, ref)
- else
- GitPushService.new.execute(project, user, oldrev, newrev, ref)
+ @user ||= identify(identifier, project, newrev)
+
+ unless @user
+ log("Triggered hook for non-existing user \"#{identifier} \"")
+ return false
+ end
+
+ if tag?(ref)
+ GitTagPushService.new.execute(project, @user, oldrev, newrev, ref)
+ else
+ GitPushService.new.execute(project, @user, oldrev, newrev, ref)
+ end
end
end
diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb
index e66df8c4db1..43ef54631a9 100644
--- a/app/workers/repository_import_worker.rb
+++ b/app/workers/repository_import_worker.rb
@@ -14,8 +14,9 @@ class RepositoryImportWorker
project.import_finish
project.save
project.satellite.create unless project.satellite.exists?
+ project.update_repository_size
else
project.import_fail
end
end
-end
+end \ No newline at end of file
diff --git a/bin/background_jobs b/bin/background_jobs
index c7ba4398cfb..b58cdce4f9f 100755
--- a/bin/background_jobs
+++ b/bin/background_jobs
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
cd $(dirname $0)/..
app_root=$(pwd)
@@ -6,22 +6,22 @@ sidekiq_pidfile="$app_root/tmp/pids/sidekiq.pid"
sidekiq_logfile="$app_root/log/sidekiq.log"
gitlab_user=$(ls -l config.ru | awk '{print $3}')
-function warn
+warn()
{
echo "$@" 1>&2
}
-function stop
+stop()
{
bundle exec sidekiqctl stop $sidekiq_pidfile >> $sidekiq_logfile 2>&1
}
-function killall
+killall()
{
pkill -u $gitlab_user -f 'sidekiq [0-9]'
}
-function restart
+restart()
{
if [ -f $sidekiq_pidfile ]; then
stop
@@ -30,20 +30,20 @@ function restart
start_sidekiq -d -L $sidekiq_logfile
}
-function start_no_deamonize
+start_no_deamonize()
{
start_sidekiq
}
-function start_sidekiq
+start_sidekiq()
{
- bundle exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1
+ bundle exec sidekiq -q post_receive -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1
}
-function load_ok
+load_ok()
{
sidekiq_pid=$(cat $sidekiq_pidfile)
- if [[ -z $sidekiq_pid ]] ; then
+ if [ -z $sidekiq_pid ] ; then
warn "Could not find a PID in $sidekiq_pidfile"
exit 0
fi
diff --git a/bin/web b/bin/web
index 1ad3b5d24b9..f6bacd6d784 100755
--- a/bin/web
+++ b/bin/web
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
cd $(dirname $0)/..
app_root=$(pwd)
@@ -6,7 +6,7 @@ app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
unicorn_config="$app_root/config/unicorn.rb"
-function get_unicorn_pid
+get_unicorn_pid()
{
local pid=$(cat $unicorn_pidfile)
if [ -z $pid ] ; then
@@ -16,18 +16,18 @@ function get_unicorn_pid
unicorn_pid=$pid
}
-function start
+start()
{
bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV
}
-function stop
+stop()
{
get_unicorn_pid
kill -QUIT $unicorn_pid
}
-function reload
+reload()
{
get_unicorn_pid
kill -USR2 $unicorn_pid
diff --git a/config/application.rb b/config/application.rb
index 0a77f58f6d1..68dce05fc59 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -41,12 +41,6 @@ module Gitlab
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
- # Enforce whitelist mode for mass assignment.
- # This will create an empty whitelist of attributes available for mass-assignment for all models
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
- # parameters by using an attr_accessible or attr_protected declaration.
- config.active_record.whitelist_attributes = true
-
# Enable the asset pipeline
config.assets.enabled = true
config.assets.paths << Emoji.images_path
@@ -79,5 +73,24 @@ module Gitlab
resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete]
end
end
+
+ # Use Redis caching across all environments
+ redis_config_file = Rails.root.join('config', 'resque.yml')
+
+ redis_url_string = if File.exists?(redis_config_file)
+ YAML.load_file(redis_config_file)[Rails.env]
+ else
+ "redis://localhost:6379"
+ end
+
+ # Redis::Store does not handle Unix sockets well, so let's do it for them
+ redis_config_hash = Redis::Store::Factory.extract_host_options_from_uri(redis_url_string)
+ redis_uri = URI.parse(redis_url_string)
+ if redis_uri.scheme == 'unix'
+ redis_config_hash[:path] = redis_uri.path
+ end
+
+ redis_config_hash[:namespace] = 'cache:gitlab'
+ config.cache_store = :redis_store, redis_config_hash
end
end
diff --git a/config/database.yml.postgresql b/config/database.yml.postgresql
index 66960551cfd..7067e0fe402 100644
--- a/config/database.yml.postgresql
+++ b/config/database.yml.postgresql
@@ -10,7 +10,6 @@ production:
# password:
# host: localhost
# port: 5432
- # socket: /tmp/postgresql.sock
#
# Development specific
@@ -22,7 +21,6 @@ development:
pool: 5
username: postgres
password:
- # socket: /tmp/postgresql.sock
#
# Staging specific
@@ -34,7 +32,6 @@ staging:
pool: 5
username: postgres
password:
- # socket: /tmp/postgresql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
@@ -46,4 +43,3 @@ test: &test
pool: 5
username: postgres
password:
- # socket: /tmp/postgresql.sock
diff --git a/config/environments/development.rb b/config/environments/development.rb
index e4c7649fda0..03af7f07864 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -19,14 +19,11 @@ Gitlab::Application.configure do
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
- # Raise exception on mass assignment protection for Active Record models
- config.active_record.mass_assignment_sanitizer = :strict
-
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
- config.assets.debug = true
+ # config.assets.debug = true
# For having correct urls in mails
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 2450d5719eb..78bf543402b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -45,16 +45,6 @@ Gitlab::Application.configure do
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
- # Use a different cache store in production
- config_file = Rails.root.join('config', 'resque.yml')
-
- resque_url = if File.exists?(config_file)
- YAML.load_file(config_file)[Rails.env]
- else
- "redis://localhost:6379"
- end
- config.cache_store = :redis_store, resque_url, {namespace: 'cache:gitlab'}
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 3860dc5c74c..25b082b98da 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -26,9 +26,6 @@ Gitlab::Application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
- # Raise exception on mass assignment protection for Active Record models
- # config.active_record.mass_assignment_sanitizer = :strict
-
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
diff --git a/config/gitlab.teatro.yml b/config/gitlab.teatro.yml
new file mode 100644
index 00000000000..f0656400beb
--- /dev/null
+++ b/config/gitlab.teatro.yml
@@ -0,0 +1,86 @@
+
+production: &base
+ gitlab:
+ host: localhost
+ port: 80
+ https: false
+
+ user: root
+
+ email_from: example@example.com
+
+ support_email: support@example.com
+
+ default_projects_features:
+ issues: true
+ merge_requests: true
+ wiki: true
+ wall: false
+ snippets: false
+ visibility_level: "private" # can be "private" | "internal" | "public"
+
+ issues_tracker:
+
+ gravatar:
+ enabled: true # Use user avatar image from Gravatar.com (default: true)
+
+ ldap:
+ enabled: false
+ host: '_your_ldap_server'
+ port: 636
+ uid: 'sAMAccountName'
+ method: 'ssl' # "tls" or "ssl" or "plain"
+ bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
+ password: '_the_password_of_the_bind_user'
+ allow_username_or_email_login: true
+
+ base: ''
+
+ user_filter: ''
+
+ omniauth:
+ enabled: false
+
+ satellites:
+ # Relative paths are relative to Rails.root (default: tmp/repo_satellites/)
+ path: /apps/gitlab-satellites/
+
+ backup:
+ path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
+
+ gitlab_shell:
+ path: /apps/gitlab-shell/
+
+ # REPOS_PATH MUST NOT BE A SYMLINK!!!
+ repos_path: /apps/repositories/
+ hooks_path: /apps/gitlab-shell/hooks/
+
+ upload_pack: true
+ receive_pack: true
+
+ git:
+ bin_path: /usr/bin/git
+ max_size: 5242880 # 5.megabytes
+ timeout: 10
+
+ extra:
+
+development:
+ <<: *base
+
+test:
+ <<: *base
+ gravatar:
+ enabled: true
+ gitlab:
+ host: localhost
+ port: 80
+ issues_tracker:
+ redmine:
+ title: "Redmine"
+ project_url: "http://redmine/projects/:issues_tracker_id"
+ issues_url: "http://redmine/:project_id/:issues_tracker_id/:id"
+ new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new"
+
+staging:
+ <<: *base
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 806984e8d40..8e85634d054 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -3,9 +3,11 @@
# # # # # # # # # # # # # # # # # #
#
# How to use:
-# 1. copy file as gitlab.yml
-# 2. Replace gitlab -> host with your domain
-# 3. Replace gitlab -> email_from
+# 1. Copy file as gitlab.yml
+# 2. Update gitlab -> host with your fully qualified domain name
+# 3. Update gitlab -> email_from
+# 4. If you installed Git from source, change git -> bin_path to /usr/local/bin/git
+# 5. Review this configuration file for other settings you may want to adjust
production: &base
#
@@ -16,8 +18,8 @@ production: &base
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: localhost
- port: 80
- https: false
+ port: 80 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
+ https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
@@ -49,23 +51,25 @@ production: &base
## COLOR = 5
# default_theme: 2 # default: 2
-
- ## Users management
- # default: false - Account passwords are not sent via the email if signup is enabled.
+ ## Users can create accounts
+ # This also allows normal users to sign up for accounts themselves
+ # default: false - By default GitLab administrators must create all new accounts
# signup_enabled: true
- #
- # default: true - If set to false, standard login form won't be shown on the sign-in page
- # signin_enabled: false
+ ## Standard login settings
+ # The standard login can be disabled to force login via LDAP
+ # default: true - If set to false the standard login form won't be shown on the sign-in page
+ # signin_enabled: false
# Restrict setting visibility levels for non-admin users.
# The default is to allow all levels.
- #restricted_visibility_levels: [ "public" ]
+ # restricted_visibility_levels: [ "public" ]
## Automatic issue closing
# If a commit message matches this regular expression, all issues referenced from the matched text will be closed.
# This happens when the commit is pushed or merged into the default branch of a project.
# When not specified the default issue_closing_pattern as specified below will be used.
+ # Tip: you can test your closing pattern at http://rubular.com
# issue_closing_pattern: '([Cc]lose[sd]|[Ff]ixe[sd]) #(\d+)'
## Default project features settings
@@ -141,7 +145,7 @@ production: &base
#
# If you are using "uid: 'userPrincipalName'" on ActiveDirectory you need to
# disable this setting, because the userPrincipalName contains an '@'.
- allow_username_or_email_login: true
+ allow_username_or_email_login: false
# Base where we can search for users
#
@@ -196,6 +200,7 @@ production: &base
satellites:
# Relative paths are relative to Rails.root (default: tmp/repo_satellites/)
path: /home/git/gitlab-satellites/
+ timeout: 30
## Backup settings
backup:
@@ -225,7 +230,7 @@ production: &base
# The next value is the maximum memory size grit can use
# Given in number of bytes per git object (e.g. a commit)
# This value can be increased if you have very large commits
- max_size: 5242880 # 5.megabytes
+ max_size: 20971520 # 20.megabytes
# Git timeout to read a commit, in seconds
timeout: 10
@@ -256,6 +261,17 @@ test:
gitlab:
host: localhost
port: 80
+
+ # When you run tests we clone and setup gitlab-shell
+ # In order to setup it correctly you need to specify
+ # your system username you use to run GitLab
+ # user: YOUR_USERNAME
+ satellites:
+ path: tmp/tests/gitlab-satellites/
+ gitlab_shell:
+ path: tmp/tests/gitlab-shell/
+ repos_path: tmp/tests/repositories/
+ hooks_path: tmp/tests/gitlab-shell/hooks/
issues_tracker:
redmine:
title: "Redmine"
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index f55e69c08f6..136622c65a2 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -133,12 +133,13 @@ Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "t
# Git
#
Settings['git'] ||= Settingslogic.new({})
-Settings.git['max_size'] ||= 5242880 # 5.megabytes
+Settings.git['max_size'] ||= 20971520 # 20.megabytes
Settings.git['bin_path'] ||= '/usr/bin/git'
Settings.git['timeout'] ||= 10
Settings['satellites'] ||= Settingslogic.new({})
Settings.satellites['path'] = File.expand_path(Settings.satellites['path'] || "tmp/repo_satellites/", Rails.root)
+Settings.satellites['timeout'] ||= 30
#
# Extra customization
@@ -150,6 +151,6 @@ Settings['extra'] ||= Settingslogic.new({})
#
if Rails.env.test?
Settings.gitlab['default_projects_limit'] = 42
- Settings.gitlab['default_can_create_group'] = false
+ Settings.gitlab['default_can_create_group'] = true
Settings.gitlab['default_can_create_team'] = false
end
diff --git a/config/initializers/4_sidekiq.rb b/config/initializers/4_sidekiq.rb
index c90d376273d..228b14cb526 100644
--- a/config/initializers/4_sidekiq.rb
+++ b/config/initializers/4_sidekiq.rb
@@ -12,6 +12,10 @@ Sidekiq.configure_server do |config|
url: resque_url,
namespace: 'resque:gitlab'
}
+
+ config.server_middleware do |chain|
+ chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger
+ end
end
Sidekiq.configure_client do |config|
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 50669ece7a8..34f4f386988 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -155,10 +155,6 @@ Devise.setup do |config|
# REST_AUTH_SITE_KEY to pepper)
# config.encryptor = :sha512
- # ==> Configuration for :token_authenticatable
- # Defines name of the authentication token params key
- config.token_authentication_key = :private_token
-
# Authentication through token does not store user in session and needs
# to be supplied on each request. Useful if you are using the token as API token.
config.skip_session_storage << :token_auth
diff --git a/config/initializers/rack_attack.rb.example b/config/initializers/rack_attack.rb.example
index bc3234bf0b6..332865d2881 100644
--- a/config/initializers/rack_attack.rb.example
+++ b/config/initializers/rack_attack.rb.example
@@ -8,11 +8,19 @@ paths_to_be_protected = [
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json",
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session",
"#{Rails.application.config.relative_url_root}/users",
- "#{Rails.application.config.relative_url_root}/users/confirmation"
+ "#{Rails.application.config.relative_url_root}/users/confirmation",
+ "#{Rails.application.config.relative_url_root}/unsubscribes/"
+
]
+# Create one big regular expression that matches strings starting with any of
+# the paths_to_be_protected.
+paths_regex = Regexp.union(paths_to_be_protected.map { |path| /\A#{Regexp.escape(path)}/ })
+
unless Rails.env.test?
Rack::Attack.throttle('protected paths', limit: 10, period: 60.seconds) do |req|
- req.ip if paths_to_be_protected.include?(req.path) && req.post?
+ if req.post? && req.path =~ paths_regex
+ req.ip
+ end
end
end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 5fe5270236b..b2d59f1c4b7 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -2,9 +2,10 @@
Gitlab::Application.config.session_store(
:redis_store, # Using the cookie_store would enable session replay attacks.
- servers: Gitlab::Application.config.cache_store[1], # re-use the Redis config from the Rails cache store
+ servers: Gitlab::Application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store
key: '_gitlab_session',
secure: Gitlab.config.gitlab.https,
httponly: true,
+ expire_after: 1.week,
path: (Rails.application.config.relative_url_root.nil?) ? '/' : Rails.application.config.relative_url_root
)
diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml
index 275273a0b12..1cbcde5b3da 100644
--- a/config/locales/devise.en.yml
+++ b/config/locales/devise.en.yml
@@ -25,6 +25,9 @@ en:
sessions:
signed_in: 'Signed in successfully.'
signed_out: 'Signed out successfully.'
+ users_sessions:
+ user:
+ signed_in: 'Signed in successfully.'
passwords:
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
updated: 'Your password was changed successfully. You are now signed in.'
diff --git a/config/routes.rb b/config/routes.rb
index 5b854ed20b9..ce66ea99951 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -47,13 +47,24 @@ Gitlab::Application.routes.draw do
get "/s/:username" => "snippets#user_index", as: :user_snippets, constraints: { username: /.*/ }
#
- # Public namespace
+ # Explroe area
#
- namespace :public do
- resources :projects, only: [:index]
- root to: "projects#index"
+ namespace :explore do
+ resources :projects, only: [:index] do
+ collection do
+ get :trending
+ get :starred
+ end
+ end
+
+ resources :groups, only: [:index]
+ root to: "projects#trending"
end
+ # Compatibility with old routing
+ get 'public' => "explore/projects#index"
+ get 'public/projects' => "explore/projects#index"
+
#
# Attachments serving
#
@@ -151,15 +162,20 @@ Gitlab::Application.routes.draw do
end
resources :users_groups, only: [:create, :update, :destroy]
+
scope module: :groups do
resource :avatar, only: [:destroy]
+ resources :milestones
end
end
resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
- devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :users_sessions }
+ devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions }
+ devise_scope :user do
+ get "/users/auth/:provider/omniauth_error" => "omniauth_callbacks#omniauth_error", as: :omniauth_error
+ end
#
# Project Area
#
@@ -170,13 +186,16 @@ Gitlab::Application.routes.draw do
post :archive
post :unarchive
post :upload_image
+ post :toggle_star
get :autocomplete_sources
get :import
put :retry_import
end
scope module: :projects do
- resources :blob, only: [:show, :destroy], constraints: {id: /.+/}
+ resources :blob, only: [:show, :destroy], constraints: { id: /.+/ } do
+ get :diff, on: :member
+ end
resources :raw, only: [:show], constraints: {id: /.+/}
resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ }
resources :edit_tree, only: [:show, :update], constraints: { id: /.+/ }, path: 'edit' do
@@ -280,7 +299,7 @@ Gitlab::Application.routes.draw do
end
end
- resources :labels, only: [:index] do
+ resources :labels, constraints: {id: /\d+/} do
collection do
post :generate
end
diff --git a/db/fixtures/development/01_admin.rb b/db/fixtures/development/01_admin.rb
index 42d18435340..1927a39f388 100644
--- a/db/fixtures/development/01_admin.rb
+++ b/db/fixtures/development/01_admin.rb
@@ -1,14 +1,11 @@
-User.seed(:id, [
- {
- id: 1,
- name: "Administrator",
- email: "admin@local.host",
- username: 'root',
- password: "5iveL!fe",
- password_confirmation: "5iveL!fe",
- admin: true,
- projects_limit: 100,
- theme_id: Gitlab::Theme::MARS,
- confirmed_at: DateTime.now
- }
-])
+User.seed do |s|
+ s.id = 1
+ s.name = "Administrator"
+ s.email = "admin@example.com"
+ s.username = 'root'
+ s.password = "5iveL!fe"
+ s.password_confirmation = "5iveL!fe"
+ s.admin = true
+ s.projects_limit = 100
+ s.confirmed_at = DateTime.now
+end
diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb
index 164bb637809..b93229a0609 100644
--- a/db/fixtures/development/04_project.rb
+++ b/db/fixtures/development/04_project.rb
@@ -1,56 +1,52 @@
-Gitlab::Seeder.quiet do
- project_urls = [
- 'https://github.com/documentcloud/underscore.git',
- 'https://github.com/diaspora/diaspora.git',
- 'https://github.com/diaspora/diaspora-project-site.git',
- 'https://github.com/diaspora/diaspora-client.git',
- 'https://github.com/brightbox/brightbox-cli.git',
- 'https://github.com/brightbox/puppet.git',
- 'https://github.com/gitlabhq/gitlabhq.git',
- 'https://github.com/gitlabhq/gitlab-ci.git',
- 'https://github.com/gitlabhq/gitlab-recipes.git',
- 'https://github.com/gitlabhq/gitlab-shell.git',
- 'https://github.com/gitlabhq/grack.git',
- 'https://github.com/gitlabhq/testme.git',
- 'https://github.com/twitter/flight.git',
- 'https://github.com/twitter/typeahead.js.git',
- 'https://github.com/h5bp/html5-boilerplate.git',
- 'https://github.com/h5bp/mobile-boilerplate.git',
- ]
-
- project_urls.each_with_index do |url, i|
- group_path, project_path = url.split('/')[-2..-1]
-
- group = Group.find_by(path: group_path)
-
- unless group
- group = Group.new(
- name: group_path.titleize,
- path: group_path
- )
- group.description = Faker::Lorem.sentence
- group.save
-
- group.add_owner(User.first)
- end
-
- project_path.gsub!(".git", "")
-
- params = {
- import_url: url,
- namespace_id: group.id,
- name: project_path.titleize,
- description: Faker::Lorem.sentence,
- visibility_level: Gitlab::VisibilityLevel.values.sample
- }
-
- project = Projects::CreateService.new(User.first, params).execute
-
- if project.valid?
- print '.'
- else
- puts project.errors.full_messages
- print 'F'
+require 'sidekiq/testing'
+
+Sidekiq::Testing.inline! do
+ Gitlab::Seeder.quiet do
+ project_urls = [
+ 'https://github.com/documentcloud/underscore.git',
+ 'https://github.com/gitlabhq/gitlabhq.git',
+ 'https://github.com/gitlabhq/gitlab-ci.git',
+ 'https://github.com/gitlabhq/gitlab-shell.git',
+ 'https://github.com/gitlabhq/testme.git',
+ 'https://github.com/twitter/flight.git',
+ 'https://github.com/twitter/typeahead.js.git',
+ 'https://github.com/h5bp/html5-boilerplate.git',
+ ]
+
+ project_urls.each_with_index do |url, i|
+ group_path, project_path = url.split('/')[-2..-1]
+
+ group = Group.find_by(path: group_path)
+
+ unless group
+ group = Group.new(
+ name: group_path.titleize,
+ path: group_path
+ )
+ group.description = Faker::Lorem.sentence
+ group.save
+
+ group.add_owner(User.first)
+ end
+
+ project_path.gsub!(".git", "")
+
+ params = {
+ import_url: url,
+ namespace_id: group.id,
+ name: project_path.titleize,
+ description: Faker::Lorem.sentence,
+ visibility_level: Gitlab::VisibilityLevel.values.sample
+ }
+
+ project = Projects::CreateService.new(User.first, params).execute
+
+ if project.valid?
+ print '.'
+ else
+ puts project.errors.full_messages
+ print 'F'
+ end
end
end
end
diff --git a/db/fixtures/development/05_users.rb b/db/fixtures/development/05_users.rb
index d736408dbf5..c263dd232af 100644
--- a/db/fixtures/development/05_users.rb
+++ b/db/fixtures/development/05_users.rb
@@ -1,5 +1,5 @@
Gitlab::Seeder.quiet do
- (2..10).each do |i|
+ (2..20).each do |i|
begin
User.seed(:id, [{
id: i,
@@ -13,4 +13,20 @@ Gitlab::Seeder.quiet do
print 'F'
end
end
+
+ (1..5).each do |i|
+ begin
+ User.seed(:id, [
+ id: i + 10,
+ username: "user#{i}",
+ name: "User #{i}",
+ email: "user#{i}@example.com",
+ confirmed_at: DateTime.now,
+ password: '12345678'
+ ])
+ print '.'
+ rescue ActiveRecord::RecordNotSaved
+ print 'F'
+ end
+ end
end
diff --git a/db/fixtures/development/07_milestones.rb b/db/fixtures/development/07_milestones.rb
index 6fe7e246770..2296821e528 100644
--- a/db/fixtures/development/07_milestones.rb
+++ b/db/fixtures/development/07_milestones.rb
@@ -1,18 +1,16 @@
-Milestone.seed(:id, [
- { id: 1, project_id: 1, title: 'v' + Faker::Address.zip_code },
- { id: 2, project_id: 1, title: 'v' + Faker::Address.zip_code },
- { id: 3, project_id: 1, title: 'v' + Faker::Address.zip_code },
- { id: 4, project_id: 2, title: 'v' + Faker::Address.zip_code },
- { id: 5, project_id: 2, title: 'v' + Faker::Address.zip_code },
+Gitlab::Seeder.quiet do
+ Project.all.each do |project|
+ (1..5).each do |i|
+ milestone_params = {
+ title: "v#{i}.0",
+ description: Faker::Lorem.sentence,
+ state: ['opened', 'closed'].sample,
+ }
- { id: 6, project_id: 2, title: 'v' + Faker::Address.zip_code },
- { id: 7, project_id: 2, title: 'v' + Faker::Address.zip_code },
- { id: 8, project_id: 3, title: 'v' + Faker::Address.zip_code },
- { id: 9, project_id: 3, title: 'v' + Faker::Address.zip_code },
- { id: 11, project_id: 3, title: 'v' + Faker::Address.zip_code },
-])
+ milestone = Milestones::CreateService.new(
+ project, project.team.users.sample, milestone_params).execute
-Milestone.all.map do |ml|
- ml.set_iid
- ml.save
+ print '.'
+ end
+ end
end
diff --git a/db/fixtures/development/08_wall.rb b/db/fixtures/development/08_wall.rb
deleted file mode 100644
index c4e304cc217..00000000000
--- a/db/fixtures/development/08_wall.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-Gitlab::Seeder.quiet do
- (1..300).each do |i|
- # Random Project
- project = Project.all.sample
-
- # Random user
- user = project.users.sample
-
- next unless user
-
- user_id = user.id
-
- Note.seed(:id, [{
- id: i,
- project_id: project.id,
- author_id: user_id,
- note: Faker::Lorem.sentence(6)
- }])
- print('.')
- end
-end
diff --git a/db/fixtures/development/09_issues.rb b/db/fixtures/development/09_issues.rb
index 635878622d0..e8b01b46d22 100644
--- a/db/fixtures/development/09_issues.rb
+++ b/db/fixtures/development/09_issues.rb
@@ -1,32 +1,16 @@
Gitlab::Seeder.quiet do
- (1..300).each do |i|
- # Random Project
- project = Project.all.sample
-
- # Random user
- user = project.team.users.sample
-
- next unless user
-
- user_id = user.id
-
- Gitlab::Seeder.by_user(user) do
- Issue.seed(:id, [{
- id: i,
- project_id: project.id,
- author_id: user_id,
- assignee_id: user_id,
+ Project.all.each do |project|
+ (1..10).each do |i|
+ issue_params = {
+ title: Faker::Lorem.sentence(6),
+ description: Faker::Lorem.sentence,
state: ['opened', 'closed'].sample,
milestone: project.milestones.sample,
- title: Faker::Lorem.sentence(6),
- description: Faker::Lorem.sentence
- }])
- end
- print('.')
- end
+ assignee: project.team.users.sample
+ }
- Issue.all.map do |issue|
- issue.set_iid
- issue.save
+ Issues::CreateService.new(project, project.team.users.sample, issue_params).execute
+ print '.'
+ end
end
end
diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb
index 62fd0d84ea3..03f8de12985 100644
--- a/db/fixtures/development/10_merge_requests.rb
+++ b/db/fixtures/development/10_merge_requests.rb
@@ -7,27 +7,17 @@ Gitlab::Seeder.quiet do
source_branch = branches.pop
target_branch = branches.pop
- # Random user
- user = project.team.users.sample
- next unless user
-
params = {
source_branch: source_branch,
target_branch: target_branch,
title: Faker::Lorem.sentence(6),
- description: Faker::Lorem.sentences(3).join(" ")
+ description: Faker::Lorem.sentences(3).join(" "),
+ milestone: project.milestones.sample,
+ assignee: project.team.users.sample
}
- merge_request = MergeRequests::CreateService.new(project, user, params).execute
-
- if merge_request.valid?
- merge_request.assignee = user
- merge_request.milestone = project.milestones.sample
- merge_request.save
- print '.'
- else
- print 'F'
- end
+ MergeRequests::CreateService.new(project, project.team.users.sample, params).execute
+ print '.'
end
end
end
diff --git a/db/fixtures/development/11_keys.rb b/db/fixtures/development/11_keys.rb
index 61329f197c3..8b4bee384e1 100644
--- a/db/fixtures/development/11_keys.rb
+++ b/db/fixtures/development/11_keys.rb
@@ -1,13 +1,12 @@
Gitlab::Seeder.quiet do
- User.first(30).each_with_index do |user, i|
- Key.seed(:id, [
- {
- id: i + 1,
- title: "Sample key #{i}",
- key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt#{i + 100}6k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
- user_id: user.id,
- }
- ])
- puts "SSH KEY ##{i} added.".green
+ User.first(10).each do |user|
+ key = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt#{user.id + 100}6k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
+
+ user.keys.create(
+ title: "Sample key #{user.id}",
+ key: key
+ )
+
+ print '.'
end
end
diff --git a/db/fixtures/development/13_comments.rb b/db/fixtures/development/13_comments.rb
index 626aba200d1..d37be53c7b9 100644
--- a/db/fixtures/development/13_comments.rb
+++ b/db/fixtures/development/13_comments.rb
@@ -1,19 +1,31 @@
Gitlab::Seeder.quiet do
- Issue.all.limit(10).each_with_index do |issue, i|
- 5.times do
- user = issue.project.team.users.sample
+ Issue.all.each do |issue|
+ project = issue.project
- Gitlab::Seeder.by_user(user) do
- Note.seed(:id, [{
- project_id: issue.project.id,
- author_id: user.id,
- note: Faker::Lorem.sentence,
- noteable_id: issue.id,
- noteable_type: 'Issue'
- }])
+ project.team.users.each do |user|
+ note_params = {
+ noteable_type: 'Issue',
+ noteable_id: issue.id,
+ note: Faker::Lorem.sentence,
+ }
- print '.'
- end
+ Notes::CreateService.new(project, user, note_params).execute
+ print '.'
+ end
+ end
+
+ MergeRequest.all.each do |mr|
+ project = mr.project
+
+ project.team.users.each do |user|
+ note_params = {
+ noteable_type: 'MergeRequest',
+ noteable_id: mr.id,
+ note: Faker::Lorem.sentence,
+ }
+
+ Notes::CreateService.new(project, user, note_params).execute
+ print '.'
end
end
end
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb
index a919fad7040..c00ba3c10ba 100644
--- a/db/fixtures/production/001_admin.rb
+++ b/db/fixtures/production/001_admin.rb
@@ -1,5 +1,5 @@
admin = User.create(
- email: "admin@local.host",
+ email: "admin@example.com",
name: "Administrator",
username: 'root',
password: "5iveL!fe",
@@ -18,7 +18,7 @@ if admin.valid?
puts %q[
Administrator account created:
-login.........admin@local.host
+login.........root
password......5iveL!fe
]
end
diff --git a/db/fixtures/test/001_repo.rb b/db/fixtures/test/001_repo.rb
index 281e3476df1..e69de29bb2d 100644
--- a/db/fixtures/test/001_repo.rb
+++ b/db/fixtures/test/001_repo.rb
@@ -1,36 +0,0 @@
-require 'fileutils'
-
-print "Unpacking seed repository..."
-
-SEED_REPO = 'seed_project.tar.gz'
-REPO_PATH = Rails.root.join('tmp', 'repositories')
-
-# Make whatever directories we need to make
-FileUtils.mkdir_p(REPO_PATH)
-
-# Copy the archive to the repo path
-FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH)
-
-# chdir to the repo path
-FileUtils.cd(REPO_PATH) do
- # Extract the archive
- `tar -xf #{SEED_REPO}`
-
- # Remove the copy
- FileUtils.rm(SEED_REPO)
-end
-puts ' done.'
-print "Creating seed satellite..."
-
-SATELLITE_PATH = Rails.root.join('tmp', 'satellite')
-# Make directory
-FileUtils.mkdir_p(SATELLITE_PATH)
-# Clear any potential directory
-FileUtils.rm_rf("#{SATELLITE_PATH}/gitlabhq")
-# Chdir, clone from the seed
-FileUtils.cd(SATELLITE_PATH) do
- # Clone the satellite
-
- `git clone --quiet #{REPO_PATH}/gitlabhq #{SATELLITE_PATH}/gitlabhq`
-end
-puts ' done.'
diff --git a/db/migrate/20140407135544_fix_namespaces.rb b/db/migrate/20140407135544_fix_namespaces.rb
index 8c4f2b0f6b1..59665d538f0 100644
--- a/db/migrate/20140407135544_fix_namespaces.rb
+++ b/db/migrate/20140407135544_fix_namespaces.rb
@@ -7,4 +7,4 @@ class FixNamespaces < ActiveRecord::Migration
def down
end
-end \ No newline at end of file
+end
diff --git a/db/migrate/20140625115202_create_users_star_projects.rb b/db/migrate/20140625115202_create_users_star_projects.rb
new file mode 100644
index 00000000000..412f0f6f34b
--- /dev/null
+++ b/db/migrate/20140625115202_create_users_star_projects.rb
@@ -0,0 +1,15 @@
+class CreateUsersStarProjects < ActiveRecord::Migration
+ def change
+ create_table :users_star_projects do |t|
+ t.integer :project_id, null: false
+ t.integer :user_id, null: false
+ t.timestamps
+ end
+ add_index :users_star_projects, :user_id
+ add_index :users_star_projects, :project_id
+ add_index :users_star_projects, [:user_id, :project_id], unique: true
+
+ add_column :projects, :star_count, :integer, default: 0, null: false
+ add_index :projects, :star_count, using: :btree
+ end
+end
diff --git a/db/migrate/20140729134820_create_labels.rb b/db/migrate/20140729134820_create_labels.rb
new file mode 100644
index 00000000000..3a4b6a152dc
--- /dev/null
+++ b/db/migrate/20140729134820_create_labels.rb
@@ -0,0 +1,11 @@
+class CreateLabels < ActiveRecord::Migration
+ def change
+ create_table :labels do |t|
+ t.string :title
+ t.string :color
+ t.integer :project_id
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140729140420_create_label_links.rb b/db/migrate/20140729140420_create_label_links.rb
new file mode 100644
index 00000000000..2bfc4ae2094
--- /dev/null
+++ b/db/migrate/20140729140420_create_label_links.rb
@@ -0,0 +1,11 @@
+class CreateLabelLinks < ActiveRecord::Migration
+ def change
+ create_table :label_links do |t|
+ t.integer :label_id
+ t.integer :target_id
+ t.string :target_type
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140729145339_migrate_project_tags.rb b/db/migrate/20140729145339_migrate_project_tags.rb
new file mode 100644
index 00000000000..5760e4bfeaa
--- /dev/null
+++ b/db/migrate/20140729145339_migrate_project_tags.rb
@@ -0,0 +1,9 @@
+class MigrateProjectTags < ActiveRecord::Migration
+ def up
+ ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'labels').update_all(context: 'tags')
+ end
+
+ def down
+ ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'tags').update_all(context: 'labels')
+ end
+end
diff --git a/db/migrate/20140729152420_migrate_taggable_labels.rb b/db/migrate/20140729152420_migrate_taggable_labels.rb
new file mode 100644
index 00000000000..dc28d727d9a
--- /dev/null
+++ b/db/migrate/20140729152420_migrate_taggable_labels.rb
@@ -0,0 +1,35 @@
+class MigrateTaggableLabels < ActiveRecord::Migration
+ def up
+ taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
+ taggings.find_each(batch_size: 500) do |tagging|
+ # Clean up orphaned taggings while we are here
+ if tagging.taggable.blank? || tagging.tag.nil?
+ tagging.destroy
+ print 'D'
+ next
+ end
+ create_label_from_tagging(tagging)
+ end
+ end
+
+ def down
+ Label.destroy_all
+ LabelLink.destroy_all
+ end
+
+ private
+
+ def create_label_from_tagging(tagging)
+ target = tagging.taggable
+ label_name = tagging.tag.name
+ # '?', '&' and ',' are no longer allowed in label names so we remove them
+ label_name.tr!('?&,', '')
+ label = target.project.labels.find_or_create_by(title: label_name, color: Label::DEFAULT_COLOR)
+
+ if label.valid? && LabelLink.create(label: label, target: target)
+ print '.'
+ else
+ print 'F'
+ end
+ end
+end
diff --git a/db/migrate/20140730111702_add_index_to_labels.rb b/db/migrate/20140730111702_add_index_to_labels.rb
new file mode 100644
index 00000000000..494241c873c
--- /dev/null
+++ b/db/migrate/20140730111702_add_index_to_labels.rb
@@ -0,0 +1,7 @@
+class AddIndexToLabels < ActiveRecord::Migration
+ def change
+ add_index "labels", :project_id
+ add_index "label_links", :label_id
+ add_index "label_links", [:target_id, :target_type]
+ end
+end
diff --git a/db/migrate/20140903115954_migrate_to_new_shell.rb b/db/migrate/20140903115954_migrate_to_new_shell.rb
new file mode 100644
index 00000000000..2d832109513
--- /dev/null
+++ b/db/migrate/20140903115954_migrate_to_new_shell.rb
@@ -0,0 +1,10 @@
+class MigrateToNewShell < ActiveRecord::Migration
+ def change
+ gitlab_shell_path = Gitlab.config.gitlab_shell.path
+ if system("#{gitlab_shell_path}/bin/create-hooks")
+ puts 'Repositories updated with new hooks'
+ else
+ raise 'Failed to rewrite gitlab-shell hooks in repositories'
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 345b6fd3b68..a2dda07c102 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140611135229) do
+ActiveRecord::Schema.define(version: 20140903115954) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -109,6 +109,27 @@ ActiveRecord::Schema.define(version: 20140611135229) do
add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree
+ create_table "label_links", force: true do |t|
+ t.integer "label_id"
+ t.integer "target_id"
+ t.string "target_type"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "label_links", ["label_id"], name: "index_label_links_on_label_id", using: :btree
+ add_index "label_links", ["target_id", "target_type"], name: "index_label_links_on_target_id_and_target_type", using: :btree
+
+ create_table "labels", force: true do |t|
+ t.string "title"
+ t.string "color"
+ t.integer "project_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree
+
create_table "merge_request_diffs", force: true do |t|
t.string "state"
t.text "st_commits"
@@ -224,11 +245,13 @@ ActiveRecord::Schema.define(version: 20140611135229) do
t.boolean "archived", default: false, null: false
t.string "import_status"
t.float "repository_size", default: 0.0
+ t.integer "star_count", default: 0, null: false
end
add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree
add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree
add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree
+ add_index "projects", ["star_count"], name: "index_projects_on_star_count", using: :btree
create_table "protected_branches", force: true do |t|
t.integer "project_id", null: false
@@ -369,6 +392,17 @@ ActiveRecord::Schema.define(version: 20140611135229) do
add_index "users_projects", ["project_id"], name: "index_users_projects_on_project_id", using: :btree
add_index "users_projects", ["user_id"], name: "index_users_projects_on_user_id", using: :btree
+ create_table "users_star_projects", force: true do |t|
+ t.integer "project_id", null: false
+ t.integer "user_id", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "users_star_projects", ["project_id"], name: "index_users_star_projects_on_project_id", using: :btree
+ add_index "users_star_projects", ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true, using: :btree
+ add_index "users_star_projects", ["user_id"], name: "index_users_star_projects_on_user_id", using: :btree
+
create_table "web_hooks", force: true do |t|
t.string "url"
t.integer "project_id"
diff --git a/doc/api/README.md b/doc/api/README.md
index e91d3af59d7..ababb7b6999 100644
--- a/doc/api/README.md
+++ b/doc/api/README.md
@@ -12,6 +12,7 @@
- [Branches](branches.md)
- [Merge Requests](merge_requests.md)
- [Issues](issues.md)
+- [Labels](labels.md)
- [Milestones](milestones.md)
- [Notes](notes.md) (comments)
- [Deploy Keys](deploy_keys.md)
@@ -30,7 +31,7 @@
## Introduction
-All API requests require authentication. You need to pass a `private_token` parameter by url or header. If passed as header, the header name must be "PRIVATE-TOKEN" (capital and with dash instead of underscore). You can find or reset your private token in your profile.
+All API requests require authentication. You need to pass a `private_token` parameter by URL or header. If passed as header, the header name must be "PRIVATE-TOKEN" (capital and with dash instead of underscore). You can find or reset your private token in your profile.
If no, or an invalid, `private_token` is provided then an error message will be returned with status code 401:
@@ -64,14 +65,14 @@ API request types:
- `GET` requests access one or more resources and return the result as JSON
- `POST` requests return `201 Created` if the resource is successfully created and return the newly created resource as JSON
-- `GET`, `PUT` and `DELETE` return `200 Ok` if the resource is accessed, modified or deleted successfully, the (modified) result is returned as JSON
-- `DELETE` requests are designed to be idempotent, meaning a request a resource still returns `200 Ok` even it was deleted before or is not available. The reasoning behind it is the user is not really interested if the resource existed before or not.
+- `GET`, `PUT` and `DELETE` return `200 OK` if the resource is accessed, modified or deleted successfully, the (modified) result is returned as JSON
+- `DELETE` requests are designed to be idempotent, meaning a request a resource still returns `200 OK` even it was deleted before or is not available. The reasoning behind it is the user is not really interested if the resource existed before or not.
The following list shows the possible return codes for API requests.
Return values:
-- `200 Ok` - The `GET`, `PUT` or `DELETE` request was successful, the resource(s) itself is returned as JSON
+- `200 OK` - The `GET`, `PUT` or `DELETE` request was successful, the resource(s) itself is returned as JSON
- `201 Created` - The `POST` request was successful and the resource is returned as JSON
- `400 Bad Request` - A required attribute of the API request is missing, e.g. the title of an issue is not given
- `401 Unauthorized` - The user is not authenticated, a valid user token is necessary, see above
@@ -132,14 +133,14 @@ When listing resources you can pass the following parameters:
## id vs iid
-When you work with API you may notice two similar fields in api entites: id and iid. The main difference between them is scope. Example:
+When you work with API you may notice two similar fields in api entities: id and iid. The main difference between them is scope. Example:
Issue:
id: 46
iid: 5
-- id - is uniq across all Issues table. It used for any api calls.
-- iid - is uniq only in scope of single project. When you browse issues or merge requests with Web UI - you see iid.
+- id - is unique across all issues. It's used for any api call.
+- iid - is unique only in scope of a single project. When you browse issues or merge requests with Web UI, you see iid.
So if you want to get issue with api you use `http://host/api/v3/.../issues/:id.json`. But when you want to create a link to web page - use `http:://host/project/issues/:iid.json`
diff --git a/doc/api/branches.md b/doc/api/branches.md
index f695b48fe2f..74386615545 100644
--- a/doc/api/branches.md
+++ b/doc/api/branches.md
@@ -41,7 +41,6 @@ Parameters:
]
```
-
## Get single repository branch
Get a single project repository branch.
@@ -85,7 +84,7 @@ Parameters:
## Protect repository branch
Protects a single project repository branch. This is an idempotent function, protecting an already
-protected repository branch still returns a `200 Ok` status code.
+protected repository branch still returns a `200 OK` status code.
```
PUT /projects/:id/repository/branches/:branch/protect
@@ -126,7 +125,7 @@ Parameters:
## Unprotect repository branch
Unprotects a single project repository branch. This is an idempotent function, unprotecting an already
-unprotected repository branch still returns a `200 Ok` status code.
+unprotected repository branch still returns a `200 OK` status code.
```
PUT /projects/:id/repository/branches/:branch/unprotect
@@ -174,7 +173,7 @@ Parameters:
- `id` (required) - The ID of a project
- `branch_name` (required) - The name of the branch
-- `ref` (required) - Create branch from commit sha or existing branch
+- `ref` (required) - Create branch from commit SHA or existing branch
```json
{
@@ -197,8 +196,9 @@ Parameters:
}
```
-## Delete repository branch
+It return 200 if succeed or 400 if failed with error message explaining reason.
+## Delete repository branch
```
DELETE /projects/:id/repository/branches/:branch
@@ -206,7 +206,8 @@ DELETE /projects/:id/repository/branches/:branch
Parameters:
-+ `id` (required) - The ID of a project
-+ `branch` (required) - The name of the branch
+- `id` (required) - The ID of a project
+- `branch` (required) - The name of the branch
-It return 200 if succeed or 405 if failed with error message explaining reason.
+It return 200 if succeed, 404 if the branch to be deleted does not exist
+or 400 for other reasons. In case of an error, an explaining message is provided.
diff --git a/doc/api/commits.md b/doc/api/commits.md
index d55b34c0c1f..9475ecbaa67 100644
--- a/doc/api/commits.md
+++ b/doc/api/commits.md
@@ -21,7 +21,8 @@ Parameters:
"title": "Replace sanitize with escape once",
"author_name": "Dmitriy Zaporozhets",
"author_email": "dzaporozhets@sphereconsultinginc.com",
- "created_at": "2012-09-20T11:50:22+03:00"
+ "created_at": "2012-09-20T11:50:22+03:00",
+ "message": "Replace sanitize with escape once"
},
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
@@ -29,7 +30,8 @@ Parameters:
"title": "Sanitize for network graph",
"author_name": "randx",
"author_email": "dmitriy.zaporozhets@gmail.com",
- "created_at": "2012-09-20T09:06:12+03:00"
+ "created_at": "2012-09-20T09:06:12+03:00",
+ "message": "Sanitize for network graph"
}
]
```
@@ -55,6 +57,7 @@ Parameters:
"author_name": "randx",
"author_email": "dmitriy.zaporozhets@gmail.com",
"created_at": "2012-09-20T09:06:12+03:00",
+ "message": "Sanitize for network graph",
"committed_date": "2012-09-20T09:06:12+03:00",
"authored_date": "2012-09-20T09:06:12+03:00",
"parent_ids": [
diff --git a/doc/api/groups.md b/doc/api/groups.md
index 1dbb93f9082..6b379b02d28 100644
--- a/doc/api/groups.md
+++ b/doc/api/groups.md
@@ -19,7 +19,6 @@ GET /groups
]
```
-
## Details of a group
Get all details of a group.
@@ -30,8 +29,7 @@ GET /groups/:id
Parameters:
-+ `id` (required) - The ID of a group
-
+- `id` (required) - The ID of a group
## New group
@@ -43,8 +41,8 @@ POST /groups
Parameters:
-+ `name` (required) - The name of the group
-+ `path` (required) - The path of the group
+- `name` (required) - The name of the group
+- `path` (required) - The path of the group
## Transfer project to group
@@ -55,9 +53,9 @@ POST /groups/:id/projects/:project_id
```
Parameters:
-+ `id` (required) - The ID of a group
-+ `project_id` (required) - The ID of a project
+- `id` (required) - The ID of a group
+- `project_id` (required) - The ID of a project
## Remove group
@@ -69,22 +67,20 @@ DELETE /groups/:id
Parameters:
-+ `id` (required) - The ID of a user group
-
+- `id` (required) - The ID of a user group
## Group members
-
**Group access levels**
The group access levels are defined in the `Gitlab::Access` module. Currently, these levels are recognized:
```
- GUEST = 10
- REPORTER = 20
- DEVELOPER = 30
- MASTER = 40
- OWNER = 50
+GUEST = 10
+REPORTER = 20
+DEVELOPER = 30
+MASTER = 40
+OWNER = 50
```
### List group members
@@ -128,10 +124,9 @@ POST /groups/:id/members
Parameters:
-+ `id` (required) - The ID of a group
-+ `user_id` (required) - The ID of a user to add
-+ `access_level` (required) - Project access level
-
+- `id` (required) - The ID of a group
+- `user_id` (required) - The ID of a user to add
+- `access_level` (required) - Project access level
### Remove user team member
@@ -143,5 +138,5 @@ DELETE /groups/:id/members/:user_id
Parameters:
-+ `id` (required) - The ID of a user group
-+ `user_id` (required) - The ID of a group member
+- `id` (required) - The ID of a user group
+- `user_id` (required) - The ID of a group member
diff --git a/doc/api/issues.md b/doc/api/issues.md
index f775d502a6d..a935b146d37 100644
--- a/doc/api/issues.md
+++ b/doc/api/issues.md
@@ -7,8 +7,18 @@ Get all issues created by authenticated user. This function takes pagination par
```
GET /issues
+GET /issues?state=opened
+GET /issues?state=closed
+GET /issues?labels=foo
+GET /issues?labels=foo,bar
+GET /issues?labels=foo,bar&state=opened
```
+Parameters:
+
+- `state` (optional) - Return `all` issues or just those that are `opened` or `closed`
+- `labels` (optional) - Comma-separated list of label names
+
```json
[
{
@@ -80,11 +90,18 @@ to return the list of project issues.
```
GET /projects/:id/issues
+GET /projects/:id/issues?state=opened
+GET /projects/:id/issues?state=closed
+GET /projects/:id/issues?labels=foo
+GET /projects/:id/issues?labels=foo,bar
+GET /projects/:id/issues?labels=foo,bar&state=opened
```
Parameters:
- `id` (required) - The ID of a project
+- `state` (optional) - Return `all` issues or just those that are `opened` or `closed`
+- `labels` (optional) - Comma-separated list of label names
## Single issue
@@ -157,6 +174,9 @@ Parameters:
- `milestone_id` (optional) - The ID of a milestone to assign issue
- `labels` (optional) - Comma-separated label names for an issue
+If the operation is successful, 200 and the newly created issue is returned.
+If an error occurs, an error number and a message explaining the reason is returned.
+
## Edit issue
Updates an existing project issue. This function is also used to mark an issue as closed.
@@ -176,6 +196,9 @@ Parameters:
- `labels` (optional) - Comma-separated label names for an issue
- `state_event` (optional) - The state event of an issue ('close' to close issue and 'reopen' to reopen it)
+If the operation is successful, 200 and the updated issue is returned.
+If an error occurs, an error number and a message explaining the reason is returned.
+
## Delete existing issue (**Deprecated**)
The function is deprecated and returns a `405 Method Not Allowed` error if called. An issue gets now closed and is done by calling `PUT /projects/:id/issues/:issue_id` with parameter `closed` set to 1.
diff --git a/doc/api/labels.md b/doc/api/labels.md
new file mode 100644
index 00000000000..de41f35d284
--- /dev/null
+++ b/doc/api/labels.md
@@ -0,0 +1,84 @@
+# Labels
+
+## List labels
+
+Get all labels for given project.
+
+```
+GET /projects/:id/labels
+```
+
+```json
+[
+ {
+ "name": "Awesome",
+ "color": "#DD10AA"
+ },
+ {
+ "name": "Documentation",
+ "color": "#1E80DD"
+ },
+ {
+ "name": "Feature",
+ "color": "#11FF22"
+ },
+ {
+ "name": "Bug",
+ "color": "#EE1122"
+ }
+]
+```
+
+## Create a new label
+
+Creates a new label for given repository with given name and color.
+
+```
+POST /projects/:id/labels
+```
+
+Parameters:
+
+- `id` (required) - The ID of a project
+- `name` (required) - The name of the label
+- `color` (required) - Color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)
+
+It returns 200 and the newly created label, if the operation succeeds.
+If the label already exists, 409 and an error message is returned.
+If label parameters are invalid, 400 and an explaining error message is returned.
+
+## Delete a label
+
+Deletes a label given by its name.
+
+```
+DELETE /projects/:id/labels
+```
+
+- `id` (required) - The ID of a project
+- `name` (required) - The name of the label to be deleted
+
+It returns 200 if the label successfully was deleted, 400 for wrong parameters
+and 404 if the label does not exist.
+In case of an error, additionally an error message is returned.
+
+## Edit an existing label
+
+Updates an existing label with new name or now color. At least one parameter
+is required, to update the label.
+
+```
+PUT /projects/:id/labels
+```
+
+Parameters:
+
+- `id` (required) - The ID of a project
+- `name` (required) - The name of the existing label
+- `new_name` (optional) - The new name of the label
+- `color` (optional) - New color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)
+
+On success, this method returns 200 with the updated label.
+If required parameters are missing or parameters are invalid, 400 is returned.
+If the label to be updated is missing, 404 is returned.
+In case of an error, additionally an error message is returned.
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 27c0d644e11..3616e29ef7c 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -30,7 +30,7 @@ Parameters:
"author": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -38,11 +38,12 @@ Parameters:
"assignee": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
- }
+ },
+ "description":"fixed login page css paddings"
}
]
```
@@ -74,7 +75,7 @@ Parameters:
"author": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -82,11 +83,12 @@ Parameters:
"assignee": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
- }
+ },
+ "description":"fixed login page css paddings"
}
```
@@ -120,7 +122,7 @@ Parameters:
"author": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -128,14 +130,18 @@ Parameters:
"assignee": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
- }
+ },
+ "description":"fixed login page css paddings"
}
```
+If the operation is successful, 200 and the newly created merge request is returned.
+If an error occurs, an error number and a message explaining the reason is returned.
+
## Update MR
Updates an existing merge request. You can change branches, title, or even close the MR.
@@ -167,7 +173,7 @@ Parameters:
"author": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -175,7 +181,7 @@ Parameters:
"assignee": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -183,17 +189,20 @@ Parameters:
}
```
+If the operation is successful, 200 and the updated merge request is returned.
+If an error occurs, an error number and a message explaining the reason is returned.
+
## Accept MR
-Merge changes submitted with MR usign this API.
+Merge changes submitted with MR using this API.
-If merge success you get 200 OK.
+If merge success you get `200 OK`.
If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged'
-If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed'
+If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed'
-If you dont have permissions to accept this merge request - you get 401
+If you don't have permissions to accept this merge request - you'll get a 401
```
PUT /projects/:id/merge_request/:merge_request_id/merge
@@ -218,7 +227,7 @@ Parameters:
"author": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -226,7 +235,7 @@ Parameters:
"assignee": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
@@ -253,7 +262,7 @@ Parameters:
"author": {
"id": 1,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"blocked": false,
"created_at": "2012-04-29T08:46:00Z"
@@ -282,7 +291,7 @@ Parameters:
"author": {
"id": 11,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2014-03-06T08:17:35.000Z"
@@ -293,7 +302,7 @@ Parameters:
"author": {
"id": 11,
"username": "admin",
- "email": "admin@local.host",
+ "email": "admin@example.com",
"name": "Administrator",
"state": "active",
"created_at": "2014-03-06T08:17:35.000Z"
diff --git a/doc/api/notes.md b/doc/api/notes.md
index e7f19965a30..b5256ac803e 100644
--- a/doc/api/notes.md
+++ b/doc/api/notes.md
@@ -14,8 +14,8 @@ GET /projects/:id/issues/:issue_id/notes
Parameters:
-+ `id` (required) - The ID of a project
-+ `issue_id` (required) - The ID of an issue
+- `id` (required) - The ID of a project
+- `issue_id` (required) - The ID of an issue
```json
[
@@ -60,10 +60,9 @@ GET /projects/:id/issues/:issue_id/notes/:note_id
Parameters:
-+ `id` (required) - The ID of a project
-+ `issue_id` (required) - The ID of a project issue
-+ `note_id` (required) - The ID of an issue note
-
+- `id` (required) - The ID of a project
+- `issue_id` (required) - The ID of a project issue
+- `note_id` (required) - The ID of an issue note
### Create new issue note
@@ -75,10 +74,9 @@ POST /projects/:id/issues/:issue_id/notes
Parameters:
-+ `id` (required) - The ID of a project
-+ `issue_id` (required) - The ID of an issue
-+ `body` (required) - The content of a note
-
+- `id` (required) - The ID of a project
+- `issue_id` (required) - The ID of an issue
+- `body` (required) - The content of a note
## Snippets
@@ -92,9 +90,8 @@ GET /projects/:id/snippets/:snippet_id/notes
Parameters:
-+ `id` (required) - The ID of a project
-+ `snippet_id` (required) - The ID of a project snippet
-
+- `id` (required) - The ID of a project
+- `snippet_id` (required) - The ID of a project snippet
### Get single snippet note
@@ -106,9 +103,9 @@ GET /projects/:id/snippets/:snippet_id/notes/:note_id
Parameters:
-+ `id` (required) - The ID of a project
-+ `snippet_id` (required) - The ID of a project snippet
-+ `note_id` (required) - The ID of an snippet note
+- `id` (required) - The ID of a project
+- `snippet_id` (required) - The ID of a project snippet
+- `note_id` (required) - The ID of an snippet note
```json
{
@@ -139,10 +136,9 @@ POST /projects/:id/snippets/:snippet_id/notes
Parameters:
-+ `id` (required) - The ID of a project
-+ `snippet_id` (required) - The ID of an snippet
-+ `body` (required) - The content of a note
-
+- `id` (required) - The ID of a project
+- `snippet_id` (required) - The ID of an snippet
+- `body` (required) - The content of a note
## Merge Requests
@@ -156,9 +152,8 @@ GET /projects/:id/merge_requests/:merge_request_id/notes
Parameters:
-+ `id` (required) - The ID of a project
-+ `merge_request_id` (required) - The ID of a project merge request
-
+- `id` (required) - The ID of a project
+- `merge_request_id` (required) - The ID of a project merge request
### Get single merge request note
@@ -170,9 +165,9 @@ GET /projects/:id/merge_requests/:merge_request_id/notes/:note_id
Parameters:
-+ `id` (required) - The ID of a project
-+ `merge_request_id` (required) - The ID of a project merge request
-+ `note_id` (required) - The ID of a merge request note
+- `id` (required) - The ID of a project
+- `merge_request_id` (required) - The ID of a project merge request
+- `note_id` (required) - The ID of a merge request note
```json
{
@@ -201,7 +196,6 @@ POST /projects/:id/merge_requests/:merge_request_id/notes
Parameters:
-+ `id` (required) - The ID of a project
-+ `merge_request_id` (required) - The ID of a merge request
-+ `body` (required) - The content of a note
-
+- `id` (required) - The ID of a project
+- `merge_request_id` (required) - The ID of a merge request
+- `body` (required) - The content of a note
diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md
index 47c81b6446c..50e134847c0 100644
--- a/doc/api/project_snippets.md
+++ b/doc/api/project_snippets.md
@@ -78,7 +78,7 @@ Parameters:
## Delete snippet
Deletes an existing project snippet. This is an idempotent function and deleting a non-existent
-snippet still returns a `200 Ok` status code.
+snippet still returns a `200 OK` status code.
```
DELETE /projects/:id/snippets/:snippet_id
diff --git a/doc/api/projects.md b/doc/api/projects.md
index d32af678fcc..8995551b9ea 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -1,6 +1,6 @@
# Projects
-### List projects
+## List projects
Get a list of projects accessible by the authenticated user.
@@ -8,6 +8,10 @@ Get a list of projects accessible by the authenticated user.
GET /projects
```
+Parameters:
+
+- `archived` (optional) - if passed, limit by archived status
+
```json
[
{
@@ -83,16 +87,15 @@ GET /projects
]
```
+### List owned projects
-#### List owned projects
-
-Get a list of projects owned by the authenticated user.
+Get a list of projects which are owned by the authenticated user.
```
GET /projects/owned
```
-#### List ALL projects
+### List ALL projects
Get a list of all GitLab projects (admin only).
@@ -102,7 +105,7 @@ GET /projects/all
### Get single project
-Get a specific project, identified by project ID or NAMESPACE/PROJECT_NAME , which is owned by the authentication user.
+Get a specific project, identified by project ID or NAMESPACE/PROJECT_NAME, which is owned by the authenticated user.
If using namespaced projects call make sure that the NAMESPACE/PROJECT_NAME is URL-encoded, eg. `/api/v3/projects/diaspora%2Fdiaspora` (where `/` is represented by `%2F`).
```
@@ -111,7 +114,7 @@ GET /projects/:id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
```json
{
@@ -163,7 +166,7 @@ Parameters:
### Get project events
-Get a project events for specific project.
+Get the events for the specified project.
Sorted from newest to latest
```
@@ -172,7 +175,7 @@ GET /projects/:id/events
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
```json
[
@@ -234,10 +237,9 @@ Parameters:
]
```
-
### Create project
-Creates new project owned by user.
+Creates a new project owned by the authenticated user.
```
POST /projects
@@ -245,21 +247,20 @@ POST /projects
Parameters:
-+ `name` (required) - new project name
-+ `namespace_id` (optional) - namespace for the new project (defaults to user)
-+ `description` (optional) - short project description
-+ `issues_enabled` (optional)
-+ `merge_requests_enabled` (optional)
-+ `wiki_enabled` (optional)
-+ `snippets_enabled` (optional)
-+ `public` (optional) - if `true` same as setting visibility_level = 20
-+ `visibility_level` (optional)
-* `import_url` (optional)
-
+- `name` (required) - new project name
+- `namespace_id` (optional) - namespace for the new project (defaults to user)
+- `description` (optional) - short project description
+- `issues_enabled` (optional)
+- `merge_requests_enabled` (optional)
+- `wiki_enabled` (optional)
+- `snippets_enabled` (optional)
+- `public` (optional) - if `true` same as setting visibility_level = 20
+- `visibility_level` (optional)
+- `import_url` (optional)
### Create project for user
-Creates a new project owned by user. Available only for admins.
+Creates a new project owned by the specified user. Available only for admins.
```
POST /projects/user/:user_id
@@ -267,21 +268,21 @@ POST /projects/user/:user_id
Parameters:
-+ `user_id` (required) - user_id of owner
-+ `name` (required) - new project name
-+ `description` (optional) - short project description
-+ `default_branch` (optional) - 'master' by default
-+ `issues_enabled` (optional)
-+ `merge_requests_enabled` (optional)
-+ `wiki_enabled` (optional)
-+ `snippets_enabled` (optional)
-+ `public` (optional) - if `true` same as setting visibility_level = 20
-+ `visibility_level` (optional)
+- `user_id` (required) - user_id of owner
+- `name` (required) - new project name
+- `description` (optional) - short project description
+- `default_branch` (optional) - 'master' by default
+- `issues_enabled` (optional)
+- `merge_requests_enabled` (optional)
+- `wiki_enabled` (optional)
+- `snippets_enabled` (optional)
+- `public` (optional) - if `true` same as setting visibility_level = 20
+- `visibility_level` (optional)
+- `import_url` (optional)
+### Remove project
-## Remove project
-
-Removes project with all resources(issues, merge requests etc)
+Removes a project including all associated resources (issues, merge requests etc.)
```
DELETE /projects/:id
@@ -289,14 +290,13 @@ DELETE /projects/:id
Parameters:
-+ `id` (required) - The ID of a project
-
+- `id` (required) - The ID of a project
## Team members
### List project team members
-Get a list of project team members.
+Get a list of a project's team members.
```
GET /projects/:id/members
@@ -304,9 +304,8 @@ GET /projects/:id/members
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `query` (optional) - Query string to search for members
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `query` (optional) - Query string to search for members
### Get project team member
@@ -318,8 +317,8 @@ GET /projects/:id/members/:user_id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `user_id` (required) - The ID of a user
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `user_id` (required) - The ID of a user
```json
{
@@ -333,7 +332,6 @@ Parameters:
}
```
-
### Add project team member
Adds a user to a project team. This is an idempotent method and can be called multiple times
@@ -346,14 +344,13 @@ POST /projects/:id/members
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `user_id` (required) - The ID of a user to add
-+ `access_level` (required) - Project access level
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `user_id` (required) - The ID of a user to add
+- `access_level` (required) - Project access level
### Edit project team member
-Updates project team member to a specified access level.
+Updates a project team member to a specified access level.
```
PUT /projects/:id/members/:user_id
@@ -361,14 +358,13 @@ PUT /projects/:id/members/:user_id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `user_id` (required) - The ID of a team member
-+ `access_level` (required) - Project access level
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `user_id` (required) - The ID of a team member
+- `access_level` (required) - Project access level
### Remove project team member
-Removes user from project team.
+Removes a user from a project team.
```
DELETE /projects/:id/members/:user_id
@@ -376,20 +372,19 @@ DELETE /projects/:id/members/:user_id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `user_id` (required) - The ID of a team member
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `user_id` (required) - The ID of a team member
This method is idempotent and can be called multiple times with the same parameters.
Revoking team membership for a user who is not currently a team member is considered success.
Please note that the returned JSON currently differs slightly. Thus you should not
rely on the returned JSON structure.
-
## Hooks
### List project hooks
-Get list of project hooks.
+Get a list of project hooks.
```
GET /projects/:id/hooks
@@ -397,12 +392,11 @@ GET /projects/:id/hooks
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
### Get project hook
-Get a specific hook for project.
+Get a specific hook for a project.
```
GET /projects/:id/hooks/:hook_id
@@ -410,8 +404,8 @@ GET /projects/:id/hooks/:hook_id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `hook_id` (required) - The ID of a project hook
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `hook_id` (required) - The ID of a project hook
```json
{
@@ -425,10 +419,9 @@ Parameters:
}
```
-
### Add project hook
-Adds a hook to project.
+Adds a hook to a specified project.
```
POST /projects/:id/hooks
@@ -436,16 +429,15 @@ POST /projects/:id/hooks
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `url` (required) - The hook URL
-+ `push_events` - Trigger hook on push events
-+ `issues_events` - Trigger hook on issues events
-+ `merge_requests_events` - Trigger hook on merge_requests events
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `url` (required) - The hook URL
+- `push_events` - Trigger hook on push events
+- `issues_events` - Trigger hook on issues events
+- `merge_requests_events` - Trigger hook on merge_requests events
### Edit project hook
-Edits a hook for project.
+Edits a hook for a specified project.
```
PUT /projects/:id/hooks/:hook_id
@@ -453,17 +445,16 @@ PUT /projects/:id/hooks/:hook_id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `hook_id` (required) - The ID of a project hook
-+ `url` (required) - The hook URL
-+ `push_events` - Trigger hook on push events
-+ `issues_events` - Trigger hook on issues events
-+ `merge_requests_events` - Trigger hook on merge_requests events
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `hook_id` (required) - The ID of a project hook
+- `url` (required) - The hook URL
+- `push_events` - Trigger hook on push events
+- `issues_events` - Trigger hook on issues events
+- `merge_requests_events` - Trigger hook on merge_requests events
### Delete project hook
-Removes a hook from project. This is an idempotent method and can be called multiple times.
+Removes a hook from a project. This is an idempotent method and can be called multiple times.
Either the hook is available or not.
```
@@ -472,13 +463,12 @@ DELETE /projects/:id/hooks/:hook_id
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `hook_id` (required) - The ID of hook to delete
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `hook_id` (required) - The ID of hook to delete
Note the JSON response differs if the hook is available or not. If the project hook
is available before it is returned in the JSON response or an empty response is returned.
-
## Branches
### List branches
@@ -491,7 +481,7 @@ GET /projects/:id/repository/branches
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
```json
[
@@ -556,9 +546,8 @@ GET /projects/:id/repository/branches/:branch
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `branch` (required) - The name of the branch.
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `branch` (required) - The name of the branch.
### Protect single branch
@@ -570,9 +559,8 @@ PUT /projects/:id/repository/branches/:branch/protect
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `branch` (required) - The name of the branch.
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `branch` (required) - The name of the branch.
### Unprotect single branch
@@ -584,13 +572,12 @@ PUT /projects/:id/repository/branches/:branch/unprotect
Parameters:
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-+ `branch` (required) - The name of the branch.
-
+- `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
+- `branch` (required) - The name of the branch.
## Admin fork relation
-Allows modification of the forked relationship between existing projects. . Available only for admins.
+Allows modification of the forked relationship between existing projects. Available only for admins.
### Create a forked from/to relation between existing projects.
@@ -600,8 +587,8 @@ POST /projects/:id/fork/:forked_from_id
Parameters:
-+ `id` (required) - The ID of the project
-+ `forked_from_id:` (required) - The ID of the project that was forked from
+- `id` (required) - The ID of the project
+- `forked_from_id:` (required) - The ID of the project that was forked from
### Delete an existing forked from relationship
@@ -611,12 +598,11 @@ DELETE /projects/:id/fork
Parameter:
-+ `id` (required) - The ID of the project
-
+- `id` (required) - The ID of the project
## Search for projects by name
-Search for projects by name which are public or the calling user has access to
+Search for projects by name which are accessible to the authenticated user.
```
GET /projects/search/:query
@@ -624,32 +610,6 @@ GET /projects/search/:query
Parameters:
-+ query (required) - A string contained in the project name
-+ per_page (optional) - number of projects to return per page
-+ page (optional) - the page to retrieve
-
-
-## Labels
-
-### List project labels
-
-Get a list of project labels.
-
-```
-GET /projects/:id/labels
-```
-
-Parameters:
-
-+ `id` (required) - The ID or NAMESPACE/PROJECT_NAME of a project
-
-```json
-[
- {
- "name": "feature"
- },
- {
- "name": "bug"
- }
-]
-```
+- query (required) - A string contained in the project name
+- per_page (optional) - number of projects to return per page
+- page (optional) - the page to retrieve
diff --git a/doc/api/repositories.md b/doc/api/repositories.md
index 26ae3e87232..a412f60c0d9 100644
--- a/doc/api/repositories.md
+++ b/doc/api/repositories.md
@@ -10,7 +10,7 @@ GET /projects/:id/repository/tags
Parameters:
-+ `id` (required) - The ID of a project
+- `id` (required) - The ID of a project
```json
[
@@ -47,9 +47,10 @@ POST /projects/:id/repository/tags
Parameters:
-+ `id` (required) - The ID of a project
-+ `tag_name` (required) - The name of a tag
-+ `ref` (required) - Create tag using commit sha, another tag name, or branch name.
+- `id` (required) - The ID of a project
+- `tag_name` (required) - The name of a tag
+- `ref` (required) - Create tag using commit SHA, another tag name, or branch name.
+- `message` (optional) - Creates annotated tag.
```json
[
@@ -71,6 +72,9 @@ Parameters:
]
```
+It returns 200 if the operation succeed. In case of an error,
+405 with an explaining error message is returned.
+
## List repository tree
Get a list of repository files and directories in a project.
@@ -81,9 +85,9 @@ GET /projects/:id/repository/tree
Parameters:
-+ `id` (required) - The ID of a project
-+ `path` (optional) - The path inside repository. Used to get contend of subdirectories
-+ `ref_name` (optional) - The name of a repository branch or tag or if not given the default branch
+- `id` (required) - The ID of a project
+- `path` (optional) - The path inside repository. Used to get contend of subdirectories
+- `ref_name` (optional) - The name of a repository branch or tag or if not given the default branch
```json
[
@@ -126,10 +130,9 @@ Parameters:
]
```
-
## Raw file content
-Get the raw file contents for a file by commit sha and path.
+Get the raw file contents for a file by commit SHA and path.
```
GET /projects/:id/repository/blobs/:sha
@@ -137,14 +140,13 @@ GET /projects/:id/repository/blobs/:sha
Parameters:
-+ `id` (required) - The ID of a project
-+ `sha` (required) - The commit or branch name
-+ `filepath` (required) - The path the file
-
+- `id` (required) - The ID of a project
+- `sha` (required) - The commit or branch name
+- `filepath` (required) - The path the file
## Raw blob content
-Get the raw file contents for a blob by blob sha.
+Get the raw file contents for a blob by blob SHA.
```
GET /projects/:id/repository/raw_blobs/:sha
@@ -152,22 +154,21 @@ GET /projects/:id/repository/raw_blobs/:sha
Parameters:
-+ `id` (required) - The ID of a project
-+ `sha` (required) - The blob sha
-
+- `id` (required) - The ID of a project
+- `sha` (required) - The blob SHA
## Get file archive
-Get a an archive of the repository
+Get an archive of the repository
```
GET /projects/:id/repository/archive
```
Parameters:
-+ `id` (required) - The ID of a project
-+ `sha` (optional) - The commit sha to download defaults to the tip of the default branch
+- `id` (required) - The ID of a project
+- `sha` (optional) - The commit SHA to download defaults to the tip of the default branch
## Compare branches, tags or commits
@@ -176,16 +177,16 @@ GET /projects/:id/repository/compare
```
Parameters:
-+ `id` (required) - The ID of a project
-+ `from` (required) - the commit sha or branch name
-+ `to` (required) - the commit sha or branch name
+- `id` (required) - The ID of a project
+- `from` (required) - the commit SHA or branch name
+- `to` (required) - the commit SHA or branch name
```
GET /projects/:id/repository/compare?from=master&to=feature
```
-Response:
+Response:
```json
@@ -220,3 +221,33 @@ Response:
"compare_same_ref": false
}
```
+
+## Contributors
+
+Get repository contributors list
+
+```
+GET /projects/:id/repository/contributors
+```
+
+Parameters:
+
+- `id` (required) - The ID of a project
+
+Response:
+
+```
+[{
+ "name": "Dmitriy Zaporozhets",
+ "email": "dmitriy.zaporozhets@gmail.com",
+ "commits": 117,
+ "additions": 2097,
+ "deletions": 517
+}, {
+ "name": "Jacob Vosmaer",
+ "email": "contact@jacobvosmaer.nl",
+ "commits": 33,
+ "additions": 338,
+ "deletions": 244
+}]
+```
diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md
index ae56b04b6ce..25311b07107 100644
--- a/doc/api/repository_files.md
+++ b/doc/api/repository_files.md
@@ -1,10 +1,8 @@
# Repository files
-## CRUD for repository files
+**CRUD for repository files**
-## Create, read, update and delete repository files using this API
-
----
+**Create, read, update and delete repository files using this API**
## Get file from repository
@@ -80,6 +78,15 @@ Parameters:
- `content` (required) - New file content
- `commit_message` (required) - Commit message
+If the commit fails for any reason we return a 400 error with a non-specific
+error message. Possible causes for a failed commit include:
+- the `file_path` contained `/../` (attempted directory traversal);
+- the new file contents were identical to the current file contents, i.e. the
+ user tried to make an empty commit;
+- the branch was updated by a Git push while the file edit was in progress.
+
+Currently gitlab-shell has a boolean return code, preventing GitLab from specifying the error.
+
## Delete existing file in repository
```
diff --git a/doc/api/session.md b/doc/api/session.md
index 2e717a2ea77..47c1c8a7a49 100644
--- a/doc/api/session.md
+++ b/doc/api/session.md
@@ -8,12 +8,12 @@ POST /session
Parameters:
-+ `login` (required) - The login of user
-+ `email` (required if login missing) - The email of user
-+ `password` (required) - Valid password
+- `login` (required) - The login of user
+- `email` (required if login missing) - The email of user
+- `password` (required) - Valid password
+**You can login with both GitLab and LDAP credentials now**
-__You can login with both GitLab and LDAP credentials now__
```json
{
diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md
index 6483a73c7ec..f9637d8a6c4 100644
--- a/doc/api/system_hooks.md
+++ b/doc/api/system_hooks.md
@@ -59,7 +59,7 @@ Parameters:
## Delete system hook
-Deletes a system hook. This is an idempotent API function and returns `200 Ok` even if the hook is not available. If the hook is deleted it is also returned as JSON.
+Deletes a system hook. This is an idempotent API function and returns `200 OK` even if the hook is not available. If the hook is deleted it is also returned as JSON.
```
DELETE /hooks/:id
diff --git a/doc/api/users.md b/doc/api/users.md
index 4ddbf739774..3fdd3a75e88 100644
--- a/doc/api/users.md
+++ b/doc/api/users.md
@@ -6,7 +6,7 @@ Get a list of users.
This function takes pagination parameters `page` and `per_page` to restrict the list of users.
-### For normal users:
+### For normal users
```
GET /users
@@ -31,8 +31,7 @@ GET /users
]
```
-
-### For admins:
+### For admins
```
GET /users
@@ -84,7 +83,7 @@ GET /users
]
```
-You can search for a users by email or username with: `/users?search=John`
+You can search for users by email or username with: `/users?search=John`
Also see `def search query` in `app/models/user.rb`.
@@ -92,7 +91,7 @@ Also see `def search query` in `app/models/user.rb`.
Get a single user.
-#### For user:
+### For user
```
GET /users/:id
@@ -112,8 +111,7 @@ Parameters:
}
```
-
-#### For admin:
+### For admin
```
GET /users/:id
@@ -161,13 +159,13 @@ Parameters:
- `username` (required) - Username
- `name` (required) - Name
- `skype` (optional) - Skype ID
-- `linkedin` (optional) - Linkedin
+- `linkedin` (optional) - LinkedIn
- `twitter` (optional) - Twitter account
-- `website_url` (optional) - Website url
+- `website_url` (optional) - Website URL
- `projects_limit` (optional) - Number of projects user can create
- `extern_uid` (optional) - External UID
- `provider` (optional) - External provider name
-- `bio` (optional) - User's bio
+- `bio` (optional) - User's biography
- `admin` (optional) - User is admin - true or false (default)
- `can_create_group` (optional) - User can create groups - true or false
@@ -181,26 +179,32 @@ PUT /users/:id
Parameters:
-- `email` - Email
-- `username` - Username
-- `name` - Name
-- `password` - Password
-- `skype` - Skype ID
-- `linkedin` - Linkedin
-- `twitter` - Twitter account
-- `website_url` - Website url
-- `projects_limit` - Limit projects each user can create
-- `extern_uid` - External UID
-- `provider` - External provider name
-- `bio` - User's bio
-- `admin` (optional) - User is admin - true or false (default)
-- `can_create_group` (optional) - User can create groups - true or false
-
-Note, at the moment this method does only return a 404 error, even in cases where a 409 (Conflict) would be more appropriate, e.g. when renaming the email address to some existing one.
+- `email` - Email
+- `username` - Username
+- `name` - Name
+- `password` - Password
+- `skype` - Skype ID
+- `linkedin` - LinkedIn
+- `twitter` - Twitter account
+- `website_url` - Website URL
+- `projects_limit` - Limit projects each user can create
+- `extern_uid` - External UID
+- `provider` - External provider name
+- `bio` - User's biography
+- `admin` (optional) - User is admin - true or false (default)
+- `can_create_group` (optional) - User can create groups - true or false
+
+Note, at the moment this method does only return a 404 error,
+even in cases where a 409 (Conflict) would be more appropriate,
+e.g. when renaming the email address to some existing one.
## User deletion
-Deletes a user. Available only for administrators. This is an idempotent function, calling this function for a non-existent user id still returns a status code `200 Ok`. The JSON response differs if the user was actually deleted or not. In the former the user is returned and in the latter not.
+Deletes a user. Available only for administrators.
+This is an idempotent function, calling this function for a non-existent user id
+still returns a status code `200 OK`.
+The JSON response differs if the user was actually deleted or not.
+In the former the user is returned and in the latter not.
```
DELETE /users/:id
@@ -310,7 +314,7 @@ POST /user/keys
Parameters:
- `title` (required) - new SSH Key's title
-- `key` (required) - new SSH key
+- `key` (required) - new SSH key
## Add SSH key for user
@@ -322,15 +326,17 @@ POST /users/:id/keys
Parameters:
-- `id` (required) - id of specified user
+- `id` (required) - id of specified user
- `title` (required) - new SSH Key's title
-- `key` (required) - new SSH key
+- `key` (required) - new SSH key
Will return created key with status `201 Created` on success, or `404 Not found` on fail.
## Delete SSH key for current user
-Deletes key owned by currently authenticated user. This is an idempotent function and calling it on a key that is already deleted or not available results in `200 Ok`.
+Deletes key owned by currently authenticated user.
+This is an idempotent function and calling it on a key that is already deleted
+or not available results in `200 OK`.
```
DELETE /user/keys/:id
@@ -351,6 +357,6 @@ DELETE /users/:uid/keys/:id
Parameters:
- `uid` (required) - id of specified user
-- `id` (required) - SSH key ID
+- `id` (required) - SSH key ID
-Will return `200 Ok` on success, or `404 Not found` if either user or key cannot be found.
+Will return `200 OK` on success, or `404 Not found` if either user or key cannot be found.
diff --git a/doc/development/architecture.md b/doc/development/architecture.md
index 9d0d58b3db9..4624d9f60b6 100644
--- a/doc/development/architecture.md
+++ b/doc/development/architecture.md
@@ -22,7 +22,7 @@ To serve repositories over SSH there's an add-on application called gitlab-shell
![GitLab Diagram Overview](gitlab_diagram_overview.png)
-A typical install of GitLab will be on Ubuntu Linux or RHEL/CentOS. It uses Nginx or Apache as a web front end to proxypass the Unicorn web server. By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and precompiled assets. GitLab serves web pages and a [GitLab API](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api) using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses redis as a non-persistent database backend for job information, meta data, and incomming jobs.
+A typical install of GitLab will be on Ubuntu Linux or RHEL/CentOS. It uses Nginx or Apache as a web front end to proxypass the Unicorn web server. By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and precompiled assets. GitLab serves web pages and a [GitLab API](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api) using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses redis as a non-persistent database backend for job information, meta data, and incoming jobs.
The GitLab web app uses MySQL or PostgreSQL for persistent database information (e.g. users, permissions, issues, other meta data). GitLab stores the bare git repositories it serves in `/home/git/repositories` by default. It also keeps default branch and hook information with the bare repository. `/home/git/gitlab-satellites` keeps checked out repositories when performing actions such as a merge request, editing files in the web interface, etc.
@@ -38,7 +38,7 @@ To summarize here's the [directory structure of the `git` user home directory](.
ps aux | grep '^git'
-GitLab has several components to operate. As a system user (i.e. any user that is not the `git` user) it requires a persistent database (MySQL/PostreSQL) and redis database. It also uses Apache httpd or nginx to proxypass Unicorn. As the `git` user it starts Sidekiq and Unicorn (a simple ruby HTTP server running on port `8080` by default). Under the gitlab user there are normally 4 processes: `unicorn_rails master` (1 process), `unicorn_rails worker` (2 processes), `sidekiq` (1 process).
+GitLab has several components to operate. As a system user (i.e. any user that is not the `git` user) it requires a persistent database (MySQL/PostreSQL) and redis database. It also uses Apache httpd or nginx to proxypass Unicorn. As the `git` user it starts Sidekiq and Unicorn (a simple ruby HTTP server running on port `8080` by default). Under the GitLab user there are normally 4 processes: `unicorn_rails master` (1 process), `unicorn_rails worker` (2 processes), `sidekiq` (1 process).
### Repository access
@@ -53,28 +53,28 @@ See the README for more information.
The GitLab init script starts and stops Unicorn and Sidekiq.
```
-/etc/init.d/gitlab
+/etc/init.d/gitlab
Usage: service gitlab {start|stop|restart|reload|status}
```
Redis (key-value store/non-persistent database)
```
-/etc/init.d/redis
+/etc/init.d/redis
Usage: /etc/init.d/redis {start|stop|status|restart|condrestart|try-restart}
```
SSH daemon
```
-/etc/init.d/sshd
+/etc/init.d/sshd
Usage: /etc/init.d/sshd {start|stop|restart|reload|force-reload|condrestart|try-restart|status}
```
Web server (one of the following)
```
-/etc/init.d/httpd
+/etc/init.d/httpd
Usage: httpd {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}
$ /etc/init.d/nginx
@@ -84,7 +84,7 @@ Usage: nginx {start|stop|restart|reload|force-reload|status|configtest}
Persistent database (one of the following)
```
-/etc/init.d/mysqld
+/etc/init.d/mysqld
Usage: /etc/init.d/mysqld {start|stop|status|restart|condrestart|try-restart|reload|force-reload}
$ /etc/init.d/postgresql
diff --git a/doc/development/gitlab_diagram_overview.odg b/doc/development/gitlab_diagram_overview.odg
index b7e02f8fa78..9bfc7313ff4 100644
--- a/doc/development/gitlab_diagram_overview.odg
+++ b/doc/development/gitlab_diagram_overview.odg
Binary files differ
diff --git a/doc/development/gitlab_diagram_overview.png b/doc/development/gitlab_diagram_overview.png
index b5831cf0a4c..d9b9eed3d8f 100644
--- a/doc/development/gitlab_diagram_overview.png
+++ b/doc/development/gitlab_diagram_overview.png
Binary files differ
diff --git a/doc/development/rake_tasks.md b/doc/development/rake_tasks.md
index 9e75b3a6275..6d9ac161e91 100644
--- a/doc/development/rake_tasks.md
+++ b/doc/development/rake_tasks.md
@@ -2,7 +2,7 @@
## Setup db with developer seeds:
-Note that if your db user does not have advanced privilegies you must create db manually before run this command
+Note that if your db user does not have advanced privileges you must create the db manually before running this command.
```
bundle exec rake setup
@@ -10,7 +10,7 @@ bundle exec rake setup
## Run tests
-This runs all test suite present in GitLab
+This runs all test suites present in GitLab.
```
bundle exec rake test
@@ -18,7 +18,7 @@ bundle exec rake test
## Generate searchable docs for source code
-You can find results under `doc/code` directory
+You can find results under the `doc/code` directory.
```
bundle exec rake gitlab:generate_docs
diff --git a/doc/install/installation.md b/doc/install/installation.md
index 1b5139e8bb9..a3a456659e7 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -4,11 +4,11 @@
Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the branch (version) of GitLab you would like to install. In most cases this should be the highest numbered stable branch (example shown below).
-![capture](http://i.imgur.com/d2AlIVj.png)
+![Select latest branch](https://i.imgur.com/Lrdxk1k.png)
If the highest number stable branch is unclear please check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version.
-## Important notes
+## Important Notes
This guide is long because it covers many cases and includes all commands you need, this is [one of the few installation scripts that actually works out of the box](https://twitter.com/robinvdvleuten/status/424163226532986880).
@@ -49,7 +49,7 @@ up-to-date and install it.
Install the required packages (needed to compile Ruby and native extensions to Ruby gems):
- sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils
+ sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake
Make sure you have the right version of Git installed
@@ -69,16 +69,16 @@ Is the system packaged Git too old? Remove it and compile from source.
# Download and compile from source
cd /tmp
- curl --progress https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.gz | tar xz
+ curl -L --progress https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.gz | tar xz
cd git-2.0.0/
make prefix=/usr/local all
# Install into /usr/local/bin
sudo make prefix=/usr/local install
- # When editing config/gitlab.yml (Step 5), change the git bin_path to /usr/local/bin/git
+ # When editing config/gitlab.yml (Step 5), change the git -> bin_path to /usr/local/bin/git
-**Note:** In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 whereas Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with:
+**Note:** In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 but this [has problems](https://github.com/gitlabhq/gitlabhq/issues/4866#issuecomment-32726573) while Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with:
sudo apt-get install -y postfix
@@ -86,7 +86,7 @@ Then select 'Internet Site' and press enter to confirm the hostname.
## 2. Ruby
-The use of ruby version managers such as [RVM](http://rvm.io/), [rbenv](https://github.com/sstephenson/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production frequently leads to hard to diagnose problems. For example, GitLab Shell is called from OpenSSH and having a version manager can prevent pushing and pulling over SSH. Version managers are not supported and we stronly advise everyone to follow the instructions below to use a system ruby.
+The use of ruby version managers such as [RVM](http://rvm.io/), [rbenv](https://github.com/sstephenson/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production frequently leads to hard to diagnose problems. For example, GitLab Shell is called from OpenSSH and having a version manager can prevent pushing and pulling over SSH. Version managers are not supported and we strongly advise everyone to follow the instructions below to use a system ruby.
Remove the old Ruby 1.8 if present
@@ -95,8 +95,8 @@ Remove the old Ruby 1.8 if present
Download Ruby and compile it:
mkdir /tmp/ruby && cd /tmp/ruby
- curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz | tar xz
- cd ruby-2.0.0-p481
+ curl -L --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
+ cd ruby-2.1.2
./configure --disable-install-rdoc
make
sudo make install
@@ -107,7 +107,7 @@ Install the Bundler Gem:
## 3. System Users
-Create a `git` user for Gitlab:
+Create a `git` user for GitLab:
sudo adduser --disabled-login --gecos 'GitLab' git
@@ -116,7 +116,7 @@ Create a `git` user for Gitlab:
We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). *Note*: because we need to make use of extensions you need at least pgsql 9.1.
# Install the database packages
- sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev
+ sudo apt-get install -y postgresql postgresql-client libpq-dev
# Login to PostgreSQL
sudo -u postgres psql -d template1
@@ -141,26 +141,19 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
### Clone the Source
# Clone GitLab repository
- sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-0-stable gitlab
+ sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-2-stable gitlab
- # Go to gitlab dir
- cd /home/git/gitlab
-
-**Note:** You can change `7-0-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server!
+**Note:** You can change `7-2-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server!
-### Configure it
+### Configure It
+ # Go to GitLab installation folder
cd /home/git/gitlab
# Copy the example GitLab config
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
- # Make sure to change "localhost" to the fully-qualified domain name of your
- # host serving GitLab where necessary
- #
- # If you want to use https make sure that you set `https` to `true`. See #using-https for all necessary details.
- #
- # If you installed Git from source, change the git bin_path to /usr/local/bin/git
+ # Update GitLab config file, follow the directions at top of file
sudo -u git -H editor config/gitlab.yml
# Make sure GitLab can write to the log/ and tmp/ directories
@@ -198,7 +191,9 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
**Important Note:** Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
-### Configure GitLab DB settings
+**Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps.
+
+### Configure GitLab DB Settings
# PostgreSQL only:
sudo -u git cp config/database.yml.postgresql config/database.yml
@@ -222,34 +217,24 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
**Note:** As of bundler 1.5.2, you can invoke `bundle install -jN` (where `N` the number of your processor cores) and enjoy the parallel gems installation with measurable difference in completion time (~60% faster). Check the number of your cores with `nproc`. For more information check this [post](http://robots.thoughtbot.com/parallel-gem-installing-using-bundler). First make sure you have bundler >= 1.5.2 (run `bundle -v`) as it addresses some [issues](https://devcenter.heroku.com/changelog-items/411) that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2.
- cd /home/git/gitlab
-
# For PostgreSQL (note, the option says "without ... mysql")
sudo -u git -H bundle install --deployment --without development test mysql aws
# Or if you use MySQL (note, the option says "without ... postgres")
sudo -u git -H bundle install --deployment --without development test postgres aws
-### Install GitLab shell
-
-GitLab Shell is an ssh access and repository management software developed specially for GitLab.
+### Install GitLab Shell
- # Go to the Gitlab installation folder:
- cd /home/git/gitlab
+GitLab Shell is an SSH access and repository management software developed specially for GitLab.
# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
- sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.6] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
-
- # By default, the gitlab-shell config is generated from your main gitlab config.
- #
- # Note: When using GitLab with HTTPS please change the following:
- # - Provide paths to the certificates under `ca_file` and `ca_path options.
- # - The `gitlab_url` option must point to the https endpoint of GitLab.
- # - In case you are using self signed certificate set `self_signed_cert` to `true`.
- # See #using-https for all necessary details.
- #
+ sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.7] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
+
+ # By default, the gitlab-shell config is generated from your main GitLab config.
# You can review (and modify) the gitlab-shell config as follows:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
+
+**Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps.
### Initialize Database and Activate Advanced Features
@@ -261,7 +246,7 @@ GitLab Shell is an ssh access and repository management software developed speci
### Install Init Script
-Download the init script (will be /etc/init.d/gitlab):
+Download the init script (will be `/etc/init.d/gitlab`):
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
@@ -269,13 +254,13 @@ And if you are installing with a non-default folder or user copy and edit the de
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
-If you installed gitlab in another directory or as a user other than the default you should change these settings in /etc/default/gitlab. Do not edit /etc/init.d/gitlab as it will be changed on upgrade.
+If you installed GitLab in another directory or as a user other than the default you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab` as it will be changed on upgrade.
Make GitLab start on boot:
sudo update-rc.d gitlab defaults 21
-### Set up logrotate
+### Setup Logrotate
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
@@ -285,7 +270,7 @@ Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
-### Compile assets
+### Compile Assets
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
@@ -300,6 +285,7 @@ Check if GitLab and its environment are configured correctly:
**Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/).
### Installation
+
sudo apt-get install -y nginx
### Site Configuration
@@ -315,7 +301,15 @@ Make sure to edit the config file to match your setup:
# domain name of your host serving GitLab.
sudo editor /etc/nginx/sites-available/gitlab
-**Note:** If you want to use https, replace the `gitlab` nginx config with `gitlab-ssl`. See [Using HTTPS](#using-https) for all necessary details.
+**Note:** If you want to use HTTPS, replace the `gitlab` Nginx config with `gitlab-ssl`. See [Using HTTPS](#using-https) for HTTPS configuration details.
+
+### Test Configuration
+
+Validate your `gitlab` or `gitlab-ssl` Nginx config file with the following command:
+
+ sudo nginx -t
+
+You should receive `syntax is okay` and `test is successful` messages. If you receive errors check your `gitlab` or `gitlab-ssl` Nginx config file for typos, etc. as indiciated in the error message given.
### Restart
@@ -331,6 +325,8 @@ To make sure you didn't miss anything run a more thorough check with:
If all items are green, then congratulations on successfully installing GitLab!
+NOTE: Supply `SANITIZE=true` environment variable to `gitlab:check` to omit project names from the output of the check command.
+
### Initial Login
Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has created an admin account for you. You can use it to log in:
@@ -346,13 +342,32 @@ Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has
### Using HTTPS
-To recapitulate what is needed to use GitLab with HTTPS:
-
-1. In `gitlab.yml` set the `https` option to `true`
-1. In the `config.yml` of gitlab-shell set the relevant options (see the [install GitLab Shell section](#install-gitlab-shell) of this document).
-1. Use the `gitlab-ssl` nginx example config instead of the `gitlab` config.
-
-### Additional markup styles
+To use GitLab with HTTPS:
+
+1. In `gitlab.yml`:
+ 1. Set the `port` option in section 1 to `443`.
+ 1. Set the `https` option in section 1 to `true`.
+1. In the `config.yml` of gitlab-shell:
+ 1. Set `gitlab_url` option to the HTTPS endpoint of GitLab (e.g. `https://git.example.com`).
+ 1. Set the certificates using either the `ca_file` or `ca_path` option.
+1. Use the `gitlab-ssl` Nginx example config instead of the `gitlab` config.
+ 1. Update `YOUR_SERVER_FQDN`.
+ 1. Update `ssl_certificate` and `ssl_certificate_key`.
+ 1. Review the configuration file and consider applying other security and performance enhancing features.
+
+Using a self-signed certificate is discouraged but if you must use it follow the normal directions then:
+ 1. Generate a self-signed SSL certificate:
+
+ ```
+ mkdir -p /etc/nginx/ssl/
+ cd /etc/nginx/ssl/
+ sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
+ sudo chmod o-r gitlab.key
+ ```
+
+ 1. In the `config.yml` of gitlab-shell set `self_signed_cert` to `true`.
+
+### Additional Markup Styles
Apart from the always supported markdown style there are other rich text files that GitLab can display. But you might have to install a dependency to do so. Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information.
@@ -370,7 +385,7 @@ If you want to connect the Redis server via socket, then use the "unix:" URL sch
### Custom SSH Connection
-If you are running SSH on a non-standard port, you must change the gitlab user's SSH config.
+If you are running SSH on a non-standard port, you must change the GitLab user's SSH config.
# Add to /home/git/.ssh/config
host localhost # Give your setup a name (here: override localhost)
@@ -378,11 +393,11 @@ If you are running SSH on a non-standard port, you must change the gitlab user's
port 2222 # Your port number
hostname 127.0.0.1; # Your server name or IP
-You also need to change the corresponding options (e.g. ssh_user, ssh_host, admin_uri) in the `config\gitlab.yml` file.
+You also need to change the corresponding options (e.g. `ssh_user`, `ssh_host`, `admin_uri`) in the `config\gitlab.yml` file.
-### LDAP authentication
+### LDAP Authentication
-You can configure LDAP authentication in config/gitlab.yml. Please restart GitLab after editing this file.
+You can configure LDAP authentication in `config/gitlab.yml`. Please restart GitLab after editing this file.
### Using Custom Omniauth Providers
@@ -412,7 +427,7 @@ These steps are fairly general and you will need to figure out the exact details
- Start GitLab:
- `sudo service gitlab start`
+ sudo service gitlab start
#### Examples
@@ -420,4 +435,4 @@ If you have successfully set up a provider that is not shipped with GitLab itsel
You can help others by reporting successful configurations and probably share a few insights or provide warnings for common errors or pitfalls by sharing your experience [in the public Wiki](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Custom-omniauth-provider-configurations).
-While we can't officially support every possible auth mechanism out there, we'd like to at least help those with special needs.
+While we can't officially support every possible authentication mechanism out there, we'd like to at least help those with special needs.
diff --git a/doc/install/requirements.md b/doc/install/requirements.md
index 9f7c03badcf..fd2e29d3c52 100644
--- a/doc/install/requirements.md
+++ b/doc/install/requirements.md
@@ -2,54 +2,45 @@
## Operating Systems
-GitLab is developed for the Linux operating system. For the installations options and instructions please see [the installation section of the readme](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/README.md#installation).
-
-### Supported Linux distributions
+### Supported Unix distributions
- Ubuntu
- Debian
- CentOS
-- RedHat Enterprise Linux
-- Scientific Linux
-- Oracle Linux
+- RedHat Enterprise Linux (please use the CentOS packages and instructions)
+- Scientific Linux (please use the CentOS packages and instructions)
+- Oracle Linux (please use the CentOS packages and instructions)
+
+For the installations options please see [the installation page on the GitLab website](https://about.gitlab.com/installation/).
-### Unsupported Linux distributions
+### Unsupported Unix distributions
+- OS X
- Arch Linux
- Fedora
- Gentoo
+- FreeBSD
-But on the above unsupported distributions is still possible to install GitLab yourself with the [manual installation guide](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md).
-
-### Unsupported Unix operating systems
-
-There is nothing that prevents GitLab from running on other Unix operating systems.
+On the above unsupported distributions is still possible to install GitLab yourself.
+Please see the [manual installation guide](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md) and the [unofficial installation guides](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Unofficial-Installation-Guides) on the public wiki for more information.
-This means you may get it to work on systems running FreeBSD or OS X.
-
-If you want to do this, please be aware it could be a lot of work.
-
-Please consider using a virtual machine to run GitLab.
-
-### Other operating systems such as Windows
+### Non Unix operating systems such as Windows
+GitLab is developed for Unix operating systems.
GitLab does **not** run on Windows and we have no plans of supporting it in the near future.
-
Please consider using a virtual machine to run GitLab.
## Ruby versions
GitLab requires Ruby (MRI) 2.0 or 2.1
-
You will have to use the standard MRI implementation of Ruby.
-
We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab needs several Gems that have native extensions.
## Hardware requirements
### CPU
-- 1 core works supports up to 100 users but the application will not be responsive
+- 1 core works supports up to 100 users but the application can be a bit slower due to having all workers and background jobs running on the same core
- **2 cores** is the **recommended** number of cores and supports up to 500 users
- 4 cores supports up to 2,000 users
- 8 cores supports up to 5,000 users
@@ -60,17 +51,19 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab
### Memory
- 512MB is the absolute minimum but we do not recommend this amount of memory.
-You will either need to configure a minimum swap of 256MB and this will only allow you to run one slow unicorn worker.
-One unicorn worker will cause only git ssh access to work because the git http access requires two running workers.
-It requires one worker to receive the user request and one worker for the authorization check.
-Or if you use SSD you can configure 2GB of swap to use two Unicorn workers and have slow operation with http access.
-- 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates configuring swap space)
-- **2GB** is the **recommended** memory size and supports up to 500 users
-- 4GB supports up to 2,000 users
-- 8GB supports up to 5,000 users
-- 16GB supports up to 10,000 users
-- 32GB supports up to 20,000 users
-- 64GB supports up to 40,000 users
+You will either need to configure 512MB or 1.5GB of swap space.
+With 512MB of swap space you must configure only one unicorn worker.
+With one unicorn worker only git over ssh access will work because the git over http access requires two running workers (one worker to receive the user request and one worker for the authorization check).
+If you use SSD storage and configure 1.5GB of swap space you can use two Unicorn workers, this will allow http access but it will still be slow.
+- 1GB RAM + 1GB swap supports up to 100 users
+- **2GB RAM** is the **recommended** memory size and supports up to 500 users
+- 4GB RAM supports up to 2,000 users
+- 8GB RAM supports up to 5,000 users
+- 16GB RAM supports up to 10,000 users
+- 32GB RAM supports up to 20,000 users
+- 64GB RAM supports up to 40,000 users
+
+Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application.
### Storage
@@ -84,7 +77,15 @@ If you have enough RAM memory and a recent CPU the speed of GitLab is mainly lim
## Database
-If you want to run the database separately, the **recommended** database size is **1 MB per user**
+If you want to run the database separately, the **recommended** database size is **1 MB per user**.
+
+## Redis and Sidekiq
+
+Redis stores all user sessions and the background task queue.
+The storage requirements for Redis are minimal, about 25kB per user.
+Sidekiq processes the background jobs with a multithreaded process.
+This process starts with the entire Rails stack (200MB+) but it can grow over time due to memory leaks.
+On a very active server (10.000 active users) the Sidekiq process can use 1GB+ of memory.
## Supported webbrowsers
diff --git a/doc/install/structure.md b/doc/install/structure.md
index 67ca1895374..5c03f073c18 100644
--- a/doc/install/structure.md
+++ b/doc/install/structure.md
@@ -13,9 +13,9 @@ This is the directory structure you will end up with following the instructions
* `/home/git/.ssh` - contains openssh settings. Specifically the `authorized_keys` file managed by gitlab-shell.
* `/home/git/gitlab` - GitLab core software.
* `/home/git/gitlab-satellites` - checked out repositories for merge requests and file editing from web UI. This can be treated as a temporary files directory.
-* `/home/git/gitlab-shell` - Core add-on component of gitlab. Maintains SSH cloning and other functionality.
+* `/home/git/gitlab-shell` - Core add-on component of GitLab. Maintains SSH cloning and other functionality.
* `/home/git/repositories` - bare repositories for all projects organized by namespace. This is where the git repositories which are pushed/pulled are maintained for all projects. **This area is critical data for projects. [Keep a backup](../raketasks/backup_restore.md)**
-*Note: the default locations for gitlab-satellites and repositories can be configured in `config/gitlab.yml` of gitlab and `config.yml` of gitlab-shell.*
+*Note: the default locations for gitlab-satellites and repositories can be configured in `config/gitlab.yml` of GitLab and `config.yml` of gitlab-shell.*
To see a more in-depth overview see the [GitLab architecture doc](../development/architecture.md).
diff --git a/doc/integration/README.md b/doc/integration/README.md
index 00c73afd872..357ed038314 100644
--- a/doc/integration/README.md
+++ b/doc/integration/README.md
@@ -10,3 +10,12 @@ See the documentation below for details on how to configure these services.
- [Slack](slack.md) Integrate with the Slack chat service
Jenkins support is [available in GitLab EE](http://doc.gitlab.com/ee/integration/jenkins.html).
+
+## Project services
+
+Integration with services such as Campfire, Flowdock, Gemnasium, HipChat, PivotalTracker and Slack are available in the from of a Project Service.
+You can find these within GitLab in the Services page under Project Settings if you are at least a master on the project.
+Project Services are a bit like plugins in that they allow a lot of freedom in adding functionality to GitLab, for example there is also a service that can send an email every time someone pushes new commits.
+Because GitLab is open source we can ship with the code and tests for all plugins.
+This allows the community to keep the plugins up to date so that they always work in newer GitLab versions.
+For an overview of what projects services are available without logging in please see the [project_services directory](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/app/models/project_services).
diff --git a/doc/integration/github.md b/doc/integration/github.md
index b53a7c12857..714593d8266 100644
--- a/doc/integration/github.md
+++ b/doc/integration/github.md
@@ -37,7 +37,7 @@ To enable the GitHub OmniAuth provider you must register your application with G
args: { scope: 'user:email' } }
```
-1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
+1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
1. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7.
diff --git a/doc/integration/google.md b/doc/integration/google.md
index 3cf546bd77e..7a78aff8ea4 100644
--- a/doc/integration/google.md
+++ b/doc/integration/google.md
@@ -2,17 +2,21 @@
To enable the Google OAuth2 OmniAuth provider you must register your application with Google. Google will generate a client ID and secret key for you to use.
-1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab.
+1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab.
1. Select "Create Project".
1. Provide the project information
- - Project name: 'GitLab' works just fine here.
+ - Project name: 'GitLab' works just fine here.
- Project ID: Must be unique to all Google Developer registered applications. Google provides a randomly generated Project ID by default. You can use the randomly generated ID or choose a new one.
1. Refresh the page. You should now see your new project in the list. Click on the project.
1. Select "APIs & auth" in the left menu.
+1. Select "APIs" in the submenu.
+ - Enable `Contacts API`
+ - Enable `Google+ API`
+
1. Select "Credentials" in the submenu.
1. Select "Create New Client ID".
@@ -41,7 +45,7 @@ To enable the Google OAuth2 OmniAuth provider you must register your application
args: { access_type: 'offline', approval_prompt: '' } }
```
-1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
+1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
1. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7.
@@ -51,12 +55,12 @@ To enable the Google OAuth2 OmniAuth provider you must register your application
On the sign in page there should now be a Google icon below the regular sign in form. Click the icon to begin the authentication process. Google will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in.
-## Further Configuration
+## Further Configuration
This further configuration is not required for Google authentication to function but it is strongly recommended. Taking these steps will increase usability for users by providing a little more recognition and branding.
At this point, when users first try to authenticate to your GitLab installation with Google they will see a generic application name on the prompt screen. The prompt informs the user that "Project Default Service Account" would like to access their account. "Project Default Service Account" isn't very recognizable and may confuse or cause users to be concerned. This is easily changeable.
1. Select 'Consent screen' in the left menu. (See steps 1, 4 and 5 above for instructions on how to get here if you closed your window).
-1. Scroll down until you find "Product Name". Change the product name to something more descriptive.
+1. Scroll down until you find "Product Name". Change the product name to something more descriptive.
1. Add any additional information as you wish - homepage, logo, privacy policy, etc. None of this is required, but it may help your users.
diff --git a/doc/markdown/markdown.md b/doc/markdown/markdown.md
index 64f571b4351..5627fd0659f 100644
--- a/doc/markdown/markdown.md
+++ b/doc/markdown/markdown.md
@@ -4,39 +4,25 @@
**[GitLab Flavored Markdown](#gitlab-flavored-markdown-gfm)**
-[Newlines](#newlines)
-
-[Multiple underscores in words](#multiple-underscores-in-words)
-
-[URL autolinking](#url-autolinking)
-
-[Code and Syntax Highlighting](#code-and-syntax-highlighting)
-
-[Emoji](#emoji)
-
-[Special GitLab references](#special-gitlab-references)
+* [Newlines](#newlines)
+* [Multiple underscores in words](#multiple-underscores-in-words)
+* [URL autolinking](#url-autolinking)
+* [Code and Syntax Highlighting](#code-and-syntax-highlighting)
+* [Emoji](#emoji)
+* [Special GitLab references](#special-gitlab-references)
**[Standard Markdown](#standard-markdown)**
-[Headers](#headers)
-
-[Emphasis](#emphasis)
-
-[Lists](#lists)
-
-[Links](#links)
-
-[Images](#images)
-
-[Blockquotes](#blockquotes)
-
-[Inline HTML](#inline-html)
-
-[Horizontal Rule](#horizontal-rule)
-
-[Line Breaks](#line-breaks)
-
-[Tables](#tables)
+* [Headers](#headers)
+* [Emphasis](#emphasis)
+* [Lists](#lists)
+* [Links](#links)
+* [Images](#images)
+* [Blockquotes](#blockquotes)
+* [Inline HTML](#inline-html)
+* [Horizontal Rule](#horizontal-rule)
+* [Line Breaks](#line-breaks)
+* [Tables](#tables)
**[References](#references)**
@@ -153,37 +139,38 @@ But let's throw in a <b>tag</b>.
## Emoji
- Sometimes you want to be :cool: and add some :sparkles: to your :speech_balloon:. Well we have a :gift: for you:
+ Sometimes you want to be a :ninja: and add some :glowing_star: to your :speech_balloon:. Well we have a gift for you:
- :exclamation: You can use emoji anywhere GFM is supported. :sunglasses:
+ :high_voltage_sign: You can use emoji anywhere GFM is supported. :victory_hand:
- You can use it to point out a :bug: or warn about :monkey:patches. And if someone improves your really :snail: code, send them a :bouquet: or some :candy:. People will :heart: you for that.
+ You can use it to point out a :bug: or warn about :speak_no_evil_monkey: patches. And if someone improves your really :snail: code, send them some :cake:. People will :heart: you for that.
- If you are :new: to this, don't be :fearful:. You can easily join the emoji :circus_tent:. All you need to do is to :book: up on the supported codes.
+ If you are new to this, don't be :fearful_face:. You can easily join the emoji :family:. All you need to do is to look up on the supported codes.
- Consult the [Emoji Cheat Sheet](http://www.emoji-cheat-sheet.com/) for a list of all supported emoji codes. :thumbsup:
+ Consult the [Emoji Cheat Sheet](https://www.dropbox.com/s/b9xaqb977s6d8w1/cheat_sheet.pdf) for a list of all supported emoji codes. :thumbsup:
-Sometimes you want to be :cool: and add some :sparkles: to your :speech_balloon:. Well we have a :gift: for you:
+Sometimes you want to be a :ninja: and add some :glowing_star: to your :speech_balloon:. Well we have a gift for you:
-:exclamation: You can use emoji anywhere GFM is supported. :sunglasses:
+:high_voltage_sign: You can use emoji anywhere GFM is supported. :victory_hand:
-You can use it to point out a :bug: or warn about :monkey:patches. And if someone improves your really :snail: code, send them a :bouquet: or some :candy:. People will :heart: you for that.
+You can use it to point out a :bug: or warn about :speak_no_evil_monkey: patches. And if someone improves your really :snail: code, send them some :cake:. People will :heart: you for that.
-If you are :new: to this, don't be :fearful:. You can easily join the emoji :circus_tent:. All you need to do is to :book: up on the supported codes.
+If you are new to this, don't be :fearful_face:. You can easily join the emoji :family:. All you need to do is to look up on the supported codes.
-Consult the [Emoji Cheat Sheet](http://www.emoji-cheat-sheet.com/) for a list of all supported emoji codes. :thumbsup:
+Consult the [Emoji Cheat Sheet](https://www.dropbox.com/s/b9xaqb977s6d8w1/cheat_sheet.pdf) for a list of all supported emoji codes. :thumbsup:
## Special GitLab References
GFM recognized special references.
-You can easily reference e.g. a team member, an issue, or a commit within a project.
+You can easily reference e.g. an issue, a commit, a team member or even the whole team within a project.
GFM will turn that reference into a link so you can navigate between them easily.
GFM will recognize the following:
- @foo : for team members
+- @all : for the whole team
- #123 : for issues
- !123 : for merge requests
- $123 : for snippets
diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md
index e01b02212b6..db22b7dbe56 100644
--- a/doc/permissions/permissions.md
+++ b/doc/permissions/permissions.md
@@ -23,6 +23,8 @@ If a user is a GitLab administrator they receive all permissions.
| Add tags | | | ✓ | ✓ | ✓ |
| Write a wiki | | | ✓ | ✓ | ✓ |
| Manage issue tracker | | | ✓ | ✓ | ✓ |
+| Manage labels | | | ✓ | ✓ | ✓ |
+| Create new milestones | | | | ✓ | ✓ |
| Add new team members | | | | ✓ | ✓ |
| Push to protected branches | | | | ✓ | ✓ |
| Enable/Disable branch protection | | | | ✓ | ✓ |
diff --git a/doc/public_access/public_access.md b/doc/public_access/public_access.md
index 493e59af225..4712c387021 100644
--- a/doc/public_access/public_access.md
+++ b/doc/public_access/public_access.md
@@ -1,6 +1,6 @@
# Public access
-Gitlab allows you to open selected projects to be accessed **publicly** or **internally**.
+GitLab allows you to open selected projects to be accessed **publicly** or **internally**.
Projects with either of these visibility levels will be listed in the [public access directory](/public).
@@ -12,7 +12,7 @@ Public projects can be cloned **without any** authentication.
It will also be listed on the [public access directory](/public).
-**Any logged in user** will have [Guest](/help/permissions) permissions on the repository.
+**Any logged in user** will have [Guest](../permissions/permissions) permissions on the repository.
## Internal projects
@@ -20,7 +20,7 @@ Internal projects can be cloned by any logged in user.
It will also be listed on the [public access directory](/public) for logged in users.
-Any logged in user will have [Guest](/help/permissions) permissions on the repository.
+Any logged in user will have [Guest](../permissions/permissions) permissions on the repository.
## How to change project visibility
diff --git a/doc/raketasks/backup_hrz.png b/doc/raketasks/backup_hrz.png
new file mode 100644
index 00000000000..03e50df1d76
--- /dev/null
+++ b/doc/raketasks/backup_hrz.png
Binary files differ
diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md
index 00ce6ed27c2..8200a8cf630 100644
--- a/doc/raketasks/backup_restore.md
+++ b/doc/raketasks/backup_restore.md
@@ -1,8 +1,11 @@
# Backup restore
+![backup banner](backup_hrz.png)
+
## Create a backup of the GitLab system
-Creates a backup archive of the database and all repositories. This archive will be saved in backup_path (see `config/gitlab.yml`).
+A backup creates an archive file that contains the database, all repositories and all attachments.
+This archive will be saved in backup_path (see `config/gitlab.yml`).
The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup.
@@ -43,6 +46,13 @@ Deleting tmp directories...[DONE]
Deleting old backups... [SKIPPING]
```
+## Storing configuration files
+
+Please be informed that a backup does not store your configuration files.
+If you use Omnibus-GitLab please see the [instructions in the readme to backup your configuration](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#backup-and-restore-omnibus-gitlab-configuration).
+If you have a cookbook installation there should be a copy of your configuration in Chef.
+If you have a manual installation please consider backing up your gitlab.yml file and any SSL keys and certificates.
+
## Restore a previously created backup
```
diff --git a/doc/raketasks/features.md b/doc/raketasks/features.md
index eaa9af5f962..99b3d5525b0 100644
--- a/doc/raketasks/features.md
+++ b/doc/raketasks/features.md
@@ -18,21 +18,3 @@ New path: `git@example.org:username/myrepo.git` or `git@example.org:groupname/my
```
bundle exec rake gitlab:enable_namespaces RAILS_ENV=production
```
-
-## Rebuild project satellites
-
-This command will build missing satellites for projects. After this you will be able to **merge a merge request** via GitLab and use the **online editor**.
-
-```
-bundle exec rake gitlab:satellites:create RAILS_ENV=production
-```
-
-Example output:
-
-```
-Creating satellite for abcd.git
-[git clone output]
-Creating satellite for abcd2.git
-[git clone output]
-done
-```
diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md
index 3339dfb03ac..f6bd7565799 100644
--- a/doc/raketasks/maintenance.md
+++ b/doc/raketasks/maintenance.md
@@ -63,6 +63,8 @@ sudo gitlab-rake gitlab:check
bundle exec rake gitlab:check RAILS_ENV=production
```
+NOTE: Use SANITIZE=true for gitlab:check if you want to omit project names from the output.
+
Example output:
```
@@ -109,12 +111,14 @@ Redis version >= 2.0.0? ... yes
Checking GitLab ... Finished
```
-## (Re-)Create satellite repos
+## (Re-)Create satellite repositories
-This will create satellite repos for all your projects.
+This will create satellite repositories for all your projects.
-If necessary, remove the `tmp/repo_satellites` directory and rerun the command below.
+If necessary, remove the `repo_satellites` directory and rerun the commands below.
```
-bundle exec rake gitlab:satellites:create RAILS_ENV=production
+sudo -u git -H mkdir -p /home/git/gitlab-satellites
+sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production
+sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
```
diff --git a/doc/raketasks/web_hooks.md b/doc/raketasks/web_hooks.md
index ac32c01289d..e1a58835d88 100644
--- a/doc/raketasks/web_hooks.md
+++ b/doc/raketasks/web_hooks.md
@@ -5,41 +5,41 @@
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook"
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook"
+ bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" RAILS_ENV=production
## Add a web hook for projects in a given **NAMESPACE**:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme
+ bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme RAILS_ENV=production
## Remove a web hook from **ALL** projects using:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook"
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook"
+ bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" RAILS_ENV=production
## Remove a web hook from projects in a given **NAMESPACE**:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme
+ bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme RAILS_ENV=production
## List **ALL** web hooks:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:list
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:list
+ bundle exec rake gitlab:web_hook:list RAILS_ENV=production
## List the web hooks from projects in a given **NAMESPACE**:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:list NAMESPACE=/
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:list NAMESPACE=/
+ bundle exec rake gitlab:web_hook:list NAMESPACE=/ RAILS_ENV=production
> Note: `/` is the global namespace.
diff --git a/doc/release/monthly.md b/doc/release/monthly.md
index 22824016f26..2e19fc50890 100644
--- a/doc/release/monthly.md
+++ b/doc/release/monthly.md
@@ -14,28 +14,68 @@ A release manager is selected that coordinates the entire release of this versio
Any changes not yet added to the changelog are added by lead developer and in that merge request the complete team is asked if there is anything missing.
-# **18th - Releasing RC1**
+### **4. Create an overall issue**
-The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub.
+```
+15th:
+
+* Update the changelog (#LINK)
+* Triage the omnibus-gitlab milestone
+
+16th:
+
+* Merge CE in to EE (#LINK)
+* Close the omnibus-gitlab milestone
+
+17th:
+
+* Create x.x.0.rc1 (#LINK)
+
+18th:
+
+* Update GitLab.com with rc1 (#LINK)
+* Regression issue and tweet about rc1 (#LINK)
+* Start blog post (#LINK)
+
+21th:
+
+* Do QA and fix anything coming out of it (#LINK)
+
+22nd:
+
+* Release CE and EE (#LINK)
-### **1. Create an issue for RC1 release**
+23rd:
-Consider naming the issue "Release x.x.x.rc1" to make it easier for later searches.
+* Prepare package for GitLab.com release (#LINK)
-### **2. Update the installation guide**
+24th:
+
+* Deploy to GitLab.com (#LINK)
+```
+
+# **16th - Merge the CE into EE**
+
+Do this via a merge request.
+
+# **17th - Create RC1**
+
+The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub.
+
+### **1. Update the installation guide**
1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay)
1. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782)
1. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794)
1. There might be other changes. Ask around.
-### **3. Create an update guides**
+### **2. Create an update guides**
1. Create: CE update guide from previous version. Like `from-6-8-to-6.9`
1. Create: CE to EE update guide in EE repository for latest version.
-1. Update: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.0-to-6.x.md to latest version.
+1. Update: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.0-to-6.x.md to latest version.
-It's best to copy paste the previous guide and make changes where necessary.
+It's best to copy paste the previous guide and make changes where necessary.
The typical steps are listed below with any points you should specifically look at.
#### 0. Any major changes?
@@ -81,7 +121,7 @@ Check if the `init.d/gitlab` script changed since last release: <https://gitlab.
#### 10. Check application status
-### **4. Code quality indicators**
+### **3. Code quality indicators**
Make sure the code quality indicators are green / good.
@@ -95,11 +135,11 @@ Make sure the code quality indicators are green / good.
- [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq)
-### **5. Set VERSION**
+### **4. Set VERSION**
Change version in VERSION to `x.x.0.rc1`.
-### **6. Tag**
+### **5. Tag**
Create an annotated tag that points to the version change commit:
@@ -107,20 +147,28 @@ Create an annotated tag that points to the version change commit:
git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1'
```
-### **7. Tweet**
-
-Tweet about the RC release:
+# **18th - Release RC1**
-> GitLab x.x.x.rc1 is out. This is a release candidate intended for testing only. Please let us know if you find regressions.
+### **1. Update GitLab.com**
-n
-### **8. Update GitLab.com**
+Merge the RC1 EE code into GitLab.com.
+Once the build is green, create a package.
+If there are big database migrations consider testing them with the production db on a VM.
+Try to deploy in the morning.
+It is important to do this as soon as possible, so we can catch any errors before we release the full version.
-Merge the RC1 code into GitLab.com. Once the build is green, deploy in the morning.
+### **2. Prepare the blog post**
-It is important to do this as soon as possible, so we can catch any errors before we release the full version.
+- Start with a complete copy of the [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) and fill it out.
+- Check the changelog of CE and EE for important changes.
+- Create a WIP MR for the blog post
+- Ask Dmitriy to add screenshots to the WIP MR.
+- Decide with team who will be the MVP user.
+- Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible.
+- Assign to one reviewer who will fix spelling issues by editing the branch (can use the online editor)
+- After the reviewer is finished the whole team will be mentioned to give their suggestions via line comments
-### **9. Create a regressions issue**
+### **3. Create a regressions issue**
On [the GitLab CE issue tracker on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/issues/) create an issue titled "GitLab X.X regressions" add the following text:
@@ -131,17 +179,19 @@ The release manager will comment here about the plans for patch releases.
Assign the issue to the release manager and /cc all the core-team members active on the issue tracker. If there are any known bugs in the release add them immediately.
-# **21st - Preparation **
+### **4. Tweet**
-### **1. Prepare the blog post**
+Tweet about the RC release:
-- Check the changelog of CE and EE for important changes. Based on [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) fill in the important information.
-- Create a WIP MR for the blog post and cc the team so everyone can give feedback.
-- Ask Dmitriy to add screenshots to the WIP MR.
-- Decide with team who will be the MVP user.
-- Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible.
+> GitLab x.x.0.rc1 is out. This release candidate is only suitable for testing. Please link regressions issues from LINK_TO_REGRESSION_ISSUE
-### **2. Q&A**
+# **21st - Preparation**
+
+### **1. Pre QA merge**
+
+Merge CE into EE before doing the QA.
+
+### **2. QA**
Create issue on dev.gitlab.org `gitlab` repository, named "GitLab X.X release" in order to keep track of the progress.
@@ -161,7 +211,16 @@ For GitLab EE, append `-ee` to the branches and tags.
`v.x.x.0-ee`
-### **1. Create x-x-stable branch and push to the repositories**
+Note: Merge CE into EE if needed.
+
+### **1. Set VERSION to x.x.x and push**
+
+- Change the GITLAB_SHELL_VERSION file in `master` of the CE repository if the version changed.
+- Change the GITLAB_SHELL_VERSION file in `master` of the EE repository if the version changed.
+- Change the VERSION file in `master` branch of the CE repository and commit and push.
+- Change the VERSION file in `master` branch of the EE repository and commit and push.
+
+### **2. Create x-x-stable branch and push to the repositories**
```
git checkout master
@@ -170,21 +229,7 @@ git checkout -b x-x-stable
git push <remote> x-x-stable
```
-### **2. Build the Omnibus packages**
-
-[Follow this guide](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md)
-
-### **3. Set VERSION to x.x.x and push**
-
-Change the GITLAB_SHELL_VERSION file in `master` of the CE repository if the version changed.
-
-Change the GITLAB_SHELL_VERSION file in `master` of the EE repository if the version changed.
-
-Change the VERSION file in `master` branch of the CE repository and commit. Cherry-pick into the `x-x-stable` branch of CE.
-
-Change the VERSION file in `master` branch of the EE repository and commit. Cherry-pick into the `x-x-stable-ee` branch of EE.
-
-### **4. Create annotated tag vx.x.x**
+### **3. Create annotated tag vx.x.x**
In `x-x-stable` branch check for the SHA-1 of the commit with VERSION file changed. Tag that commit,
@@ -194,12 +239,17 @@ git tag -a vx.x.0 -m 'Version x.x.0' xxxxx
where `xxxxx` is SHA-1.
-### **5. Push the tag**
+### **4. Push the tag**
```
git push origin vx.x.0
```
+### **5. Build the Omnibus packages**
+
+Follow the [release doc in the Omnibus repository](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md).
+This can happen before tagging because Omnibus uses tags in its own repo and SHA1's to refer to the GitLab codebase.
+
### **6. Push to remotes**
For GitLab CE, push to dev, GitLab.com and GitHub.
@@ -208,27 +258,29 @@ For GitLab EE, push to the subscribers repo.
Make sure the branch is marked 'protected' on each of the remotes you pushed to.
-NOTE: You might not have the rights to push to master on dev. Ask Dmitriy.
-
### **7. Publish blog for new release**
Merge the [blog merge request](#1-prepare-the-blog-post) in `www-gitlab-com` repository.
### **8. Tweet to blog**
-Send out a tweet to share the good news with the world. List the features in short and link to the blog post.
+Send out a tweet to share the good news with the world.
+List the most important features and link to the blog post.
-Proposed tweet for CE "GitLab X.X.X CE is released! It brings *** <link-to-blogpost>"
+Proposed tweet for CE "GitLab X.X is released! It brings *** <link-to-blogpost>"
-Proposed tweet for EE "GitLab X.X.X EE is released! It brings *** <link-to-blogpost>"
+### **9. Send out the newsletter**
-### **9. Send out newsletter**
+Send out an email to the 'GitLab Newsletter' mailing list on MailChimp.
+Replicate the former release newsletter and modify it accordingly.
+Include a link to the blog post and keep it short.
-In MailChimp replicate the former release newsletters to customers / newsletter subscribers (these are two separate things) and modify them accordingly.
+Proposed email text:
+"We have released a new version of GitLab. See our blog post(<link>) for more information."
-Include a link to the blog post and keep it short.
+### **10. Update installation.md**
-Proposed email for CE: "We have released a new version of GitLab Community Edition and its packages. See our blog post(<link>) for more information."
+Update [installation.md](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) to the newest version in master and cherry-pick that commit into the stable branch.
# **23rd - Optional Patch Release**
diff --git a/doc/release/patch.md b/doc/release/patch.md
index 7762c9f0e11..bcc14568fc8 100644
--- a/doc/release/patch.md
+++ b/doc/release/patch.md
@@ -27,4 +27,5 @@ Otherwise include it in the monthly release and note there was a regression fix
1. [Build new packages with the latest version](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md)
1. Cherry-pick the changelog update back into master
1. Send tweets about the release from `@gitlabhq`, tweet should include the most important feature that the release is addressing as well as the link to the changelog
-1. Note in the 'GitLab X.X regressions' issue that the patch was published(CE only)
+1. Note in the 'GitLab X.X regressions' issue that the patch was published (CE only)
+1. Send out an email to the 'GitLab Newsletter' mailing list on MailChimp (or the 'Subscribers' list if the patch is EE only)
diff --git a/doc/release/security.md b/doc/release/security.md
index 5265ca82eba..da442de6ee1 100644
--- a/doc/release/security.md
+++ b/doc/release/security.md
@@ -18,9 +18,8 @@ Please report suspected security vulnerabilities in private to <support@gitlab.c
1. Create feature branches for the blog post on GitLab.com and link them from the code branch
1. Merge and publish the blog posts
1. Send tweets about the release from `@gitlabhq`
-1. Send out an email to the subscribers mailing list on MailChimp
+1. Send out an email to the 'GitLab Newsletter' mailing list on MailChimp (or the 'Subscribers' list if the security fix is for EE only)
1. Send out an email to [the community google mailing list](https://groups.google.com/forum/#!forum/gitlabhq)
-1. Send out an email to [the GitLab newsletter list](http://gitlab.us5.list-manage.com/subscribe?u=498dccd07cf3e9482bee33ba4&id=98a9a4992c)
1. Post a signed copy of our complete announcement to [oss-security](http://www.openwall.com/lists/oss-security/) and request a CVE number
1. Add the security researcher to the [Security Researcher Acknowledgments list](http://www.gitlab.com/vulnerability-acknowledgements/)
1. Thank the security researcher in an email for their cooperation
@@ -60,7 +59,7 @@ XXX
### Credit
-We want to thank XXX of XXX for the reponsible disclosure of this vulnerability.
+We want to thank XXX of XXX for the responsible disclosure of this vulnerability.
## Email template
diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md
index 47f17c1a080..54e6e3a9e3f 100644
--- a/doc/system_hooks/system_hooks.md
+++ b/doc/system_hooks/system_hooks.md
@@ -1,6 +1,6 @@
# System hooks
-Your GitLab instance can perform HTTP POST requests on the following events: `create_project`, `delete_project`, `create_user`, `delete_user` and `change_team_member`.
+Your GitLab instance can perform HTTP POST requests on the following events: `project_create`, `project_destroy`, `user_add_to_team`, `user_remove_from_team`, `user_create`, `user_destroy`, `key_create` and `key_destroy`.
System hooks can be used, e.g. for logging or changing information in a LDAP server.
@@ -93,3 +93,27 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"user_id": 41
}
```
+
+**Key added**
+
+```json
+{
+ "event_name": "key_create",
+ "created_at": "2014-08-18 18:45:16 UTC",
+ "username": "root",
+ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost",
+ "id": 4
+}
+```
+
+**Key removed**
+
+```json
+{
+ "event_name": "key_destroy",
+ "created_at": "2014-08-18 18:45:16 UTC",
+ "username": "root",
+ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost",
+ "id": 4
+}
+```
diff --git a/doc/update/4.0-to-4.1.md b/doc/update/4.0-to-4.1.md
index d5e5d62fb15..4149ed6b08d 100644
--- a/doc/update/4.0-to-4.1.md
+++ b/doc/update/4.0-to-4.1.md
@@ -36,7 +36,7 @@ sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production
sudo mv /etc/init.d/gitlab /etc/init.d/gitlab.old
# get new one using sidekiq
-sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/4-1-stable/init.d/gitlab
+sudo curl -L --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/4-1-stable/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
diff --git a/doc/update/4.2-to-5.0.md b/doc/update/4.2-to-5.0.md
index 230c1e88b23..897cd0b91fa 100644
--- a/doc/update/4.2-to-5.0.md
+++ b/doc/update/4.2-to-5.0.md
@@ -7,9 +7,10 @@ GitLab 5.0 is affected by critical security vulnerability CVE-2013-4490.
## Important changes
- We don't use `gitlab` user any more. Everything will be moved to `git` user
+- Self signed SSL certificates are not supported until GitLab 5.1
- **requires ruby1.9.3**
-## 0. Stop gitlab
+## 0. Stop GitLab
sudo service gitlab stop
@@ -40,7 +41,7 @@ git checkout v1.1.0
# copy config
cp config.yml.example config.yml
-# change url to gitlab instance
+# change url to GitLab instance
# ! make sure url end with '/' like 'https://gitlab.example/'
vim config.yml
@@ -48,14 +49,14 @@ vim config.yml
./support/rewrite-hooks.sh
# check ruby version for git user ( 1.9 required!! )
-# gitlab shell requires system ruby 1.9
+# GitLab shell requires system ruby 1.9
ruby -v
# exit from git user
exit
```
-## 4. Copy gitlab instance to git user
+## 4. Copy GitLab instance to git user
```bash
sudo cp -R /home/gitlab/gitlab /home/git/gitlab
@@ -66,7 +67,7 @@ sudo rm -rf /home/gitlab/gitlab-satellites
sudo rm /tmp/gitlab.socket
```
-## 5. Update gitlab to recent version
+## 5. Update GitLab to recent version
```bash
cd /home/git/gitlab
@@ -115,7 +116,7 @@ sudo chmod -R u+rwX /home/git/gitlab/tmp/pids
```bash
# init.d
sudo rm /etc/init.d/gitlab
-sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab
+sudo curl -L --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
# unicorn
@@ -156,9 +157,48 @@ sudo -u git -H /home/git/gitlab-shell/bin/check
# /home/git/.ssh/authorized_keys: OK
-# Now check gitlab instance
+# Now check GitLab instance
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
```
-**P.S. If everything works as expected you can remove gitlab user from system**
+## 9. Cleanup
+
+**If everything works as expected you can cleanup some old things**
+Recommend you wait a bit and do a backup before completing the following.
+
+```bash
+# remove GitLab user from system
+sudo userdel -r gitlab
+
+cd /home/git
+
+# cleanup .profile
+## remove text from .profile added during gitolite installation:
+## PATH=\$PATH:/home/git/bin
+## export PATH
+## to see what a clean .profile for new users on your system would look like see /etc/skel/.profile
+sudo -u git -H vim .profile
+
+# remove gitolite
+sudo rm -R bin
+sudo rm -Rf gitolite
+sudo rm -R .gitolite
+sudo rm .gitolite.rc
+sudo rm -f gitlab.pub
+sudo rm projects.list
+
+# reset tmp folders
+sudo service gitlab stop
+cd /home/git/gitlab
+sudo rm -R tmp
+sudo -u git -H mkdir tmp
+sudo chmod -R u+rwX tmp/
+
+# reboot system
+sudo reboot
+
+# login, check that GitLab is running fine
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
+```
diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md
index 628d8bc7dfa..0e597abb1a9 100644
--- a/doc/update/5.0-to-5.1.md
+++ b/doc/update/5.0-to-5.1.md
@@ -52,7 +52,7 @@ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
```bash
# init.d
sudo rm /etc/init.d/gitlab
-sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
+sudo curl -L --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
@@ -69,3 +69,22 @@ mysql> \q
## 7. Start application
sudo service gitlab start
+
+## 8. Check installation
+
+
+```bash
+# In 5-10 seconds lets check gitlab-shell
+sudo -u git -H /home/git/gitlab-shell/bin/check
+
+# Example of success output
+# Check GitLab API access: OK
+# Check directories and files:
+# /home/git/repositories: OK
+# /home/git/.ssh/authorized_keys: OK
+
+
+# Now check gitlab instance
+sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
+
+```
diff --git a/doc/update/5.1-to-5.2.md b/doc/update/5.1-to-5.2.md
index c37f20ce55e..6ef559ac9f9 100644
--- a/doc/update/5.1-to-5.2.md
+++ b/doc/update/5.1-to-5.2.md
@@ -93,7 +93,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.0 to 5.1](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/5.1-to-5.4.md b/doc/update/5.1-to-5.4.md
index 53dbfd00ad4..8ec56b266ca 100644
--- a/doc/update/5.1-to-5.4.md
+++ b/doc/update/5.1-to-5.4.md
@@ -89,7 +89,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.2 to 5.3](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/5.1-to-6.0.md b/doc/update/5.1-to-6.0.md
index 11afc75f0f3..a76b371e6d6 100644
--- a/doc/update/5.1-to-6.0.md
+++ b/doc/update/5.1-to-6.0.md
@@ -28,7 +28,7 @@ Any changes to group members will immediately be reflected in the project permis
You can even have multiple owners for a group, greatly simplifying administration.
-## 0. Backup
+## 0. Backup & prepare for update
It's useful to make a backup just in case things go south:
(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version)
@@ -38,6 +38,72 @@ cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
+The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following can help you have a more smooth upgrade.
+
+### Find projets with invalid project names
+
+#### MySQL
+Login to MySQL:
+
+ mysql -u root -p
+
+Find projects with invalid names:
+
+```bash
+mysql> use gitlabhq_production;
+
+# find projects with invalid first char, projects must start with letter
+mysql> select name from projects where name REGEXP '^[^A-Za-z]';
+
+# find projects with other invalid chars
+## names must only contain alphanumeric chars, underscores, spaces, periods, and dashes
+mysql> select name from projects where name REGEXP '[^a-zA-Z0-9_ .-]+';
+```
+
+If any projects have invalid names try correcting them from the web interface before starting the upgrade.
+If correcting them from the web interface fails you can correct them using MySQL:
+
+```bash
+# e.g. replace invalid / with allowed _
+mysql> update projects set name = REPLACE(name,'/','_');
+# repeat for all invalid chars found in project names
+```
+
+#### PostgreSQL
+Make sure all project names start with a letter and only contain alphanumeric chars, underscores, spaces, periods, and dashes (a-zA-Z0-9_ .-).
+
+### Find other common errors
+
+```
+cd /home/git/gitlab
+# Start rails console
+sudo -u git -H bin/rails console production
+
+# Make sure none of the following rails commands return results
+
+# All project owners should have an owner:
+Project.all.select { |project| project.owner.blank? }
+
+# Every user should have a namespace:
+User.all.select { |u| u.namespace.blank? }
+
+# Projects in the global namespace should not conflict with projects in the owner namespace:
+Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? }
+```
+
+If any of the above rails commands returned results other than `=> []` try correcting the issue from the web interface.
+
+If you find projects without an owner (first rails command above), correct it. For MySQL setups:
+
+```bash
+# get your user id
+mysql> select id, name from users order by name;
+
+# set yourself as owner of project
+# replace your_user_id with your user id and bad_project_id with the project id from the rails command
+mysql> update projects set creator_id=your_user_id where id=bad_project_id;
+```
+
## 1. Stop server
sudo service gitlab stop
@@ -89,21 +155,24 @@ sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
# Clear and precompile assets
sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
+
+#Add dealing with newlines for editor
+sudo -u git -H git config --global core.autocrlf input
```
## 6. Update config files
Note: We switched from Puma in GitLab 5.x to unicorn in GitLab 6.0.
-- Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/gitlab.yml.example but with your settings.
-- Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/unicorn.rb.example but with your settings.
+- Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-0-stable/config/gitlab.yml.example but with your settings.
+- Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-0-stable/config/unicorn.rb.example but with your settings.
## 7. Update Init script
```bash
cd /home/git/gitlab
sudo rm /etc/init.d/gitlab
-sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
@@ -136,7 +205,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.0 to 5.1](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
@@ -144,25 +213,3 @@ Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the data
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
```
-
-## Troubleshooting
-
-The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following commands can be run in the rails console to look for 'bad' data.
-
-All project owners should have an owner:
-
-```
-Project.all.select { |project| project.owner.blank? }
-```
-
-Every user should have a namespace:
-
-```
-User.all.select { |u| u.namespace.blank? }
-```
-
-Projects in the global namespace should not conflict with projects in the owner namespace:
-
-```
-Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? }
-```
diff --git a/doc/update/5.2-to-5.3.md b/doc/update/5.2-to-5.3.md
index e39e18d4211..61ddf135641 100644
--- a/doc/update/5.2-to-5.3.md
+++ b/doc/update/5.2-to-5.3.md
@@ -50,7 +50,7 @@ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
```bash
sudo rm /etc/init.d/gitlab
-sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab
+sudo curl -L --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
@@ -75,7 +75,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.1 to 5.2`](5.1-to-5.2.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.1 to 5.2](5.1-to-5.2.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/5.3-to-5.4.md b/doc/update/5.3-to-5.4.md
index e1749f133b3..8a0d43e3e64 100644
--- a/doc/update/5.3-to-5.4.md
+++ b/doc/update/5.3-to-5.4.md
@@ -54,7 +54,7 @@ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
```bash
sudo rm /etc/init.d/gitlab
-sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-4-stable/lib/support/init.d/gitlab
+sudo curl -L --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-4-stable/lib/support/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
@@ -79,7 +79,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.2 to 5.3](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.0-to-6.1.md b/doc/update/6.0-to-6.1.md
index 36c7f04f635..9d67a3bcb96 100644
--- a/doc/update/6.0-to-6.1.md
+++ b/doc/update/6.0-to-6.1.md
@@ -73,7 +73,6 @@ sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
```bash
sudo rm /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
## 7. Start application
@@ -98,7 +97,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.4 to 6.0](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.0-to-7.0.md b/doc/update/6.0-to-7.2.md
index b73adc8cfb3..8dfcbcdd056 100644
--- a/doc/update/6.0-to-7.0.md
+++ b/doc/update/6.0-to-7.2.md
@@ -1,13 +1,16 @@
-# From 6.0 to 7.0
-
-## Deprecations
-
-The 'Wall' feature has been removed in GitLab 7.0. Existing wall comments will remain stored in the database after the upgrade.
+# From 6.0 to 7.2
## Global issue numbers
As of 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their URL. If you use an old issue number URL and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects.
+## Editable labels
+
+In GitLab 7.2 we replace Issue and Merge Request tags with labels, making it
+possible to edit the label text and color. The characters '?', '&' and ',' are
+no longer allowed however so those will be removed from your tags during the
+database migrations for GitLab 7.2.
+
## 0. Backup
It's useful to make a backup just in case things go south:
@@ -22,7 +25,39 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
sudo service gitlab stop
-## 2. Get latest code
+## 2. Update Ruby
+
+If you are still using Ruby 1.9.3 or below, you will need to update Ruby.
+You can check which version you are running with `ruby -v`.
+
+If you are you running Ruby 2.0.x, you do not need to upgrade ruby, but can consider doing so for performance reasons.
+
+If you are running Ruby 2.1.1 consider upgrading to 2.1.2, because of the high memory usage of Ruby 2.1.1.
+
+Install, update dependencies:
+
+```bash
+sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
+```
+
+Download and compile Ruby:
+
+```bash
+mkdir /tmp/ruby && cd /tmp/ruby
+curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
+cd ruby-2.1.2
+./configure --disable-install-rdoc
+make
+sudo make install
+```
+
+Install Bundler:
+
+```bash
+sudo gem install bundler --no-ri --no-rdoc
+```
+
+## 3. Get latest code
```bash
cd /home/git/gitlab
@@ -32,7 +67,7 @@ sudo -u git -H git fetch --all
For GitLab Community Edition:
```bash
-sudo -u git -H git checkout 7-0-stable
+sudo -u git -H git checkout 7-2-stable
```
OR
@@ -40,26 +75,29 @@ OR
For GitLab Enterprise Edition:
```bash
-sudo -u git -H git checkout 7-0-stable-ee
+sudo -u git -H git checkout 7-2-stable-ee
```
-## 3. Install additional packages
+## 4. Install additional packages
```bash
# Add support for lograte for better log file handling
sudo apt-get install logrotate
+
+# Install pkg-config and cmake, which is needed for the latest versions of rugged
+sudo apt-get install pkg-config cmake
```
-## 4. Update gitlab-shell
+## 5. Update gitlab-shell
```bash
cd /home/git/gitlab-shell
sudo -u git -H git fetch
-sudo -u git -H git checkout v1.9.3 # Addresses multiple critical security vulnerabilities
+sudo -u git -H git checkout v1.9.7
```
-## 5. Install libs, migrations, etc.
+## 6. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
@@ -70,7 +108,6 @@ sudo -u git -H bundle install --without development test postgres --deployment
# PostgreSQL installations (note: the line below states '--without ... mysql')
sudo -u git -H bundle install --without development test mysql --deployment
-
# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
@@ -82,19 +119,24 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Close access to gitlab-satellites for others
sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites
+
+# Update init.d script
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
```
-## 6. Update config files
+## 7. Update config files
-TIP: to see what changed in gitlab.yml.example in this release use next command:
+TIP: to see what changed in gitlab.yml.example in this release use next command:
```
-git diff 6-0-stable:config/gitlab.yml.example 7-0-stable:config/gitlab.yml.example
+git diff 6-0-stable:config/gitlab.yml.example 7-2-stable:config/gitlab.yml.example
```
-* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/config/gitlab.yml.example but with your settings.
-* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/config/unicorn.rb.example but with your settings.
-* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/config/gitlab.yml.example but with your settings.
+* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/config/unicorn.rb.example but with your settings.
+* Make `/home/git/gitlab-shell/config.yml` the same as https://gitlab.com/gitlab-org/gitlab-shell/blob/v1.9.7/config.yml.example but with your settings.
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/lib/support/nginx/gitlab-ssl but with your settings.
* Copy rack attack middleware config
```bash
@@ -107,12 +149,6 @@ sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```
-## 7. Update Init script
-
-```bash
-sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-```
-
## 8. Start application
sudo service gitlab start
@@ -131,11 +167,17 @@ To make sure you didn't miss anything run a more thorough check with:
If all items are green, then congratulations upgrade complete!
+## 10. Update OmniAuth configuration
+
+When using Google omniauth login, changes of the Google account required.
+Ensure that `Contacts API` and the `Google+ API` are enabled in the [Google Developers Console](https://console.developers.google.com/).
+More details can be found at the [integration documentation](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/google.md).
+
## Things went south? Revert to previous version (6.0)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.4 to 6.0](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
@@ -146,4 +188,4 @@ sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
## Login issues after upgrade?
-If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page)
+If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page)
diff --git a/doc/update/6.1-to-6.2.md b/doc/update/6.1-to-6.2.md
index 9ab53aae24b..efa6e43124c 100644
--- a/doc/update/6.1-to-6.2.md
+++ b/doc/update/6.1-to-6.2.md
@@ -88,7 +88,6 @@ sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```bash
sudo rm /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
## 8. Start application
@@ -112,7 +111,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.0 to 6.1`](6.0-to-6.1.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.0 to 6.1](6.0-to-6.1.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.2-to-6.3.md b/doc/update/6.2-to-6.3.md
index dfe2e551b36..e9b3bdd2f54 100644
--- a/doc/update/6.2-to-6.3.md
+++ b/doc/update/6.2-to-6.3.md
@@ -32,7 +32,7 @@ sudo -u git -H git fetch
sudo -u git -H git checkout v1.7.9 # Addresses multiple critical security vulnerabilities
```
-The Gitlab-shell config changed recently, so check for config file changes and make `/home/git/gitlab-shell/config.yml` the same as <https://github.com/gitlabhq/gitlab-shell/blob/master/config.yml.example>
+The gitlab-shell config changed recently, so check for config file changes and make `/home/git/gitlab-shell/config.yml` the same as <https://github.com/gitlabhq/gitlab-shell/blob/master/config.yml.example>
## 4. Install libs, migrations, etc.
@@ -55,7 +55,7 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
## 5. Update config files
-TIP: to see what changed in gitlab.yml.example in this release use next command:
+TIP: to see what changed in gitlab.yml.example in this release use next command:
```
git diff 6-2-stable:config/gitlab.yml.example 6-3-stable:config/gitlab.yml.example
@@ -74,7 +74,6 @@ sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers
```bash
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
## 7. Start application
@@ -98,7 +97,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.1 to 6.2`](6.1-to-6.2.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.1 to 6.2](6.1-to-6.2.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.3-to-6.4.md b/doc/update/6.3-to-6.4.md
index 18dce9b5f93..96c2895981d 100644
--- a/doc/update/6.3-to-6.4.md
+++ b/doc/update/6.3-to-6.4.md
@@ -79,7 +79,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.2 to 6.3`](6.2-to-6.3.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.2 to 6.3](6.2-to-6.3.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.4-to-6.5.md b/doc/update/6.4-to-6.5.md
index 1a95a98b6f2..1624296fc3f 100644
--- a/doc/update/6.4-to-6.5.md
+++ b/doc/update/6.4-to-6.5.md
@@ -83,7 +83,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.3 to 6.4`](6.3-to-6.4.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.3 to 6.4](6.3-to-6.4.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/6.5-to-6.6.md b/doc/update/6.5-to-6.6.md
index ee6a5a9bdf2..544eee17fec 100644
--- a/doc/update/6.5-to-6.6.md
+++ b/doc/update/6.5-to-6.6.md
@@ -83,7 +83,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.4 to 6.5`](6.4-to-6.5.md), except for the database migration
+Follow the [upgrade guide from 6.4 to 6.5](6.4-to-6.5.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/6.6-to-6.7.md b/doc/update/6.6-to-6.7.md
index 1e3b7da12d4..77ac4d0bfa6 100644
--- a/doc/update/6.6-to-6.7.md
+++ b/doc/update/6.6-to-6.7.md
@@ -18,7 +18,7 @@ cd /home/git/gitlab
sudo -u git -H git fetch --all
```
-For Gitlab Community Edition:
+For GitLab Community Edition:
```bash
sudo -u git -H git checkout 6-7-stable
@@ -93,7 +93,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.5 to 6.6`](6.5-to-6.6.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.5 to 6.6](6.5-to-6.6.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md
index 3c98896a9b2..16f3439c998 100644
--- a/doc/update/6.7-to-6.8.md
+++ b/doc/update/6.7-to-6.8.md
@@ -62,7 +62,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
# Close access to gitlab-satellites for others
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
@@ -111,7 +110,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.6 to 6.7`](6.6-to-6.7.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.6 to 6.7](6.6-to-6.7.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/6.8-to-6.9.md b/doc/update/6.8-to-6.9.md
index 4a3e45ae5ee..9efb384ff59 100644
--- a/doc/update/6.8-to-6.9.md
+++ b/doc/update/6.8-to-6.9.md
@@ -20,7 +20,7 @@ cd /home/git/gitlab
sudo -u git -H git fetch --all
```
-For Gitlab Community Edition:
+For GitLab Community Edition:
```bash
sudo -u git -H git checkout 6-9-stable
@@ -90,7 +90,7 @@ If all items are green, then congratulations upgrade is complete!
## Things went south? Revert to previous version (6.8)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.7 to 6.8`](6.7-to-6.8.md), except for the database migration
+Follow the [upgrade guide from 6.7 to 6.8](6.7-to-6.8.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/6.9-to-7.0.md b/doc/update/6.9-to-7.0.md
index 2ddd83c624e..1f3421a799b 100644
--- a/doc/update/6.9-to-7.0.md
+++ b/doc/update/6.9-to-7.0.md
@@ -13,14 +13,46 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
sudo service gitlab stop
```
-### 2. Get latest code
+### 2. Update Ruby
+
+If you are still using Ruby 1.9.3 or below, you will need to update Ruby.
+You can check which version you are running with `ruby -v`.
+
+If you are you running Ruby 2.0.x, you do not need to upgrade ruby, but can consider doing so for performance reasons.
+
+If you are running Ruby 2.1.1 consider upgrading to 2.1.2, because of the high memory usage of Ruby 2.1.1.
+
+Install, update dependencies:
+
+```bash
+sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
+```
+
+Download and compile Ruby:
+
+```bash
+mkdir /tmp/ruby && cd /tmp/ruby
+curl -L --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
+cd ruby-2.1.2
+./configure --disable-install-rdoc
+make
+sudo make install
+```
+
+Install Bundler:
+
+```bash
+sudo gem install bundler --no-ri --no-rdoc
+```
+
+### 3. Get latest code
```bash
cd /home/git/gitlab
sudo -u git -H git fetch --all
```
-For Gitlab Community Edition:
+For GitLab Community Edition:
```bash
sudo -u git -H git checkout 7-0-stable
@@ -34,7 +66,7 @@ For GitLab Enterprise Edition:
sudo -u git -H git checkout 7-0-stable-ee
```
-### 3. Update gitlab-shell (and its config)
+### 4. Update gitlab-shell (and its config)
```bash
cd /home/git/gitlab-shell
@@ -42,7 +74,7 @@ sudo -u git -H git fetch
sudo -u git -H git checkout v1.9.6
```
-### 4. Install libs, migrations, etc.
+### 5. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
@@ -61,25 +93,27 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
-### 5. Update config files
+### 6. Update config files
#### New configuration options for gitlab.yml
There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired.
```
-git diff 6-9-stable:config/gitlab.yml.example 7-0-stable:config/gitlab.yml.example
+git diff origin/6-9-stable:config/gitlab.yml.example origin/7-0-stable:config/gitlab.yml.example
```
-### 6. Start application
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting
+
+### 7. Start application
sudo service gitlab start
sudo service nginx restart
-### 7. Check application status
+### 8. Check application status
Check if GitLab and its environment are configured correctly:
@@ -94,7 +128,7 @@ If all items are green, then congratulations upgrade is complete!
## Things went south? Revert to previous version (6.9)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.8 to 6.9`](6.8-to-6.9.md), except for the database migration
+Follow the [upgrade guide from 6.8 to 6.9](6.8-to-6.9.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/7.0-to-7.1.md b/doc/update/7.0-to-7.1.md
new file mode 100644
index 00000000000..82bb5708734
--- /dev/null
+++ b/doc/update/7.0-to-7.1.md
@@ -0,0 +1,137 @@
+# From 7.0 to 7.1
+
+### 0. Backup
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
+```
+
+### 1. Stop server
+
+```bash
+sudo service gitlab stop
+```
+
+### 2. Update Ruby
+
+If you are still using Ruby 1.9.3 or below, you will need to update Ruby.
+You can check which version you are running with `ruby -v`.
+
+If you are you running Ruby 2.0.x, you do not need to upgrade ruby, but can consider doing so for performance reasons.
+
+If you are running Ruby 2.1.1 consider upgrading to 2.1.2, because of the high memory usage of Ruby 2.1.1.
+
+Install, update dependencies:
+
+```bash
+sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
+```
+
+Download and compile Ruby:
+
+```bash
+mkdir /tmp/ruby && cd /tmp/ruby
+curl -L --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
+cd ruby-2.1.2
+./configure --disable-install-rdoc
+make
+sudo make install
+```
+
+Install Bundler:
+
+```bash
+sudo gem install bundler --no-ri --no-rdoc
+```
+
+### 3. Get latest code
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H git fetch --all
+```
+
+For GitLab Community Edition:
+
+```bash
+sudo -u git -H git checkout 7-1-stable
+```
+
+OR
+
+For GitLab Enterprise Edition:
+
+```bash
+sudo -u git -H git checkout 7-1-stable-ee
+```
+
+### 4. Update gitlab-shell (and its config)
+
+```bash
+cd /home/git/gitlab-shell
+sudo -u git -H git fetch
+sudo -u git -H git checkout v1.9.6
+```
+
+### 5. Install libs, migrations, etc.
+
+```bash
+cd /home/git/gitlab
+
+# MySQL installations (note: the line below states '--without ... postgres')
+sudo -u git -H bundle install --without development test postgres --deployment
+
+# PostgreSQL installations (note: the line below states '--without ... mysql')
+sudo -u git -H bundle install --without development test mysql --deployment
+
+# Run database migrations
+sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
+
+# Clean up assets and cache
+sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
+
+# Update init.d script
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
+```
+
+### 6. Update config files
+
+#### New configuration options for gitlab.yml
+
+There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired.
+
+```
+git diff 7-0-stable:config/gitlab.yml.example 7-1-stable:config/gitlab.yml.example
+```
+
+### 7. Start application
+
+ sudo service gitlab start
+ sudo service nginx restart
+
+### 8. Check application status
+
+Check if GitLab and its environment are configured correctly:
+
+ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
+
+To make sure you didn't miss anything run a more thorough check with:
+
+ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
+
+If all items are green, then congratulations upgrade is complete!
+
+## Things went south? Revert to previous version (7.0)
+
+### 1. Revert the code to the previous version
+Follow the [upgrade guide from 6.9 to 7.0](6.9-to-7.0.md), except for the database migration
+(The backup is already migrated to the previous version)
+
+### 2. Restore from the backup:
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
+```
+If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above.
diff --git a/doc/update/7.1-to-7.2.md b/doc/update/7.1-to-7.2.md
new file mode 100644
index 00000000000..ff5574114a8
--- /dev/null
+++ b/doc/update/7.1-to-7.2.md
@@ -0,0 +1,136 @@
+# From 7.1 to 7.2
+
+## Editable labels
+
+In GitLab 7.2 we replace Issue and Merge Request tags with labels, making it
+possible to edit the label text and color. The characters '?', '&' and ',' are
+no longer allowed however so those will be removed from your tags during the
+database migrations for GitLab 7.2.
+
+### 0. Backup
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
+```
+
+### 1. Stop server
+
+```bash
+sudo service gitlab stop
+```
+
+### 2. Get latest code
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H git fetch --all
+```
+
+For GitLab Community Edition:
+
+```bash
+sudo -u git -H git checkout 7-2-stable
+```
+
+OR
+
+For GitLab Enterprise Edition:
+
+```bash
+sudo -u git -H git checkout 7-2-stable-ee
+```
+
+### 3. Update gitlab-shell
+
+```bash
+cd /home/git/gitlab-shell
+sudo -u git -H git fetch
+sudo -u git -H git checkout v1.9.7
+```
+
+### 4. Install new system dependencies
+
+The latest version of the 'rugged' gem requires `pkg-config` and `cmake` to
+build its native extensions.
+
+```bash
+sudo apt-get install pkg-config cmake
+```
+
+### 5. Install libs, migrations, etc.
+
+```bash
+cd /home/git/gitlab
+
+# MySQL installations (note: the line below states '--without ... postgres')
+sudo -u git -H bundle install --without development test postgres --deployment
+
+# PostgreSQL installations (note: the line below states '--without ... mysql')
+sudo -u git -H bundle install --without development test mysql --deployment
+
+# Run database migrations
+sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
+
+# Clean up assets and cache
+sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
+
+# Update init.d script
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
+```
+
+### 6. Update config files
+
+#### New configuration options for gitlab.yml
+
+There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml.
+
+```
+git diff 7-1-stable:config/gitlab.yml.example 7-2-stable:config/gitlab.yml.example
+```
+
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting
+
+Update rack attack middleware config
+
+```
+sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
+```
+
+### 7. Start application
+
+ sudo service gitlab start
+ sudo service nginx restart
+
+### 8. Check application status
+
+Check if GitLab and its environment are configured correctly:
+
+ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
+
+To make sure you didn't miss anything run a more thorough check with:
+
+ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
+
+If all items are green, then congratulations upgrade is complete!
+
+### 9. Update OmniAuth configuration
+
+When using Google omniauth login, changes of the Google account required.
+Ensure that `Contacts API` and the `Google+ API` are enabled in the [Google Developers Console](https://console.developers.google.com/).
+More details can be found at the [integration documentation](../integration/google.md).
+
+## Things went south? Revert to previous version (7.1)
+
+### 1. Revert the code to the previous version
+Follow the [upgrade guide from 7.0 to 7.1](7.0-to-7.1.md), except for the database migration
+(The backup is already migrated to the previous version)
+
+### 2. Restore from the backup:
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
+```
+If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above.
diff --git a/doc/update/7.2-to-7.3.md b/doc/update/7.2-to-7.3.md
new file mode 100644
index 00000000000..7cc8f8e2ede
--- /dev/null
+++ b/doc/update/7.2-to-7.3.md
@@ -0,0 +1,10 @@
+# From 7.2 to 7.3
+
+# GitLab 7.3 has not been released yet!
+
+This document currently just serves as a place to keep track of updates that will be needed for the 7.3 update.
+
+### Update config files
+
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting \ No newline at end of file
diff --git a/doc/update/README.md b/doc/update/README.md
index 8c0cf5f7b26..9a6f09b370a 100644
--- a/doc/update/README.md
+++ b/doc/update/README.md
@@ -1,5 +1,4 @@
- [The individual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update)
- [Upgrader](upgrader.md)
-- [Ruby](ruby.md)
- [Patch versions](patch_versions.md)
- [MySQL to PostgreSQL](mysql_to_postgresql.md)
diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md
index 05c95679673..ed72e156efe 100644
--- a/doc/update/mysql_to_postgresql.md
+++ b/doc/update/mysql_to_postgresql.md
@@ -15,7 +15,9 @@ git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
cd mysql-postgresql-converter
mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production
python db_converter.py databasename.mysql databasename.psql
-psql -f databasename.psql -d gitlabhq_production
+
+# Import the database dump as the application database user
+sudo -u git psql -f databasename.psql -d gitlabhq_production
# Rebuild indexes (see below)
@@ -68,6 +70,7 @@ test -e /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled || sudo /
```
## Converting a GitLab backup file from MySQL to Postgres
+**Note:** Please make sure to have Python 2.7.x (or higher) installed.
GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using the lanyrd database converter we can replace a MySQL database dump inside the tar file with a Postgres database dump. This can be useful if you are moving to another server.
@@ -91,7 +94,7 @@ cd tmp/backups/postgresql
sudo -u git -H mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production
# Clone the database converter
-sudo -u git -H git clone https://github.com/lanyrd/mysql-postgresql-converter.git
+sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
# Convert gitlabhq_production.mysql
sudo -u git -H mkdir db
diff --git a/doc/update/ruby.md b/doc/update/ruby.md
deleted file mode 100644
index d1d9d3e77f5..00000000000
--- a/doc/update/ruby.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Updating Ruby from source
-
-This guide explains how to update Ruby in case you installed it from source according to the [instructions](../install/installation.md#2-ruby).
-
-## 1. Look for Ruby versions
-
-This guide will only update `/usr/local/bin/ruby`. You can see which Ruby binaries are installed on your system by running:
-
-```bash
-ls -l $(which -a ruby)
-```
-
-## 2. Stop GitLab
-
-```bash
-sudo service gitlab stop
-```
-
-## 3. Install or update dependencies
-
-Here we are assuming you are using Debian/Ubuntu.
-
-```bash
-sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
-```
-
-## 4. Download, compile and install Ruby
-
-Find the latest stable version of Ruby 1.9 or 2.0 at <https://www.ruby-lang.org/en/downloads/>. We recommend at least 2.0.0-p353, which is patched against [CVE-2013-4164](https://www.ruby-lang.org/en/news/2013/11/22/heap-overflow-in-floating-point-parsing-cve-2013-4164/).
-
-```bash
-cd /tmp
-curl --progress http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz
-cd ruby-2.0.0-p353
-./configure --disable-install-rdoc
-make
-sudo make install # overwrite the existing Ruby in /usr/local/bin
-sudo gem install bundler
-```
-
-### 5. Reinstall GitLab gem bundle
-
-Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](../install/installation.md#install-gems).
-
-```bash
-cd /home/git/gitlab
-sudo -u git -H rm -rf vendor/bundle # remove existing Gem bundle
-sudo -u git -H bundle install --deployment --without development test mysql aws # Assuming PostgreSQL
-```
-
-## 6. Start GitLab
-
-We are now ready to restart GitLab.
-
-```bash
-sudo service gitlab start
-```
-
-## Done
diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md
index 00dc87e2f99..e8379fcc318 100644
--- a/doc/update/upgrader.md
+++ b/doc/update/upgrader.md
@@ -21,6 +21,8 @@ If you have local changes to your GitLab repository the script will stash them a
## 2. Run GitLab upgrade tool
+Note: GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies)
+
# Starting with GitLab version 7.0 upgrader script has been moved to bin directory
cd /home/git/gitlab
if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb; else sudo -u git -H ruby script/upgrade.rb; fi
diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md
index ada21d23ac3..13c4de4301e 100644
--- a/doc/web_hooks/web_hooks.md
+++ b/doc/web_hooks/web_hooks.md
@@ -76,7 +76,9 @@ Triggered when a new issue is created or an existing issue was updated/closed/re
"description": "Create new API for manipulations with repository",
"milestone_id": null,
"state": "opened",
- "iid": 23
+ "iid": 23,
+ "url": "http://example.com/diaspora/issues/23",
+ "action": "open"
}
}
```
diff --git a/doc/workflow/README.md b/doc/workflow/README.md
index c715f6e5943..b18f62a1fa6 100644
--- a/doc/workflow/README.md
+++ b/doc/workflow/README.md
@@ -1,3 +1,5 @@
- [Workflow](workflow.md)
- [Project Features](project_features.md)
- [Authorization for merge requests](authorization_for_merge_requests.md)
+- [Groups](groups.md)
+- [Labels](labels.md)
diff --git a/doc/workflow/groups.md b/doc/workflow/groups.md
new file mode 100644
index 00000000000..52bf611dc5e
--- /dev/null
+++ b/doc/workflow/groups.md
@@ -0,0 +1,71 @@
+# GitLab Groups
+
+GitLab groups allow you to group projects into directories and give users to several projects at once.
+
+When you create a new project in GitLab, the default namespace for the project is the personal namespace associated with your GitLab user.
+In this document we will see how to create groups, put projects in groups and manage who can access the projects in a group.
+
+## Creating groups
+
+You can create a group by going to the 'Groups' tab of the GitLab dashboard and clicking the 'New group' button.
+
+![Click the 'New group' button in the 'Groups' tab](groups/new_group_button.png)
+
+Next, enter the name (required) and the optional description and group avatar.
+
+![Fill in the name for your new group](groups/new_group_form.png)
+
+When your group has been created you are presented with the group dashboard feed, which will be empty.
+
+![Group dashboard](groups/group_dashboard.png)
+
+You can use the 'New project' button to add a project to the new group.
+
+## Transferring an existing project into a group
+
+You can transfer an existing project into a group you own from the project settings page.
+First scroll down to the 'Dangerous settings' and click 'Show them to me'.
+Now you can pick any of the groups you manage as the new namespace for the group.
+
+![Transfer a project to a new namespace](groups/transfer_project.png)
+
+GitLab administrators can use the admin interface to move any project to any namespace if needed.
+
+## Adding users to a group
+
+One of the benefits of putting multiple projects in one group is that you can give a user to access to all projects in the group with one action.
+
+Suppose we have a group with two projects.
+
+![Group with two projects](groups/group_with_two_projects.png)
+
+On the 'Group Members' page we can now add a new user Barry to the group.
+
+![Add user Barry to the group](groups/add_member_to_group.png)
+
+Now because Barry is a 'Developer' member of the 'Open Source' group, he automatically gets 'Developer' access to all projects in the 'Open Source' group.
+
+![Barry has 'Developer' access to GitLab CI](groups/project_members_via_group.png)
+
+If necessary, you can increase the access level of an individual user for a specific project, by adding them as a Member to the project.
+
+![Barry effectively has 'Master' access to GitLab CI now](groups/override_access_level.png)
+
+## Managing group memberships via LDAP
+
+In GitLab Enterprise Edition it is possible to manage GitLab group memberships using LDAP groups.
+See [the GitLab Enterprise Edition documentation](http://doc.gitlab.com/ee/integration/ldap.html) for more information.
+
+## Allowing only admins to create groups
+
+By default, any GitLab user can create new groups.
+This ability can be disabled for individual users from the admin panel.
+It is also possible to configure GitLab so that new users default to not being able to create groups:
+
+```
+# For omnibus-gitlab, put the following in /etc/gitlab/gitlab.rb
+gitlab_rails['gitlab_default_can_create_group'] = false
+
+# For installations from source, uncomment the 'default_can_create_group'
+# line in /home/git/gitlab/config/gitlab.yml
+```
diff --git a/doc/workflow/groups/add_member_to_group.png b/doc/workflow/groups/add_member_to_group.png
new file mode 100644
index 00000000000..fa340ce572f
--- /dev/null
+++ b/doc/workflow/groups/add_member_to_group.png
Binary files differ
diff --git a/doc/workflow/groups/group_dashboard.png b/doc/workflow/groups/group_dashboard.png
new file mode 100644
index 00000000000..7fc9048d74d
--- /dev/null
+++ b/doc/workflow/groups/group_dashboard.png
Binary files differ
diff --git a/doc/workflow/groups/group_with_two_projects.png b/doc/workflow/groups/group_with_two_projects.png
new file mode 100644
index 00000000000..87242781e4f
--- /dev/null
+++ b/doc/workflow/groups/group_with_two_projects.png
Binary files differ
diff --git a/doc/workflow/groups/new_group_button.png b/doc/workflow/groups/new_group_button.png
new file mode 100644
index 00000000000..51e82798658
--- /dev/null
+++ b/doc/workflow/groups/new_group_button.png
Binary files differ
diff --git a/doc/workflow/groups/new_group_form.png b/doc/workflow/groups/new_group_form.png
new file mode 100644
index 00000000000..bf992c40bc2
--- /dev/null
+++ b/doc/workflow/groups/new_group_form.png
Binary files differ
diff --git a/doc/workflow/groups/override_access_level.png b/doc/workflow/groups/override_access_level.png
new file mode 100644
index 00000000000..f4225a63679
--- /dev/null
+++ b/doc/workflow/groups/override_access_level.png
Binary files differ
diff --git a/doc/workflow/groups/project_members_via_group.png b/doc/workflow/groups/project_members_via_group.png
new file mode 100644
index 00000000000..b13cb1cfd95
--- /dev/null
+++ b/doc/workflow/groups/project_members_via_group.png
Binary files differ
diff --git a/doc/workflow/groups/transfer_project.png b/doc/workflow/groups/transfer_project.png
new file mode 100644
index 00000000000..044fe10d073
--- /dev/null
+++ b/doc/workflow/groups/transfer_project.png
Binary files differ
diff --git a/doc/workflow/labels.md b/doc/workflow/labels.md
new file mode 100644
index 00000000000..085b7baf5ce
--- /dev/null
+++ b/doc/workflow/labels.md
@@ -0,0 +1,16 @@
+# Labels
+
+In GitLab, you can easily tag issues and merge requests. If you have permission level `Developer` or higher, you can manage labels. To create, edit or delete a label, go to a project and then to `Issues` and then `Labels`.
+
+Here you can create a new label.
+
+![new label](labels/label1.png)
+
+You can choose to set a color.
+
+![label color](labels/label2.png)
+
+If you want to change an existing label, press edit next to the listed label.
+You will be presented with the same form as when creating a new label.
+
+![edit label](labels/label3.png)
diff --git a/doc/workflow/labels/label1.png b/doc/workflow/labels/label1.png
new file mode 100644
index 00000000000..cac661a34c8
--- /dev/null
+++ b/doc/workflow/labels/label1.png
Binary files differ
diff --git a/doc/workflow/labels/label2.png b/doc/workflow/labels/label2.png
new file mode 100644
index 00000000000..44d9fef86d4
--- /dev/null
+++ b/doc/workflow/labels/label2.png
Binary files differ
diff --git a/doc/workflow/labels/label3.png b/doc/workflow/labels/label3.png
new file mode 100644
index 00000000000..e2fce11b7a4
--- /dev/null
+++ b/doc/workflow/labels/label3.png
Binary files differ
diff --git a/doc/workflow/project_features.md b/doc/workflow/project_features.md
index 48e86ee3ef5..a523b3facbe 100644
--- a/doc/workflow/project_features.md
+++ b/doc/workflow/project_features.md
@@ -16,7 +16,7 @@ They integrate deeply into GitLab and are easily referenced from anywhere by usi
Using a merge request, you can review and discuss code before it is merged in the branch of your code.
-As with issues, it can be assigned; people, issues, etc. can be refereced; milestones attached.
+As with issues, it can be assigned; people, issues, etc. can be referenced; milestones attached.
We see it as an integral part of working together on code and couldn't work without it.
diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature
deleted file mode 100644
index 24c45028697..00000000000
--- a/features/dashboard/search.feature
+++ /dev/null
@@ -1,10 +0,0 @@
-@dashboard
-Feature: Dashboard Search
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And I visit dashboard search page
-
- Scenario: I should see project I am looking for
- Given I search for "Sho"
- Then I should see "Shop" project link
diff --git a/features/dashboard/shortcuts.feature b/features/dashboard/shortcuts.feature
new file mode 100644
index 00000000000..7c25b3926c9
--- /dev/null
+++ b/features/dashboard/shortcuts.feature
@@ -0,0 +1,21 @@
+@dashboard
+Feature: Dashboard shortcuts
+ Background:
+ Given I sign in as a user
+ And I visit dashboard page
+
+ @javascript
+ Scenario: Navigate to projects tab
+ Given I press "g" and "p"
+ Then the active main tab should be Projects
+
+ @javascript
+ Scenario: Navigate to issue tab
+ Given I press "g" and "i"
+ Then the active main tab should be Issues
+
+ @javascript
+ Scenario: Navigate to merge requests tab
+ Given I press "g" and "m"
+ Then the active main tab should be Merge Requests
+
diff --git a/features/public/projects.feature b/features/explore/projects.feature
index c7bb3b4f8ce..9827ebe3e57 100644
--- a/features/public/projects.feature
+++ b/features/explore/projects.feature
@@ -1,5 +1,5 @@
@public
-Feature: Public Projects Feature
+Feature: Explore Projects Feature
Background:
Given public project "Community"
And internal project "Internal"
@@ -100,3 +100,17 @@ Feature: Public Projects Feature
And I visit "Internal" merge requests page
And project "Internal" has "Feature implemented" open merge request
Then I should see list of merge requests for "Internal" project
+
+ Scenario: Trending page
+ Given I sign in as a user
+ And project "Community" has comments
+ When I visit the explore trending projects
+ Then I should see project "Community"
+ And I should not see project "Internal"
+ And I should not see project "Enterprise"
+
+ Scenario: Most starred page
+ Given I sign in as a user
+ When I visit the explore starred projects
+ Then I should see project "Community"
+ And I should see project "Internal"
diff --git a/features/public/public_groups.feature b/features/explore/public_groups.feature
index 8bbda8cb6d4..825e3da934e 100644
--- a/features/public/public_groups.feature
+++ b/features/explore/public_groups.feature
@@ -1,5 +1,5 @@
@public
-Feature: Public Projects Feature
+Feature: Explore Groups Feature
Background:
Given group "TestGroup" has private project "Enterprise"
@@ -117,3 +117,35 @@ Feature: Public Projects Feature
And I visit group "TestGroup" members page
Then I should see group member "John Doe"
And I should not see member roles
+
+ Scenario: I should see group with public project in public groups area
+ Given group "TestGroup" has public project "Community"
+ When I visit the public groups area
+ Then I should see group "TestGroup"
+
+ Scenario: I should not see group with internal project in public groups area
+ Given group "TestGroup" has internal project "Internal"
+ When I visit the public groups area
+ Then I should not see group "TestGroup"
+
+ Scenario: I should not see group with private project in public groups area
+ When I visit the public groups area
+ Then I should not see group "TestGroup"
+
+ Scenario: I should see group with public project in public groups area as user
+ Given group "TestGroup" has public project "Community"
+ When I sign in as a user
+ And I visit the public groups area
+ Then I should see group "TestGroup"
+
+ Scenario: I should see group with internal project in public groups area as user
+ Given group "TestGroup" has internal project "Internal"
+ When I sign in as a user
+ And I visit the public groups area
+ Then I should see group "TestGroup"
+
+ Scenario: I should not see group with private project in public groups area as user
+ When I sign in as a user
+ And I visit the public groups area
+ Then I should not see group "TestGroup"
+
diff --git a/features/group.feature b/features/group.feature
index 71c28c07a3c..b5ff03db844 100644
--- a/features/group.feature
+++ b/features/group.feature
@@ -120,3 +120,24 @@ Feature: Groups
When I search for 'Mary' member
Then I should see user "Mary Jane" in team list
Then I should not see user "John Doe" in team list
+
+ # Group milestones
+
+ Scenario: I should see group "Owned" milestone index page with no milestones
+ When I visit group "Owned" page
+ And I click on group milestones
+ Then I should see group milestones index page has no milestones
+
+ Scenario: I should see group "Owned" milestone index page with milestones
+ Given Group has projects with milestones
+ When I visit group "Owned" page
+ And I click on group milestones
+ Then I should see group milestones index page with milestones
+
+ Scenario: I should see group "Owned" milestone show page
+ Given Group has projects with milestones
+ When I visit group "Owned" page
+ And I click on group milestones
+ And I click on one group milestone
+ Then I should see group milestone with descriptions and expiry date
+ And I should see group milestone with all issues and MRs assigned to that milestone
diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature
index abebef04fcd..d124cb7eecd 100644
--- a/features/project/commits/branches.feature
+++ b/features/project/commits/branches.feature
@@ -15,5 +15,29 @@ Feature: Project Browse branches
Scenario: I create a branch
Given I visit project branches page
And I click new branch link
- When I submit new branch form
+ And I submit new branch form
Then I should see new branch created
+
+ @javascript
+ Scenario: I delete a branch
+ Given I visit project branches page
+ And I click branch 'improve/awesome' delete link
+ Then I should not see branch 'improve/awesome'
+
+ Scenario: I create a branch with invalid name
+ Given I visit project branches page
+ And I click new branch link
+ And I submit new branch form with invalid name
+ Then I should see new an error that branch is invalid
+
+ Scenario: I create a branch with invalid reference
+ Given I visit project branches page
+ And I click new branch link
+ And I submit new branch form with invalid reference
+ Then I should see new an error that ref is invalid
+
+ Scenario: I create a branch that already exists
+ Given I visit project branches page
+ And I click new branch link
+ And I submit new branch form with branch that already exists
+ Then I should see new an error that branch already exists
diff --git a/features/project/commits/commits.feature b/features/project/commits/commits.feature
index cbe8b321507..7c6db3c465a 100644
--- a/features/project/commits/commits.feature
+++ b/features/project/commits/commits.feature
@@ -38,10 +38,6 @@ Feature: Project Browse commits
Given I visit big commit page
Then I see big commit warning
- Scenario: I browse huge commit
- Given I visit huge commit page
- Then I see huge commit message
-
Scenario: I browse a commit with an image
Given I visit a commit with an image that changed
Then The diff links to both the previous and current image
diff --git a/features/project/commits/tags.feature b/features/project/commits/tags.feature
index 1ac0f8bfa45..36c7a6492ff 100644
--- a/features/project/commits/tags.feature
+++ b/features/project/commits/tags.feature
@@ -7,5 +7,25 @@ Feature: Project Browse tags
Scenario: I can see all git tags
Then I should see "Shop" all tags list
+ Scenario: I create a tag
+ And I click new tag link
+ And I submit new tag form
+ Then I should see new tag created
+
+ Scenario: I create a tag with invalid name
+ And I click new tag link
+ And I submit new tag form with invalid name
+ Then I should see new an error that tag is invalid
+
+ Scenario: I create a tag with invalid reference
+ And I click new tag link
+ And I submit new tag form with invalid reference
+ Then I should see new an error that tag ref is invalid
+
+ Scenario: I create a tag that already exists
+ And I click new tag link
+ And I submit new tag form with tag that already exists
+ Then I should see new an error that tag already exists
+
# @wip
# Scenario: I can download project by tag
diff --git a/features/project/commits/user_lookup.feature b/features/project/commits/user_lookup.feature
index f3864c0ab38..7b194ab9206 100644
--- a/features/project/commits/user_lookup.feature
+++ b/features/project/commits/user_lookup.feature
@@ -2,13 +2,14 @@ Feature: Project Browse Commits User Lookup
Background:
Given I sign in as a user
And I own a project
- And I have the user that authored the commits
And I visit my project's commits page
Scenario: I browse commit from list
- Given I click on commit link
- Then I see commit info
+ Given I have user with primary email
+ When I click on commit link
+ Then I see author based on primary email
Scenario: I browse another commit from list
- Given I click on another commit link
- Then I see other commit info \ No newline at end of file
+ Given I have user with secondary email
+ When I click on another commit link
+ Then I see author based on secondary email
diff --git a/features/project/edit_issuetracker.feature b/features/project/edit_issuetracker.feature
index b5477d3c7ab..cc0de07ca69 100644
--- a/features/project/edit_issuetracker.feature
+++ b/features/project/edit_issuetracker.feature
@@ -15,4 +15,4 @@ Feature: Project Issue Tracker
When I visit edit project "Shop" page
And change the issue tracker to "Redmine"
And I save project
- Then I the project should have "Redmine" as issue tracker \ No newline at end of file
+ Then I the project should have "Redmine" as issue tracker
diff --git a/features/project/forked_merge_requests.feature b/features/project/forked_merge_requests.feature
index 5832b729deb..7442145d87e 100644
--- a/features/project/forked_merge_requests.feature
+++ b/features/project/forked_merge_requests.feature
@@ -4,7 +4,6 @@ Feature: Project Forked Merge Requests
And I am a member of project "Shop"
And I have a project forked off of "Shop" called "Forked Shop"
- @javascript
Scenario: I submit new unassigned merge request to a forked project
Given I visit project "Forked Shop" merge requests page
And I click link "New Merge Request"
diff --git a/features/project/hooks.feature b/features/project/hooks.feature
index b158e07ad33..1a60846a23e 100644
--- a/features/project/hooks.feature
+++ b/features/project/hooks.feature
@@ -19,3 +19,14 @@ Feature: Project Hooks
When I click test hook button
Then hook should be triggered
+ Scenario: I test a hook on empty project
+ Given I own empty project with hook
+ And I visit project hooks page
+ When I click test hook button
+ Then I should see hook error message
+
+ Scenario: I test a hook on down URL
+ Given project has hook
+ And I visit project hooks page
+ When I click test hook button with invalid URL
+ Then I should see hook service down error message
diff --git a/features/project/issues/filter_labels.feature b/features/project/issues/filter_labels.feature
index 8df7a119e84..f4a0a7977cc 100644
--- a/features/project/issues/filter_labels.feature
+++ b/features/project/issues/filter_labels.feature
@@ -2,9 +2,10 @@ Feature: Project Filter Labels
Background:
Given I sign in as a user
And I own project "Shop"
- And project "Shop" has issue "Bugfix1" with tags: "bug", "feature"
- And project "Shop" has issue "Bugfix2" with tags: "bug", "enhancement"
- And project "Shop" has issue "Feature1" with tags: "feature"
+ And project "Shop" has labels: "bug", "feature", "enhancement"
+ And project "Shop" has issue "Bugfix1" with labels: "bug", "feature"
+ And project "Shop" has issue "Bugfix2" with labels: "bug", "enhancement"
+ And project "Shop" has issue "Feature1" with labels: "feature"
Given I visit project "Shop" issues page
Scenario: I should see project issues
@@ -18,9 +19,12 @@ Feature: Project Filter Labels
And I should see "Bugfix2" in issues list
And I should not see "Feature1" in issues list
- Scenario: I filter by two labels
- Given I click link "bug"
- And I click link "feature"
- Then I should see "Bugfix1" in issues list
- And I should not see "Bugfix2" in issues list
- And I should not see "Feature1" in issues list
+ # TODO: make labels filter works according to this scanario
+ # right now it looks for label 1 OR label 2. Old behaviour (this test) was
+ # all issues that have both label 1 AND label 2
+ #Scenario: I filter by two labels
+ #Given I click link "bug"
+ #And I click link "feature"
+ #Then I should see "Bugfix1" in issues list
+ #And I should not see "Bugfix2" in issues list
+ #And I should not see "Feature1" in issues list
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
index 191e8dcbe7f..e3001318c23 100644
--- a/features/project/issues/issues.feature
+++ b/features/project/issues/issues.feature
@@ -30,6 +30,13 @@ Feature: Project Issues
And I submit new issue "500 error on profile"
Then I should see issue "500 error on profile"
+ Scenario: I submit new unassigned issue with labels
+ Given project "Shop" has labels: "bug", "feature", "enhancement"
+ And I click link "New Issue"
+ And I submit new issue "500 error on profile" with label 'bug'
+ Then I should see issue "500 error on profile"
+ And I should see label 'bug' with issue
+
@javascript
Scenario: I comment issue
Given I visit issue page "Release 0.4"
@@ -56,6 +63,36 @@ Feature: Project Issues
Then I should see "Release 0.3" in issues
And I should not see "Release 0.4" in issues
+ @javascript
+ Scenario: Search issues when search string exactly matches issue description
+ Given project 'Shop' has issue 'Bugfix1' with description: 'Description for issue1'
+ And I fill in issue search with 'Description for issue1'
+ Then I should see 'Bugfix1' in issues
+ And I should not see "Release 0.4" in issues
+ And I should not see "Release 0.3" in issues
+ And I should not see "Tweet control" in issues
+
+ @javascript
+ Scenario: Search issues when search string partially matches issue description
+ Given project 'Shop' has issue 'Bugfix1' with description: 'Description for issue1'
+ And project 'Shop' has issue 'Feature1' with description: 'Feature submitted for issue1'
+ And I fill in issue search with 'issue1'
+ Then I should see 'Feature1' in issues
+ Then I should see 'Bugfix1' in issues
+ And I should not see "Release 0.4" in issues
+ And I should not see "Release 0.3" in issues
+ And I should not see "Tweet control" in issues
+
+ @javascript
+ Scenario: Search issues when search string matches no issue description
+ Given project 'Shop' has issue 'Bugfix1' with description: 'Description for issue1'
+ And I fill in issue search with 'Rock and roll'
+ Then I should not see 'Bugfix1' in issues
+ And I should not see "Release 0.4" in issues
+ And I should not see "Release 0.3" in issues
+ And I should not see "Tweet control" in issues
+
+
# Markdown
Scenario: Headers inside the description should have ids generated for them.
diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature
index e601a41bfc4..77ee5d8a686 100644
--- a/features/project/issues/labels.feature
+++ b/features/project/issues/labels.feature
@@ -2,9 +2,47 @@ Feature: Project Labels
Background:
Given I sign in as a user
And I own project "Shop"
- And project "Shop" have issues tags: "bug", "feature"
+ And project "Shop" has labels: "bug", "feature", "enhancement"
Given I visit project "Shop" labels page
- Scenario: I should see active milestones
+ Scenario: I should see labels list
Then I should see label "bug"
And I should see label "feature"
+
+ Scenario: I create new label
+ Given I visit project "Shop" new label page
+ When I submit new label 'support'
+ Then I should see label 'support'
+
+ Scenario: I edit label
+ Given I visit 'bug' label edit page
+ When I change label 'bug' to 'fix'
+ Then I should not see label 'bug'
+ Then I should see label 'fix'
+
+ Scenario: I remove label
+ When I remove label 'bug'
+ Then I should not see label 'bug'
+
+ @javascript
+ Scenario: I remove all labels
+ When I delete all labels
+ Then I should see labels help message
+
+ Scenario: I create a label with invalid color
+ Given I visit project "Shop" new label page
+ When I submit new label with invalid color
+ Then I should see label color error message
+
+ Scenario: I create a label that already exists
+ Given I visit project "Shop" new label page
+ When I submit new label 'bug'
+ Then I should see label label exist error message
+
+ Scenario: I create the same label on another project
+ Given I own project "Forum"
+ And I visit project "Forum" labels page
+ And I visit project "Forum" new label page
+ When I submit new label 'bug'
+ Then I should see label 'bug'
+
diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature
index 6a2ba7e3b28..8b6c296dfe6 100644
--- a/features/project/merge_requests.feature
+++ b/features/project/merge_requests.feature
@@ -52,27 +52,27 @@ Feature: Project Merge Requests
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
And I switch to the diff tab
- And I leave a comment like "Line is wrong" on line 185 of the first file
+ And I leave a comment like "Line is wrong" on diff
And I switch to the merge request's comments tab
- Then I should see a discussion has started on line 185
+ Then I should see a discussion has started on diff
@javascript
Scenario: I comment on a line of a commit in merge request
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
- And I click on the first commit in the merge request
- And I leave a comment like "Line is wrong" on line 185 of the first file in commit
+ And I click on the commit in the merge request
+ And I leave a comment like "Line is wrong" on diff in commit
And I switch to the merge request's comments tab
- Then I should see a discussion has started on commit b1e6a9dbf1:L185
+ Then I should see a discussion has started on commit diff
@javascript
Scenario: I comment on a commit in merge request
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
- And I click on the first commit in the merge request
+ And I click on the commit in the merge request
And I leave a comment on the diff page in commit
And I switch to the merge request's comments tab
- Then I should see a discussion has started on commit b1e6a9dbf1
+ Then I should see a discussion has started on commit
@javascript
Scenario: I accept merge request with custom commit message
@@ -139,3 +139,11 @@ Feature: Project Merge Requests
And I click link "Show inline discussion" of the second file
Then I should see a comment like "Line is wrong" in the second file
And I should still see a comment like "Line is correct" in the first file
+
+ @javascript
+ Scenario: I unfold diff
+ Given project "Shop" have "Bug NS-05" open merge request with diffs inside
+ And I visit merge request page "Bug NS-05"
+ And I switch to the diff tab
+ And I unfold diff
+ Then I should see additional file lines
diff --git a/features/project/network.feature b/features/project/network.feature
index 22beb1c50bc..8beb6043aff 100644
--- a/features/project/network.feature
+++ b/features/project/network.feature
@@ -12,28 +12,28 @@ Feature: Project Network Graph
@javascript
Scenario: I should switch "branch" and "tag"
- When I switch ref to "stable"
- Then page should select "stable" in select box
- And page should have "stable" on graph
- When I switch ref to "v2.1.0"
- Then page should select "v2.1.0" in select box
- And page should have "v2.1.0" on graph
+ When I switch ref to "feature"
+ Then page should select "feature" in select box
+ And page should have "feature" on graph
+ When I switch ref to "v1.0.0"
+ Then page should select "v1.0.0" in select box
+ And page should have "v1.0.0" on graph
@javascript
Scenario: I should looking for a commit by SHA
- When I looking for a commit by SHA of "v2.1.0"
+ When I looking for a commit by SHA of "v1.0.0"
Then page should have network graph
And page should select "master" in select box
- And page should have "v2.1.0" on graph
+ And page should have "v1.0.0" on graph
@javascript
Scenario: I should filter selected tag
- When I switch ref to "v2.1.0"
- Then page should have content not containing "v2.1.0"
+ When I switch ref to "v1.0.0"
+ Then page should have content not containing "v1.0.0"
When click "Show only selected branch" checkbox
- Then page should not have content not containing "v2.1.0"
+ Then page should not have content not containing "v1.0.0"
When click "Show only selected branch" checkbox
- Then page should have content not containing "v2.1.0"
+ Then page should have content not containing "v1.0.0"
Scenario: I should fail to look for a commit
When I look for a commit by ";"
diff --git a/features/project/project.feature b/features/project/project.feature
index d8bb1d55e2d..c1f192f123e 100644
--- a/features/project/project.feature
+++ b/features/project/project.feature
@@ -24,3 +24,14 @@ Feature: Project Feature
When I visit edit project "Shop" page
And change project path settings
Then I should see project with new path settings
+
+ Scenario: I should see project readme and version
+ When I visit project "Shop" page
+ Then I should see project "Shop" README link
+ And I should see project "Shop" version
+
+ Scenario: I should change project default branch
+ When I visit edit project "Shop" page
+ And change project default branch
+ And I save project
+ Then I should see project default branch changed
diff --git a/features/project/public.feature b/features/project/public.feature
deleted file mode 100644
index c5a9da14c54..00000000000
--- a/features/project/public.feature
+++ /dev/null
@@ -1,8 +0,0 @@
-Feature: Public Projects
- Background:
- Given I sign in as a user
-
- Scenario: I should see the list of public projects
- When I visit the public projects area
- Then I should see the list of public projects
-
diff --git a/features/project/redirects.feature b/features/project/redirects.feature
index 776ab83a876..a2e77e7bf30 100644
--- a/features/project/redirects.feature
+++ b/features/project/redirects.feature
@@ -31,3 +31,8 @@ Feature: Project Redirects
And I click on "Sign In"
And Authenticate
Then I should be redirected to "Community" page
+
+ Scenario: I visit private project page without signing in
+ When I visit project "Enterprise" page
+ And I get redirected to signin page where I sign in
+ Then I should be redirected to "Enterprise" page
diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature
new file mode 100644
index 00000000000..16882fded8e
--- /dev/null
+++ b/features/project/shortcuts.feature
@@ -0,0 +1,46 @@
+@dashboard
+Feature: Project shortcuts
+ Background:
+ Given I sign in as a user
+ And I own a project
+ And I visit my project's home page
+
+ @javascript
+ Scenario: Navigate to files tab
+ Given I press "g" and "f"
+ Then the active main tab should be Files
+
+ @javascript
+ Scenario: Navigate to commits tab
+ Given I press "g" and "c"
+ Then the active main tab should be Commits
+
+ @javascript
+ Scenario: Navigate to network tab
+ Given I press "g" and "n"
+ Then the active main tab should be Network
+
+ @javascript
+ Scenario: Navigate to graphs tab
+ Given I press "g" and "g"
+ Then the active main tab should be Graphs
+
+ @javascript
+ Scenario: Navigate to issues tab
+ Given I press "g" and "i"
+ Then the active main tab should be Issues
+
+ @javascript
+ Scenario: Navigate to merge requests tab
+ Given I press "g" and "m"
+ Then the active main tab should be Merge Requests
+
+ @javascript
+ Scenario: Navigate to snippets tab
+ Given I press "g" and "s"
+ Then the active main tab should be Snippets
+
+ @javascript
+ Scenario: Navigate to wiki tab
+ Given I press "g" and "w"
+ Then the active main tab should be Wiki
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature
index a204c3e10c7..a674800ccb8 100644
--- a/features/project/source/browse_files.feature
+++ b/features/project/source/browse_files.feature
@@ -8,11 +8,11 @@ Feature: Project Browse files
Then I should see files from repository
Scenario: I browse files for specific ref
- Given I visit project source page for "8470d70"
- Then I should see files from repository for "8470d70"
+ Given I visit project source page for "6d39438"
+ Then I should see files from repository for "6d39438"
Scenario: I browse file content
- Given I click on "Gemfile.lock" file in repo
+ Given I click on ".gitignore" file in repo
Then I should see it content
Scenario: I browse raw file
@@ -26,16 +26,40 @@ Feature: Project Browse files
@javascript
Scenario: I can edit file
- Given I click on "Gemfile.lock" file in repo
+ Given I click on ".gitignore" file in repo
And I click button "edit"
Then I can edit code
@javascript
Scenario: I can see editing preview
- Given I click on "Gemfile.lock" file in repo
+ Given I click on ".gitignore" file in repo
And I click button "edit"
And I edit code
And I click link "Diff"
Then I see diff
+ Scenario: I can browse directory with Browse Dir
+ Given I click on files directory
+ And I click on history link
+ Then I see Browse dir link
+ Scenario: I can browse file with Browse File
+ Given I click on readme file
+ And I click on history link
+ Then I see Browse file link
+
+ Scenario: I can browse code with Browse Code
+ Given I click on history link
+ Then I see Browse code link
+
+ # Permalink
+
+ Scenario: I click on the permalink link from a branch ref
+ Given I click on ".gitignore" file in repo
+ And I click on permalink
+ Then I am redirected to the permalink URL
+
+ Scenario: I don't see the permalink link from a SHA ref
+ Given I visit project source page for "6d394385cf567f80a8fd85055db1ab4c5295806f"
+ And I click on ".gitignore" file in repo
+ Then I don't see the permalink link
diff --git a/features/project/source/git_blame.feature b/features/project/source/git_blame.feature
index 3b20437a875..ae62c166c12 100644
--- a/features/project/source/git_blame.feature
+++ b/features/project/source/git_blame.feature
@@ -5,6 +5,6 @@ Feature: Project Browse git repo
Given I visit project source page
Scenario: I blame file
- Given I click on "Gemfile.lock" file in repo
+ Given I click on ".gitignore" file in repo
And I click blame button
Then I should see git file blame
diff --git a/features/project/source/markdown_render.feature b/features/project/source/markdown_render.feature
index 970a9e57864..fce351317c6 100644
--- a/features/project/source/markdown_render.feature
+++ b/features/project/source/markdown_render.feature
@@ -2,7 +2,7 @@ Feature: Project markdown render
Background:
Given I sign in as a user
And I own project "Delta"
- Given I visit project source page
+ And I visit markdown branch
# Tree README
@@ -11,26 +11,26 @@ Feature: Project markdown render
And I click on a relative link in README
Then I should see the correct markdown
- Scenario: I browse files from master branch
- Then I should see files from repository in master
+ Scenario: I browse files from markdown branch
+ Then I should see files from repository in markdown
And I should see rendered README which contains correct links
And I click on Gitlab API in README
Then I should see correct document rendered
- Scenario: I view README in master branch
- Then I should see files from repository in master
+ Scenario: I view README in markdown branch
+ Then I should see files from repository in markdown
And I should see rendered README which contains correct links
And I click on Rake tasks in README
Then I should see correct directory rendered
- Scenario: I view README in master branch to see reference links to directory
- Then I should see files from repository in master
+ Scenario: I view README in markdown branch to see reference links to directory
+ Then I should see files from repository in markdown
And I should see rendered README which contains correct links
And I click on GitLab API doc directory in README
Then I should see correct doc/api directory rendered
- Scenario: I view README in master branch to see reference links to file
- Then I should see files from repository in master
+ Scenario: I view README in markdown branch to see reference links to file
+ Then I should see files from repository in markdown
And I should see rendered README which contains correct links
And I click on Maintenance in README
Then I should see correct maintenance file rendered
@@ -41,19 +41,19 @@ Feature: Project markdown render
# Blob
- Scenario: I navigate to doc directory to view documentation in master
+ Scenario: I navigate to doc directory to view documentation in markdown
And I navigate to the doc/api/README
And I see correct file rendered
And I click on users in doc/api/README
Then I should see the correct document file
- Scenario: I navigate to doc directory to view user doc in master
+ Scenario: I navigate to doc directory to view user doc in markdown
And I navigate to the doc/api/README
And I see correct file rendered
And I click on raketasks in doc/api/README
Then I should see correct directory rendered
- Scenario: I navigate to doc directory to view user doc in master
+ Scenario: I navigate to doc directory to view user doc in markdown
And I navigate to the doc/api/README
And Header "GitLab API" should have correct id and link
diff --git a/features/project/source/multiselect_blob.feature b/features/project/source/multiselect_blob.feature
index 0fdfe7ce938..f60b646a8d9 100644
--- a/features/project/source/multiselect_blob.feature
+++ b/features/project/source/multiselect_blob.feature
@@ -2,7 +2,7 @@ Feature: Project Multiselect Blob
Background:
Given I sign in as a user
And I own project "Shop"
- And I visit "Gemfile.lock" file in repo
+ And I visit ".gitignore" file in repo
@javascript
Scenario: I click line 1 in file
diff --git a/features/project/source/search_code.feature b/features/project/source/search_code.feature
index 13f15cc922f..93b326696d0 100644
--- a/features/project/source/search_code.feature
+++ b/features/project/source/search_code.feature
@@ -1,9 +1,15 @@
Feature: Project Search code
Background:
Given I sign in as a user
- And I own project "Shop"
- Given I visit project source page
- Scenario: Search for term "Welcome to GitLab"
- When I search for term "Welcome to GitLab"
- Then I should see files from repository containing "Welcome to GitLab"
+ Scenario: Search for term "coffee"
+ Given I own project "Shop"
+ And I visit project source page
+ When I search for term "coffee"
+ Then I should see files from repository containing "coffee"
+
+ Scenario: Search on empty project
+ Given I own an empty project
+ And I visit my project's home page
+ When I search for term "coffee"
+ Then I should see empty result
diff --git a/features/project/star.feature b/features/project/star.feature
new file mode 100644
index 00000000000..3322f891805
--- /dev/null
+++ b/features/project/star.feature
@@ -0,0 +1,38 @@
+Feature: Project Star
+ Scenario: New projects have 0 stars
+ Given public project "Community"
+ When I visit project "Community" page
+ Then The project has no stars
+
+ Scenario: Empty projects show star count
+ Given public empty project "Empty Public Project"
+ When I visit empty project page
+ Then The project has no stars
+
+ Scenario: Signed off users can't star projects
+ Given public project "Community"
+ And I visit project "Community" page
+ When I click on the star toggle button
+ Then The project has 0 stars
+
+ @javascript
+ Scenario: Signed in users can toggle star
+ Given I sign in as "John Doe"
+ And public project "Community"
+ And I visit project "Community" page
+ When I click on the star toggle button
+ Then The project has 1 star
+ When I click on the star toggle button
+ Then The project has 0 stars
+
+ @javascript
+ Scenario: Star count sums stars
+ Given I sign in as "John Doe"
+ And public project "Community"
+ And I visit project "Community" page
+ And I click on the star toggle button
+ And I logout
+ And I sign in as "Mary Jane"
+ And I visit project "Community" page
+ When I click on the star toggle button
+ Then The project has 2 stars
diff --git a/features/search.feature b/features/search.feature
new file mode 100644
index 00000000000..54708c17575
--- /dev/null
+++ b/features/search.feature
@@ -0,0 +1,46 @@
+@dashboard
+Feature: Search
+ Background:
+ Given I sign in as a user
+ And I own project "Shop"
+ And I visit dashboard search page
+
+ Scenario: I should see project I am looking for
+ Given I search for "Sho"
+ Then I should see "Shop" project link
+
+ Scenario: I should see issues I am looking for
+ And project has issues
+ When I search for "Foo"
+ And I click "Issues" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see merge requests I am looking for
+ And project has merge requests
+ When I search for "Foo"
+ When I click "Merge requests" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see project code I am looking for
+ When I click project "Shop" link
+ And I search for "rspec"
+ Then I should see code results for project "Shop"
+
+ Scenario: I should see project issues
+ And project has issues
+ When I click project "Shop" link
+ And I search for "Foo"
+ And I click "Issues" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see project merge requests
+ And project has merge requests
+ When I click project "Shop" link
+ And I search for "Foo"
+ And I click "Merge requests" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
diff --git a/features/steps/admin/active_tab.rb b/features/steps/admin/active_tab.rb
index ccafe09c18f..8f09e51ccef 100644
--- a/features/steps/admin/active_tab.rb
+++ b/features/steps/admin/active_tab.rb
@@ -4,7 +4,7 @@ class AdminActiveTab < Spinach::FeatureSteps
include SharedActiveTab
Then 'the active main tab should be Home' do
- ensure_active_main_tab('Home')
+ ensure_active_main_tab('Overview')
end
Then 'the active main tab should be Projects' do
diff --git a/features/steps/dashboard/active_tab.rb b/features/steps/dashboard/active_tab.rb
index 8f5f0eed816..d5db3339df2 100644
--- a/features/steps/dashboard/active_tab.rb
+++ b/features/steps/dashboard/active_tab.rb
@@ -3,19 +3,7 @@ class DashboardActiveTab < Spinach::FeatureSteps
include SharedPaths
include SharedActiveTab
- Then 'the active main tab should be Home' do
- ensure_active_main_tab('Home')
- end
-
- Then 'the active main tab should be Issues' do
- ensure_active_main_tab('Issues')
- end
-
- Then 'the active main tab should be Merge Requests' do
- ensure_active_main_tab('Merge Requests')
- end
-
- Then 'the active main tab should be Help' do
+ step 'the active main tab should be Help' do
ensure_active_main_tab('Help')
end
end
diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb
index 706c9babcee..84a480bd7f8 100644
--- a/features/steps/dashboard/dashboard.rb
+++ b/features/steps/dashboard/dashboard.rb
@@ -12,7 +12,7 @@ class Dashboard < Spinach::FeatureSteps
end
Then 'I should see last push widget' do
- page.should have_content "You pushed to new_design"
+ page.should have_content "You pushed to fix"
page.should have_link "Create Merge Request"
end
@@ -23,7 +23,7 @@ class Dashboard < Spinach::FeatureSteps
Then 'I see prefilled new Merge Request page' do
current_path.should == new_project_merge_request_path(@project)
find("#merge_request_target_project_id").value.should == @project.id.to_s
- find("#merge_request_source_branch").value.should == "new_design"
+ find("#merge_request_source_branch").value.should == "fix"
find("#merge_request_target_branch").value.should == "master"
end
diff --git a/features/steps/dashboard/search.rb b/features/steps/dashboard/search.rb
deleted file mode 100644
index 32966a8617a..00000000000
--- a/features/steps/dashboard/search.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class DashboardSearch < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedPaths
- include SharedProject
-
- Given 'I search for "Sho"' do
- fill_in "dashboard_search", with: "Sho"
- click_button "Search"
- end
-
- Then 'I should see "Shop" project link' do
- page.should have_link "Shop"
- end
-
- Given 'I search for "Contibuting"' do
- fill_in "dashboard_search", with: "Contibuting"
- click_button "Search"
- end
-end
diff --git a/features/steps/dashboard/shortcuts.rb b/features/steps/dashboard/shortcuts.rb
new file mode 100644
index 00000000000..d4484e7a20f
--- /dev/null
+++ b/features/steps/dashboard/shortcuts.rb
@@ -0,0 +1,6 @@
+class DashboardShortcuts < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+ include SharedActiveTab
+end
diff --git a/features/steps/public/groups_feature.rb b/features/steps/explore/groups_feature.rb
index 015deca5427..b529c5f8455 100644
--- a/features/steps/public/groups_feature.rb
+++ b/features/steps/explore/groups_feature.rb
@@ -1,4 +1,4 @@
-class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
+class Spinach::Features::ExploreGroupsFeature < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedGroup
@@ -15,7 +15,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
step 'group "TestGroup" has public project "Community"' do
group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC)
end
-
+
step '"John Doe" is owner of group "TestGroup"' do
group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup")
user = create(:user, name: "John Doe")
@@ -37,31 +37,31 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
step 'I visit group "TestGroup" members page' do
visit members_group_path(Group.find_by(name: "TestGroup"))
end
-
+
step 'I should not see project "Enterprise" items' do
page.should_not have_content "Enterprise"
end
-
+
step 'I should see project "Internal" items' do
page.should have_content "Internal"
end
-
+
step 'I should not see project "Internal" items' do
page.should_not have_content "Internal"
end
-
+
step 'I should see project "Community" items' do
page.should have_content "Community"
end
-
+
step 'I change filter to Everyone\'s' do
click_link "Everyone's"
end
-
+
step 'I should see group member "John Doe"' do
page.should have_content "John Doe"
end
-
+
step 'I should not see member roles' do
page.body.should_not match(%r{owner|developer|reporter|guest}i)
end
@@ -90,4 +90,3 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
)
end
end
-
diff --git a/features/steps/public/projects.rb b/features/steps/explore/projects.rb
index 7c7311bb91c..f31d32a4a2d 100644
--- a/features/steps/public/projects.rb
+++ b/features/steps/explore/projects.rb
@@ -1,12 +1,8 @@
-class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
+class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
- step 'public empty project "Empty Public Project"' do
- create :empty_project, :public, name: 'Empty Public Project'
- end
-
step 'I should see project "Empty Public Project"' do
page.should have_content "Empty Public Project"
end
@@ -20,16 +16,6 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
page.should have_content 'README.md'
end
- step 'I visit empty project page' do
- project = Project.find_by(name: 'Empty Public Project')
- visit project_path(project)
- end
-
- step 'I visit project "Community" page' do
- project = Project.find_by(name: 'Community')
- visit project_path(project)
- end
-
step 'I should see empty public project details' do
page.should have_content 'Git global setup'
end
@@ -48,24 +34,14 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
end
end
- step 'I visit project "Enterprise" page' do
- project = Project.find_by(name: 'Enterprise')
- visit project_path(project)
- end
-
step 'I should see project "Community" home page' do
- within '.project-home-title' do
+ within '.navbar-gitlab .title' do
page.should have_content 'Community'
end
end
- step 'I visit project "Internal" page' do
- project = Project.find_by(name: 'Internal')
- visit project_path(project)
- end
-
step 'I should see project "Internal" home page' do
- within '.project-home-title' do
+ within '.navbar-gitlab .title' do
page.should have_content 'Internal'
end
end
diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb
index f321428592f..c3ee42f1127 100644
--- a/features/steps/group/group.rb
+++ b/features/steps/group/group.rb
@@ -164,6 +164,41 @@ class Groups < Spinach::FeatureSteps
end
end
+ step 'I click on group milestones' do
+ click_link 'Milestones'
+ end
+
+ step 'I should see group milestones index page has no milestones' do
+ page.should have_content('No milestones to show')
+ end
+
+ step 'Group has projects with milestones' do
+ group_milestone
+ end
+
+ step 'I should see group milestones index page with milestones' do
+ page.should have_content('Version 7.2')
+ page.should have_content('GL-113')
+ page.should have_link('2 Issues', href: group_milestone_path("owned", "version-7-2", title: "Version 7.2"))
+ page.should have_link('3 Merge Requests', href: group_milestone_path("owned", "gl-113", title: "GL-113"))
+ end
+
+ step 'I click on one group milestone' do
+ click_link 'GL-113'
+ end
+
+ step 'I should see group milestone with descriptions and expiry date' do
+ page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry')
+ page.should have_content('expires at Aug 20, 2114')
+ end
+
+ step 'I should see group milestone with all issues and MRs assigned to that milestone' do
+ page.should have_content('Milestone GL-113')
+ page.should have_content('Progress: 0 closed – 4 open')
+ page.should have_link(@issue1.title, href: project_issue_path(@project1, @issue1))
+ page.should have_link(@mr3.title, href: project_merge_request_path(@project3, @mr3))
+ end
+
protected
def assigned_to_me key
@@ -173,4 +208,70 @@ class Groups < Spinach::FeatureSteps
def project
Group.find_by(name: "Owned").projects.first
end
+
+ def group_milestone
+ group = Group.find_by(name: "Owned")
+
+ @project1 = create :project,
+ group: group
+ project2 = create :project,
+ path: 'gitlab-ci',
+ group: group
+ @project3 = create :project,
+ path: 'cookbook-gitlab',
+ group: group
+ milestone1_project1 = create :milestone,
+ title: "Version 7.2",
+ project: @project1
+ milestone1_project2 = create :milestone,
+ title: "Version 7.2",
+ project: project2
+ milestone1_project3 = create :milestone,
+ title: "Version 7.2",
+ project: @project3
+ milestone2_project1 = create :milestone,
+ title: "GL-113",
+ project: @project1
+ milestone2_project2 = create :milestone,
+ title: "GL-113",
+ project: project2
+ milestone2_project3 = create :milestone,
+ title: "GL-113",
+ project: @project3,
+ due_date: '2114-08-20',
+ description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry'
+ @issue1 = create :issue,
+ project: @project1,
+ assignee: current_user,
+ author: current_user,
+ milestone: milestone2_project1
+ issue2 = create :issue,
+ project: project2,
+ assignee: current_user,
+ author: current_user,
+ milestone: milestone1_project2
+ issue3 = create :issue,
+ project: @project3,
+ assignee: current_user,
+ author: current_user,
+ milestone: milestone1_project1
+ mr1 = create :merge_request,
+ source_project: @project1,
+ target_project: @project1,
+ assignee: current_user,
+ author: current_user,
+ milestone: milestone2_project1
+ mr2 = create :merge_request,
+ source_project: project2,
+ target_project: project2,
+ assignee: current_user,
+ author: current_user,
+ milestone: milestone2_project2
+ @mr3 = create :merge_request,
+ source_project: @project3,
+ target_project: @project3,
+ assignee: current_user,
+ author: current_user,
+ milestone: milestone2_project3
+ end
end
diff --git a/features/steps/help.rb b/features/steps/help.rb
index 67054e14303..0d1c9c00376 100644
--- a/features/steps/help.rb
+++ b/features/steps/help.rb
@@ -16,6 +16,6 @@ class Spinach::Features::Help < Spinach::FeatureSteps
end
step 'Header "Rebuild project satellites" should have correct ids and links' do
- header_should_have_correct_id_and_link(2, '(Re-)Create satellite repos', 're-create-satellite-repos', '.documentation')
+ header_should_have_correct_id_and_link(2, '(Re-)Create satellite repositories', 're-create-satellite-repositories', '.documentation')
end
end
diff --git a/features/steps/profile/active_tab.rb b/features/steps/profile/active_tab.rb
index ee9f5f201cf..1924a6fa785 100644
--- a/features/steps/profile/active_tab.rb
+++ b/features/steps/profile/active_tab.rb
@@ -4,7 +4,7 @@ class ProfileActiveTab < Spinach::FeatureSteps
include SharedActiveTab
Then 'the active main tab should be Home' do
- ensure_active_main_tab('Home')
+ ensure_active_main_tab('Profile')
end
Then 'the active main tab should be Account' do
diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb
index 879bcf41b40..5a7ac207314 100644
--- a/features/steps/profile/profile.rb
+++ b/features/steps/profile/profile.rb
@@ -145,6 +145,7 @@ class Profile < Spinach::FeatureSteps
end
step 'I submit new password' do
+ fill_in :user_current_password, with: '12345678'
fill_in :user_password, with: '12345678'
fill_in :user_password_confirmation, with: '12345678'
click_button "Set new password"
@@ -179,7 +180,7 @@ class Profile < Spinach::FeatureSteps
@group.add_owner(current_user)
@project = create(:project, namespace: @group)
@event = create(:closed_issue_event, project: @project)
-
+
@project.team << [current_user, :master]
end
diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb
index dcc252f4765..2862256e03b 100644
--- a/features/steps/project/active_tab.rb
+++ b/features/steps/project/active_tab.rb
@@ -3,44 +3,7 @@ class ProjectActiveTab < Spinach::FeatureSteps
include SharedPaths
include SharedProject
include SharedActiveTab
-
- # Main Tabs
-
- Then 'the active main tab should be Home' do
- ensure_active_main_tab('Home')
- end
-
- Then 'the active main tab should be Settings' do
- ensure_active_main_tab('Settings')
- end
-
- Then 'the active main tab should be Files' do
- ensure_active_main_tab('Files')
- end
-
- Then 'the active main tab should be Commits' do
- ensure_active_main_tab('Commits')
- end
-
- Then 'the active main tab should be Network' do
- ensure_active_main_tab('Network')
- end
-
- Then 'the active main tab should be Issues' do
- ensure_active_main_tab('Issues')
- end
-
- Then 'the active main tab should be Merge Requests' do
- ensure_active_main_tab('Merge Requests')
- end
-
- Then 'the active main tab should be Wall' do
- ensure_active_main_tab('Wall')
- end
-
- Then 'the active main tab should be Wiki' do
- ensure_active_main_tab('Wiki')
- end
+ include SharedProjectTab
# Sub Tabs: Home
diff --git a/features/steps/project/archived.rb b/features/steps/project/archived.rb
index dfbe762c438..8b490d2ffc0 100644
--- a/features/steps/project/archived.rb
+++ b/features/steps/project/archived.rb
@@ -34,4 +34,4 @@ class ProjectArchived < Spinach::FeatureSteps
click_link "Unarchive"
end
-end \ No newline at end of file
+end
diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb
index 7a0625952de..cfc88bdad22 100644
--- a/features/steps/project/browse_branches.rb
+++ b/features/steps/project/browse_branches.rb
@@ -38,9 +38,48 @@ class ProjectBrowseBranches < Spinach::FeatureSteps
click_button 'Create branch'
end
+ step 'I submit new branch form with invalid name' do
+ fill_in 'branch_name', with: '1.0 stable'
+ fill_in 'ref', with: 'master'
+ click_button 'Create branch'
+ end
+
+ step 'I submit new branch form with invalid reference' do
+ fill_in 'branch_name', with: 'foo'
+ fill_in 'ref', with: 'foo'
+ click_button 'Create branch'
+ end
+
+ step 'I submit new branch form with branch that already exists' do
+ fill_in 'branch_name', with: 'master'
+ fill_in 'ref', with: 'master'
+ click_button 'Create branch'
+ end
+
step 'I should see new branch created' do
- within '.tree-ref-holder' do
- page.should have_content 'deploy_keys'
+ page.should have_content 'deploy_keys'
+ end
+
+ step 'I should see new an error that branch is invalid' do
+ page.should have_content 'Branch name invalid'
+ end
+
+ step 'I should see new an error that ref is invalid' do
+ page.should have_content 'Invalid reference name'
+ end
+
+ step 'I should see new an error that branch already exists' do
+ page.should have_content 'Branch already exists'
+ end
+
+ step "I click branch 'improve/awesome' delete link" do
+ within '.js-branch-improve\/awesome' do
+ find('.btn-remove').click
+ sleep 0.05
end
end
+
+ step "I should not see branch 'improve/awesome'" do
+ page.all(visible: true).should_not have_content 'improve/awesome'
+ end
end
diff --git a/features/steps/project/browse_commits.rb b/features/steps/project/browse_commits.rb
index bd944dee610..37207aafebe 100644
--- a/features/steps/project/browse_commits.rb
+++ b/features/steps/project/browse_commits.rb
@@ -2,11 +2,12 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
+ include RepoHelpers
Then 'I see project commits' do
commit = @project.repository.commit
page.should have_content(@project.name)
- page.should have_content(commit.message)
+ page.should have_content(commit.message[0..20])
page.should have_content(commit.id.to_s[0..5])
end
@@ -19,21 +20,21 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
page.response_headers['Content-Type'].should have_content("application/atom+xml")
page.body.should have_selector("title", text: "Recent commits to #{@project.name}")
page.body.should have_selector("author email", text: commit.author_email)
- page.body.should have_selector("entry summary", text: commit.description)
+ page.body.should have_selector("entry summary", text: commit.description[0..10])
end
Given 'I click on commit link' do
- visit project_commit_path(@project, ValidCommit::ID)
+ visit project_commit_path(@project, sample_commit.id)
end
Then 'I see commit info' do
- page.should have_content ValidCommit::MESSAGE
- page.should have_content "Showing 1 changed file"
+ page.should have_content sample_commit.message
+ page.should have_content "Showing #{sample_commit.files_changed_count} changed files"
end
And 'I fill compare fields with refs' do
- fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812"
- fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
+ fill_in "from", with: sample_commit.parent_id
+ fill_in "to", with: sample_commit.id
click_button "Compare"
end
@@ -56,33 +57,24 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
end
Given 'I visit big commit page' do
- visit project_commit_path(@project, BigCommits::BIG_COMMIT_ID)
+ Commit::DIFF_SAFE_FILES = 20
+ visit project_commit_path(@project, sample_big_commit.id)
end
Then 'I see big commit warning' do
- page.should have_content BigCommits::BIG_COMMIT_MESSAGE
- page.should have_content "Warning! This is a large diff"
- page.should have_content "If you still want to see the diff"
- end
-
- Given 'I visit huge commit page' do
- visit project_commit_path(@project, BigCommits::HUGE_COMMIT_ID)
- end
-
- Then 'I see huge commit message' do
- page.should have_content BigCommits::HUGE_COMMIT_MESSAGE
- page.should have_content "Warning! This is a large diff"
- page.should_not have_content "If you still want to see the diff"
+ page.should have_content sample_big_commit.message
+ page.should have_content "Too many changes"
+ Commit::DIFF_SAFE_FILES = 100
end
Given 'I visit a commit with an image that changed' do
- visit project_commit_path(@project, 'cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b')
+ visit project_commit_path(@project, sample_image_commit.id)
end
Then 'The diff links to both the previous and current image' do
links = page.all('.two-up span div a')
- links[0]['href'].should =~ %r{blob/bc3735004cb45cec5e0e4fa92710897a910a5957}
- links[1]['href'].should =~ %r{blob/cc1ba255d6c5ffdce87a357ba7ccc397a4f4026b}
+ links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}}
+ links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}}
end
Given 'I click side-by-side diff button' do
@@ -96,5 +88,4 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
Then 'I see inline diff button' do
page.should have_content "Inline Diff"
end
-
end
diff --git a/features/steps/project/browse_commits_user_lookup.rb b/features/steps/project/browse_commits_user_lookup.rb
index 328be373553..198ea29f28d 100644
--- a/features/steps/project/browse_commits_user_lookup.rb
+++ b/features/steps/project/browse_commits_user_lookup.rb
@@ -2,34 +2,47 @@ class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
-
- Given 'I have the user that authored the commits' do
- @user = create(:user, email: 'dmitriy.zaporozhets@gmail.com')
- create(:email, { user: @user, email: 'dzaporozhets@sphereconsultinginc.com' })
- end
Given 'I click on commit link' do
- visit project_commit_path(@project, ValidCommit::ID)
+ visit project_commit_path(@project, sample_commit.id)
end
Given 'I click on another commit link' do
- visit project_commit_path(@project, ValidCommitWithAltEmail::ID)
+ visit project_commit_path(@project, sample_commit.parent_id)
+ end
+
+ step 'I have user with primary email' do
+ user_primary
+ end
+
+ step 'I have user with secondary email' do
+ user_secondary
end
- Then 'I see commit info' do
- page.should have_content ValidCommit::MESSAGE
- check_author_link(ValidCommit::AUTHOR_EMAIL)
+ step 'I see author based on primary email' do
+ check_author_link(sample_commit.author_email, user_primary)
end
-
- Then 'I see other commit info' do
- page.should have_content ValidCommitWithAltEmail::MESSAGE
- check_author_link(ValidCommitWithAltEmail::AUTHOR_EMAIL)
+
+ step 'I see author based on secondary email' do
+ check_author_link(sample_commit.author_email, user_secondary)
end
- def check_author_link(email)
+ def check_author_link(email, user)
author_link = find('.commit-author-link')
- author_link['href'].should == user_path(@user)
+ author_link['href'].should == user_path(user)
author_link['data-original-title'].should == email
- find('.commit-author-name').text.should == @user.name
+ find('.commit-author-name').text.should == user.name
+ end
+
+ def user_primary
+ @user_primary ||= create(:user, email: 'dmitriy.zaporozhets@gmail.com')
+ end
+
+ def user_secondary
+ @user_secondary ||= begin
+ user = create(:user, email: 'dzaporozhets@example.com')
+ create(:email, { user: user, email: 'dmitriy.zaporozhets@gmail.com' })
+ user
+ end
end
end
diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb
index 7cdd1101ac5..bd395a0d26e 100644
--- a/features/steps/project/browse_files.rb
+++ b/features/steps/project/browse_files.rb
@@ -2,26 +2,26 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
+ include RepoHelpers
step 'I should see files from repository' do
- page.should have_content "app"
- page.should have_content "history"
- page.should have_content "Gemfile"
+ page.should have_content "VERSION"
+ page.should have_content ".gitignore"
+ page.should have_content "LICENSE"
end
- step 'I should see files from repository for "8470d70"' do
- current_path.should == project_tree_path(@project, "8470d70")
- page.should have_content "app"
- page.should have_content "history"
- page.should have_content "Gemfile"
+ step 'I should see files from repository for "6d39438"' do
+ current_path.should == project_tree_path(@project, "6d39438")
+ page.should have_content ".gitignore"
+ page.should have_content "LICENSE"
end
- step 'I click on "Gemfile.lock" file in repo' do
- click_link "Gemfile.lock"
+ step 'I click on ".gitignore" file in repo' do
+ click_link ".gitignore"
end
step 'I should see it content' do
- page.should have_content "DEPENDENCIES"
+ page.should have_content "*.rbc"
end
step 'I click link "raw"' do
@@ -29,7 +29,7 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
end
step 'I should see raw file content' do
- page.source.should == ValidCommit::BLOB_FILE
+ page.source.should == sample_blob.data
end
step 'I click button "edit"' do
@@ -62,4 +62,45 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
page.should have_content "File name"
page.should have_content "Commit message"
end
+
+ step 'I click on files directory' do
+ click_link 'files'
+ end
+
+ step 'I click on history link' do
+ click_link 'history'
+ end
+
+ step 'I see Browse dir link' do
+ page.should have_link 'Browse Dir »'
+ page.should_not have_link 'Browse Code »'
+ end
+
+ step 'I click on readme file' do
+ click_link 'README.md'
+ end
+
+ step 'I see Browse file link' do
+ page.should have_link 'Browse File »'
+ page.should_not have_link 'Browse Code »'
+ end
+
+ step 'I see Browse code link' do
+ page.should have_link 'Browse Code »'
+ page.should_not have_link 'Browse File »'
+ page.should_not have_link 'Browse Dir »'
+ end
+
+ step 'I click on permalink' do
+ click_link 'permalink'
+ end
+
+ step 'I am redirected to the permalink URL' do
+ expect(current_path).to eq(project_blob_path(
+ @project, @project.repository.commit.sha + '/.gitignore'))
+ end
+
+ step "I don't see the permalink link" do
+ expect(page).not_to have_link('permalink')
+ end
end
diff --git a/features/steps/project/browse_git_repo.rb b/features/steps/project/browse_git_repo.rb
index cd9a60f49cb..2c3017dd4e2 100644
--- a/features/steps/project/browse_git_repo.rb
+++ b/features/steps/project/browse_git_repo.rb
@@ -3,8 +3,8 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- Given 'I click on "Gemfile.lock" file in repo' do
- click_link "Gemfile.lock"
+ Given 'I click on ".gitignore" file in repo' do
+ click_link ".gitignore"
end
And 'I click blame button' do
@@ -12,8 +12,8 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps
end
Then 'I should see git file blame' do
- page.should have_content "DEPENDENCIES"
+ page.should have_content "*.rb"
page.should have_content "Dmitriy Zaporozhets"
- page.should have_content "Moving to rails 3.2"
+ page.should have_content "Initial commit"
end
end
diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb
index 0cbfa0d80aa..64c0c284f6c 100644
--- a/features/steps/project/browse_tags.rb
+++ b/features/steps/project/browse_tags.rb
@@ -3,8 +3,52 @@ class ProjectBrowseTags < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- Then 'I should see "Shop" all tags list' do
+ step 'I should see "Shop" all tags list' do
page.should have_content "Tags"
- page.should have_content "v1.2.1"
+ page.should have_content "v1.0.0"
+ end
+
+ step 'I click new tag link' do
+ click_link 'New tag'
+ end
+
+ step 'I submit new tag form' do
+ fill_in 'tag_name', with: 'v7.0'
+ fill_in 'ref', with: 'master'
+ click_button 'Create tag'
+ end
+
+ step 'I submit new tag form with invalid name' do
+ fill_in 'tag_name', with: 'v 1.0'
+ fill_in 'ref', with: 'master'
+ click_button 'Create tag'
+ end
+
+ step 'I submit new tag form with invalid reference' do
+ fill_in 'tag_name', with: 'foo'
+ fill_in 'ref', with: 'foo'
+ click_button 'Create tag'
+ end
+
+ step 'I submit new tag form with tag that already exists' do
+ fill_in 'tag_name', with: 'v1.0.0'
+ fill_in 'ref', with: 'master'
+ click_button 'Create tag'
+ end
+
+ step 'I should see new tag created' do
+ page.should have_content 'v7.0'
+ end
+
+ step 'I should see new an error that tag is invalid' do
+ page.should have_content 'Tag name invalid'
+ end
+
+ step 'I should see new an error that tag ref is invalid' do
+ page.should have_content 'Invalid reference name'
+ end
+
+ step 'I should see new an error that tag already exists' do
+ page.should have_content 'Tag already exists'
end
end
diff --git a/features/steps/project/filter_labels.rb b/features/steps/project/filter_labels.rb
index 5926d69d6c7..9b31a6d9da2 100644
--- a/features/steps/project/filter_labels.rb
+++ b/features/steps/project/filter_labels.rb
@@ -3,68 +3,77 @@ class ProjectFilterLabels < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- Then 'I should see "bug" in labels filter' do
+ step 'I should see "bug" in labels filter' do
within ".labels-filter" do
page.should have_content "bug"
end
end
- And 'I should see "feature" in labels filter' do
+ step 'I should see "feature" in labels filter' do
within ".labels-filter" do
page.should have_content "feature"
end
end
- And 'I should see "enhancement" in labels filter' do
+ step 'I should see "enhancement" in labels filter' do
within ".labels-filter" do
page.should have_content "enhancement"
end
end
- Then 'I should see "Bugfix1" in issues list' do
+ step 'I should see "Bugfix1" in issues list' do
within ".issues-list" do
page.should have_content "Bugfix1"
end
end
- And 'I should see "Bugfix2" in issues list' do
+ step 'I should see "Bugfix2" in issues list' do
within ".issues-list" do
page.should have_content "Bugfix2"
end
end
- And 'I should not see "Bugfix2" in issues list' do
+ step 'I should not see "Bugfix2" in issues list' do
within ".issues-list" do
page.should_not have_content "Bugfix2"
end
end
- And 'I should not see "Feature1" in issues list' do
+ step 'I should not see "Feature1" in issues list' do
within ".issues-list" do
page.should_not have_content "Feature1"
end
end
- Given 'I click link "bug"' do
- click_link "bug"
+ step 'I click link "bug"' do
+ within ".labels-filter" do
+ click_link "bug"
+ end
end
- Given 'I click link "feature"' do
- click_link "feature"
+ step 'I click link "feature"' do
+ within ".labels-filter" do
+ click_link "feature"
+ end
end
- And 'project "Shop" has issue "Bugfix1" with tags: "bug", "feature"' do
+ step 'project "Shop" has issue "Bugfix1" with labels: "bug", "feature"' do
project = Project.find_by(name: "Shop")
- create(:issue, title: "Bugfix1", project: project, label_list: ['bug', 'feature'])
+ issue = create(:issue, title: "Bugfix1", project: project)
+ issue.labels << project.labels.find_by(title: 'bug')
+ issue.labels << project.labels.find_by(title: 'feature')
end
- And 'project "Shop" has issue "Bugfix2" with tags: "bug", "enhancement"' do
+ step 'project "Shop" has issue "Bugfix2" with labels: "bug", "enhancement"' do
project = Project.find_by(name: "Shop")
- create(:issue, title: "Bugfix2", project: project, label_list: ['bug', 'enhancement'])
+ issue = create(:issue, title: "Bugfix2", project: project)
+ issue.labels << project.labels.find_by(title: 'bug')
+ issue.labels << project.labels.find_by(title: 'enhancement')
end
- And 'project "Shop" has issue "Feature1" with tags: "feature"' do
+ step 'project "Shop" has issue "Feature1" with labels: "feature"' do
project = Project.find_by(name: "Shop")
- create(:issue, title: "Feature1", project: project, label_list: 'feature')
+ issue = create(:issue, title: "Feature1", project: project)
+ issue.labels << project.labels.find_by(title: 'feature')
end
end
diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb
index c00d9014b1d..93ceaa0ebb1 100644
--- a/features/steps/project/fork.rb
+++ b/features/steps/project/fork.rb
@@ -6,31 +6,23 @@ class ForkProject < Spinach::FeatureSteps
step 'I click link "Fork"' do
page.should have_content "Shop"
page.should have_content "Fork"
- Gitlab::Shell.any_instance.stub(:fork_repository).and_return(true)
click_link "Fork"
end
step 'I am a member of project "Shop"' do
- @project = Project.find_by(name: "Shop")
- @project ||= create(:project, name: "Shop", group: create(:group))
+ @project = create(:project, name: "Shop")
@project.team << [@user, :reporter]
end
step 'I should see the forked project page' do
page.should have_content "Project was successfully forked."
- current_path.should include current_user.namespace.path
- @forked_project = Project.find_by(namespace_id: current_user.namespace.path)
end
step 'I already have a project named "Shop" in my namespace' do
- current_user.namespace ||= create(:namespace)
- current_user.namespace.should_not be_nil
- current_user.namespace.path.should_not be_nil
@my_project = create(:project, name: "Shop", namespace: current_user.namespace)
end
step 'I should see a "Name has already been taken" warning' do
page.should have_content "Name has already been taken"
end
-
end
diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb
index 3c497638d9c..6ec527df13d 100644
--- a/features/steps/project/forked_merge_requests.rb
+++ b/features/steps/project/forked_merge_requests.rb
@@ -9,18 +9,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
@project = Project.find_by(name: "Shop")
@project ||= create(:project, name: "Shop")
@project.team << [@user, :reporter]
+ @project.ensure_satellite_exists
end
step 'I have a project forked off of "Shop" called "Forked Shop"' do
- @forking_user = @user
- forked_project_link = build(:forked_project_link)
- @forked_project = Project.find_by(name: "Forked Shop")
- @forked_project ||= create(:project, name: "Forked Shop", forked_project_link: forked_project_link, creator_id: @forking_user.id , namespace: @forking_user.namespace)
-
- forked_project_link.forked_from_project = @project
- forked_project_link.forked_to_project = @forked_project
- @forked_project.team << [@forking_user , :master]
- forked_project_link.save!
+ @forked_project = Projects::ForkService.new(@project, @user).execute
end
step 'I click link "New Merge Request"' do
@@ -33,8 +26,8 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
current_path.should == project_merge_request_path(@project, @merge_request)
@merge_request.title.should == "Merge Request On Forked Project"
@merge_request.source_project.should == @forked_project
- @merge_request.source_branch.should == "master"
- @merge_request.target_branch.should == "stable"
+ @merge_request.source_branch.should == "fix"
+ @merge_request.target_branch.should == "master"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
@@ -42,17 +35,11 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I fill out a "Merge Request On Forked Project" merge request' do
- select2 @forked_project.id, from: "#merge_request_source_project_id"
- select2 @project.id, from: "#merge_request_target_project_id"
-
- find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s
- find(:select, "merge_request_target_project_id", {}).value.should == @project.id.to_s
-
- select2 "master", from: "#merge_request_source_branch"
- select2 "stable", from: "#merge_request_target_branch"
+ select @forked_project.path_with_namespace, from: "merge_request_source_project_id"
+ select @project.path_with_namespace, from: "merge_request_target_project_id"
+ select "fix", from: "merge_request_source_branch"
+ select "master", from: "merge_request_target_branch"
- find(:select, "merge_request_source_branch", {}).value.should == 'master'
- find(:select, "merge_request_target_branch", {}).value.should == 'stable'
click_button "Compare branches"
fill_in "merge_request_title", with: "Merge Request On Forked Project"
@@ -101,8 +88,8 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
@merge_request = @project.merge_requests.last
current_path.should == project_merge_request_path(@project, @merge_request)
@merge_request.source_project.should == @forked_project
- @merge_request.source_branch.should == "master"
- @merge_request.target_branch.should == "stable"
+ @merge_request.source_branch.should == "fix"
+ @merge_request.target_branch.should == "master"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
@@ -114,33 +101,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
page.should have_link "Create Merge Request"
end
- step 'project "Forked Shop" has push event' do
- @forked_project = Project.find_by(name: "Forked Shop")
-
- data = {
- before: "0000000000000000000000000000000000000000",
- after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
- ref: "refs/heads/new_design",
- user_id: @user.id,
- user_name: @user.name,
- repository: {
- name: @forked_project.name,
- url: "localhost/rubinius",
- description: "",
- homepage: "localhost/rubinius",
- private: true
- }
- }
-
- @event = Event.create(
- project: @forked_project,
- action: Event::PUSHED,
- data: data,
- author_id: @user.id
- )
- end
-
-
step 'I click link edit "Merge Request On Forked Project"' do
find("#edit_merge_request").click
end
diff --git a/features/steps/project/hooks.rb b/features/steps/project/hooks.rb
index 19ff3244543..2bd383676e7 100644
--- a/features/steps/project/hooks.rb
+++ b/features/steps/project/hooks.rb
@@ -8,31 +8,57 @@ class ProjectHooks < Spinach::FeatureSteps
include RSpec::Mocks::ExampleMethods
include WebMock::API
- Given 'project has hook' do
+ step 'project has hook' do
@hook = create(:project_hook, project: current_project)
end
- Then 'I should see project hook' do
+ step 'I own empty project with hook' do
+ @project = create(:empty_project,
+ name: 'Empty Project', namespace: @user.namespace)
+ @hook = create(:project_hook, project: current_project)
+ end
+
+ step 'I should see project hook' do
page.should have_content @hook.url
end
- When 'I submit new hook' do
+ step 'I submit new hook' do
@url = Faker::Internet.uri("http")
fill_in "hook_url", with: @url
expect { click_button "Add Web Hook" }.to change(ProjectHook, :count).by(1)
end
- Then 'I should see newly created hook' do
+ step 'I should see newly created hook' do
page.current_path.should == project_hooks_path(current_project)
page.should have_content(@url)
end
- When 'I click test hook button' do
+ step 'I click test hook button' do
stub_request(:post, @hook.url).to_return(status: 200)
click_link 'Test Hook'
end
- Then 'hook should be triggered' do
+ step 'I click test hook button with invalid URL' do
+ stub_request(:post, @hook.url).to_raise(SocketError)
+ click_link 'Test Hook'
+ end
+
+ step 'hook should be triggered' do
page.current_path.should == project_hooks_path(current_project)
+ page.should have_selector '.flash-notice',
+ text: 'Hook successfully executed.'
+ end
+
+ step 'I should see hook error message' do
+ page.should have_selector '.flash-alert',
+ text: 'Hook execution failed. '\
+ 'Ensure the project has commits.'
+ end
+
+ step 'I should see hook service down error message' do
+ page.should have_selector '.flash-alert',
+ text: 'Hook execution failed. '\
+ 'Ensure hook URL is correct and '\
+ 'service is up.'
end
end
diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb
index d0b4aa6e080..32a3a0d3f56 100644
--- a/features/steps/project/issues.rb
+++ b/features/steps/project/issues.rb
@@ -50,10 +50,22 @@ class ProjectIssues < Spinach::FeatureSteps
click_button "Submit new issue"
end
+ step 'I submit new issue "500 error on profile" with label \'bug\'' do
+ fill_in "issue_title", with: "500 error on profile"
+ select 'bug', from: "Labels"
+ click_button "Submit new issue"
+ end
+
Given 'I click link "500 error on profile"' do
click_link "500 error on profile"
end
+ step 'I should see label \'bug\' with issue' do
+ within '.issue-show-labels' do
+ page.should have_content 'bug'
+ end
+ end
+
Then 'I should see issue "500 error on profile"' do
issue = Issue.find_by(title: "500 error on profile")
page.should have_content issue.title
@@ -62,34 +74,34 @@ class ProjectIssues < Spinach::FeatureSteps
end
Given 'I fill in issue search with "Re"' do
- fill_in 'issue_search', with: "Re"
+ filter_issue "Re"
end
Given 'I fill in issue search with "Bu"' do
- fill_in 'issue_search', with: "Bu"
+ filter_issue "Bu"
end
And 'I fill in issue search with ".3"' do
- fill_in 'issue_search', with: ".3"
+ filter_issue ".3"
end
And 'I fill in issue search with "Something"' do
- fill_in 'issue_search', with: "Something"
+ filter_issue "Something"
end
And 'I fill in issue search with ""' do
- fill_in 'issue_search', with: ""
+ filter_issue ""
end
Given 'project "Shop" has milestone "v2.2"' do
- project = Project.find_by(name: "Shop")
+
milestone = create(:milestone, title: "v2.2", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
end
And 'project "Shop" has milestone "v3.0"' do
- project = Project.find_by(name: "Shop")
+
milestone = create(:milestone, title: "v3.0", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
@@ -105,20 +117,20 @@ class ProjectIssues < Spinach::FeatureSteps
end
When 'I select first assignee from "Shop" project' do
- project = Project.find_by(name: "Shop")
+
first_assignee = project.users.first
select first_assignee.name, from: "assignee_id"
end
Then 'I should see first assignee from "Shop" as selected assignee' do
issues_assignee_selector = "#issue_assignee_id_chzn > a"
- project = Project.find_by(name: "Shop")
+
assignee_name = project.users.first.name
page.find(issues_assignee_selector).should have_content(assignee_name)
end
And 'project "Shop" have "Release 0.4" open issue' do
- project = Project.find_by(name: "Shop")
+
create(:issue,
title: "Release 0.4",
project: project,
@@ -128,7 +140,6 @@ class ProjectIssues < Spinach::FeatureSteps
end
And 'project "Shop" have "Tweet control" open issue' do
- project = Project.find_by(name: "Shop")
create(:issue,
title: "Tweet control",
project: project,
@@ -136,7 +147,6 @@ class ProjectIssues < Spinach::FeatureSteps
end
And 'project "Shop" have "Release 0.3" closed issue' do
- project = Project.find_by(name: "Shop")
create(:closed_issue,
title: "Release 0.3",
project: project,
@@ -175,4 +185,47 @@ class ProjectIssues < Spinach::FeatureSteps
step 'The code block should be unchanged' do
page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
end
+
+ step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do
+ issue = create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project)
+ end
+
+ step 'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\'' do
+ issue = create(:issue, title: 'Feature1', description: 'Feature submitted for issue1', project: project)
+ end
+
+ step 'I fill in issue search with \'Description for issue1\'' do
+ filter_issue 'Description for issue'
+ end
+
+ step 'I fill in issue search with \'issue1\'' do
+ filter_issue 'issue1'
+ end
+
+ step 'I fill in issue search with \'Rock and roll\'' do
+ filter_issue 'Description for issue'
+ end
+
+ step 'I should see \'Bugfix1\' in issues' do
+ page.should have_content 'Bugfix1'
+ end
+
+ step 'I should see \'Feature1\' in issues' do
+ page.should have_content 'Feature1'
+ end
+
+ step 'I should not see \'Bugfix1\' in issues' do
+ page.should_not have_content 'Bugfix1'
+ end
+
+ def filter_issue(text)
+ fill_in 'issue_search', with: text
+
+ # make sure AJAX request finished
+ URI.parse(current_url).request_uri == project_issues_path(project, issue_search: text)
+ end
+
+ def project
+ @project ||= Project.find_by(name: 'Shop')
+ end
end
diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb
index 0907cdb526f..6dd4df8a1ad 100644
--- a/features/steps/project/labels.rb
+++ b/features/steps/project/labels.rb
@@ -3,22 +3,105 @@ class ProjectLabels < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- Then 'I should see label "bug"' do
- within ".labels-table" do
+ step 'I should see label "bug"' do
+ within ".manage-labels-list" do
page.should have_content "bug"
end
end
- And 'I should see label "feature"' do
- within ".labels-table" do
+ step 'I should see label "feature"' do
+ within ".manage-labels-list" do
page.should have_content "feature"
end
end
- And 'project "Shop" have issues tags: "bug", "feature"' do
- project = Project.find_by(name: "Shop")
- ['bug', 'feature'].each do |label|
- create(:issue, project: project, label_list: label)
+ step 'I visit \'bug\' label edit page' do
+ visit edit_project_label_path(project, bug_label)
+ end
+
+ step 'I remove label \'bug\'' do
+ within "#label_#{bug_label.id}" do
+ click_link 'Remove'
+ end
+ end
+
+ step 'I delete all labels' do
+ within '.labels' do
+ all('.btn-remove').each do |remove|
+ remove.click
+ sleep 0.05
+ end
+ end
+ end
+
+ step 'I should see labels help message' do
+ within '.labels' do
+ page.should have_content 'Create first label or generate default set of '\
+ 'labels'
+ end
+ end
+
+ step 'I submit new label \'support\'' do
+ fill_in 'Title', with: 'support'
+ fill_in 'Background Color', with: '#F95610'
+ click_button 'Save'
+ end
+
+ step 'I submit new label \'bug\'' do
+ fill_in 'Title', with: 'bug'
+ fill_in 'Background Color', with: '#F95610'
+ click_button 'Save'
+ end
+
+ step 'I submit new label with invalid color' do
+ fill_in 'Title', with: 'support'
+ fill_in 'Background Color', with: '#12'
+ click_button 'Save'
+ end
+
+ step 'I should see label label exist error message' do
+ within '.label-form' do
+ page.should have_content 'Title has already been taken'
+ end
+ end
+
+ step 'I should see label color error message' do
+ within '.label-form' do
+ page.should have_content 'Color is invalid'
+ end
+ end
+
+ step 'I should see label \'bug\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'bug'
+ end
+ end
+
+ step 'I should not see label \'bug\'' do
+ within '.manage-labels-list' do
+ page.should_not have_content 'bug'
+ end
+ end
+
+ step 'I should see label \'support\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'support'
end
end
+
+ step 'I change label \'bug\' to \'fix\'' do
+ fill_in 'Title', with: 'fix'
+ fill_in 'Background Color', with: '#F15610'
+ click_button 'Save'
+ end
+
+ step 'I should see label \'fix\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'fix'
+ end
+ end
+
+ def bug_label
+ project.labels.find_or_create_by(title: 'bug')
+ end
end
diff --git a/features/steps/project/markdown_render.rb b/features/steps/project/markdown_render.rb
index c94de283069..1885649891e 100644
--- a/features/steps/project/markdown_render.rb
+++ b/features/steps/project/markdown_render.rb
@@ -12,11 +12,10 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
@project.team << [@user, :master]
end
- Then 'I should see files from repository in master' do
- current_path.should == project_tree_path(@project, "master")
- page.should have_content "Gemfile"
- page.should have_content "app"
- page.should have_content "README"
+ Then 'I should see files from repository in markdown' do
+ current_path.should == project_tree_path(@project, "markdown")
+ page.should have_content "README.md"
+ page.should have_content "CHANGELOG"
end
And 'I should see rendered README which contains correct links' do
@@ -34,7 +33,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Then 'I should see correct document rendered' do
- current_path.should == project_blob_path(@project, "master/doc/api/README.md")
+ current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "All API requests require authentication"
end
@@ -43,7 +42,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Then 'I should see correct directory rendered' do
- current_path.should == project_tree_path(@project, "master/doc/raketasks")
+ current_path.should == project_tree_path(@project, "markdown/doc/raketasks")
page.should have_content "backup_restore.md"
page.should have_content "maintenance.md"
end
@@ -53,7 +52,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Then 'I should see correct doc/api directory rendered' do
- current_path.should == project_tree_path(@project, "master/doc/api")
+ current_path.should == project_tree_path(@project, "markdown/doc/api")
page.should have_content "README.md"
page.should have_content "users.md"
end
@@ -63,7 +62,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Then 'I should see correct maintenance file rendered' do
- current_path.should == project_blob_path(@project, "master/doc/raketasks/maintenance.md")
+ current_path.should == project_blob_path(@project, "markdown/doc/raketasks/maintenance.md")
page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production"
end
@@ -86,7 +85,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
And 'I see correct file rendered' do
- current_path.should == project_blob_path(@project, "master/doc/api/README.md")
+ current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "Contents"
page.should have_link "Users"
page.should have_link "Rake tasks"
@@ -97,7 +96,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Then 'I should see the correct document file' do
- current_path.should == project_blob_path(@project, "master/doc/api/users.md")
+ current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "Get a list of users."
end
@@ -125,9 +124,8 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
Then 'I should see files from repository in markdown branch' do
current_path.should == project_tree_path(@project, "markdown")
- page.should have_content "Gemfile"
- page.should have_content "app"
- page.should have_content "README"
+ page.should have_content "README.md"
+ page.should have_content "CHANGELOG"
end
And 'I see correct file rendered in markdown branch' do
@@ -256,8 +254,8 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Given 'I go directory which contains README file' do
- visit project_tree_path(@project, "master/doc/api")
- current_path.should == project_tree_path(@project, "master/doc/api")
+ visit project_tree_path(@project, "markdown/doc/api")
+ current_path.should == project_tree_path(@project, "markdown/doc/api")
end
And 'I click on a relative link in README' do
@@ -265,7 +263,7 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
end
Then 'I should see the correct markdown' do
- current_path.should == project_blob_path(@project, "master/doc/api/users.md")
+ current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "List users"
end
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index e0aec699a56..05d3e5067c5 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -61,8 +61,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I submit new merge request "Wiki Feature"' do
- select "master", from: "merge_request_source_branch"
- select "notes_refactoring", from: "merge_request_target_branch"
+ select "fix", from: "merge_request_source_branch"
+ select "feature", from: "merge_request_target_branch"
click_button "Compare branches"
fill_in "merge_request_title", with: "Wiki Feature"
click_button "Submit merge request"
@@ -73,7 +73,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
title: "Bug NS-04",
source_project: project,
target_project: project,
- source_branch: 'stable',
+ source_branch: 'fix',
target_branch: 'master',
author: project.users.first,
description: "# Description header"
@@ -104,9 +104,9 @@ class ProjectMergeRequests < Spinach::FeatureSteps
visit project_merge_request_path(project, merge_request)
end
- step 'I click on the first commit in the merge request' do
- within '.first-commits' do
- click_link merge_request.commits.first.short_id(8)
+ step 'I click on the commit in the merge request' do
+ within '.mr-commits' do
+ click_link sample_commit.id[0..8]
end
end
@@ -116,36 +116,35 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I leave a comment on the diff page in commit' do
- find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
+ click_diff_line(sample_commit.line_code)
leave_comment "One comment to rule them all"
end
- step 'I leave a comment like "Line is wrong" on line 185 of the first file' do
+ step 'I leave a comment like "Line is wrong" on diff' do
init_diff_note
leave_comment "Line is wrong"
end
- step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do
- find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
+ step 'I leave a comment like "Line is wrong" on diff in commit' do
+ click_diff_line(sample_commit.line_code)
leave_comment "Line is wrong"
end
- step 'I should see a discussion has started on line 185' do
- page.should have_content "#{current_user.name} started a discussion on this merge request diff"
- page.should have_content "app/assets/stylesheets/tree.scss:L185"
+ step 'I should see a discussion has started on diff' do
+ page.should have_content "#{current_user.name} started a discussion"
+ page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong"
end
- step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do
+ step 'I should see a discussion has started on commit diff' do
page.should have_content "#{current_user.name} started a discussion on commit"
- page.should have_content "app/assets/stylesheets/tree.scss:L185"
+ page.should have_content sample_commit.line_code_path
page.should have_content "Line is wrong"
end
- step 'I should see a discussion has started on commit b1e6a9dbf1' do
+ step 'I should see a discussion has started on commit' do
page.should have_content "#{current_user.name} started a discussion on commit"
page.should have_content "One comment to rule them all"
- page.should have_content "app/assets/stylesheets/tree.scss:L185"
end
step 'merge request is mergeable' do
@@ -162,6 +161,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I accept this merge request' do
+ Gitlab::Satellite::MergeAction.any_instance.stub(
+ merge!: true,
+ )
+
click_button "Accept Merge Request"
end
@@ -239,6 +242,14 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
end
+ step 'I unfold diff' do
+ first('.js-unfold').click
+ end
+
+ step 'I should see additional file lines' do
+ expect(first('.text-file')).to have_content('.bundle')
+ end
+
def project
@project ||= Project.find_by!(name: "Shop")
end
@@ -248,7 +259,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
def init_diff_note
- find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click
+ click_diff_line(sample_commit.line_code)
end
def leave_comment(message)
@@ -257,20 +268,22 @@ class ProjectMergeRequests < Spinach::FeatureSteps
click_button "Add Comment"
end
- within ".note-text" do
- page.should have_content message
- end
+ page.should have_content message
end
def init_diff_note_first_file
- find('a[data-line-code="a5cc2925ca8258af241be7e5b0381edf30266302_12_12"]').click
+ click_diff_line(sample_compare.changes[0][:line_code])
end
def init_diff_note_second_file
- find('a[data-line-code="8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_28_39"]').click
+ click_diff_line(sample_compare.changes[1][:line_code])
end
def have_visible_content (text)
have_css("*", text: text, visible: true)
end
+
+ def click_diff_line(code)
+ find("a[data-line-code='#{code}']").click
+ end
end
diff --git a/features/steps/project/multiselect_blob.rb b/features/steps/project/multiselect_blob.rb
index 3d330e837c1..d4dc1186970 100644
--- a/features/steps/project/multiselect_blob.rb
+++ b/features/steps/project/multiselect_blob.rb
@@ -52,7 +52,7 @@ class ProjectMultiselectBlob < Spinach::FeatureSteps
page.evaluate_script("window.history.forward()")
end
- step 'I click on "Gemfile.lock" file in repo' do
- click_link "Gemfile.lock"
+ step 'I click on ".gitignore" file in repo' do
+ click_link ".gitignore"
end
-end \ No newline at end of file
+end
diff --git a/features/steps/project/network_graph.rb b/features/steps/project/network_graph.rb
index 1c5cfcc6c68..9f5da288914 100644
--- a/features/steps/project/network_graph.rb
+++ b/features/steps/project/network_graph.rb
@@ -19,8 +19,8 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
page.should have_selector '.select2-chosen', text: "master"
end
- And 'page should select "v2.1.0" in select box' do
- page.should have_selector '.select2-chosen', text: "v2.1.0"
+ And 'page should select "v1.0.0" in select box' do
+ page.should have_selector '.select2-chosen', text: "v1.0.0"
end
And 'page should have "master" on graph' do
@@ -29,13 +29,13 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end
end
- When 'I switch ref to "stable"' do
- page.select 'stable', from: 'ref'
+ When 'I switch ref to "feature"' do
+ page.select 'feature', from: 'ref'
sleep 2
end
- When 'I switch ref to "v2.1.0"' do
- page.select 'v2.1.0', from: 'ref'
+ When 'I switch ref to "v1.0.0"' do
+ page.select 'v1.0.0', from: 'ref'
sleep 2
end
@@ -44,43 +44,43 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
sleep 2
end
- Then 'page should have content not containing "v2.1.0"' do
+ Then 'page should have content not containing "v1.0.0"' do
within '.network-graph' do
- page.should have_content 'cleaning'
+ page.should have_content 'Change some files'
end
end
- Then 'page should not have content not containing "v2.1.0"' do
+ Then 'page should not have content not containing "v1.0.0"' do
within '.network-graph' do
- page.should_not have_content 'cleaning'
+ page.should_not have_content 'Change some files'
end
end
- And 'page should select "stable" in select box' do
- page.should have_selector '.select2-chosen', text: "stable"
+ And 'page should select "feature" in select box' do
+ page.should have_selector '.select2-chosen', text: "feature"
end
- And 'page should select "v2.1.0" in select box' do
- page.should have_selector '.select2-chosen', text: "v2.1.0"
+ And 'page should select "v1.0.0" in select box' do
+ page.should have_selector '.select2-chosen', text: "v1.0.0"
end
- And 'page should have "stable" on graph' do
+ And 'page should have "feature" on graph' do
within '.network-graph' do
- page.should have_content 'stable'
+ page.should have_content 'feature'
end
end
- When 'I looking for a commit by SHA of "v2.1.0"' do
+ When 'I looking for a commit by SHA of "v1.0.0"' do
within ".network-form" do
- fill_in 'extended_sha1', with: '98d6492'
+ fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
find('button').click
end
sleep 2
end
- And 'page should have "v2.1.0" on graph' do
+ And 'page should have "v1.0.0" on graph' do
within '.network-graph' do
- page.should have_content 'v2.1.0'
+ page.should have_content 'v1.0.0'
end
end
diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb
index 92728d474b2..2ffa1a62978 100644
--- a/features/steps/project/project.rb
+++ b/features/steps/project/project.rb
@@ -24,4 +24,25 @@ class ProjectFeature < Spinach::FeatureSteps
step 'I should see project with new path settings' do
project.path.should == "new-path"
end
+
+ step 'I should see project "Shop" README link' do
+ within '.project-side' do
+ page.should have_content "README.md"
+ end
+ end
+
+ step 'I should see project "Shop" version' do
+ within '.project-side' do
+ page.should have_content "Version: 6.7.0.pre"
+ end
+ end
+
+ step 'change project default branch' do
+ select 'fix', from: 'project_default_branch'
+ click_button 'Save changes'
+ end
+
+ step 'I should see project default branch changed' do
+ find(:css, 'select#project_default_branch').value.should == 'fix'
+ end
end
diff --git a/features/steps/project/project_shortcuts.rb b/features/steps/project/project_shortcuts.rb
new file mode 100644
index 00000000000..ce6e21a4258
--- /dev/null
+++ b/features/steps/project/project_shortcuts.rb
@@ -0,0 +1,36 @@
+class ProjectShortcuts < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+ include SharedProjectTab
+
+ step 'I press "g" and "f"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('f')
+ end
+
+ step 'I press "g" and "c"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('c')
+ end
+
+ step 'I press "g" and "n"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('n')
+ end
+
+ step 'I press "g" and "g"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('g')
+ end
+
+ step 'I press "g" and "s"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('s')
+ end
+
+ step 'I press "g" and "w"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('w')
+ end
+end
diff --git a/features/steps/project/public.rb b/features/steps/project/public.rb
deleted file mode 100644
index 7063e7d56ae..00000000000
--- a/features/steps/project/public.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class PublicProjects < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedProject
- include SharedPaths
-
- Then 'I should see the list of public projects' do
- page.should have_content "Public Projects"
- end
-end
diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb
index 5a4342dba30..39d39c8aeca 100644
--- a/features/steps/project/redirects.rb
+++ b/features/steps/project/redirects.rb
@@ -17,7 +17,8 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
end
step 'I should see project "Community" home page' do
- within '.project-home-title' do
+ Gitlab.config.gitlab.stub(:host).and_return("www.example.com")
+ within '.navbar-gitlab .title' do
page.should have_content 'Community'
end
end
@@ -33,15 +34,12 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
end
step 'I click on "Sign In"' do
- within '.pull-right' do
- click_link "Sign in"
- end
+ first(:link, "Sign in").click
end
step 'Authenticate' do
admin = create(:admin)
project = Project.find_by(name: 'Community')
- find(:xpath, "//input[@id='return_to']").set "/#{project.path_with_namespace}"
fill_in "user_login", with: admin.email
fill_in "user_password", with: admin.password
click_button "Sign in"
@@ -53,5 +51,19 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
page.current_path.should == "/#{project.path_with_namespace}"
page.status_code.should == 200
end
-end
+ step 'I get redirected to signin page where I sign in' do
+ admin = create(:admin)
+ project = Project.find_by(name: 'Enterprise')
+ fill_in "user_login", with: admin.email
+ fill_in "user_password", with: admin.password
+ click_button "Sign in"
+ Thread.current[:current_user] = admin
+ end
+
+ step 'I should be redirected to "Enterprise" page' do
+ project = Project.find_by(name: 'Enterprise')
+ page.current_path.should == "/#{project.path_with_namespace}"
+ page.status_code.should == 200
+ end
+end
diff --git a/features/steps/project/search_code.rb b/features/steps/project/search_code.rb
index d117b019a15..55218b6e745 100644
--- a/features/steps/project/search_code.rb
+++ b/features/steps/project/search_code.rb
@@ -3,15 +3,17 @@ class ProjectSearchCode < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- When 'I search for term "Welcome to GitLab"' do
- fill_in "search", with: "Welcome to GitLab"
+ step 'I search for term "coffee"' do
+ fill_in "search", with: "coffee"
click_button "Go"
- click_link 'Repository Code'
end
- Then 'I should see files from repository containing "Welcome to GitLab"' do
- page.should have_content "Welcome to GitLab"
- page.should have_content "GitLab is a free project and repository management application"
+ step 'I should see files from repository containing "coffee"' do
+ page.should have_content 'coffee'
+ page.should have_content 'CONTRIBUTING.md'
end
+ step 'I should see empty result' do
+ page.should have_content "We couldn't find any matching"
+ end
end
diff --git a/features/steps/project/star.rb b/features/steps/project/star.rb
new file mode 100644
index 00000000000..562df04e340
--- /dev/null
+++ b/features/steps/project/star.rb
@@ -0,0 +1,33 @@
+class Spinach::Features::ProjectStar < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedProject
+ include SharedPaths
+ include SharedUser
+
+ step "The project has no stars" do
+ page.should_not have_content '.star-buttons'
+ end
+
+ step "The project has 0 stars" do
+ has_n_stars(0)
+ end
+
+ step "The project has 1 star" do
+ has_n_stars(1)
+ end
+
+ step "The project has 2 stars" do
+ has_n_stars(2)
+ end
+
+ # Requires @javascript
+ step "I click on the star toggle button" do
+ page.find(".star .toggle", visible: true).click
+ end
+
+ protected
+
+ def has_n_stars(n)
+ expect(page).to have_css(".star .count", text: /^#{n}$/, visible: true)
+ end
+end
diff --git a/features/steps/search.rb b/features/steps/search.rb
new file mode 100644
index 00000000000..b1058989d0b
--- /dev/null
+++ b/features/steps/search.rb
@@ -0,0 +1,73 @@
+class Spinach::Features::Search < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+
+ step 'I search for "Sho"' do
+ fill_in "dashboard_search", with: "Sho"
+ click_button "Search"
+ end
+
+ step 'I search for "Foo"' do
+ fill_in "dashboard_search", with: "Foo"
+ click_button "Search"
+ end
+
+ step 'I search for "rspec"' do
+ fill_in "dashboard_search", with: "rspec"
+ click_button "Search"
+ end
+
+ step 'I click "Issues" link' do
+ within '.search-filter' do
+ click_link 'Issues'
+ end
+ end
+
+ step 'I click project "Shop" link' do
+ within '.project-filter' do
+ click_link project.name_with_namespace
+ end
+ end
+
+ step 'I click "Merge requests" link' do
+ within '.search-filter' do
+ click_link 'Merge requests'
+ end
+ end
+
+ step 'I should see "Shop" project link' do
+ page.should have_link "Shop"
+ end
+
+ step 'I should see code results for project "Shop"' do
+ page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
+ end
+
+ step 'I search for "Contibuting"' do
+ fill_in "dashboard_search", with: "Contibuting"
+ click_button "Search"
+ end
+
+ step 'project has issues' do
+ create(:issue, title: "Foo", project: project)
+ create(:issue, title: "Bar", project: project)
+ end
+
+ step 'project has merge requests' do
+ create(:merge_request, title: "Foo", source_project: project, target_project: project)
+ create(:merge_request, :simple, title: "Bar", source_project: project, target_project: project)
+ end
+
+ step 'I should see "Foo" link' do
+ page.should have_link "Foo"
+ end
+
+ step 'I should not see "Bar" link' do
+ page.should_not have_link "Bar"
+ end
+
+ def project
+ @project ||= Project.find_by(name: "Shop")
+ end
+end
diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb
index d504fda3327..c776af14e04 100644
--- a/features/steps/shared/active_tab.rb
+++ b/features/steps/shared/active_tab.rb
@@ -2,11 +2,7 @@ module SharedActiveTab
include Spinach::DSL
def ensure_active_main_tab(content)
- if content == "Home"
- page.find('.main-nav li.active').should have_css('i.icon-home')
- else
- page.find('.main-nav li.active').should have_content(content)
- end
+ page.find('.main-nav li.active').should have_content(content)
end
def ensure_active_sub_tab(content)
@@ -28,4 +24,24 @@ module SharedActiveTab
And 'no other sub navs should be active' do
page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1)
end
+
+ step 'the active main tab should be Home' do
+ ensure_active_main_tab('Activity')
+ end
+
+ step 'the active main tab should be Projects' do
+ ensure_active_main_tab('Projects')
+ end
+
+ step 'the active main tab should be Issues' do
+ ensure_active_main_tab('Issues')
+ end
+
+ step 'the active main tab should be Merge Requests' do
+ ensure_active_main_tab('Merge Requests')
+ end
+
+ step 'the active main tab should be Help' do
+ ensure_active_main_tab('Help')
+ end
end
diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb
index b8c11ce0a23..b48021dc146 100644
--- a/features/steps/shared/authentication.rb
+++ b/features/steps/shared/authentication.rb
@@ -24,6 +24,10 @@ module SharedAuthentication
current_path.should == new_user_session_path
end
+ step "I logout" do
+ logout
+ end
+
def current_user
@user || User.first
end
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb
index f917d7bde08..b107b083220 100644
--- a/features/steps/shared/diff_note.rb
+++ b/features/steps/shared/diff_note.rb
@@ -1,8 +1,9 @@
module SharedDiffNote
include Spinach::DSL
+ include RepoHelpers
Given 'I cancel the diff comment' do
- within(".diff-file") do
+ within(diff_file_selector) do
find(".js-close-discussion-note-form").click
end
end
@@ -13,14 +14,14 @@ module SharedDiffNote
end
Given 'I haven\'t written any diff comment text' do
- within(".diff-file") do
+ within(diff_file_selector) do
fill_in "note[note]", with: ""
end
end
Given 'I leave a diff comment like "Typo, please fix"' do
- find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click
- within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do
+ click_diff_line(sample_commit.line_code)
+ within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Typo, please fix"
find(".js-comment-button").trigger("click")
sleep 0.05
@@ -28,88 +29,86 @@ module SharedDiffNote
end
Given 'I preview a diff comment text like "Should fix it :smile:"' do
- find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click
- within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do
+ click_diff_line(sample_commit.line_code)
+ within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:"
find(".js-note-preview-button").trigger("click")
end
end
Given 'I preview another diff comment text like "DRY this up"' do
- find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click
+ click_diff_line(sample_commit.del_line_code)
- within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do
+ within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
fill_in "note[note]", with: "DRY this up"
find(".js-note-preview-button").trigger("click")
end
end
Given 'I open a diff comment form' do
- find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click
+ click_diff_line(sample_commit.line_code)
end
Given 'I open another diff comment form' do
- find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click
+ click_diff_line(sample_commit.del_line_code)
end
Given 'I write a diff comment like ":-1: I don\'t like this"' do
- within(".diff-file") do
+ within(diff_file_selector) do
fill_in "note[note]", with: ":-1: I don\'t like this"
end
end
Given 'I submit the diff comment' do
- within(".diff-file") do
+ within(diff_file_selector) do
click_button("Add Comment")
end
end
-
-
Then 'I should not see the diff comment form' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should_not have_css("form.new_note")
end
end
Then 'I should not see the diff comment preview button' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css(".js-note-preview-button", visible: false)
end
end
Then 'I should not see the diff comment text field' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css(".js-note-text", visible: false)
end
end
Then 'I should only see one diff form' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css("form.new_note", count: 1)
end
end
Then 'I should see a diff comment form with ":-1: I don\'t like this"' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_field("note[note]", with: ":-1: I don\'t like this")
end
end
Then 'I should see a diff comment saying "Typo, please fix"' do
- within(".diff-file .note") do
+ within("#{diff_file_selector} .note") do
page.should have_content("Typo, please fix")
end
end
Then 'I should see a discussion reply button' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_link("Reply")
end
end
Then 'I should see a temporary diff comment form' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css(".js-temp-notes-holder form.new_note")
end
end
@@ -119,40 +118,48 @@ module SharedDiffNote
end
Then 'I should see an empty diff comment form' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_field("note[note]", with: "")
end
end
Then 'I should see the cancel comment button' do
- within(".diff-file form") do
+ within("#{diff_file_selector} form") do
page.should have_css(".js-close-discussion-note-form", text: "Cancel")
end
end
Then 'I should see the diff comment preview' do
- within(".diff-file form") do
+ within("#{diff_file_selector} form") do
page.should have_css(".js-note-preview", visible: false)
end
end
Then 'I should see the diff comment edit button' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css(".js-note-write-button", visible: true)
end
end
Then 'I should see the diff comment preview button' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css(".js-note-preview-button", visible: true)
end
end
Then 'I should see two separate previews' do
- within(".diff-file") do
+ within(diff_file_selector) do
page.should have_css(".js-note-preview", visible: true, count: 2)
page.should have_content("Should fix it")
page.should have_content("DRY this up")
end
end
+
+ def diff_file_selector
+ ".diff-file:nth-of-type(1)"
+ end
+
+ def click_diff_line(code)
+ find("a[data-line-code='#{code}']").click
+ end
end
diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb
index 6b4c47312a7..1b225dd61a6 100644
--- a/features/steps/shared/group.rb
+++ b/features/steps/shared/group.rb
@@ -21,6 +21,14 @@ module SharedGroup
is_member_of("Mary Jane", "Guest", Gitlab::Access::GUEST)
end
+ step 'I should see group "TestGroup"' do
+ page.should have_content "TestGroup"
+ end
+
+ step 'I should not see group "TestGroup"' do
+ page.should_not have_content "TestGroup"
+ end
+
protected
def is_member_of(username, groupname, role)
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 2090b642059..276947dc060 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -1,5 +1,6 @@
module SharedPaths
include Spinach::DSL
+ include RepoHelpers
step 'I visit new project page' do
visit new_project_path
@@ -257,15 +258,21 @@ module SharedPaths
end
step 'I visit blob file from repo' do
- visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH))
+ visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
end
- step 'I visit "Gemfile.lock" file in repo' do
- visit project_blob_path(@project, File.join(root_ref, 'Gemfile.lock'))
+ step 'I visit ".gitignore" file in repo' do
+ visit project_blob_path(@project, File.join(root_ref, '.gitignore'))
end
- step 'I visit project source page for "8470d70"' do
- visit project_tree_path(@project, "8470d70")
+ step 'I visit project source page for "6d39438"' do
+ visit project_tree_path(@project, "6d39438")
+ end
+
+ step 'I visit project source page for' \
+ ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
+ visit project_tree_path(@project,
+ '6d394385cf567f80a8fd85055db1ab4c5295806f')
end
step 'I visit project tags page' do
@@ -273,7 +280,7 @@ module SharedPaths
end
step 'I visit project commit page' do
- visit project_commit_path(@project, ValidCommit::ID)
+ visit project_commit_path(@project, sample_commit.id)
end
step 'I visit project "Shop" issues page' do
@@ -286,9 +293,25 @@ module SharedPaths
end
step 'I visit project "Shop" labels page' do
+ project = Project.find_by(name: 'Shop')
+ visit project_labels_path(project)
+ end
+
+ step 'I visit project "Forum" labels page' do
+ project = Project.find_by(name: 'Forum')
visit project_labels_path(project)
end
+ step 'I visit project "Shop" new label page' do
+ project = Project.find_by(name: 'Shop')
+ visit new_project_label_path(project)
+ end
+
+ step 'I visit project "Forum" new label page' do
+ project = Project.find_by(name: 'Forum')
+ visit new_project_label_path(project)
+ end
+
step 'I visit merge request page "Bug NS-04"' do
mr = MergeRequest.find_by(title: "Bug NS-04")
visit project_merge_request_path(mr.target_project, mr)
@@ -320,15 +343,51 @@ module SharedPaths
end
# ----------------------------------------
+ # Visibility Projects
+ # ----------------------------------------
+
+ step 'I visit project "Community" page' do
+ project = Project.find_by(name: "Community")
+ visit project_path(project)
+ end
+
+ step 'I visit project "Internal" page' do
+ project = Project.find_by(name: "Internal")
+ visit project_path(project)
+ end
+
+ step 'I visit project "Enterprise" page' do
+ project = Project.find_by(name: "Enterprise")
+ visit project_path(project)
+ end
+
+ # ----------------------------------------
+ # Empty Projects
+ # ----------------------------------------
+
+ step "I visit empty project page" do
+ project = Project.find_by(name: "Empty Public Project")
+ visit project_path(project)
+ end
+
+ # ----------------------------------------
# Public Projects
# ----------------------------------------
step 'I visit the public projects area' do
- visit public_root_path
+ visit explore_projects_path
end
- step 'I visit public page for "Community" project' do
- visit public_project_path(Project.find_by(name: "Community"))
+ step 'I visit the explore trending projects' do
+ visit trending_explore_projects_path
+ end
+
+ step 'I visit the explore starred projects' do
+ visit starred_explore_projects_path
+ end
+
+ step 'I visit the public groups area' do
+ visit explore_groups_path
end
# ----------------------------------------
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index 40362fee0bc..c131976614f 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -10,7 +10,7 @@ module SharedProject
# Create a specific project called "Shop"
And 'I own project "Shop"' do
@project = Project.find_by(name: "Shop")
- @project ||= create(:project, name: "Shop", namespace: @user.namespace)
+ @project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true)
@project.team << [@user, :master]
end
@@ -21,13 +21,20 @@ module SharedProject
@project.team << [@user, :master]
end
+ # Create an empty project without caring about the name
+ And 'I own an empty project' do
+ @project = create(:empty_project,
+ name: 'Empty Project', namespace: @user.namespace)
+ @project.team << [@user, :master]
+ end
+
And 'project "Shop" has push event' do
@project = Project.find_by(name: "Shop")
data = {
before: "0000000000000000000000000000000000000000",
- after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
- ref: "refs/heads/new_design",
+ after: "6d394385cf567f80a8fd85055db1ab4c5295806f",
+ ref: "refs/heads/fix",
user_id: @user.id,
user_name: @user.name,
repository: {
@@ -49,7 +56,7 @@ module SharedProject
Then 'I should see project "Shop" activity feed' do
project = Project.find_by(name: "Shop")
- page.should have_content "#{@user.name} pushed new branch new_design at #{project.name_with_namespace}"
+ page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}"
end
Then 'I should see project settings' do
@@ -122,4 +129,20 @@ module SharedProject
project ||= create :empty_project, :public, name: 'Community', namespace: user.namespace
project.team << [user, :master]
end
+
+ step 'public empty project "Empty Public Project"' do
+ create :empty_project, :public, name: "Empty Public Project"
+ end
+
+ step 'project "Community" has comments' do
+ project = Project.find_by(name: "Community")
+ 2.times { create(:note_on_issue, project: project) }
+ end
+
+ step 'project "Shop" has labels: "bug", "feature", "enhancement"' do
+ project = Project.find_by(name: "Shop")
+ create(:label, project: project, title: 'bug')
+ create(:label, project: project, title: 'feature')
+ create(:label, project: project, title: 'enhancement')
+ end
end
diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb
new file mode 100644
index 00000000000..6aa4f1b20df
--- /dev/null
+++ b/features/steps/shared/project_tab.rb
@@ -0,0 +1,46 @@
+require_relative 'active_tab'
+
+module SharedProjectTab
+ include Spinach::DSL
+ include SharedActiveTab
+
+ step 'the active main tab should be Home' do
+ ensure_active_main_tab('Project')
+ end
+
+ step 'the active main tab should be Files' do
+ ensure_active_main_tab('Files')
+ end
+
+ step 'the active main tab should be Commits' do
+ ensure_active_main_tab('Commits')
+ end
+
+ step 'the active main tab should be Network' do
+ ensure_active_main_tab('Network')
+ end
+
+ step 'the active main tab should be Graphs' do
+ ensure_active_main_tab('Graphs')
+ end
+
+ step 'the active main tab should be Issues' do
+ ensure_active_main_tab('Issues')
+ end
+
+ step 'the active main tab should be Merge Requests' do
+ ensure_active_main_tab('Merge Requests')
+ end
+
+ step 'the active main tab should be Snippets' do
+ ensure_active_main_tab('Snippets')
+ end
+
+ step 'the active main tab should be Wiki' do
+ ensure_active_main_tab('Wiki')
+ end
+
+ step 'the active main tab should be Settings' do
+ ensure_active_main_tab('Settings')
+ end
+end
diff --git a/features/steps/shared/shortcuts.rb b/features/steps/shared/shortcuts.rb
new file mode 100644
index 00000000000..bbb7afec0ad
--- /dev/null
+++ b/features/steps/shared/shortcuts.rb
@@ -0,0 +1,18 @@
+module SharedActiveTab
+ include Spinach::DSL
+
+ step 'I press "g" and "p"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('p')
+ end
+
+ step 'I press "g" and "i"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('i')
+ end
+
+ step 'I press "g" and "m"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('m')
+ end
+end
diff --git a/features/support/env.rb b/features/support/env.rb
index 3ab2ce0a3e6..22f28987fe3 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -15,7 +15,7 @@ require 'spinach/capybara'
require 'sidekiq/testing/inline'
-%w(valid_commit valid_commit_with_alt_email big_commits select2_helper test_env).each do |f|
+%w(select2_helper test_env repo_helpers).each do |f|
require Rails.root.join('spec', 'support', f)
end
@@ -39,7 +39,6 @@ Capybara.ignore_hidden_elements = false
DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario do
- TestEnv.setup_stubs
DatabaseCleaner.start
end
@@ -48,7 +47,7 @@ Spinach.hooks.after_scenario do
end
Spinach.hooks.before_run do
- TestEnv.init(mailer: false, init_repos: true, repos: false)
+ TestEnv.init(mailer: false)
RSpec::Mocks::setup self
include FactoryGirl::Syntax::Methods
diff --git a/lib/api/api.rb b/lib/api/api.rb
index ce4cc8b34f7..2c7cd9038c3 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -46,5 +46,6 @@ module API
mount Commits
mount Namespaces
mount Branches
+ mount Labels
end
end
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index b32a4aa7bc2..4db5f61dd28 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -80,9 +80,17 @@ module API
# POST /projects/:id/repository/branches
post ":id/repository/branches" do
authorize_push_project
- @branch = CreateBranchService.new.execute(user_project, params[:branch_name], params[:ref], current_user)
-
- present @branch, with: Entities::RepoObject, project: user_project
+ result = CreateBranchService.new.execute(user_project,
+ params[:branch_name],
+ params[:ref],
+ current_user)
+ if result[:status] == :success
+ present result[:branch],
+ with: Entities::RepoObject,
+ project: user_project
+ else
+ render_api_error!(result[:message], 400)
+ end
end
# Delete branch
@@ -99,7 +107,7 @@ module API
if result[:state] == :success
true
else
- render_api_error!(result[:message], 405)
+ render_api_error!(result[:message], result[:return_code])
end
end
end
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index b190646a1e3..74fdef93543 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -102,6 +102,7 @@ module API
class RepoCommit < Grape::Entity
expose :id, :short_id, :title, :author_name, :author_email, :created_at
+ expose :safe_message, as: :message
end
class RepoCommitDetail < RepoCommit
@@ -126,7 +127,7 @@ module API
end
class Issue < ProjectEntity
- expose :label_list, as: :labels
+ expose :label_names, as: :labels
expose :milestone, using: Entities::Milestone
expose :assignee, :author, using: Entities::UserBasic
end
@@ -135,7 +136,9 @@ module API
expose :target_branch, :source_branch, :upvotes, :downvotes
expose :author, :assignee, using: Entities::UserBasic
expose :source_project_id, :target_project_id
- expose :label_list, as: :labels
+ expose :label_names, as: :labels
+ expose :description
+ expose :milestone, using: Entities::Milestone
end
class SSHKey < Grape::Entity
@@ -191,7 +194,7 @@ module API
end
class Label < Grape::Entity
- expose :name
+ expose :name, :color
end
class RepoDiff < Grape::Entity
@@ -201,13 +204,13 @@ module API
class Compare < Grape::Entity
expose :commit, using: Entities::RepoCommit do |compare, options|
- if compare.commit
- Commit.new compare.commit
- end
+ Commit.decorate(compare.commits).last
end
+
expose :commits, using: Entities::RepoCommit do |compare, options|
- Commit.decorate compare.commits
+ Commit.decorate(compare.commits)
end
+
expose :diffs, using: Entities::RepoDiff do |compare, options|
compare.diffs
end
@@ -218,5 +221,9 @@ module API
expose :same, as: :compare_same_ref
end
+
+ class Contributor < Grape::Entity
+ expose :name, :email, :commits, :additions, :deletions
+ end
end
end
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index b6a5806d646..6af0f6d1b25 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -5,6 +5,10 @@ module API
SUDO_HEADER ="HTTP_SUDO"
SUDO_PARAM = :sudo
+ def parse_boolean(value)
+ [ true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON' ].include?(value)
+ end
+
def current_user
private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s
@current_user ||= User.find_by(authentication_token: private_token)
@@ -98,10 +102,33 @@ module API
def attributes_for_keys(keys)
attrs = {}
+
keys.each do |key|
- attrs[key] = params[key] if params[key].present? or (params.has_key?(key) and params[key] == false)
+ if params[key].present? or (params.has_key?(key) and params[key] == false)
+ attrs[key] = params[key]
+ end
+ end
+
+ ActionController::Parameters.new(attrs).permit!
+ end
+
+ # Helper method for validating all labels against its names
+ def validate_label_params(params)
+ errors = {}
+
+ if params[:labels].present?
+ params[:labels].split(',').each do |label_name|
+ label = user_project.labels.create_with(
+ color: Label::DEFAULT_COLOR).find_or_initialize_by(
+ title: label_name.strip)
+
+ if label.invalid?
+ errors[label.title] = label.errors
+ end
+ end
end
- attrs
+
+ errors
end
# error helpers
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 5850892df07..5f484f63418 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -12,7 +12,9 @@ module API
# ref - branch name
# forced_push - forced_push
#
- get "/allowed" do
+ post "/allowed" do
+ status 200
+
# Check for *.wiki repositories.
# Strip out the .wiki from the pathname before finding the
# project. This applies the correct project permissions to
@@ -34,10 +36,7 @@ module API
actor,
params[:action],
project,
- params[:ref],
- params[:oldrev],
- params[:newrev],
- params[:forced_push]
+ params[:changes]
)
end
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index f50be3a815d..5369149cdfc 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -3,13 +3,41 @@ module API
class Issues < Grape::API
before { authenticate! }
+ helpers do
+ def filter_issues_state(issues, state = nil)
+ case state
+ when 'opened' then issues.opened
+ when 'closed' then issues.closed
+ else issues
+ end
+ end
+
+ def filter_issues_labels(issues, labels)
+ issues.includes(:labels).where("labels.title" => labels.split(','))
+ end
+ end
+
resource :issues do
# Get currently authenticated user's issues
#
- # Example Request:
+ # Parameters:
+ # state (optional) - Return "opened" or "closed" issues
+ # labels (optional) - Comma-separated list of label names
+
+ # Example Requests:
# GET /issues
+ # GET /issues?state=opened
+ # GET /issues?state=closed
+ # GET /issues?labels=foo
+ # GET /issues?labels=foo,bar
+ # GET /issues?labels=foo,bar&state=opened
get do
- present paginate(current_user.issues), with: Entities::Issue
+ issues = current_user.issues
+ issues = filter_issues_state(issues, params[:state]) unless params[:state].nil?
+ issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil?
+ issues = issues.order('issues.id DESC')
+
+ present paginate(issues), with: Entities::Issue
end
end
@@ -18,10 +46,24 @@ module API
#
# Parameters:
# id (required) - The ID of a project
- # Example Request:
+ # state (optional) - Return "opened" or "closed" issues
+ # labels (optional) - Comma-separated list of label names
+ #
+ # Example Requests:
+ # GET /projects/:id/issues
+ # GET /projects/:id/issues?state=opened
+ # GET /projects/:id/issues?state=closed
# GET /projects/:id/issues
+ # GET /projects/:id/issues?labels=foo
+ # GET /projects/:id/issues?labels=foo,bar
+ # GET /projects/:id/issues?labels=foo,bar&state=opened
get ":id/issues" do
- present paginate(user_project.issues), with: Entities::Issue
+ issues = user_project.issues
+ issues = filter_issues_state(issues, params[:state]) unless params[:state].nil?
+ issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil?
+ issues = issues.order('issues.id DESC')
+
+ present paginate(issues), with: Entities::Issue
end
# Get a single project issue
@@ -50,10 +92,21 @@ module API
post ":id/issues" do
required_attributes! [:title]
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id]
- attrs[:label_list] = params[:labels] if params[:labels].present?
+
+ # Validate label names in advance
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
+ end
+
issue = ::Issues::CreateService.new(user_project, current_user, attrs).execute
if issue.valid?
+ # Find or create labels and attach to issue. Labels are valid because
+ # we already checked its name, so there can't be an error here
+ if params[:labels].present?
+ issue.add_labels_by_names(params[:labels].split(','))
+ end
+
present issue, with: Entities::Issue
else
not_found!
@@ -76,13 +129,24 @@ module API
put ":id/issues/:issue_id" do
issue = user_project.issues.find(params[:issue_id])
authorize! :modify_issue, issue
-
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :state_event]
- attrs[:label_list] = params[:labels] if params[:labels].present?
+
+ # Validate label names in advance
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
+ end
issue = ::Issues::UpdateService.new(user_project, current_user, attrs).execute(issue)
if issue.valid?
+ # Find or create labels and attach to issue. Labels are valid because
+ # we already checked its name, so there can't be an error here
+ unless params[:labels].nil?
+ issue.remove_labels
+ # Create and add labels to the new created issue
+ issue.add_labels_by_names(params[:labels].split(','))
+ end
+
present issue, with: Entities::Issue
else
not_found!
diff --git a/lib/api/labels.rb b/lib/api/labels.rb
new file mode 100644
index 00000000000..2fdf53ffec2
--- /dev/null
+++ b/lib/api/labels.rb
@@ -0,0 +1,103 @@
+module API
+ # Labels API
+ class Labels < Grape::API
+ before { authenticate! }
+
+ resource :projects do
+ # Get all labels of the project
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # Example Request:
+ # GET /projects/:id/labels
+ get ':id/labels' do
+ present user_project.labels, with: Entities::Label
+ end
+
+ # Creates a new label
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # name (required) - The name of the label to be deleted
+ # color (required) - Color of the label given in 6-digit hex
+ # notation with leading '#' sign (e.g. #FFAABB)
+ # Example Request:
+ # POST /projects/:id/labels
+ post ':id/labels' do
+ authorize! :admin_label, user_project
+ required_attributes! [:name, :color]
+
+ attrs = attributes_for_keys [:name, :color]
+ label = user_project.find_label(attrs[:name])
+
+ if label
+ return render_api_error!('Label already exists', 409)
+ end
+
+ label = user_project.labels.create(attrs)
+
+ if label.valid?
+ present label, with: Entities::Label
+ else
+ render_api_error!(label.errors.full_messages.join(', '), 400)
+ end
+ end
+
+ # Deletes an existing label
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # name (required) - The name of the label to be deleted
+ #
+ # Example Request:
+ # DELETE /projects/:id/labels
+ delete ':id/labels' do
+ authorize! :admin_label, user_project
+ required_attributes! [:name]
+
+ label = user_project.find_label(params[:name])
+ if !label
+ return render_api_error!('Label not found', 404)
+ end
+
+ label.destroy
+ end
+
+ # Updates an existing label. At least one optional parameter is required.
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # name (optional) - The name of the label to be deleted
+ # color (optional) - Color of the label given in 6-digit hex
+ # notation with leading '#' sign (e.g. #FFAABB)
+ # Example Request:
+ # PUT /projects/:id/labels
+ put ':id/labels' do
+ authorize! :admin_label, user_project
+ required_attributes! [:name]
+
+ label = user_project.find_label(params[:name])
+ if !label
+ return render_api_error!('Label not found', 404)
+ end
+
+ attrs = attributes_for_keys [:new_name, :color]
+
+ if attrs.empty?
+ return render_api_error!('Required parameters "name" or "color" ' \
+ 'missing',
+ 400)
+ end
+
+ # Rename new name to the actual label attribute name
+ attrs[:name] = attrs.delete(:new_name) if attrs.key?(:new_name)
+
+ if label.update(attrs)
+ present label, with: Entities::Label
+ else
+ render_api_error!(label.errors.full_messages.join(', '), 400)
+ end
+ end
+ end
+ end
+end
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index fc1f1254a9e..8726379bf3c 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -76,10 +76,20 @@ module API
authorize! :write_merge_request, user_project
required_attributes! [:source_branch, :target_branch, :title]
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
- attrs[:label_list] = params[:labels] if params[:labels].present?
+
+ # Validate label names in advance
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
+ end
+
merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute
if merge_request.valid?
+ # Find or create labels and attach to issue
+ if params[:labels].present?
+ merge_request.add_labels_by_names(params[:labels].split(","))
+ end
+
present merge_request, with: Entities::MergeRequest
else
handle_merge_request_errors! merge_request.errors
@@ -103,12 +113,23 @@ module API
#
put ":id/merge_request/:merge_request_id" do
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description]
- attrs[:label_list] = params[:labels] if params[:labels].present?
merge_request = user_project.merge_requests.find(params[:merge_request_id])
authorize! :modify_merge_request, merge_request
+
+ # Validate label names in advance
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
+ end
+
merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request)
if merge_request.valid?
+ # Find or create labels and attach to issue
+ unless params[:labels].nil?
+ merge_request.remove_labels
+ merge_request.add_labels_by_names(params[:labels].split(","))
+ end
+
present merge_request, with: Entities::MergeRequest
else
handle_merge_request_errors! merge_request.errors
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 732c969d7ef..55f7975bbf7 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -7,7 +7,7 @@ module API
helpers do
def map_public_to_visibility_level(attrs)
publik = attrs.delete(:public)
- publik = [ true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON' ].include?(publik)
+ publik = parse_boolean(publik)
attrs[:visibility_level] = Gitlab::VisibilityLevel::PUBLIC if !attrs[:visibility_level].present? && publik == true
attrs
end
@@ -15,10 +15,20 @@ module API
# Get a projects list for authenticated user
#
+ # Parameters:
+ # archived (optional) - if passed, limit by archived status
+ #
# Example Request:
# GET /projects
get do
- @projects = paginate current_user.authorized_projects
+ @projects = current_user.authorized_projects
+
+ # If the archived parameter is passed, limit results accordingly
+ if params[:archived].present?
+ @projects = @projects.where(archived: parse_boolean(params[:archived]))
+ end
+
+ @projects = paginate @projects
present @projects, with: Entities::Project
end
@@ -77,6 +87,7 @@ module API
# namespace_id (optional) - defaults to user namespace
# public (optional) - if true same as setting visibility_level = 20
# visibility_level (optional) - 0 by default
+ # import_url (optional)
# Example Request
# POST /projects
post do
@@ -117,6 +128,7 @@ module API
# snippets_enabled (optional)
# public (optional) - if true same as setting visibility_level = 20
# visibility_level (optional)
+ # import_url (optional)
# Example Request
# POST /projects/user/:user_id
post "user/:user_id" do
@@ -130,7 +142,8 @@ module API
:wiki_enabled,
:snippets_enabled,
:public,
- :visibility_level]
+ :visibility_level,
+ :import_url]
attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateService.new(user, attrs).execute
if @project.saved?
@@ -211,17 +224,6 @@ module API
@users = paginate @users
present @users, with: Entities::UserBasic
end
-
- # Get a project labels
- #
- # Parameters:
- # id (required) - The ID of a project
- # Example Request:
- # GET /projects/:id/labels
- get ':id/labels' do
- @labels = user_project.issues_labels
- present @labels, with: Entities::Label
- end
end
end
end
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index 03806d9343b..07c29aa7b4c 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -32,14 +32,23 @@ module API
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# ref (required) - Create tag from commit sha or branch
+ # message (optional) - Specifying a message creates an annotated tag.
# Example Request:
# POST /projects/:id/repository/tags
post ':id/repository/tags' do
authorize_push_project
- @tag = CreateTagService.new.execute(user_project, params[:tag_name],
- params[:ref], current_user)
-
- present @tag, with: Entities::RepoObject, project: user_project
+ message = params[:message] || nil
+ result = CreateTagService.new.execute(user_project, params[:tag_name],
+ params[:ref], message,
+ current_user)
+
+ if result[:status] == :success
+ present result[:tag],
+ with: Entities::RepoObject,
+ project: user_project
+ else
+ render_api_error!(result[:message], 400)
+ end
end
# Get a project repository tree
@@ -115,21 +124,13 @@ module API
# GET /projects/:id/repository/archive
get ":id/repository/archive", requirements: { format: Gitlab::Regex.archive_formats_regex } do
authorize! :download_code, user_project
- repo = user_project.repository
- ref = params[:sha]
- format = params[:format]
- storage_path = Gitlab.config.gitlab.repository_downloads_path
+ file_path = ArchiveRepositoryService.new.execute(user_project, params[:sha], params[:format])
- file_path = repo.archive_repo(ref, storage_path, format)
if file_path && File.exists?(file_path)
data = File.open(file_path, 'rb').read
-
header["Content-Disposition"] = "attachment; filename=\"#{File.basename(file_path)}\""
-
content_type MIME::Types.type_for(file_path).first.content_type
-
env['api.format'] = :binary
-
present data
else
not_found!
@@ -147,9 +148,21 @@ module API
get ':id/repository/compare' do
authorize! :download_code, user_project
required_attributes! [:from, :to]
- compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE)
+ compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to])
present compare, with: Entities::Compare
end
+
+ # Get repository contributors
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # Example Request:
+ # GET /projects/:id/repository/contributors
+ get ':id/repository/contributors' do
+ authorize! :download_code, user_project
+
+ present user_project.repository.contributors, with: Entities::Contributor
+ end
end
end
end
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 92dbe97f0a4..69553f16397 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -59,7 +59,7 @@ module API
authenticated_as_admin!
required_attributes! [:email, :password, :name, :username]
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :extern_uid, :provider, :bio, :can_create_group, :admin]
- user = User.build_user(attrs, as: :admin)
+ user = User.build_user(attrs)
admin = attrs.delete(:admin)
user.admin = admin unless admin.nil?
if user.save
@@ -96,7 +96,7 @@ module API
admin = attrs.delete(:admin)
user.admin = admin unless admin.nil?
- if user.update_attributes(attrs, as: :admin)
+ if user.update_attributes(attrs)
present user, with: Entities::UserFull
else
not_found!
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 6f7c4f7c909..ea05fa2c261 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -69,7 +69,7 @@ module Backup
end
print 'Put GitLab hooks in repositories dirs'.yellow
- if system("#{Gitlab.config.gitlab_shell.path}/support/rewrite-hooks.sh", Gitlab.config.gitlab_shell.repos_path)
+ if system("#{Gitlab.config.gitlab_shell.path}/bin/create-hooks")
puts " [DONE]".green
else
puts " [FAILED]".red
diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb
index b93800e235f..907373ab991 100644
--- a/lib/gitlab/backend/shell.rb
+++ b/lib/gitlab/backend/shell.rb
@@ -27,7 +27,7 @@ module Gitlab
# import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git")
#
def import_repository(name, url)
- system "#{gitlab_shell_path}/bin/gitlab-projects", "import-project", "#{name}.git", url
+ system "#{gitlab_shell_path}/bin/gitlab-projects", "import-project", "#{name}.git", url, '240'
end
# Move repository
@@ -107,12 +107,17 @@ module Gitlab
# path - project path with namespace
# tag_name - new tag name
# ref - HEAD for new tag
+ # message - optional message for tag (annotated tag)
#
# Ex.
# add_tag("gitlab/gitlab-ci", "v4.0", "master")
+ # add_tag("gitlab/gitlab-ci", "v4.0", "master", "message")
#
- def add_tag(path, tag_name, ref)
- system "#{gitlab_shell_path}/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref
+ def add_tag(path, tag_name, ref, message = nil)
+ cmd = %W(#{gitlab_shell_path}/bin/gitlab-projects create-tag #{path}.git
+ #{tag_name} #{ref})
+ cmd << message unless message.nil? || message.empty?
+ system *cmd
end
# Remove repository tag
diff --git a/lib/gitlab/blacklist.rb b/lib/gitlab/blacklist.rb
index 6bc2c3b487c..65efb6e4407 100644
--- a/lib/gitlab/blacklist.rb
+++ b/lib/gitlab/blacklist.rb
@@ -3,7 +3,31 @@ module Gitlab
extend self
def path
- %w(admin dashboard files groups help profile projects search public assets u s teams merge_requests issues users snippets services repository hooks notes)
+ %w(
+ admin
+ dashboard
+ files
+ groups
+ help
+ profile
+ projects
+ search
+ public
+ assets
+ u
+ s
+ teams
+ merge_requests
+ issues
+ users
+ snippets
+ services
+ repository
+ hooks
+ notes
+ unsubscribes
+ all
+ )
end
end
end
diff --git a/lib/gitlab/compare_result.rb b/lib/gitlab/compare_result.rb
new file mode 100644
index 00000000000..d72391dade5
--- /dev/null
+++ b/lib/gitlab/compare_result.rb
@@ -0,0 +1,9 @@
+module Gitlab
+ class CompareResult
+ attr_reader :commits, :diffs
+
+ def initialize(compare)
+ @commits, @diffs = compare.commits, compare.diffs
+ end
+ end
+end
diff --git a/lib/gitlab/config_helper.rb b/lib/gitlab/config_helper.rb
new file mode 100644
index 00000000000..41880069e4c
--- /dev/null
+++ b/lib/gitlab/config_helper.rb
@@ -0,0 +1,9 @@
+module Gitlab::ConfigHelper
+ def gitlab_config_features
+ Gitlab.config.gitlab.default_projects_features
+ end
+
+ def gitlab_config
+ Gitlab.config.gitlab
+ end
+end
diff --git a/lib/gitlab/contributors.rb b/lib/gitlab/contributors.rb
new file mode 100644
index 00000000000..c41e92b620f
--- /dev/null
+++ b/lib/gitlab/contributors.rb
@@ -0,0 +1,9 @@
+module Gitlab
+ class Contributor
+ attr_accessor :email, :name, :commits, :additions, :deletions
+
+ def initialize
+ @commits, @additions, @deletions = 0, 0, 0
+ end
+ end
+end
diff --git a/lib/gitlab/diff_parser.rb b/lib/gitlab/diff_parser.rb
index 14bbb328637..b244295027e 100644
--- a/lib/gitlab/diff_parser.rb
+++ b/lib/gitlab/diff_parser.rb
@@ -30,7 +30,7 @@ module Gitlab
line_new = line.match(/\+[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)
+ yield(full_line, type, nil, line_new, line_old)
next
else
type = identification_type(line)
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 38b3d82e2f4..e75a5a1d62e 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -5,7 +5,7 @@ module Gitlab
attr_reader :params, :project, :git_cmd, :user
- def allowed?(actor, cmd, project, ref = nil, oldrev = nil, newrev = nil, forced_push = false)
+ def allowed?(actor, cmd, project, changes = nil)
case cmd
when *DOWNLOAD_COMMANDS
if actor.is_a? User
@@ -19,12 +19,12 @@ module Gitlab
end
when *PUSH_COMMANDS
if actor.is_a? User
- push_allowed?(actor, project, ref, oldrev, newrev, forced_push)
+ push_allowed?(actor, project, changes)
elsif actor.is_a? DeployKey
# Deploy key not allowed to push
return false
elsif actor.is_a? Key
- push_allowed?(actor.user, project, ref, oldrev, newrev, forced_push)
+ push_allowed?(actor.user, project, changes)
else
raise 'Wrong actor'
end
@@ -41,13 +41,21 @@ module Gitlab
end
end
- def push_allowed?(user, project, ref, oldrev, newrev, forced_push)
- if user && user_allowed?(user)
+ def push_allowed?(user, project, changes)
+ return false unless user && user_allowed?(user)
+ return true if changes.blank?
+
+ changes = changes.lines if changes.kind_of?(String)
+
+ # Iterate over all changes to find if user allowed all of them to be applied
+ changes.each do |change|
+ oldrev, newrev, ref = changes.split('')
+
action = if project.protected_branch?(ref)
# we dont allow force push to protected branch
- if forced_push.to_s == 'true'
+ if forced_push?(oldrev, newrev)
:force_push_code_to_protected_branches
- # and we dont allow remove of protected branch
+ # and we dont allow remove of protected branch
elsif newrev =~ /0000000/
:remove_protected_branches
else
@@ -59,7 +67,22 @@ module Gitlab
else
:push_code
end
- user.can?(action, project)
+ unless user.can?(action, project)
+ # If user does not have access to make at least one change - cancel all push
+ return false
+ end
+ end
+
+ # If user has access to make all changes
+ true
+ end
+
+ def forced_push?(oldrev, newrev)
+ return false if project.empty_repo?
+
+ if oldrev !~ /00000000/ && newrev !~ /00000000/
+ missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read
+ missed_refs.split("\n").size > 0
else
false
end
diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb
new file mode 100644
index 00000000000..13cb08948bb
--- /dev/null
+++ b/lib/gitlab/git_ref_validator.rb
@@ -0,0 +1,11 @@
+module Gitlab
+ module GitRefValidator
+ extend self
+ # Validates a given name against the git reference specification
+ #
+ # Returns true for a valid reference name, false otherwise
+ def validate(ref_name)
+ system *%W(git check-ref-format refs/#{ref_name})
+ end
+ end
+end
diff --git a/lib/gitlab/issues_labels.rb b/lib/gitlab/issues_labels.rb
index bc49d27b521..0d34976736f 100644
--- a/lib/gitlab/issues_labels.rb
+++ b/lib/gitlab/issues_labels.rb
@@ -1,27 +1,27 @@
module Gitlab
class IssuesLabels
class << self
- def important_labels
- %w(bug critical confirmed)
- end
-
- def warning_labels
- %w(documentation support)
- end
-
- def neutral_labels
- %w(discussion suggestion)
- end
-
- def positive_labels
- %w(feature enhancement)
- end
-
def generate(project)
- labels = important_labels + warning_labels + neutral_labels + positive_labels
+ red = '#d9534f'
+ yellow = '#f0ad4e'
+ blue = '#428bca'
+ green = '#5cb85c'
+
+ labels = [
+ { title: "bug", color: red },
+ { title: "critical", color: red },
+ { title: "confirmed", color: red },
+ { title: "documentation", color: yellow },
+ { title: "support", color: yellow },
+ { title: "discussion", color: blue },
+ { title: "suggestion", color: blue },
+ { title: "feature", color: green },
+ { title: "enhancement", color: green }
+ ]
- project.issues_default_label_list = labels
- project.save
+ labels.each do |label|
+ project.labels.create(label)
+ end
end
end
end
diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb
index 4e48ff11871..c054b6f5865 100644
--- a/lib/gitlab/ldap/access.rb
+++ b/lib/gitlab/ldap/access.rb
@@ -9,13 +9,26 @@ module Gitlab
end
end
+ def self.allowed?(user)
+ self.open do |access|
+ if access.allowed?(user)
+ # GitLab EE LDAP code goes here
+ user.last_credential_check_at = Time.now
+ user.save
+ true
+ else
+ false
+ end
+ end
+ end
+
def initialize(adapter=nil)
@adapter = adapter
end
def allowed?(user)
if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter)
- !Gitlab::LDAP::Person.active_directory_disabled?(user.extern_uid, adapter)
+ !Gitlab::LDAP::Person.disabled_via_active_directory?(user.extern_uid, adapter)
else
false
end
diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb
index e36616f0e66..68ac1b22909 100644
--- a/lib/gitlab/ldap/adapter.rb
+++ b/lib/gitlab/ldap/adapter.rb
@@ -14,7 +14,15 @@ module Gitlab
end
def self.adapter_options
- encryption = config['method'].to_s == 'ssl' ? :simple_tls : nil
+ encryption =
+ case config['method'].to_s
+ when 'ssl'
+ :simple_tls
+ when 'tls'
+ :start_tls
+ else
+ nil
+ end
options = {
host: config['host'],
@@ -78,7 +86,8 @@ module Gitlab
end
def dn_matches_filter?(dn, filter)
- ldap_search(base: dn, filter: filter, scope: Net::LDAP::SearchScope_BaseObject, attributes: %w{dn}).any?
+ ldap_search(base: dn, filter: filter,
+ scope: Net::LDAP::SearchScope_BaseObject, attributes: %w{dn}).any?
end
def ldap_search(*args)
diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb
index 9ad6618bd46..87c3d711db4 100644
--- a/lib/gitlab/ldap/person.rb
+++ b/lib/gitlab/ldap/person.rb
@@ -16,7 +16,7 @@ module Gitlab
adapter.user('dn', dn)
end
- def self.active_directory_disabled?(dn, adapter=nil)
+ def self.disabled_via_active_directory?(dn, adapter=nil)
adapter ||= Gitlab::LDAP::Adapter.new
adapter.dn_matches_filter?(dn, AD_USER_DISABLED)
end
diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb
index be3fcc4f035..e6aa3890992 100644
--- a/lib/gitlab/ldap/user.rb
+++ b/lib/gitlab/ldap/user.rb
@@ -26,7 +26,7 @@ module Gitlab
# * When user already has account and need to link their LDAP account.
# * LDAP uid changed for user with same email and we need to update their uid
#
- user = find_user(email)
+ user = model.find_by(email: email)
if user
user.update_attributes(extern_uid: uid, provider: provider)
@@ -43,21 +43,6 @@ module Gitlab
user
end
- def find_user(email)
- user = model.find_by(email: email)
-
- # If no user found and allow_username_or_email_login is true
- # we look for user by extracting part of their email
- if !user && email && ldap_conf['allow_username_or_email_login']
- uname = email.partition('@').first
- # Strip apostrophes since they are disallowed as part of username
- username = uname.gsub("'", "")
- user = model.find_by(username: username)
- end
-
- user
- end
-
def authenticate(login, password)
# Check user against LDAP backend if user is not authenticated
# Only check with valid login and password to prevent anonymous bind results
@@ -92,10 +77,6 @@ module Gitlab
model.where("provider = ? and lower(extern_uid) = ?", provider, uid.downcase).last
end
- def username
- auth.info.nickname.to_s.force_encoding("utf-8")
- end
-
def provider
'ldap'
end
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 50e6b1efca6..6017a4c86c1 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -169,10 +169,13 @@ module Gitlab
end
def reference_user(identifier, project = @project)
- if user = User.find_by(username: identifier)
- options = html_options.merge(
+ options = html_options.merge(
class: "gfm gfm-team_member #{html_options[:class]}"
)
+
+ if identifier == "all"
+ link_to("@all", project_url(project), options)
+ elsif user = User.find_by(username: identifier)
link_to("@#{identifier}", user_url(identifier), options)
end
end
diff --git a/lib/gitlab/markdown_helper.rb b/lib/gitlab/markdown_helper.rb
new file mode 100644
index 00000000000..abed12fe570
--- /dev/null
+++ b/lib/gitlab/markdown_helper.rb
@@ -0,0 +1,25 @@
+module Gitlab
+ module MarkdownHelper
+ module_function
+
+ # Public: Determines if a given filename is compatible with GitHub::Markup.
+ #
+ # filename - Filename string to check
+ #
+ # Returns boolean
+ def markup?(filename)
+ filename.downcase.end_with?(*%w(.textile .rdoc .org .creole .wiki
+ .mediawiki .rst .adoc .asciidoc .asc))
+ end
+
+ # Public: Determines if a given filename is compatible with
+ # GitLab-flavored Markdown.
+ #
+ # filename - Filename string to check
+ #
+ # Returns boolean
+ def gitlab_markdown?(filename)
+ filename.downcase.end_with?(*%w(.mdown .md .markdown))
+ end
+ end
+end
diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb
index c5be884a895..9670aad2c5d 100644
--- a/lib/gitlab/oauth/user.rb
+++ b/lib/gitlab/oauth/user.rb
@@ -27,7 +27,7 @@ module Gitlab
password_confirmation: password,
}
- user = model.build_user(opts, as: :admin)
+ user = model.build_user(opts)
user.skip_confirmation!
# Services like twitter and github does not return email via oauth
@@ -44,7 +44,13 @@ module Gitlab
user.username = email_username.gsub("'", "")
end
- user.save!
+ begin
+ user.save!
+ rescue ActiveRecord::RecordInvalid => e
+ log.info "(OAuth) Email #{e.record.errors[:email]}. Username #{e.record.errors[:username]}"
+ return nil, e.record.errors
+ end
+
log.info "(OAuth) Creating user #{email} from login with extern_uid => #{uid}"
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap?
@@ -61,10 +67,11 @@ module Gitlab
end
def uid
- auth.info.uid || auth.uid
+ auth.uid.to_s
end
def email
+ return unless auth.info.respond_to?(:email)
auth.info.email.downcase unless auth.info.email.nil?
end
@@ -77,6 +84,7 @@ module Gitlab
end
def username
+ return unless auth.info.respond_to?(:nickname)
auth.info.nickname.to_s.force_encoding("utf-8")
end
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb
new file mode 100644
index 00000000000..90511662b20
--- /dev/null
+++ b/lib/gitlab/project_search_results.rb
@@ -0,0 +1,52 @@
+module Gitlab
+ class ProjectSearchResults < SearchResults
+ attr_reader :project, :repository_ref
+
+ def initialize(project_id, query, repository_ref = nil)
+ @project = Project.find(project_id)
+ @repository_ref = repository_ref
+ @query = Shellwords.shellescape(query) if query.present?
+ end
+
+ def objects(scope, page = nil)
+ case scope
+ when 'notes'
+ notes.page(page).per(per_page)
+ when 'blobs'
+ Kaminari.paginate_array(blobs).page(page).per(per_page)
+ else
+ super
+ end
+ end
+
+ def total_count
+ @total_count ||= issues_count + merge_requests_count + blobs_count + notes_count
+ end
+
+ def blobs_count
+ @blobs_count ||= blobs.count
+ end
+
+ def notes_count
+ @notes_count ||= notes.count
+ end
+
+ private
+
+ def blobs
+ if project.empty_repo?
+ []
+ else
+ project.repository.search_files(query, repository_ref)
+ end
+ end
+
+ def notes
+ Note.where(project_id: limit_project_ids).search(query).order('updated_at DESC')
+ end
+
+ def limit_project_ids
+ [project.id]
+ end
+ end
+end
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index e932b64f4f0..4b8038843b0 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -6,18 +6,35 @@ module Gitlab
default_regex
end
+ def username_regex_message
+ default_regex_message
+ end
+
def project_name_regex
/\A[a-zA-Z0-9_][a-zA-Z0-9_\-\. ]*\z/
end
+ def project_regex_message
+ "can contain only letters, digits, '_', '-' and '.' and space. " \
+ "It must start with letter, digit or '_'."
+ end
+
def name_regex
/\A[a-zA-Z0-9_\-\. ]*\z/
end
+ def name_regex_message
+ "can contain only letters, digits, '_', '-' and '.' and space."
+ end
+
def path_regex
default_regex
end
+ def path_regex_message
+ default_regex_message
+ end
+
def archive_formats_regex
#|zip|tar| tar.gz | tar.bz2 |
/(zip|tar|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/
@@ -48,8 +65,14 @@ module Gitlab
protected
+ def default_regex_message
+ "can contain only letters, digits, '_', '-' and '.'. " \
+ "It must start with letter, digit or '_', optionally preceeded by '.'. " \
+ "It must not end in '.git'."
+ end
+
def default_regex
- /\A[.?]?[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
+ /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
end
end
end
diff --git a/lib/gitlab/satellite/action.rb b/lib/gitlab/satellite/action.rb
index 5ea6f956765..be45cb5c98e 100644
--- a/lib/gitlab/satellite/action.rb
+++ b/lib/gitlab/satellite/action.rb
@@ -1,7 +1,7 @@
module Gitlab
module Satellite
class Action
- DEFAULT_OPTIONS = { git_timeout: 30.seconds }
+ DEFAULT_OPTIONS = { git_timeout: Gitlab.config.satellites.timeout.seconds }
attr_accessor :options, :project, :user
diff --git a/lib/gitlab/satellite/compare_action.rb b/lib/gitlab/satellite/compare_action.rb
index c923bb9c0f0..46c98a8f4ca 100644
--- a/lib/gitlab/satellite/compare_action.rb
+++ b/lib/gitlab/satellite/compare_action.rb
@@ -1,5 +1,7 @@
module Gitlab
module Satellite
+ class BranchesWithoutParent < StandardError; end
+
class CompareAction < Action
def initialize(user, target_project, target_branch, source_project, source_branch)
super user, target_project
@@ -8,34 +10,16 @@ module Gitlab
@source_project, @source_branch = source_project, source_branch
end
- # Only show what is new in the source branch compared to the target branch, not the other way around.
- # The line 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"
- def diffs
+ # Compare 2 repositories and return Gitlab::CompareResult object
+ def result
in_locked_and_timed_satellite do |target_repo|
prepare_satellite!(target_repo)
update_satellite_source_and_target!(target_repo)
- common_commit = target_repo.git.native(:merge_base, default_options, ["origin/#{@target_branch}", "source/#{@source_branch}"]).strip
- #this method doesn't take default options
- diffs = target_repo.diff(common_commit, "source/#{@source_branch}")
- diffs = diffs.map { |diff| Gitlab::Git::Diff.new(diff) }
- diffs
- end
- rescue Grit::Git::CommandFailed => ex
- handle_exception(ex)
- end
- # Retrieve an array of commits between the source and the target
- def commits
- in_locked_and_timed_satellite do |target_repo|
- prepare_satellite!(target_repo)
- update_satellite_source_and_target!(target_repo)
- commits = target_repo.commits_between("origin/#{@target_branch}", "source/#{@source_branch}")
- commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) }
- commits
+ Gitlab::CompareResult.new(compare(target_repo))
end
rescue Grit::Git::CommandFailed => ex
- handle_exception(ex)
+ raise BranchesWithoutParent
end
private
@@ -44,10 +28,17 @@ module Gitlab
def update_satellite_source_and_target!(target_repo)
target_repo.remote_add('source', @source_project.repository.path_to_repo)
target_repo.remote_fetch('source')
- target_repo.git.checkout(default_options({b: true}), @target_branch, "origin/#{@target_branch}")
rescue Grit::Git::CommandFailed => ex
handle_exception(ex)
end
+
+ def compare(repo)
+ @compare ||= Gitlab::Git::Compare.new(
+ Gitlab::Git::Repository.new(repo.path),
+ "origin/#{@target_branch}",
+ "source/#{@source_branch}"
+ )
+ end
end
end
end
diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb
index 5f17aa60b8b..7c9b2294647 100644
--- a/lib/gitlab/satellite/merge_action.rb
+++ b/lib/gitlab/satellite/merge_action.rb
@@ -31,8 +31,9 @@ module Gitlab
# push merge back to bare repo
# will raise CommandFailed when push fails
merge_repo.git.push(default_options, :origin, merge_request.target_branch)
+
# remove source branch
- if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)
+ if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) && !merge_request.for_fork?
# will raise CommandFailed when push fails
merge_repo.git.push(default_options, :origin, ":#{merge_request.source_branch}")
end
@@ -44,27 +45,30 @@ module Gitlab
handle_exception(ex)
end
- # Get a raw diff of the source to the target
def diff_in_satellite
in_locked_and_timed_satellite do |merge_repo|
prepare_satellite!(merge_repo)
update_satellite_source_and_target!(merge_repo)
- diff = merge_repo.git.native(:diff, default_options, "origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}")
+
+ # Only show what is new in the source branch compared to the target branch, not the other way around.
+ # The line 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 = merge_repo.git.native(:merge_base, default_options, ["origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}"]).strip
+ merge_repo.git.native(:diff, default_options, common_commit, "source/#{merge_request.source_branch}")
end
rescue Grit::Git::CommandFailed => ex
handle_exception(ex)
end
- # Only show what is new in the source branch compared to the target branch, not the other way around.
- # The line 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"
def diffs_between_satellite
in_locked_and_timed_satellite do |merge_repo|
prepare_satellite!(merge_repo)
update_satellite_source_and_target!(merge_repo)
if merge_request.for_fork?
+ # Only show what is new in the source branch compared to the target branch, not the other way around.
+ # The line 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 = merge_repo.git.native(:merge_base, default_options, ["origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}"]).strip
- #this method doesn't take default options
diffs = merge_repo.diff(common_commit, "source/#{merge_request.source_branch}")
else
raise "Attempt to determine diffs between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]"
diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb
index 05123ad9c41..f34d661c9fc 100644
--- a/lib/gitlab/satellite/satellite.rb
+++ b/lib/gitlab/satellite/satellite.rb
@@ -53,7 +53,7 @@ module Gitlab
File.open(lock_file, "w+") do |f|
begin
f.flock File::LOCK_EX
- Dir.chdir(path) { return yield }
+ yield
ensure
f.flock File::LOCK_UN
end
@@ -121,6 +121,7 @@ module Gitlab
#
# Note: this will only update remote branches (i.e. origin/*)
def update_from_source!
+ repo.git.remote(default_options, 'set-url', :origin, project.repository.path_to_repo)
repo.git.fetch(default_options, :origin)
end
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
new file mode 100644
index 00000000000..75a3dfe37c3
--- /dev/null
+++ b/lib/gitlab/search_results.rb
@@ -0,0 +1,69 @@
+module Gitlab
+ class SearchResults
+ attr_reader :query
+
+ # Limit search results by passed project ids
+ # It allows us to search only for projects user has access to
+ attr_reader :limit_project_ids
+
+ def initialize(limit_project_ids, query)
+ @limit_project_ids = limit_project_ids || Project.all
+ @query = Shellwords.shellescape(query) if query.present?
+ end
+
+ def objects(scope, page = nil)
+ case scope
+ when 'projects'
+ projects.page(page).per(per_page)
+ when 'issues'
+ issues.page(page).per(per_page)
+ when 'merge_requests'
+ merge_requests.page(page).per(per_page)
+ else
+ Kaminari.paginate_array([]).page(page).per(per_page)
+ end
+ end
+
+ def total_count
+ @total_count ||= projects_count + issues_count + merge_requests_count
+ end
+
+ def projects_count
+ @projects_count ||= projects.count
+ end
+
+ def issues_count
+ @issues_count ||= issues.count
+ end
+
+ def merge_requests_count
+ @merge_requests_count ||= merge_requests.count
+ end
+
+ def empty?
+ total_count.zero?
+ end
+
+ private
+
+ def projects
+ Project.where(id: limit_project_ids).search(query)
+ end
+
+ def issues
+ Issue.where(project_id: limit_project_ids).full_search(query).order('updated_at DESC')
+ end
+
+ def merge_requests
+ MergeRequest.in_projects(limit_project_ids).full_search(query).order('updated_at DESC')
+ end
+
+ def default_scope
+ 'projects'
+ end
+
+ def per_page
+ 20
+ end
+ end
+end
diff --git a/lib/gitlab/sidekiq_middleware/arguments_logger.rb b/lib/gitlab/sidekiq_middleware/arguments_logger.rb
new file mode 100644
index 00000000000..7813091ec7b
--- /dev/null
+++ b/lib/gitlab/sidekiq_middleware/arguments_logger.rb
@@ -0,0 +1,10 @@
+module Gitlab
+ module SidekiqMiddleware
+ class ArgumentsLogger
+ def call(worker, job, queue)
+ Sidekiq.logger.info "arguments: #{job['args']}"
+ yield
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/theme.rb b/lib/gitlab/theme.rb
index 44237a062fc..b7c50cb734d 100644
--- a/lib/gitlab/theme.rb
+++ b/lib/gitlab/theme.rb
@@ -1,10 +1,10 @@
module Gitlab
class Theme
- BASIC = 1
- MARS = 2
- MODERN = 3
- GRAY = 4
- COLOR = 5
+ BASIC = 1 unless const_defined?(:BASIC)
+ MARS = 2 unless const_defined?(:MARS)
+ MODERN = 3 unless const_defined?(:MODERN)
+ GRAY = 4 unless const_defined?(:GRAY)
+ COLOR = 5 unless const_defined?(:COLOR)
def self.css_class_by_id(id)
themes = {
diff --git a/lib/gitlab/upgrader.rb b/lib/gitlab/upgrader.rb
index 0846359f9b1..74b049b5143 100644
--- a/lib/gitlab/upgrader.rb
+++ b/lib/gitlab/upgrader.rb
@@ -43,7 +43,7 @@ module Gitlab
end
def latest_version_raw
- remote_tags, _ = Gitlab::Popen.popen(%W(git ls-remote --tags origin))
+ remote_tags, _ = Gitlab::Popen.popen(%W(git ls-remote --tags https://gitlab.com/gitlab-org/gitlab-ce.git))
git_tags = remote_tags.split("\n").grep(/tags\/v#{current_version.major}/)
git_tags = git_tags.select { |version| version =~ /v\d\.\d\.\d\Z/ }
last_tag = git_tags.last.match(/v\d\.\d\.\d/).to_s
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
new file mode 100644
index 00000000000..de7e0404086
--- /dev/null
+++ b/lib/gitlab/url_builder.rb
@@ -0,0 +1,25 @@
+module Gitlab
+ class UrlBuilder
+ include Rails.application.routes.url_helpers
+
+ def initialize(type)
+ @type = type
+ end
+
+ def build(id)
+ case @type
+ when :issue
+ issue_url(id)
+ end
+ end
+
+ private
+
+ def issue_url(id)
+ issue = Issue.find(id)
+ project_issue_url(id: issue.iid,
+ project_id: issue.project,
+ host: Settings.gitlab['url'])
+ end
+ end
+end
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
index 16df21b49ba..4885baf9526 100644
--- a/lib/gitlab/user_access.rb
+++ b/lib/gitlab/user_access.rb
@@ -3,13 +3,8 @@ module Gitlab
def self.allowed?(user)
return false if user.blocked?
- if Gitlab.config.ldap.enabled
- if user.ldap_user?
- # Check if LDAP user exists and match LDAP user_filter
- Gitlab::LDAP::Access.open do |adapter|
- return false unless adapter.allowed?(user)
- end
- end
+ if user.requires_ldap_check?
+ return false unless Gitlab::LDAP::Access.allowed?(user)
end
true
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index eada9bcddf5..d0b6cde3c7e 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -5,9 +5,9 @@
#
module Gitlab
module VisibilityLevel
- PRIVATE = 0
- INTERNAL = 10
- PUBLIC = 20
+ PRIVATE = 0 unless const_defined?(:PRIVATE)
+ INTERNAL = 10 unless const_defined?(:INTERNAL)
+ PUBLIC = 20 unless const_defined?(:PUBLIC)
class << self
def values
@@ -21,9 +21,23 @@ module Gitlab
'Public' => PUBLIC
}
end
-
+
def allowed_for?(user, level)
- user.is_admin? || !Gitlab.config.gitlab.restricted_visibility_levels.include?(level)
+ user.is_admin? || allowed_level?(level)
+ end
+
+ # Level can be a string `"public"` or a value `20`, first check if valid,
+ # then check if the corresponding string appears in the config
+ def allowed_level?(level)
+ if options.has_key?(level.to_s)
+ non_restricted_level?(level)
+ elsif options.has_value?(level.to_i)
+ non_restricted_level?(options.key(level.to_i).downcase)
+ end
+ end
+
+ def non_restricted_level?(level)
+ ! Gitlab.config.gitlab.restricted_visibility_levels.include?(level)
end
end
diff --git a/lib/gt_one_coercion.rb b/lib/gt_one_coercion.rb
new file mode 100644
index 00000000000..ef2dc09767c
--- /dev/null
+++ b/lib/gt_one_coercion.rb
@@ -0,0 +1,5 @@
+class GtOneCoercion < Virtus::Attribute
+ def coerce(value)
+ [1, value.to_i].max
+ end
+end
diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab
index 36306eeb3a6..16b06fe006e 100644
--- a/lib/support/nginx/gitlab
+++ b/lib/support/nginx/gitlab
@@ -1,69 +1,85 @@
-# GITLAB
-# Maintainer: @randx
-
-# CHUNKED TRANSFER
-# It is a known issue that Git-over-HTTP requires chunked transfer encoding [0] which is not
-# supported by Nginx < 1.3.9 [1]. As a result, pushing a large object with Git (i.e. a single large file)
-# can lead to a 411 error. In theory you can get around this by tweaking this configuration file and either
-# - installing an old version of Nginx with the chunkin module [2] compiled in, or
-# - using a newer version of Nginx.
-#
-# At the time of writing we do not know if either of these theoretical solutions works. As a workaround
-# users can use Git over SSH to push large files.
-#
-# [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
-# [1] https://github.com/agentzh/chunkin-nginx-module#status
-# [2] https://github.com/agentzh/chunkin-nginx-module
+## GitLab
+## Maintainer: @randx
+##
+## Lines starting with two hashes (##) are comments with information.
+## Lines starting with one hash (#) are configuration parameters that can be uncommented.
+##
+##################################
+## CHUNKED TRANSFER ##
+##################################
+##
+## It is a known issue that Git-over-HTTP requires chunked transfer encoding [0]
+## which is not supported by Nginx < 1.3.9 [1]. As a result, pushing a large object
+## with Git (i.e. a single large file) can lead to a 411 error. In theory you can get
+## around this by tweaking this configuration file and either:
+## - installing an old version of Nginx with the chunkin module [2] compiled in, or
+## - using a newer version of Nginx.
+##
+## At the time of writing we do not know if either of these theoretical solutions works.
+## As a workaround users can use Git over SSH to push large files.
+##
+## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
+## [1] https://github.com/agentzh/chunkin-nginx-module#status
+## [2] https://github.com/agentzh/chunkin-nginx-module
+##
+###################################
+## configuration ##
+###################################
+##
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
+## Normal HTTP host
server {
- listen *:80 default_server; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
- server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
- server_tokens off; # don't show the version number, a security best practice
+ listen *:80 default_server;
+ server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
+ server_tokens off; ## Don't show the nginx version number, a security best practice
root /home/git/gitlab/public;
-
- # Increase this if you want to upload large attachments
- # Or if you want to accept large git objects over http
+
+ ## Increase this if you want to upload large attachments
+ ## Or if you want to accept large git objects over http
client_max_body_size 20m;
- # individual nginx logs for this gitlab vhost
+ ## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
- # serve static files from defined root folder;.
- # @gitlab is a named location for the upstream fallback, see below
+ ## Serve static files from defined root folder.
+ ## @gitlab is a named location for the upstream fallback, see below.
try_files $uri $uri/index.html $uri.html @gitlab;
}
- # if a file, which is not found in the root folder is requested,
- # then the proxy pass the request to the upsteam (gitlab unicorn)
+ ## If a file, which is not found in the root folder is requested,
+ ## then the proxy passes the request to the upsteam (gitlab unicorn).
location @gitlab {
- # If you use https make sure you disable gzip compression
- # to be safe against BREACH attack
+ ## If you use HTTPS make sure you disable gzip compression
+ ## to be safe against BREACH attack.
# gzip off;
- proxy_read_timeout 300; # Some requests take more than 30 seconds.
- proxy_connect_timeout 300; # Some requests take more than 30 seconds.
- proxy_redirect off;
+ ## https://github.com/gitlabhq/gitlabhq/issues/694
+ ## Some requests take more than 30 seconds.
+ proxy_read_timeout 300;
+ proxy_connect_timeout 300;
+ proxy_redirect off;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Frame-Options SAMEORIGIN;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab;
}
- # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
- # WARNING: If you are using relative urls do remove the block below
- # See config/application.rb under "Relative url support" for the list of
- # other files that need to be changed for relative url support
- location ~ ^/(assets)/ {
+ ## Enable gzip compression as per rails guide:
+ ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
+ ## WARNING: If you are using relative urls remove the block below
+ ## See config/application.rb under "Relative url support" for the list of
+ ## other files that need to be changed for relative url support
+ location ~ ^/(assets)/ {
root /home/git/gitlab/public;
gzip_static on; # to serve pre-gzipped version
expires max;
diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl
index 22e923b377c..0ba9d055c8c 100644
--- a/lib/support/nginx/gitlab-ssl
+++ b/lib/support/nginx/gitlab-ssl
@@ -3,33 +3,10 @@
##
## Modified from nginx http version
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
+## Modified from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
##
-## Lines starting with two hashes (##) are comments containing information
-## for configuration. One hash (#) comments are actual configuration parameters
-## which you can comment/uncomment to your liking.
-##
-###################################
-## SSL configuration ##
-###################################
-##
-## Optimal configuration is taken from:
-## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
-## Make sure to read it and understand what each option does.
-##
-## [Optional] Generate a self-signed ssl certificate:
-## mkdir /etc/nginx/ssl/
-## cd /etc/nginx/ssl/
-## sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
-## sudo chmod o-r gitlab.key
-##
-## Edit `gitlab-shell/config.yml`:
-## 1) Set "gitlab_url" param in `gitlab-shell/config.yml` to `https://git.example.com`
-## 2) Set "ca_file" to `/etc/nginx/ssl/gitlab.crt`
-## 3) Set "self_signed_cert" to `true`
-## Edit `gitlab/config/gitlab.yml`:
-## 1) Define port for http "port: 443"
-## 2) Enable https "https: true"
-## 3) Update ssl for gravatar "ssl_url: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm"
+## Lines starting with two hashes (##) are comments with information.
+## Lines starting with one hash (#) are configuration parameters that can be uncommented.
##
##################################
## CHUNKED TRANSFER ##
@@ -42,39 +19,39 @@
## - installing an old version of Nginx with the chunkin module [2] compiled in, or
## - using a newer version of Nginx.
##
-## At the time of writing we do not know if either of these theoretical solutions works. As a workaround
-## users can use Git over SSH to push large files.
+## At the time of writing we do not know if either of these theoretical solutions works.
+## As a workaround users can use Git over SSH to push large files.
##
## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
## [1] https://github.com/agentzh/chunkin-nginx-module#status
## [2] https://github.com/agentzh/chunkin-nginx-module
-
+##
+##
+###################################
+## SSL configuration ##
+###################################
+##
+## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab {
-
- ## Uncomment if you have set up unicorn to listen on a unix socket (recommended).
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
-
- ## Uncomment if unicorn is configured to listen on a tcp port.
- ## Check the port number in /home/git/gitlab/config/unicorn.rb
- # server 127.0.0.1:8080;
}
-## This is a normal HTTP host which redirects all traffic to the HTTPS host.
+## Normal HTTP host
server {
- listen *:80;
- ## Replace git.example.com with your FQDN.
- server_name git.example.com;
- server_tokens off;
- ## root doesn't have to be a valid path since we are redirecting
- root /nowhere;
- rewrite ^ https://$server_name$request_uri permanent;
+ listen *:80 default_server;
+ server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
+ server_tokens off; ## Don't show the nginx version number, a security best practice
+
+ ## Redirects all traffic to the HTTPS host
+ root /nowhere; ## root doesn't have to be a valid path since we are redirecting
+ rewrite ^ https://$server_name$request_uri? permanent;
}
+## HTTPS host
server {
listen 443 ssl;
- ## Replace git.example.com with your FQDN.
- server_name git.example.com;
+ server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
server_tokens off;
root /home/git/gitlab/public;
@@ -93,27 +70,29 @@ server {
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache builtin:1000 shared:SSL:10m;
- ## Enable OCSP stapling to reduce the overhead and latency of running SSL.
+ ssl_prefer_server_ciphers on;
+
+ add_header Strict-Transport-Security max-age=63072000;
+ add_header X-Frame-Options SAMEORIGIN;
+ add_header X-Content-Type-Options nosniff;
+
+ ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
## Replace with your ssl_trusted_certificate. For more info see:
## - https://medium.com/devops-programming/4445f4862461
## - https://www.ruby-forum.com/topic/4419319
- ssl_stapling on;
- ssl_stapling_verify on;
- ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
- resolver 208.67.222.222 208.67.222.220 valid=300s;
- resolver_timeout 10s;
-
- ssl_prefer_server_ciphers on;
- ## [Optional] Generate a stronger DHE parameter (recommended):
+ ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
+ # ssl_stapling on;
+ # ssl_stapling_verify on;
+ # ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
+ # resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
+ # resolver_timeout 10s;
+
+ ## [Optional] Generate a stronger DHE parameter:
## cd /etc/ssl/certs
- ## openssl dhparam -out dhparam.pem 2048
+ ## sudo openssl dhparam -out dhparam.pem 4096
##
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
- add_header Strict-Transport-Security max-age=63072000;
- add_header X-Frame-Options DENY;
- add_header X-Content-Type-Options nosniff;
-
## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
@@ -125,10 +104,9 @@ server {
}
## If a file, which is not found in the root folder is requested,
- ## then the proxy pass the request to the upsteam (gitlab unicorn).
+ ## then the proxy passes the request to the upsteam (gitlab unicorn).
location @gitlab {
-
- ## If you use https make sure you disable gzip compression
+ ## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
gzip off;
@@ -150,7 +128,7 @@ server {
## Enable gzip compression as per rails guide:
## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
- ## WARNING: If you are using relative urls do remove the block below
+ ## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
location ~ ^/(assets)/ {
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 34116568e99..9ea5c55abd6 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -27,6 +27,7 @@ namespace :gitlab do
check_projects_have_namespace
check_satellites_exist
check_redis_version
+ check_ruby_version
check_git_version
finished_checking "GitLab"
@@ -216,7 +217,7 @@ namespace :gitlab do
puts ""
Project.find_each(batch_size: 100) do |project|
- print "#{project.name_with_namespace.yellow} ... "
+ print sanitized_message(project)
if project.satellite.exists?
puts "yes".green
@@ -317,10 +318,11 @@ namespace :gitlab do
options = {
"user.name" => "GitLab",
- "user.email" => Gitlab.config.gitlab.email_from
+ "user.email" => Gitlab.config.gitlab.email_from,
+ "core.autocrlf" => "input"
}
correct_options = options.map do |name, value|
- run(%W(git config --global --get #{name})).try(:squish) == value
+ run(%W(#{Gitlab.config.git.bin_path} config --global --get #{name})).try(:squish) == value
end
if correct_options.all?
@@ -328,8 +330,9 @@ namespace :gitlab do
else
puts "no".red
try_fixing_it(
- sudo_gitlab("git config --global user.name \"#{options["user.name"]}\""),
- sudo_gitlab("git config --global user.email \"#{options["user.email"]}\"")
+ sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global user.name \"#{options["user.name"]}\""),
+ sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global user.email \"#{options["user.email"]}\""),
+ sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global core.autocrlf \"#{options["core.autocrlf"]}\"")
)
for_more_information(
see_installation_guide_section "GitLab"
@@ -525,7 +528,7 @@ namespace :gitlab do
puts ""
Project.find_each(batch_size: 100) do |project|
- print "#{project.name_with_namespace.yellow} ... "
+ print sanitized_message(project)
if project.empty_repo?
puts "repository is empty".magenta
@@ -538,7 +541,7 @@ namespace :gitlab do
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
- "#{gitlab_shell_path}/support/rewrite-hooks.sh"
+ "#{gitlab_shell_path}/bin/create-hooks"
)
fix_and_rerun
next
@@ -553,7 +556,7 @@ namespace :gitlab do
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
- "lib/support/rewrite-hooks.sh"
+ "#{gitlab_shell_path}/bin/create-hooks"
)
fix_and_rerun
end
@@ -588,7 +591,7 @@ namespace :gitlab do
puts ""
Project.find_each(batch_size: 100) do |project|
- print "#{project.name_with_namespace.yellow} ... "
+ print sanitized_message(project)
if project.namespace
puts "yes".green
@@ -816,6 +819,23 @@ namespace :gitlab do
end
end
+ def check_ruby_version
+ required_version = Gitlab::VersionInfo.new(2, 0, 0)
+ current_version = Gitlab::VersionInfo.parse(run(%W(ruby --version)))
+
+ print "Ruby version >= #{required_version} ? ... "
+
+ if current_version.valid? && required_version <= current_version
+ puts "yes (#{current_version})".green
+ else
+ puts "no".red
+ try_fixing_it(
+ "Update your ruby to a version >= #{required_version} from #{current_version}"
+ )
+ fix_and_rerun
+ end
+ end
+
def check_git_version
required_version = Gitlab::VersionInfo.new(1, 7, 10)
current_version = Gitlab::VersionInfo.parse(run(%W(#{Gitlab.config.git.bin_path} --version)))
@@ -837,4 +857,20 @@ namespace :gitlab do
def omnibus_gitlab?
Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails'
end
+
+ def sanitized_message(project)
+ if sanitize
+ "#{project.namespace_id.to_s.yellow}/#{project.id.to_s.yellow} ... "
+ else
+ "#{project.name_with_namespace.yellow} ... "
+ end
+ end
+
+ def sanitize
+ if ENV['SANITIZE'] == "true"
+ true
+ else
+ false
+ end
+ end
end
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake
index 4aaab11340f..63dcdc52370 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/lib/tasks/gitlab/cleanup.rake
@@ -84,5 +84,29 @@ namespace :gitlab do
puts "To cleanup this directories run this command with REMOVE=true".yellow
end
end
+
+ desc "GITLAB | Cleanup | Block users that have been removed in LDAP"
+ task block_removed_ldap_users: :environment do
+ warn_user_is_not_gitlab
+ block_flag = ENV['BLOCK']
+
+ User.ldap.each do |ldap_user|
+ print "#{ldap_user.name} (#{ldap_user.extern_uid}) ..."
+ if Gitlab::LDAP::Access.open { |access| access.allowed?(ldap_user) }
+ puts " [OK]".green
+ else
+ if block_flag
+ ldap_user.block!
+ puts " [BLOCKED]".red
+ else
+ puts " [NOT IN LDAP]".yellow
+ end
+ end
+ end
+
+ unless block_flag
+ puts "To block these users run this command with BLOCK=true".yellow
+ end
+ end
end
end
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index dfc90bb3339..ece3ad58385 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -4,10 +4,11 @@ namespace :gitlab do
task :install, [:tag, :repo] => :environment do |t, args|
warn_user_is_not_gitlab
- args.with_defaults(tag: "v1.9.3", repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
+ default_version = File.read(File.join(Rails.root, "GITLAB_SHELL_VERSION")).strip
+ args.with_defaults(tag: 'v' + default_version, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Settings.gitlab.user
- home_dir = Settings.gitlab.user_home
+ home_dir = Rails.env.test? ? Rails.root.join('tmp/tests') : Settings.gitlab.user_home
gitlab_url = Settings.gitlab.url
# gitlab-shell requires a / at the end of the url
gitlab_url += "/" unless gitlab_url.match(/\/$/)
diff --git a/lib/tasks/gitlab/sidekiq.rake b/lib/tasks/gitlab/sidekiq.rake
new file mode 100644
index 00000000000..7e2a6668e59
--- /dev/null
+++ b/lib/tasks/gitlab/sidekiq.rake
@@ -0,0 +1,47 @@
+namespace :gitlab do
+ namespace :sidekiq do
+ QUEUE = 'queue:post_receive'
+
+ desc 'Drop all Sidekiq PostReceive jobs for a given project'
+ task :drop_post_receive , [:project] => :environment do |t, args|
+ unless args.project.present?
+ abort "Please specify the project you want to drop PostReceive jobs for:\n rake gitlab:sidekiq:drop_post_receive[group/project]"
+ end
+ project_path = Project.find_with_namespace(args.project).repository.path_to_repo
+
+ Sidekiq.redis do |redis|
+ unless redis.exists(QUEUE)
+ abort "Queue #{QUEUE} is empty"
+ end
+
+ temp_queue = "#{QUEUE}_#{Time.now.to_i}"
+ redis.rename(QUEUE, temp_queue)
+
+ # At this point, then post_receive queue is empty. It may be receiving
+ # new jobs already. We will repopulate it with the old jobs, skipping the
+ # ones we want to drop.
+ dropped = 0
+ while (job = redis.lpop(temp_queue)) do
+ if repo_path(job) == project_path
+ dropped += 1
+ else
+ redis.rpush(QUEUE, job)
+ end
+ end
+ # The temp_queue will delete itself after we have popped all elements
+ # from it
+
+ puts "Dropped #{dropped} jobs containing #{project_path} from #{QUEUE}"
+ end
+ end
+
+ def repo_path(job)
+ job_args = JSON.parse(job)['args']
+ if job_args
+ job_args.first
+ else
+ nil
+ end
+ end
+ end
+end
diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake
index 5b937ce0a28..c01b00bd1c0 100644
--- a/lib/tasks/gitlab/test.rake
+++ b/lib/tasks/gitlab/test.rake
@@ -11,4 +11,4 @@ namespace :gitlab do
system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!")
end
end
-end \ No newline at end of file
+end
diff --git a/lib/unfold_form.rb b/lib/unfold_form.rb
new file mode 100644
index 00000000000..46b12beeaaf
--- /dev/null
+++ b/lib/unfold_form.rb
@@ -0,0 +1,11 @@
+require_relative 'gt_one_coercion'
+
+class UnfoldForm
+ include Virtus.model
+
+ attribute :since, GtOneCoercion
+ attribute :to, GtOneCoercion
+ attribute :bottom, Boolean
+ attribute :unfold, Boolean, default: true
+ attribute :offset, Integer
+end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index e1c0269b295..cc32805f5ec 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -30,4 +30,4 @@ describe ApplicationController do
controller.send(:check_password_expiration)
end
end
-end \ No newline at end of file
+end
diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb
index cea6922e1c3..11d748ca77f 100644
--- a/spec/controllers/blob_controller_spec.rb
+++ b/spec/controllers/blob_controller_spec.rb
@@ -34,4 +34,18 @@ describe Projects::BlobController do
it { should respond_with(:not_found) }
end
end
+
+ describe 'GET show with tree path' do
+ render_views
+
+ before do
+ get :show, project_id: project.to_param, id: id
+ controller.instance_variable_set(:@blob, nil)
+ end
+
+ context 'redirect to tree' do
+ let(:id) { 'markdown/doc' }
+ it { should redirect_to("/#{project.path_with_namespace}/tree/markdown/doc") }
+ end
+ end
end
diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb
index 1502bded97f..300527e4ff2 100644
--- a/spec/controllers/merge_requests_controller_spec.rb
+++ b/spec/controllers/merge_requests_controller_spec.rb
@@ -3,12 +3,11 @@ require 'spec_helper'
describe Projects::MergeRequestsController do
let(:project) { create(:project) }
let(:user) { create(:user) }
- let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project, target_branch: "stable", source_branch: "master") }
+ let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
before do
sign_in(user)
project.team << [user, :master]
- Projects::MergeRequestsController.any_instance.stub(validates_merge_request: true, )
end
describe "#show" do
@@ -61,7 +60,7 @@ describe Projects::MergeRequestsController do
it "should really be a git email patch with commit" do
get :show, project_id: project.to_param, id: merge_request.iid, format: format
- expect(response.body[0..100]).to start_with("From 6ea87c47f0f8a24ae031c3fff17bc913889ecd00")
+ expect(response.body[0..100]).to start_with("From #{merge_request.commits.last.id}")
end
it "should contain git diffs" do
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 944df5314bd..71bc49787cc 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -2,6 +2,7 @@ require('spec_helper')
describe ProjectsController do
let(:project) { create(:project) }
+ let(:public_project) { create(:project, :public) }
let(:user) { create(:user) }
let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') }
let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') }
@@ -40,4 +41,22 @@ describe ProjectsController do
end
end
end
+
+ describe "POST #toggle_star" do
+ it "toggles star if user is signed in" do
+ sign_in(user)
+ expect(user.starred?(public_project)).to be_false
+ post :toggle_star, id: public_project.to_param
+ expect(user.starred?(public_project)).to be_true
+ post :toggle_star, id: public_project.to_param
+ expect(user.starred?(public_project)).to be_false
+ end
+
+ it "does nothing if user is not signed in" do
+ post :toggle_star, id: public_project.to_param
+ expect(user.starred?(public_project)).to be_false
+ post :toggle_star, id: public_project.to_param
+ expect(user.starred?(public_project)).to be_false
+ end
+ end
end
diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb
index 479118a3465..8147fb0e6fb 100644
--- a/spec/controllers/tree_controller_spec.rb
+++ b/spec/controllers/tree_controller_spec.rb
@@ -26,7 +26,7 @@ describe Projects::TreeController do
end
context "valid branch, valid path" do
- let(:id) { 'master/app/' }
+ let(:id) { 'master/encoding/' }
it { should respond_with(:success) }
end
@@ -36,8 +36,21 @@ describe Projects::TreeController do
end
context "invalid branch, valid path" do
- let(:id) { 'invalid-branch/app/' }
+ let(:id) { 'invalid-branch/encoding/' }
it { should respond_with(:not_found) }
end
end
+
+ describe 'GET show with blob path' do
+ render_views
+
+ before do
+ get :show, project_id: project.to_param, id: id
+ end
+
+ context 'redirect to blob' do
+ let(:id) { 'master/README.md' }
+ it { should redirect_to("/#{project.path_with_namespace}/blob/master/README.md") }
+ end
+ end
end
diff --git a/spec/factories.rb b/spec/factories.rb
index 41cc99cbcb9..03c87fcc6c5 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -27,50 +27,6 @@ FactoryGirl.define do
factory :admin, traits: [:admin]
end
- factory :empty_project, class: 'Project' do
- sequence(:name) { |n| "project#{n}" }
- path { name.downcase.gsub(/\s/, '_') }
- namespace
- creator
-
- trait :public do
- visibility_level Gitlab::VisibilityLevel::PUBLIC
- end
-
- trait :internal do
- visibility_level Gitlab::VisibilityLevel::INTERNAL
- end
-
- trait :private do
- visibility_level Gitlab::VisibilityLevel::PRIVATE
- end
- end
-
- # Generates a test repository from the repository stored under `spec/seed_project.tar.gz`.
- # Once you run `rake gitlab:setup`, you can see what the repository looks like under `tmp/repositories/gitlabhq`.
- # In order to modify files in the repository, you must untar the seed, modify and remake the tar.
- # Before recompressing, do not forget to `git checkout master`.
- # After recompressing, you need to run `RAILS_ENV=test bundle exec rake gitlab:setup` to regenerate the seeds under tmp.
- #
- # If you want to modify the repository only for an specific type of tests, e.g., markdown tests,
- # consider using a feature branch to reduce the chances of collision with other tests.
- # Create a new commit, and use the same commit message that you will use for the change in the main repo.
- # Changing the commig message and SHA of branch `master` may break tests.
- factory :project, parent: :empty_project do
- path { 'gitlabhq' }
-
- after :create do |project|
- TestEnv.clear_repo_dir(project.namespace, project.path)
- TestEnv.reset_satellite_dir
- TestEnv.create_repo(project.namespace, project.path)
- end
- end
-
- factory :redmine_project, parent: :project do
- issues_tracker { "redmine" }
- issues_tracker_id { "project_name_in_redmine" }
- end
-
factory :group do
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }
@@ -106,105 +62,6 @@ FactoryGirl.define do
factory :reopened_issue, traits: [:reopened]
end
- factory :merge_request do
- title
- author
- source_project factory: :project
- target_project { source_project }
-
- # → git log stable..master --pretty=oneline
- # b1e6a9dbf1c85e6616497a5e7bad9143a4bd0828 tree css fixes
- # 8716fc78f3c65bbf7bcf7b574febd583bc5d2812 Added loading animation for notes
- # cd5c4bac5042c5469dcdf7e7b2f768d3c6fd7088 notes count for wall
- # 8470d70da67355c9c009e4401746b1d5410af2e3 notes controller refactored
- # 1e689bfba39525ead225eaf611948cfbe8ac34cf fixed notes logic
- # f0f14c8eaba69ebddd766498a9d0b0e79becd633 finished scss refactoring
- # 3a4b4fb4cde7809f033822a171b9feae19d41fff Moving ui styles to one scss file, Added ui class to body
- # 065c200c33f68c2bb781e35a43f9dc8138a893b5 removed unnecessary hr tags & titles
- # 1e8b111be85df0db6c8000ef9a710bc0221eae83 Merge branch 'master' of github.com:gitlabhq/gitlabhq
- # f403da73f5e62794a0447aca879360494b08f678 Fixed ajax loading image. Fixed wrong wording
- # e6ea73c77600d413d370249b8e392734f7d1dbee Merge pull request #468 from bencevans/patch-1
- # 4a3c05b69355deee25767a74d0512ec4b510d4ef Merge pull request #470 from bgondy/patch-1
- # 0347fe2412eb51d3efeccc35210e9268bc765ac5 Update app/views/projects/team.html.haml
- # 2b5c61bdece1f7eb2b901ceea7d364065cdf76ac Title for a link fixed
- # 460eeb13b7560b40104044973ff933b1a6dbbcaa Increased count of notes loaded when visit wall page
- # 21c141afb1c53a9180a99d2cca29ffa613eb7e3a Merge branch 'notes_refactoring'
- # 292a41cbe295f16f7148913b31eb0fb91f3251c3 Fixed comments for snippets. Tests fixed
- # d41d8ffb02fa74fd4571603548bd7e401ec99e0c Reply button, Comments for Merge Request diff
- # b1a36b552be2a7a6bc57fbed6c52dc6ed82111f8 Merge pull request #466 from skroutz/no-rbenv
- # db75dae913e8365453ca231f101b067314a7ea71 Merge pull request #465 from skroutz/branches_commit_link
- # 75f040fbfe4b5af23ff004ad3207c3976df097a8 Don't enforce rbenv version
- # e42fb4fda475370dcb0d8f8f1268bfdc7a0cc437 Fix broken commit link in branches page
- # 215a01f63ccdc085f75a48f6f7ab6f2b15b5852c move notes login to one controller
- # 81092c01984a481e312de10a28e3f1a6dda182a3 Status codes for errors, New error pages
- # 7d279f9302151e3c8f4c5df9c5200a72799409b9 better error handling for not found resource, gitolite error
- # 9e6d0710e927aa8ea834b8a9ae9f277be617ac7d Merge pull request #443 from CedricGatay/fix/incorrectLineNumberingInDiff
- # 6ea87c47f0f8a24ae031c3fff17bc913889ecd00 Incorrect line numbering in diff
- #
- # → git log master..stable --pretty=oneline
- # empty
-
- source_branch "master"
- target_branch "stable"
-
- trait :with_diffs do
- end
-
- trait :closed do
- state :closed
- end
-
- trait :reopened do
- state :reopened
- end
-
- trait :simple do
- source_branch "simple_merge_request"
- target_branch "master"
- end
-
- factory :closed_merge_request, traits: [:closed]
- factory :reopened_merge_request, traits: [:reopened]
- factory :merge_request_with_diffs, traits: [:with_diffs]
- end
-
- factory :note do
- project
- note "Note"
- author
-
- factory :note_on_commit, traits: [:on_commit]
- factory :note_on_commit_diff, traits: [:on_commit, :on_diff]
- factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
- factory :note_on_merge_request, traits: [:on_merge_request]
- factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff]
-
- trait :on_commit do
- project factory: :project
- commit_id "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
- noteable_type "Commit"
- end
-
- trait :on_diff do
- line_code "0_184_184"
- end
-
- trait :on_merge_request do
- project factory: :project
- noteable_id 1
- noteable_type "MergeRequest"
- end
-
- trait :on_issue do
- noteable_id 1
- noteable_type "Issue"
- end
-
- trait :with_attachment do
- attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "`/png") }
- end
- end
-
factory :event do
factory :closed_issue_event do
project
@@ -245,7 +102,7 @@ FactoryGirl.define do
end
end
end
-
+
factory :email do
user
email do
diff --git a/spec/factories/label_links.rb b/spec/factories/label_links.rb
new file mode 100644
index 00000000000..bd304b5db6b
--- /dev/null
+++ b/spec/factories/label_links.rb
@@ -0,0 +1,20 @@
+# == Schema Information
+#
+# Table name: label_links
+#
+# id :integer not null, primary key
+# label_id :integer
+# target_id :integer
+# target_type :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :label_link do
+ label
+ target factory: :issue
+ end
+end
diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb
new file mode 100644
index 00000000000..6829387c660
--- /dev/null
+++ b/spec/factories/labels.rb
@@ -0,0 +1,21 @@
+# == Schema Information
+#
+# Table name: labels
+#
+# id :integer not null, primary key
+# title :string(255)
+# color :string(255)
+# project_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :label do
+ title "Bug"
+ color "#990000"
+ project
+ end
+end
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb
new file mode 100644
index 00000000000..0ae8ea5f878
--- /dev/null
+++ b/spec/factories/merge_requests.rb
@@ -0,0 +1,69 @@
+# == Schema Information
+#
+# Table name: merge_requests
+#
+# id :integer not null, primary key
+# target_branch :string(255) not null
+# source_branch :string(255) not null
+# source_project_id :integer not null
+# author_id :integer
+# assignee_id :integer
+# title :string(255)
+# created_at :datetime
+# updated_at :datetime
+# milestone_id :integer
+# state :string(255)
+# merge_status :string(255)
+# target_project_id :integer not null
+# iid :integer
+# description :text
+# position :integer default(0)
+#
+
+FactoryGirl.define do
+ factory :merge_request do
+ title
+ author
+ source_project factory: :project
+ target_project { source_project }
+
+ # → git log --pretty=oneline feature..master
+ # 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com
+ # 570e7b2abdd848b95f2f578043fc23bd6f6fd24d Change some files
+ # 6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 More submodules
+ # d14d6c0abdd253381df51a723d58691b2ee1ab08 Remove ds_store files
+ # c1acaa58bbcbc3eafe538cb8274ba387047b69f8 Ignore DS files
+ #
+ # See also RepoHelpers.sample_compare
+ #
+ source_branch "master"
+ target_branch "feature"
+
+ merge_status :can_be_merged
+
+ trait :with_diffs do
+ end
+
+ trait :conflict do
+ source_branch "feature_conflict"
+ target_branch "feature"
+ end
+
+ trait :closed do
+ state :closed
+ end
+
+ trait :reopened do
+ state :reopened
+ end
+
+ trait :simple do
+ source_branch "feature"
+ target_branch "master"
+ end
+
+ factory :closed_merge_request, traits: [:closed]
+ factory :reopened_merge_request, traits: [:reopened]
+ factory :merge_request_with_diffs, traits: [:with_diffs]
+ end
+end
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb
new file mode 100644
index 00000000000..83d0cc62dbf
--- /dev/null
+++ b/spec/factories/notes.rb
@@ -0,0 +1,59 @@
+# == Schema Information
+#
+# Table name: notes
+#
+# id :integer not null, primary key
+# note :text
+# noteable_type :string(255)
+# author_id :integer
+# created_at :datetime
+# updated_at :datetime
+# project_id :integer
+# attachment :string(255)
+# line_code :string(255)
+# commit_id :string(255)
+# noteable_id :integer
+# system :boolean default(FALSE), not null
+# st_diff :text
+#
+
+require_relative '../support/repo_helpers'
+
+FactoryGirl.define do
+ factory :note do
+ project
+ note "Note"
+ author
+
+ factory :note_on_commit, traits: [:on_commit]
+ factory :note_on_commit_diff, traits: [:on_commit, :on_diff]
+ factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
+ factory :note_on_merge_request, traits: [:on_merge_request]
+ factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff]
+
+ trait :on_commit do
+ project factory: :project
+ commit_id RepoHelpers.sample_commit.id
+ noteable_type "Commit"
+ end
+
+ trait :on_diff do
+ line_code "0_184_184"
+ end
+
+ trait :on_merge_request do
+ project factory: :project
+ noteable_id 1
+ noteable_type "MergeRequest"
+ end
+
+ trait :on_issue do
+ noteable_id 1
+ noteable_type "Issue"
+ end
+
+ trait :with_attachment do
+ attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "`/png") }
+ end
+ end
+end
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
new file mode 100644
index 00000000000..5324654c48c
--- /dev/null
+++ b/spec/factories/projects.rb
@@ -0,0 +1,72 @@
+# == Schema Information
+#
+# Table name: projects
+#
+# id :integer not null, primary key
+# name :string(255)
+# path :string(255)
+# description :text
+# created_at :datetime
+# updated_at :datetime
+# creator_id :integer
+# issues_enabled :boolean default(TRUE), not null
+# wall_enabled :boolean default(TRUE), not null
+# merge_requests_enabled :boolean default(TRUE), not null
+# wiki_enabled :boolean default(TRUE), not null
+# namespace_id :integer
+# issues_tracker :string(255) default("gitlab"), not null
+# issues_tracker_id :string(255)
+# snippets_enabled :boolean default(TRUE), not null
+# last_activity_at :datetime
+# import_url :string(255)
+# visibility_level :integer default(0), not null
+# archived :boolean default(FALSE), not null
+# import_status :string(255)
+# repository_size :float default(0.0)
+# star_count :integer default(0), not null
+#
+
+FactoryGirl.define do
+ factory :empty_project, class: 'Project' do
+ sequence(:name) { |n| "project#{n}" }
+ path { name.downcase.gsub(/\s/, '_') }
+ namespace
+ creator
+ snippets_enabled true
+
+ trait :public do
+ visibility_level Gitlab::VisibilityLevel::PUBLIC
+ end
+
+ trait :internal do
+ visibility_level Gitlab::VisibilityLevel::INTERNAL
+ end
+
+ trait :private do
+ visibility_level Gitlab::VisibilityLevel::PRIVATE
+ end
+ end
+
+ # Generates a test repository from the repository stored under `spec/seed_project.tar.gz`.
+ # Once you run `rake gitlab:setup`, you can see what the repository looks like under `tmp/repositories/gitlabhq`.
+ # In order to modify files in the repository, you must untar the seed, modify and remake the tar.
+ # Before recompressing, do not forget to `git checkout master`.
+ # After recompressing, you need to run `RAILS_ENV=test bundle exec rake gitlab:setup` to regenerate the seeds under tmp.
+ #
+ # If you want to modify the repository only for an specific type of tests, e.g., markdown tests,
+ # consider using a feature branch to reduce the chances of collision with other tests.
+ # Create a new commit, and use the same commit message that you will use for the change in the main repo.
+ # Changing the commig message and SHA of branch `master` may break tests.
+ factory :project, parent: :empty_project do
+ path { 'gitlabhq' }
+
+ after :create do |project|
+ TestEnv.copy_repo(project)
+ end
+ end
+
+ factory :redmine_project, parent: :project do
+ issues_tracker { "redmine" }
+ issues_tracker_id { "project_name_in_redmine" }
+ end
+end
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index d7f3f3a302c..f0daf081018 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -226,7 +226,7 @@ describe "Issues", feature: true do
issue.save
end
- it 'shows assignee text' do
+ it "shows assignee text", js: true do
logout
login_with guest
@@ -262,7 +262,7 @@ describe "Issues", feature: true do
issue.save
end
- it 'shows milestone text' do
+ it "shows milestone text", js: true do
logout
login_with guest
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb
index 3fe11849660..47776ba7f3f 100644
--- a/spec/features/notes_on_merge_requests_spec.rb
+++ b/spec/features/notes_on_merge_requests_spec.rb
@@ -1,197 +1,209 @@
require 'spec_helper'
-describe "On a merge request", js: true, feature: true do
- let!(:merge_request) { create(:merge_request, :simple) }
- let!(:project) { merge_request.source_project }
- let!(:note) { create(:note_on_merge_request, :with_attachment, project: project) }
-
- before do
- login_as :admin
- visit project_merge_request_path(project, merge_request)
- end
+describe 'Comments' do
+ include RepoHelpers
- subject { page }
+ describe "On a merge request", js: true, feature: true do
+ let!(:merge_request) { create(:merge_request) }
+ let!(:project) { merge_request.source_project }
+ let!(:note) { create(:note_on_merge_request, :with_attachment, project: project) }
- describe "the note form" do
- it 'should be valid' do
- should have_css(".js-main-target-form", visible: true, count: 1)
- find(".js-main-target-form input[type=submit]").value.should == "Add Comment"
- within(".js-main-target-form") { should_not have_link("Cancel") }
- within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) }
+ before do
+ login_as :admin
+ visit project_merge_request_path(project, merge_request)
end
- describe "with text" do
- before do
- within(".js-main-target-form") do
- fill_in "note[note]", with: "This is awesome"
- end
- end
+ subject { page }
- it 'should have enable submit button and preview button' do
- within(".js-main-target-form") { should_not have_css(".js-comment-button[disabled]") }
- within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: true) }
+ describe "the note form" do
+ it 'should be valid' do
+ should have_css(".js-main-target-form", visible: true, count: 1)
+ find(".js-main-target-form input[type=submit]").value.should == "Add Comment"
+ within(".js-main-target-form") { should_not have_link("Cancel") }
+ within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) }
end
- end
- end
- describe "when posting a note" do
- before do
- within(".js-main-target-form") do
- fill_in "note[note]", with: "This is awsome!"
- find(".js-note-preview-button").trigger("click")
- click_button "Add Comment"
+ describe "with text" do
+ before do
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "This is awesome"
+ end
+ end
+
+ it 'should have enable submit button and preview button' do
+ within(".js-main-target-form") { should_not have_css(".js-comment-button[disabled]") }
+ within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: true) }
+ end
end
end
- it 'should be added and form reset' do
- should have_content("This is awsome!")
- within(".js-main-target-form") { should have_no_field("note[note]", with: "This is awesome!") }
- within(".js-main-target-form") { should have_css(".js-note-preview", visible: false) }
- within(".js-main-target-form") { should have_css(".js-note-text", visible: true) }
- end
- end
+ describe "when posting a note" do
+ before do
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "This is awsome!"
+ find(".js-note-preview-button").trigger("click")
+ click_button "Add Comment"
+ end
+ end
- describe "when editing a note", js: true do
- it "should contain the hidden edit form" do
- within("#note_#{note.id}") { should have_css(".note-edit-form", visible: false) }
+ it 'should be added and form reset' do
+ should have_content("This is awsome!")
+ within(".js-main-target-form") { should have_no_field("note[note]", with: "This is awesome!") }
+ within(".js-main-target-form") { should have_css(".js-note-preview", visible: false) }
+ within(".js-main-target-form") { should have_css(".js-note-text", visible: true) }
+ end
end
- describe "editing the note" do
- before do
- find('.note').hover
- find(".js-note-edit").click
+ describe "when editing a note", js: true do
+ it "should contain the hidden edit form" do
+ within("#note_#{note.id}") { should have_css(".note-edit-form", visible: false) }
end
- it "should show the note edit form and hide the note body" do
- within("#note_#{note.id}") do
- find(".note-edit-form", visible: true).should be_visible
- find(".note-text", visible: false).should_not be_visible
+ describe "editing the note" do
+ before do
+ find('.note').hover
+ find(".js-note-edit").click
end
- end
-
- it "should reset the edit note form textarea with the original content of the note if cancelled" do
- find('.note').hover
- find(".js-note-edit").click
- within(".note-edit-form") do
- fill_in "note[note]", with: "Some new content"
- find(".btn-cancel").click
- find(".js-note-text", visible: false).text.should == note.note
+ it "should show the note edit form and hide the note body" do
+ within("#note_#{note.id}") do
+ find(".note-edit-form", visible: true).should be_visible
+ find(".note-text", visible: false).should_not be_visible
+ end
end
- end
- it "appends the edited at time to the note" do
- find('.note').hover
- find(".js-note-edit").click
+ it "should reset the edit note form textarea with the original content of the note if cancelled" do
+ find('.note').hover
+ find(".js-note-edit").click
- within(".note-edit-form") do
- fill_in "note[note]", with: "Some new content"
- find(".btn-save").click
+ within(".note-edit-form") do
+ fill_in "note[note]", with: "Some new content"
+ find(".btn-cancel").click
+ find(".js-note-text", visible: false).text.should == note.note
+ end
end
- within("#note_#{note.id}") do
- should have_css(".note-last-update small")
- find(".note-last-update small").text.should match(/Edited less than a minute ago/)
+ it "appends the edited at time to the note" do
+ find('.note').hover
+ find(".js-note-edit").click
+
+ within(".note-edit-form") do
+ fill_in "note[note]", with: "Some new content"
+ find(".btn-save").click
+ end
+
+ within("#note_#{note.id}") do
+ should have_css(".note-last-update small")
+ find(".note-last-update small").text.should match(/Edited less than a minute ago/)
+ end
end
end
- end
- describe "deleting an attachment" do
- before do
- find('.note').hover
- find(".js-note-edit").click
- end
+ describe "deleting an attachment" do
+ before do
+ find('.note').hover
+ find(".js-note-edit").click
+ end
- it "shows the delete link" do
- within(".note-attachment") do
- should have_css(".js-note-attachment-delete")
+ it "shows the delete link" do
+ within(".note-attachment") do
+ should have_css(".js-note-attachment-delete")
+ end
end
- end
- it "removes the attachment div and resets the edit form" do
- find(".js-note-attachment-delete").click
- should_not have_css(".note-attachment")
- find(".note-edit-form", visible: false).should_not be_visible
+ it "removes the attachment div and resets the edit form" do
+ find(".js-note-attachment-delete").click
+ should_not have_css(".note-attachment")
+ find(".note-edit-form", visible: false).should_not be_visible
+ end
end
end
end
-end
-
-describe "On a merge request diff", js: true, feature: true do
- let(:merge_request) { create(:merge_request, :with_diffs, :simple) }
- let(:project) { merge_request.source_project }
-
- before do
- login_as :admin
- visit diffs_project_merge_request_path(project, merge_request)
- end
- subject { page }
+ describe "On a merge request diff", js: true, feature: true do
+ let(:merge_request) { create(:merge_request) }
+ let(:project) { merge_request.source_project }
- describe "when adding a note" do
before do
- find('a[data-line-code="8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_7_7"]').click
- end
-
- describe "the notes holder" do
- it { should have_css(".js-temp-notes-holder") }
-
- it { within(".js-temp-notes-holder") { should have_css(".new_note") } }
+ login_as :admin
+ visit diffs_project_merge_request_path(project, merge_request)
end
- describe "the note form" do
- it "shouldn't add a second form for same row" do
- find('a[data-line-code="8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_7_7"]').click
+ subject { page }
- should have_css("tr[id='8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_7_7'] + .js-temp-notes-holder form", count: 1)
+ describe "when adding a note" do
+ before do
+ find("a[data-line-code=\"#{line_code}\"]").click
end
- it "should be removed when canceled" do
- within(".diff-file form[rel$='8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_7_7']") do
- find(".js-close-discussion-note-form").trigger("click")
- end
+ describe "the notes holder" do
+ it { should have_css(".js-temp-notes-holder") }
- should have_no_css(".js-temp-notes-holder")
+ it { within(".js-temp-notes-holder") { should have_css(".new_note") } }
end
- end
- end
- describe "with muliple note forms" do
- before do
- find('a[data-line-code="8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_7_7"]').click
- find('a[data-line-code="8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_10_10"]').click
- end
+ describe "the note form" do
+ it "shouldn't add a second form for same row" do
+ find("a[data-line-code=\"#{line_code}\"]").click
- it { should have_css(".js-temp-notes-holder", count: 2) }
-
- describe "previewing them separately" do
- before do
- # add two separate texts and trigger previews on both
- within("tr[id='8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_7_7'] + .js-temp-notes-holder") do
- fill_in "note[note]", with: "One comment on line 7"
- find(".js-note-preview-button").trigger("click")
+ should have_css("tr[id='#{line_code}'] + .js-temp-notes-holder form", count: 1)
end
- within("tr[id='8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_10_10'] + .js-temp-notes-holder") do
- fill_in "note[note]", with: "Another comment on line 10"
- find(".js-note-preview-button").trigger("click")
+
+ it "should be removed when canceled" do
+ within(".diff-file form[rel$='#{line_code}']") do
+ find(".js-close-discussion-note-form").trigger("click")
+ end
+
+ should have_no_css(".js-temp-notes-holder")
end
end
end
- describe "posting a note" do
+ describe "with muliple note forms" do
before do
- within("tr[id='8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d_10_10'] + .js-temp-notes-holder") do
- fill_in "note[note]", with: "Another comment on line 10"
- click_button("Add Comment")
+ find("a[data-line-code=\"#{line_code}\"]").click
+ find("a[data-line-code=\"#{line_code_2}\"]").click
+ end
+
+ it { should have_css(".js-temp-notes-holder", count: 2) }
+
+ describe "previewing them separately" do
+ before do
+ # add two separate texts and trigger previews on both
+ within("tr[id='#{line_code}'] + .js-temp-notes-holder") do
+ fill_in "note[note]", with: "One comment on line 7"
+ find(".js-note-preview-button").trigger("click")
+ end
+ within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do
+ fill_in "note[note]", with: "Another comment on line 10"
+ find(".js-note-preview-button").trigger("click")
+ end
end
end
- it 'should be added as discussion' do
- should have_content("Another comment on line 10")
- should have_css(".notes_holder")
- should have_css(".notes_holder .note", count: 1)
- should have_link("Reply")
+ describe "posting a note" do
+ before do
+ within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do
+ fill_in "note[note]", with: "Another comment on line 10"
+ click_button("Add Comment")
+ end
+ end
+
+ it 'should be added as discussion' do
+ should have_content("Another comment on line 10")
+ should have_css(".notes_holder")
+ should have_css(".notes_holder .note", count: 1)
+ should have_link("Reply")
+ end
end
end
end
+
+ def line_code
+ sample_compare.changes.first[:line_code]
+ end
+
+ def line_code_2
+ sample_compare.changes.last[:line_code]
+ end
end
diff --git a/spec/fixtures/doc_sample.txt b/spec/fixtures/doc_sample.txt
index 45dbc1aadde..600477e9421 100644
--- a/spec/fixtures/doc_sample.txt
+++ b/spec/fixtures/doc_sample.txt
@@ -1,3 +1,3 @@
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? \ No newline at end of file
+Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 053a1fe22f5..2db67cfdf95 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -132,12 +132,12 @@ describe ApplicationHelper do
it "includes a list of branch names" do
options[0][0].should == 'Branches'
- options[0][1].should include('master', 'stable')
+ options[0][1].should include('master', 'feature')
end
it "includes a list of tag names" do
options[1][0].should == 'Tags'
- options[1][1].should include('v0.9.4','v1.2.0')
+ options[1][1].should include('v1.0.0','v1.1.0')
end
it "includes a specific commit ref if defined" do
@@ -217,4 +217,13 @@ describe ApplicationHelper do
).to eq("<a href=\"http://www.example.com\" rel=\"noreferrer nofollow\">Example</a>")
end
end
+
+ describe 'markup_render' do
+ let(:content) { 'Noël' }
+
+ it 'should preserve encoding' do
+ content.encoding.name.should == 'UTF-8'
+ expect(render_markup('foo.rst', content).encoding.name).to eq('UTF-8')
+ end
+ end
end
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index fc9d1ac90c0..ba6af6f8b45 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -5,6 +5,7 @@ describe GitlabMarkdownHelper do
include IssuesHelper
let!(:project) { create(:project) }
+ let(:empty_project) { create(:empty_project) }
let(:user) { create(:user, username: 'gfm') }
let(:commit) { project.repository.commit }
@@ -16,6 +17,7 @@ describe GitlabMarkdownHelper do
before do
# Helper expects a @project instance variable
@project = project
+ @ref = 'markdown'
@repository = project.repository
end
@@ -471,13 +473,13 @@ describe GitlabMarkdownHelper do
it "should handle relative urls for a file in master" do
actual = "[GitLab API doc](doc/api/README.md)\n"
- expected = "<p><a href=\"/#{project.path_with_namespace}/blob/master/doc/api/README.md\">GitLab API doc</a></p>\n"
+ expected = "<p><a href=\"/#{project.path_with_namespace}/blob/#{@ref}/doc/api/README.md\">GitLab API doc</a></p>\n"
markdown(actual).should match(expected)
end
it "should handle relative urls for a directory in master" do
actual = "[GitLab API doc](doc/api)\n"
- expected = "<p><a href=\"/#{project.path_with_namespace}/tree/master/doc/api\">GitLab API doc</a></p>\n"
+ expected = "<p><a href=\"/#{project.path_with_namespace}/tree/#{@ref}/doc/api\">GitLab API doc</a></p>\n"
markdown(actual).should match(expected)
end
@@ -489,13 +491,13 @@ describe GitlabMarkdownHelper do
it "should handle relative urls in reference links for a file in master" do
actual = "[GitLab API doc][GitLab readme]\n [GitLab readme]: doc/api/README.md\n"
- expected = "<p><a href=\"/#{project.path_with_namespace}/blob/master/doc/api/README.md\">GitLab API doc</a></p>\n"
+ expected = "<p><a href=\"/#{project.path_with_namespace}/blob/#{@ref}/doc/api/README.md\">GitLab API doc</a></p>\n"
markdown(actual).should match(expected)
end
it "should handle relative urls in reference links for a directory in master" do
actual = "[GitLab API doc directory][GitLab readmes]\n [GitLab readmes]: doc/api/\n"
- expected = "<p><a href=\"/#{project.path_with_namespace}/tree/master/doc/api\">GitLab API doc directory</a></p>\n"
+ expected = "<p><a href=\"/#{project.path_with_namespace}/tree/#{@ref}/doc/api\">GitLab API doc directory</a></p>\n"
markdown(actual).should match(expected)
end
@@ -506,6 +508,19 @@ describe GitlabMarkdownHelper do
end
end
+ describe "markdwon for empty repository" do
+ before do
+ @project = empty_project
+ @repository = empty_project.repository
+ end
+
+ it "should not touch relative urls" do
+ actual = "[GitLab API doc][GitLab readme]\n [GitLab readme]: doc/api/README.md\n"
+ expected = "<p><a href=\"doc/api/README.md\">GitLab API doc</a></p>\n"
+ markdown(actual).should match(expected)
+ end
+ end
+
describe "#render_wiki_content" do
before do
@wiki = double('WikiPage')
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb
index f66a5cc9f5c..1e64a201942 100644
--- a/spec/helpers/labels_helper_spec.rb
+++ b/spec/helpers/labels_helper_spec.rb
@@ -1,13 +1,6 @@
require 'spec_helper'
describe LabelsHelper do
- describe '#label_css_class' do
- it 'returns label-danger when given Bug as param' do
- expect(label_css_class('bug')).to eq('label-danger')
- end
-
- it 'returns label-danger when given Bug as param' do
- expect(label_css_class('Bug')).to eq('label-danger')
- end
- end
+ it { expect(text_color_for_bg('#EEEEEE')).to eq('#333') }
+ it { expect(text_color_for_bg('#222E2E')).to eq('#FFF') }
end
diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb
deleted file mode 100644
index d450b687caf..00000000000
--- a/spec/helpers/tree_helper_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'spec_helper'
-
-describe TreeHelper do
- describe '#markup?' do
- %w(textile rdoc org creole mediawiki rst asciidoc pod).each do |type|
- it "returns true for #{type} files" do
- markup?("README.#{type}").should be_true
- end
- end
-
- it "returns false when given a non-markup filename" do
- markup?('README.rb').should_not be_true
- end
- end
-end
diff --git a/spec/javascripts/stat_graph_spec.js b/spec/javascripts/stat_graph_spec.js
index b8881769ac1..b589af34610 100644
--- a/spec/javascripts/stat_graph_spec.js
+++ b/spec/javascripts/stat_graph_spec.js
@@ -14,4 +14,4 @@ describe("StatGraph", function () {
})
})
-}); \ No newline at end of file
+});
diff --git a/spec/lib/git_ref_validator_spec.rb b/spec/lib/git_ref_validator_spec.rb
new file mode 100644
index 00000000000..b2469c18395
--- /dev/null
+++ b/spec/lib/git_ref_validator_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe Gitlab::GitRefValidator do
+ it { Gitlab::GitRefValidator.validate('feature/new').should be_true }
+ it { Gitlab::GitRefValidator.validate('implement_@all').should be_true }
+ it { Gitlab::GitRefValidator.validate('my_new_feature').should be_true }
+ it { Gitlab::GitRefValidator.validate('#1').should be_true }
+ it { Gitlab::GitRefValidator.validate('feature/~new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/^new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/:new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/?new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/*new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/[new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/new.').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature\@{').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature\new').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature//new').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature new').should be_false }
+end
diff --git a/spec/lib/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
index 073b811c3fb..073b811c3fb 100644
--- a/spec/lib/auth_spec.rb
+++ b/spec/lib/gitlab/auth_spec.rb
diff --git a/spec/lib/gitlab/gitlab_markdown_helper_spec.rb b/spec/lib/gitlab/gitlab_markdown_helper_spec.rb
new file mode 100644
index 00000000000..540618a5603
--- /dev/null
+++ b/spec/lib/gitlab/gitlab_markdown_helper_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe Gitlab::MarkdownHelper do
+ describe '#markup?' do
+ %w(textile rdoc org creole wiki
+ mediawiki rst adoc asciidoc asc).each do |type|
+ it "returns true for #{type} files" do
+ Gitlab::MarkdownHelper.markup?("README.#{type}").should be_true
+ end
+ end
+
+ it 'returns false when given a non-markup filename' do
+ Gitlab::MarkdownHelper.markup?('README.rb').should_not be_true
+ end
+ end
+
+ describe '#gitlab_markdown?' do
+ %w(mdown md markdown).each do |type|
+ it "returns true for #{type} files" do
+ Gitlab::MarkdownHelper.gitlab_markdown?("README.#{type}").should be_true
+ end
+ end
+
+ it 'returns false when given a non-markdown filename' do
+ Gitlab::MarkdownHelper.gitlab_markdown?('README.rb').should_not be_true
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ldap/ldap_access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb
index d8c107502ba..2307a03f656 100644
--- a/spec/lib/gitlab/ldap/ldap_access_spec.rb
+++ b/spec/lib/gitlab/ldap/access_spec.rb
@@ -16,14 +16,14 @@ describe Gitlab::LDAP::Access do
context 'when the user is found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) }
- context 'and the Active Directory disabled flag is set' do
- before { Gitlab::LDAP::Person.stub(active_directory_disabled?: true) }
+ context 'and the user is diabled via active directory' do
+ before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: true) }
it { should be_false }
end
- context 'and the Active Directory disabled flag is not set' do
- before { Gitlab::LDAP::Person.stub(active_directory_disabled?: false) }
+ context 'and has no disabled flag in active diretory' do
+ before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: false) }
it { should be_true }
end
diff --git a/spec/lib/gitlab/ldap/ldap_adapter_spec.rb b/spec/lib/gitlab/ldap/adapter_spec.rb
index c3f07334431..c3f07334431 100644
--- a/spec/lib/gitlab/ldap/ldap_adapter_spec.rb
+++ b/spec/lib/gitlab/ldap/adapter_spec.rb
diff --git a/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb b/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
deleted file mode 100644
index 501642dca79..00000000000
--- a/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'spec_helper'
-
-describe Gitlab::LDAP do
- let(:gl_auth) { Gitlab::LDAP::User }
-
- before do
- Gitlab.config.stub(omniauth: {})
-
- @info = double(
- uid: '12djsak321',
- name: 'John',
- email: 'john@mail.com',
- nickname: 'john'
- )
- end
-
- describe :find_for_ldap_auth do
- before do
- @auth = double(
- uid: '12djsak321',
- info: @info,
- provider: 'ldap'
- )
- end
-
- it "should update credentials by email if missing uid" do
- user = double('User')
- User.stub find_by_extern_uid_and_provider: nil
- User.stub(:find_by).with(hash_including(email: anything())) { user }
- user.should_receive :update_attributes
- gl_auth.find_or_create(@auth)
- end
-
- it "should update credentials by username if missing uid and Gitlab.config.ldap.allow_username_or_email_login is true" do
- user = double('User')
- value = Gitlab.config.ldap.allow_username_or_email_login
- Gitlab.config.ldap['allow_username_or_email_login'] = true
- User.stub find_by_extern_uid_and_provider: nil
- User.stub(:find_by).with(hash_including(email: anything())) { nil }
- User.stub(:find_by).with(hash_including(username: anything())) { user }
- user.should_receive :update_attributes
- gl_auth.find_or_create(@auth)
- Gitlab.config.ldap['allow_username_or_email_login'] = value
- end
-
- it "should not update credentials by username if missing uid and Gitlab.config.ldap.allow_username_or_email_login is false" do
- user = double('User')
- value = Gitlab.config.ldap.allow_username_or_email_login
- Gitlab.config.ldap['allow_username_or_email_login'] = false
- User.stub find_by_extern_uid_and_provider: nil
- User.stub(:find_by).with(hash_including(email: anything())) { nil }
- User.stub(:find_by).with(hash_including(username: anything())) { user }
- user.should_not_receive :update_attributes
- gl_auth.find_or_create(@auth)
- Gitlab.config.ldap['allow_username_or_email_login'] = value
- end
- end
-end
diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb
new file mode 100644
index 00000000000..725338965be
--- /dev/null
+++ b/spec/lib/gitlab/ldap/user_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+
+describe Gitlab::LDAP::User do
+ let(:gl_auth) { Gitlab::LDAP::User }
+ let(:info) do
+ double(
+ name: 'John',
+ email: 'john@example.com',
+ nickname: 'john'
+ )
+ end
+ before { Gitlab.config.stub(omniauth: {}) }
+
+ describe :find_or_create do
+ let(:auth) do
+ double(info: info, provider: 'ldap', uid: 'my-uid')
+ end
+
+ it "finds the user if already existing" do
+ existing_user = create(:user, extern_uid: 'my-uid', provider: 'ldap')
+
+ expect{ gl_auth.find_or_create(auth) }.to_not change{ User.count }
+ end
+
+ it "connects to existing non-ldap user if the email matches" do
+ existing_user = create(:user, email: 'john@example.com')
+ expect{ gl_auth.find_or_create(auth) }.to_not change{ User.count }
+
+ existing_user.reload
+ expect(existing_user.extern_uid).to eql 'my-uid'
+ expect(existing_user.provider).to eql 'ldap'
+ end
+
+ it "creates a new user if not found" do
+ expect{ gl_auth.find_or_create(auth) }.to change{ User.count }.by(1)
+ end
+ end
+end
diff --git a/spec/lib/gitlab/oauth/user_spec.rb b/spec/lib/gitlab/oauth/user_spec.rb
new file mode 100644
index 00000000000..c241e198609
--- /dev/null
+++ b/spec/lib/gitlab/oauth/user_spec.rb
@@ -0,0 +1,83 @@
+require 'spec_helper'
+
+describe Gitlab::OAuth::User do
+ let(:gl_auth) { Gitlab::OAuth::User }
+ let(:info) do
+ double(
+ nickname: 'john',
+ name: 'John',
+ email: 'john@mail.com'
+ )
+ end
+
+ before do
+ Gitlab.config.stub(omniauth: {})
+ end
+
+ describe :find do
+ let!(:existing_user) { create(:user, extern_uid: 'my-uid', provider: 'my-provider') }
+
+ it "finds an existing user based on uid and provider (facebook)" do
+ auth = double(info: double(name: 'John'), uid: 'my-uid', provider: 'my-provider')
+ assert gl_auth.find(auth)
+ end
+
+ it "finds an existing user based on nested uid and provider" do
+ auth = double(info: info, uid: 'my-uid', provider: 'my-provider')
+ assert gl_auth.find(auth)
+ end
+ end
+
+ describe :create do
+ it "should create user from LDAP" do
+ auth = double(info: info, uid: 'my-uid', provider: 'ldap')
+ user = gl_auth.create(auth)
+
+ user.should be_valid
+ user.extern_uid.should == auth.uid
+ user.provider.should == 'ldap'
+ end
+
+ it "should create user from Omniauth" do
+ auth = double(info: info, uid: 'my-uid', provider: 'twitter')
+ user = gl_auth.create(auth)
+
+ user.should be_valid
+ user.extern_uid.should == auth.uid
+ user.provider.should == 'twitter'
+ end
+
+ it "should apply defaults to user" do
+ auth = double(info: info, uid: 'my-uid', provider: 'ldap')
+ user = gl_auth.create(auth)
+
+ user.should be_valid
+ user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
+ user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
+ end
+
+ it "Set a temp email address if not provided (like twitter does)" do
+ info = double(
+ uid: 'my-uid',
+ nickname: 'john',
+ name: 'John'
+ )
+ auth = double(info: info, uid: 'my-uid', provider: 'my-provider')
+
+ user = gl_auth.create(auth)
+ expect(user.email).to_not be_empty
+ end
+
+ it 'generates a username if non provided (google)' do
+ info = double(
+ uid: 'my-uid',
+ name: 'John',
+ email: 'john@example.com'
+ )
+ auth = double(info: info, uid: 'my-uid', provider: 'my-provider')
+
+ user = gl_auth.create(auth)
+ expect(user.username).to eql 'john'
+ end
+ end
+end
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
new file mode 100644
index 00000000000..a3aae7771bd
--- /dev/null
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe Gitlab::Regex do
+ describe 'path regex' do
+ it { 'gitlab-ce'.should match(Gitlab::Regex.path_regex) }
+ it { 'gitlab_git'.should match(Gitlab::Regex.path_regex) }
+ it { '_underscore.js'.should match(Gitlab::Regex.path_regex) }
+ it { '100px.com'.should match(Gitlab::Regex.path_regex) }
+ it { '?gitlab'.should_not match(Gitlab::Regex.path_regex) }
+ it { 'git lab'.should_not match(Gitlab::Regex.path_regex) }
+ it { 'gitlab.git'.should_not match(Gitlab::Regex.path_regex) }
+ end
+
+ describe 'project name regex' do
+ it { 'gitlab-ce'.should match(Gitlab::Regex.project_name_regex) }
+ it { 'GitLab CE'.should match(Gitlab::Regex.project_name_regex) }
+ it { '100 lines'.should match(Gitlab::Regex.project_name_regex) }
+ it { 'gitlab.git'.should match(Gitlab::Regex.project_name_regex) }
+ it { '?gitlab'.should_not match(Gitlab::Regex.project_name_regex) }
+ end
+end
diff --git a/spec/lib/gitlab/satellite/action_spec.rb b/spec/lib/gitlab/satellite/action_spec.rb
index d65e7c42b7e..0622caf1e3b 100644
--- a/spec/lib/gitlab/satellite/action_spec.rb
+++ b/spec/lib/gitlab/satellite/action_spec.rb
@@ -5,6 +5,9 @@ describe 'Gitlab::Satellite::Action' do
let(:user) { create(:user) }
describe '#prepare_satellite!' do
+ it 'should be able to fetch timeout from conf' do
+ Gitlab::Satellite::Action::DEFAULT_OPTIONS[:git_timeout].should == 30.seconds
+ end
it 'create a repository with a parking branch and one remote: origin' do
repo = project.satellite.repo
@@ -113,4 +116,3 @@ describe 'Gitlab::Satellite::Action' do
end
end
-
diff --git a/spec/lib/gitlab/satellite/merge_action_spec.rb b/spec/lib/gitlab/satellite/merge_action_spec.rb
index 41d3321b173..479a73a1081 100644
--- a/spec/lib/gitlab/satellite/merge_action_spec.rb
+++ b/spec/lib/gitlab/satellite/merge_action_spec.rb
@@ -1,22 +1,16 @@
require 'spec_helper'
describe 'Gitlab::Satellite::MergeAction' do
- before(:each) do
- @master = ['master', '69b34b7e9ad9f496f0ad10250be37d6265a03bba']
- @one_after_stable = ['stable', '6ea87c47f0f8a24ae031c3fff17bc913889ecd00'] #this commit sha is one after stable
- @wiki_branch = ['wiki', '635d3e09b72232b6e92a38de6cc184147e5bcb41'] #this is the commit sha where the wiki branch goes off from master
- @conflicting_metior = ['metior', '313d96e42b313a0af5ab50fa233bf43e27118b3f'] #this branch conflicts with the wiki branch
-
- # these commits are quite close together, itended to make string diffs/format patches small
- @close_commit1 = ['2_3_notes_fix', '8470d70da67355c9c009e4401746b1d5410af2e3']
- @close_commit2 = ['scss_refactoring', 'f0f14c8eaba69ebddd766498a9d0b0e79becd633']
- end
+ include RepoHelpers
let(:project) { create(:project, namespace: create(:group)) }
let(:fork_project) { create(:project, namespace: create(:group), forked_from_project: project) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:merge_request_fork) { create(:merge_request, source_project: fork_project, target_project: project) }
+ let(:merge_request_with_conflict) { create(:merge_request, :conflict, source_project: project, target_project: project) }
+ let(:merge_request_fork_with_conflict) { create(:merge_request, :conflict, source_project: project, target_project: project) }
+
describe '#commits_between' do
def verify_commits(commits, first_commit_sha, last_commit_sha)
commits.each { |commit| commit.class.should == Gitlab::Git::Commit }
@@ -26,51 +20,27 @@ describe 'Gitlab::Satellite::MergeAction' do
context 'on fork' do
it 'should get proper commits between' do
- merge_request_fork.target_branch = @one_after_stable[0]
- merge_request_fork.source_branch = @master[0]
- commits = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).commits_between
- verify_commits(commits, @one_after_stable[1], @master[1])
-
- merge_request_fork.target_branch = @wiki_branch[0]
- merge_request_fork.source_branch = @master[0]
commits = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).commits_between
- verify_commits(commits, @wiki_branch[1], @master[1])
+ verify_commits(commits, sample_compare.commits.first, sample_compare.commits.last)
end
end
context 'between branches' do
it 'should raise exception -- not expected to be used by non forks' do
- merge_request.target_branch = @one_after_stable[0]
- merge_request.source_branch = @master[0]
- expect {Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between}.to raise_error
-
- merge_request.target_branch = @wiki_branch[0]
- merge_request.source_branch = @master[0]
- expect {Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between}.to raise_error
+ expect { Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between }.to raise_error
end
end
end
describe '#format_patch' do
- let(:target_commit) {['artiom-config-examples','9edbac5ac88ffa1ec9dad0097226b51e29ebc9ac']}
- let(:source_commit) {['metior', '313d96e42b313a0af5ab50fa233bf43e27118b3f']}
-
def verify_content(patch)
- (patch.include? source_commit[1]).should be_true
- (patch.include? '635d3e09b72232b6e92a38de6cc184147e5bcb41').should be_true
- (patch.include? '2bb2dee057327c81978ed0aa99904bd7ff5e6105').should be_true
- (patch.include? '2e83de1924ad3429b812d17498b009a8b924795d').should be_true
- (patch.include? 'ee45a49c57a362305431cbf004e4590b713c910e').should be_true
- (patch.include? 'a6870dd08f8f274d9a6b899f638c0c26fefaa690').should be_true
-
- (patch.include? 'e74fae147abc7d2ffbf93d363dbbe45b87751f6f').should be_false
- (patch.include? '86f76b11c670425bbab465087f25172378d76147').should be_false
+ sample_compare.commits.each do |commit|
+ patch.include?(commit).should be_true
+ end
end
context 'on fork' do
it 'should build a format patch' do
- merge_request_fork.target_branch = target_commit[0]
- merge_request_fork.source_branch = source_commit[0]
patch = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).format_patch
verify_content(patch)
end
@@ -78,8 +48,6 @@ describe 'Gitlab::Satellite::MergeAction' do
context 'between branches' do
it 'should build a format patch' do
- merge_request.target_branch = target_commit[0]
- merge_request.source_branch = source_commit[0]
patch = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request).format_patch
verify_content(patch)
end
@@ -87,7 +55,6 @@ describe 'Gitlab::Satellite::MergeAction' do
end
describe '#diffs_between_satellite tested against diff_in_satellite' do
-
def is_a_matching_diff(diff, diffs)
diff_count = diff.scan('diff --git').size
diff_count.should >= 1
@@ -100,50 +67,38 @@ describe 'Gitlab::Satellite::MergeAction' do
context 'on fork' do
it 'should get proper diffs' do
- merge_request_fork.target_branch = @close_commit1[0]
- merge_request_fork.source_branch = @master[0]
diffs = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).diffs_between_satellite
-
- merge_request_fork.target_branch = @close_commit1[0]
- merge_request_fork.source_branch = @master[0]
diff = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request_fork).diff_in_satellite
-
is_a_matching_diff(diff, diffs)
end
end
context 'between branches' do
it 'should get proper diffs' do
- merge_request.target_branch = @close_commit1[0]
- merge_request.source_branch = @master[0]
- expect{Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite}.to raise_error
+ expect{ Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite }.to raise_error
end
end
end
describe '#can_be_merged?' do
context 'on fork' do
- it 'return true or false depending on if something is mergable' do
- merge_request_fork.target_branch = @one_after_stable[0]
- merge_request_fork.source_branch = @master[0]
- Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).can_be_merged?.should be_true
-
- merge_request_fork.target_branch = @conflicting_metior[0]
- merge_request_fork.source_branch = @wiki_branch[0]
- Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).can_be_merged?.should be_false
- end
+ it { Gitlab::Satellite::MergeAction.new(
+ merge_request_fork.author,
+ merge_request_fork).can_be_merged?.should be_true }
+
+ it { Gitlab::Satellite::MergeAction.new(
+ merge_request_fork_with_conflict.author,
+ merge_request_fork_with_conflict).can_be_merged?.should be_false }
end
context 'between branches' do
- it 'return true or false depending on if something is mergable' do
- merge_request.target_branch = @one_after_stable[0]
- merge_request.source_branch = @master[0]
- Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).can_be_merged?.should be_true
-
- merge_request.target_branch = @conflicting_metior[0]
- merge_request.source_branch = @wiki_branch[0]
- Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).can_be_merged?.should be_false
- end
+ it { Gitlab::Satellite::MergeAction.new(
+ merge_request.author,
+ merge_request).can_be_merged?.should be_true }
+
+ it { Gitlab::Satellite::MergeAction.new(
+ merge_request_with_conflict.author,
+ merge_request_with_conflict).can_be_merged?.should be_false }
end
end
end
diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb
new file mode 100644
index 00000000000..eb47bee8336
--- /dev/null
+++ b/spec/lib/gitlab/url_builder_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe Gitlab::UrlBuilder do
+ describe 'When asking for an issue' do
+ it 'returns the issue url' do
+ issue = create(:issue)
+ url = Gitlab::UrlBuilder.new(:issue).build(issue.id)
+ expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.to_param}/issues/#{issue.iid}"
+ end
+ end
+end
diff --git a/spec/lib/oauth_spec.rb b/spec/lib/oauth_spec.rb
deleted file mode 100644
index 2f15b5e0349..00000000000
--- a/spec/lib/oauth_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'spec_helper'
-
-describe Gitlab::OAuth::User do
- let(:gl_auth) { Gitlab::OAuth::User }
-
- before do
- Gitlab.config.stub(omniauth: {})
-
- @info = double(
- uid: '12djsak321',
- nickname: 'john',
- name: 'John',
- email: 'john@mail.com'
- )
- end
-
- describe :create do
- it "should create user from LDAP" do
- @auth = double(info: @info, provider: 'ldap')
- user = gl_auth.create(@auth)
-
- user.should be_valid
- user.extern_uid.should == @info.uid
- user.provider.should == 'ldap'
- end
-
- it "should create user from Omniauth" do
- @auth = double(info: @info, provider: 'twitter')
- user = gl_auth.create(@auth)
-
- user.should be_valid
- user.extern_uid.should == @info.uid
- user.provider.should == 'twitter'
- end
-
- it "should apply defaults to user" do
- @auth = double(info: @info, provider: 'ldap')
- user = gl_auth.create(@auth)
-
- user.should be_valid
- user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
- user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
- end
- end
-end
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 224b613b477..702431e0712 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -3,6 +3,7 @@ require 'spec_helper'
describe Notify do
include EmailSpec::Helpers
include EmailSpec::Matchers
+ include RepoHelpers
let(:gitlab_sender) { Gitlab.config.gitlab.email_from }
let(:recipient) { create(:user, email: 'recipient@example.com') }
@@ -22,11 +23,28 @@ describe Notify do
end
end
+ shared_examples 'an email starting a new thread' do |message_id_prefix|
+ it 'has a discussion identifier' do
+ should have_header 'Message-ID', /<#{message_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
+ end
+ end
+
+ shared_examples 'an answer to an existing thread' do |thread_id_prefix|
+ it 'has a subject that begins with Re: ' do
+ should have_subject /^Re: /
+ end
+
+ it 'has headers that reference an existing thread' do
+ should have_header 'References', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
+ should have_header 'In-Reply-To', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
+ end
+ end
+
describe 'for new users, the email' do
let(:example_site_path) { root_path }
let(:new_user) { create(:user, email: 'newguy@example.com', created_by_id: 1) }
- subject { Notify.new_user_email(new_user.id, new_user.password) }
+ subject { Notify.new_user_email(new_user.id, new_user.password, 'kETLwRaayvigPq_x3SNM') }
it_behaves_like 'an email sent from GitLab'
@@ -42,8 +60,12 @@ describe Notify do
should have_body_text /#{new_user.email}/
end
- it 'contains the new user\'s password' do
- should have_body_text /password/
+ it 'contains the password text' do
+ should have_body_text /Click here to set your password/
+ end
+
+ it 'includes a link for user to set password' do
+ should have_body_text 'http://localhost/users/password/edit?reset_password_token=kETLwRaayvigPq_x3SNM'
end
it 'includes a link to the site' do
@@ -153,6 +175,7 @@ describe Notify do
subject { Notify.new_issue_email(issue.assignee_id, issue.id) }
it_behaves_like 'an assignee email'
+ it_behaves_like 'an email starting a new thread', 'issue'
it 'has the correct subject' do
should have_subject /#{project.name} \| #{issue.title} \(##{issue.iid}\)/
@@ -161,10 +184,6 @@ describe Notify do
it 'contains a link to the new issue' do
should have_body_text /#{project_issue_path project, issue}/
end
-
- it 'has the correct message-id set' do
- should have_header 'Message-ID', "<issue_#{issue.id}@#{Gitlab.config.gitlab.host}>"
- end
end
describe 'that are new with a description' do
@@ -179,6 +198,7 @@ describe Notify do
subject { Notify.reassigned_issue_email(recipient.id, issue.id, previous_assignee.id, current_user) }
it_behaves_like 'a multiple recipients email'
+ it_behaves_like 'an answer to an existing thread', 'issue'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
@@ -201,16 +221,14 @@ describe Notify do
it 'contains a link to the issue' do
should have_body_text /#{project_issue_path project, issue}/
end
-
- it 'has the correct reference set' do
- should have_header 'References', "<issue_#{issue.id}@#{Gitlab.config.gitlab.host}>"
- end
end
describe 'status changed' do
let(:status) { 'closed' }
subject { Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user) }
+ it_behaves_like 'an answer to an existing thread', 'issue'
+
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
sender.display_name.should eq(current_user.name)
@@ -232,10 +250,6 @@ describe Notify do
it 'contains a link to the issue' do
should have_body_text /#{project_issue_path project, issue}/
end
-
- it 'has the correct reference set' do
- should have_header 'References', "<issue_#{issue.id}@#{Gitlab.config.gitlab.host}>"
- end
end
end
@@ -249,6 +263,7 @@ describe Notify do
subject { Notify.new_merge_request_email(merge_request.assignee_id, merge_request.id) }
it_behaves_like 'an assignee email'
+ it_behaves_like 'an email starting a new thread', 'merge_request'
it 'has the correct subject' do
should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/
@@ -283,6 +298,7 @@ describe Notify do
subject { Notify.reassigned_merge_request_email(recipient.id, merge_request.id, previous_assignee.id, current_user.id) }
it_behaves_like 'a multiple recipients email'
+ it_behaves_like 'an answer to an existing thread', 'merge_request'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
@@ -307,10 +323,40 @@ describe Notify do
end
end
+ describe 'status changed' do
+ let(:status) { 'reopened' }
+ subject { Notify.merge_request_status_email(recipient.id, merge_request.id, status, current_user) }
+
+ it_behaves_like 'an answer to an existing thread', 'merge_request'
+
+ it 'is sent as the author' do
+ sender = subject.header[:from].addrs[0]
+ sender.display_name.should eq(current_user.name)
+ sender.address.should eq(gitlab_sender)
+ end
+
+ it 'has the correct subject' do
+ should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/i
+ end
+
+ it 'contains the new status' do
+ should have_body_text /#{status}/i
+ end
+
+ it 'contains the user name' do
+ should have_body_text /#{current_user.name}/i
+ end
+
+ it 'contains a link to the merge request' do
+ should have_body_text /#{project_merge_request_path project, merge_request}/
+ end
+ end
+
describe 'that are merged' do
subject { Notify.merged_merge_request_email(recipient.id, merge_request.id, merge_author.id) }
it_behaves_like 'a multiple recipients email'
+ it_behaves_like 'an answer to an existing thread', 'merge_request'
it 'is sent as the merge author' do
sender = subject.header[:from].addrs[0]
@@ -329,10 +375,6 @@ describe Notify do
it 'contains a link to the merge request' do
should have_body_text /#{project_merge_request_path project, merge_request}/
end
-
- it 'has the correct reference set' do
- should have_header 'References', "<merge_request_#{merge_request.id}@#{Gitlab.config.gitlab.host}>"
- end
end
end
end
@@ -410,6 +452,7 @@ describe Notify do
subject { Notify.note_commit_email(recipient.id, note.id) }
it_behaves_like 'a note email'
+ it_behaves_like 'an answer to an existing thread', 'commits'
it 'has the correct subject' do
should have_subject /#{commit.title} \(#{commit.short_id}\)/
@@ -428,6 +471,7 @@ describe Notify do
subject { Notify.note_merge_request_email(recipient.id, note.id) }
it_behaves_like 'a note email'
+ it_behaves_like 'an answer to an existing thread', 'merge_request'
it 'has the correct subject' do
should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/
@@ -446,6 +490,7 @@ describe Notify do
subject { Notify.note_issue_email(recipient.id, note.id) }
it_behaves_like 'a note email'
+ it_behaves_like 'an answer to an existing thread', 'issue'
it 'has the correct subject' do
should have_subject /#{issue.title} \(##{issue.iid}\)/
@@ -509,7 +554,7 @@ describe Notify do
describe 'email on push with multiple commits' do
let(:example_site_path) { root_path }
let(:user) { create(:user) }
- let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, 'cd5c4bac', 'b1e6a9db') }
+ let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, sample_image_commit.id, sample_commit.id) }
let(:commits) { Commit.decorate(compare.commits) }
let(:diff_path) { project_compare_path(project, from: commits.first, to: commits.last) }
@@ -530,11 +575,11 @@ describe Notify do
end
it 'includes commits list' do
- should have_body_text /tree css fixes/
+ should have_body_text /Change some files/
end
it 'includes diffs' do
- should have_body_text /Checkout wiki pages for installation information/
+ should have_body_text /def archive_formats_regex/
end
it 'contains a link to the diff' do
@@ -545,7 +590,7 @@ describe Notify do
describe 'email on push with a single commit' do
let(:example_site_path) { root_path }
let(:user) { create(:user) }
- let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, '8716fc78', 'b1e6a9db') }
+ let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, sample_commit.parent_id, sample_commit.id) }
let(:commits) { Commit.decorate(compare.commits) }
let(:diff_path) { project_commit_path(project, commits.first) }
@@ -566,11 +611,11 @@ describe Notify do
end
it 'includes commits list' do
- should have_body_text /tree css fixes/
+ should have_body_text /Change some files/
end
it 'includes diffs' do
- should have_body_text /Checkout wiki pages for installation information/
+ should have_body_text /def archive_formats_regex/
end
it 'contains a link to the diff' do
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index d8ab171d3ee..1673184cbe4 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -11,7 +11,7 @@ describe Commit do
end
it "truncates a message without a newline at 80 characters" do
- message = commit.safe_message * 10
+ message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.'
commit.stub(:safe_message).and_return(message)
commit.title.should == "#{message[0..79]}&hellip;"
@@ -24,11 +24,14 @@ describe Commit do
commit.title.should == message
end
- it "truncates a message with a newline after 80 characters at 70 characters" do
- message = (commit.safe_message * 10) + "\n"
+ it "does not truncates a message with a newline after 80 but less 100 characters" do
+ message =<<eos
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit.
+Vivamus egestas lacinia lacus, sed rutrum mauris.
+eos
commit.stub(:safe_message).and_return(message)
- commit.title.should == "#{message[0..79]}&hellip;"
+ commit.title.should == message.split("\n").first
end
end
diff --git a/spec/models/gitlab_ci_service_spec.rb b/spec/models/gitlab_ci_service_spec.rb
index a0708f14236..439a30869bb 100644
--- a/spec/models/gitlab_ci_service_spec.rb
+++ b/spec/models/gitlab_ci_service_spec.rb
@@ -26,7 +26,6 @@ describe GitlabCiService do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe 'commits methods' do
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index d53c4037c35..8b299cea67c 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -25,8 +25,6 @@ describe Issue do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:author_id) }
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe 'modules' do
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb
index 474067fe38a..95c0aed0ffe 100644
--- a/spec/models/key_spec.rb
+++ b/spec/models/key_spec.rb
@@ -20,8 +20,6 @@ describe Key do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
- it { should_not allow_mass_assignment_of(:user_id) }
end
describe "Validation" do
diff --git a/spec/models/label_link_spec.rb b/spec/models/label_link_spec.rb
new file mode 100644
index 00000000000..0db60432ad3
--- /dev/null
+++ b/spec/models/label_link_spec.rb
@@ -0,0 +1,21 @@
+# == Schema Information
+#
+# Table name: label_links
+#
+# id :integer not null, primary key
+# label_id :integer
+# target_id :integer
+# target_type :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
+require 'spec_helper'
+
+describe LabelLink do
+ let(:label) { create(:label_link) }
+ it { label.should be_valid }
+
+ it { should belong_to(:label) }
+ it { should belong_to(:target) }
+end
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb
new file mode 100644
index 00000000000..31634648f04
--- /dev/null
+++ b/spec/models/label_spec.rb
@@ -0,0 +1,43 @@
+# == Schema Information
+#
+# Table name: labels
+#
+# id :integer not null, primary key
+# title :string(255)
+# color :string(255)
+# project_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
+require 'spec_helper'
+
+describe Label do
+ let(:label) { create(:label) }
+ it { label.should be_valid }
+
+ it { should belong_to(:project) }
+
+ describe 'Validation' do
+ it 'should validate color code' do
+ build(:label, color: 'G-ITLAB').should_not be_valid
+ build(:label, color: 'AABBCC').should_not be_valid
+ build(:label, color: '#AABBCCEE').should_not be_valid
+ build(:label, color: '#GGHHII').should_not be_valid
+ build(:label, color: '#').should_not be_valid
+ build(:label, color: '').should_not be_valid
+
+ build(:label, color: '#AABBCC').should be_valid
+ end
+
+ it 'should validate title' do
+ build(:label, title: 'G,ITLAB').should_not be_valid
+ build(:label, title: 'G?ITLAB').should_not be_valid
+ build(:label, title: 'G&ITLAB').should_not be_valid
+ build(:label, title: '').should_not be_valid
+
+ build(:label, title: 'GITLAB').should be_valid
+ build(:label, title: 'gitlab').should be_valid
+ end
+ end
+end
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 1148df87ab7..c40f75290ed 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -17,6 +17,7 @@
# target_project_id :integer not null
# iid :integer
# description :text
+# position :integer default(0)
#
require 'spec_helper'
@@ -28,8 +29,6 @@ describe MergeRequest do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:author_id) }
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe "Respond to" do
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb
index 8309ad3a724..a3071c3251a 100644
--- a/spec/models/milestone_spec.rb
+++ b/spec/models/milestone_spec.rb
@@ -22,7 +22,6 @@ describe Milestone do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe "Validation" do
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index d2bf96979f9..3562ebed1ff 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -26,8 +26,6 @@ describe Namespace do
it { should validate_presence_of :owner }
describe "Mass assignment" do
- it { should allow_mass_assignment_of(:name) }
- it { should allow_mass_assignment_of(:path) }
end
describe "Respond to" do
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 43779e6bbfc..d06dee6ce92 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -27,8 +27,6 @@ describe Note do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:author) }
- it { should_not allow_mass_assignment_of(:author_id) }
end
describe "Validation" do
diff --git a/spec/models/project_snippet_spec.rb b/spec/models/project_snippet_spec.rb
index 42147179387..e4df934460b 100644
--- a/spec/models/project_snippet_spec.rb
+++ b/spec/models/project_snippet_spec.rb
@@ -23,7 +23,6 @@ describe ProjectSnippet do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe "Validation" do
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 93eae5a9ebd..1c11ac39567 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -22,6 +22,8 @@
# visibility_level :integer default(0), not null
# archived :boolean default(FALSE), not null
# import_status :string(255)
+# repository_size :float default(0.0)
+# star_count :integer default(0), not null
#
require 'spec_helper'
@@ -48,8 +50,6 @@ describe Project do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:namespace_id) }
- it { should_not allow_mass_assignment_of(:creator_id) }
end
describe "Validation" do
@@ -126,24 +126,21 @@ describe Project do
describe :update_merge_requests do
let(:project) { create(:project) }
-
- before do
- @merge_request = create(:merge_request, source_project: project, target_project: project)
- @key = create(:key, user_id: project.owner.id)
- end
+ let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
+ let(:key) { create(:key, user_id: project.owner.id) }
+ let(:prev_commit_id) { merge_request.commits.last.id }
+ let(:commit_id) { merge_request.commits.first.id }
it "should close merge request if last commit from source branch was pushed to target branch" do
- @merge_request.reload_code
- @merge_request.last_commit.id.should == "69b34b7e9ad9f496f0ad10250be37d6265a03bba"
- project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "69b34b7e9ad9f496f0ad10250be37d6265a03bba", "refs/heads/stable", @key.user)
- @merge_request.reload
- @merge_request.merged?.should be_true
+ project.update_merge_requests(prev_commit_id, commit_id, "refs/heads/#{merge_request.target_branch}", key.user)
+ merge_request.reload
+ merge_request.merged?.should be_true
end
it "should update merge request commits with new one if pushed to source branch" do
- project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "69b34b7e9ad9f496f0ad10250be37d6265a03bba", "refs/heads/master", @key.user)
- @merge_request.reload
- @merge_request.last_commit.id.should == "69b34b7e9ad9f496f0ad10250be37d6265a03bba"
+ project.update_merge_requests(prev_commit_id, commit_id, "refs/heads/#{merge_request.source_branch}", key.user)
+ merge_request.reload
+ merge_request.last_commit.id.should == commit_id
end
end
@@ -239,7 +236,76 @@ describe Project do
project.protected_branches.create(name: 'master')
end
- it { project.open_branches.map(&:name).should include('bootstrap') }
+ it { project.open_branches.map(&:name).should include('feature') }
it { project.open_branches.map(&:name).should_not include('master') }
end
+
+ describe '#star_count' do
+ it 'counts stars from multiple users' do
+ user1 = create :user
+ user2 = create :user
+ project = create :project, :public
+
+ expect(project.star_count).to eq(0)
+
+ user1.toggle_star(project)
+ expect(project.reload.star_count).to eq(1)
+
+ user2.toggle_star(project)
+ project.reload
+ expect(project.reload.star_count).to eq(2)
+
+ user1.toggle_star(project)
+ project.reload
+ expect(project.reload.star_count).to eq(1)
+
+ user2.toggle_star(project)
+ project.reload
+ expect(project.reload.star_count).to eq(0)
+ end
+
+ it 'counts stars on the right project' do
+ user = create :user
+ project1 = create :project, :public
+ project2 = create :project, :public
+
+ expect(project1.star_count).to eq(0)
+ expect(project2.star_count).to eq(0)
+
+ user.toggle_star(project1)
+ project1.reload
+ project2.reload
+ expect(project1.star_count).to eq(1)
+ expect(project2.star_count).to eq(0)
+
+ user.toggle_star(project1)
+ project1.reload
+ project2.reload
+ expect(project1.star_count).to eq(0)
+ expect(project2.star_count).to eq(0)
+
+ user.toggle_star(project2)
+ project1.reload
+ project2.reload
+ expect(project1.star_count).to eq(0)
+ expect(project2.star_count).to eq(1)
+
+ user.toggle_star(project2)
+ project1.reload
+ project2.reload
+ expect(project1.star_count).to eq(0)
+ expect(project2.star_count).to eq(0)
+ end
+
+ it 'is decremented when an upvoter account is deleted' do
+ user = create :user
+ project = create :project, :public
+ user.toggle_star(project)
+ project.reload
+ expect(project.star_count).to eq(1)
+ user.destroy
+ project.reload
+ expect(project.star_count).to eq(0)
+ end
+ end
end
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb
index 32a82470e4f..e4ee2fc5b13 100644
--- a/spec/models/project_wiki_spec.rb
+++ b/spec/models/project_wiki_spec.rb
@@ -1,33 +1,14 @@
require "spec_helper"
describe ProjectWiki do
-
- def remove_temp_repo(path)
- FileUtils.rm_rf path
- end
-
- def commit_details
- commit = {name: user.name, email: user.email, message: "test commit"}
- end
-
- def create_page(name, content)
- subject.wiki.write_page(name, :markdown, content, commit_details)
- end
-
- def destroy_page(page)
- subject.wiki.delete_page(page, commit_details)
- end
-
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:repository) { project.repository }
let(:user) { project.owner }
let(:gitlab_shell) { Gitlab::Shell.new }
+ let(:project_wiki) { ProjectWiki.new(project, user) }
- subject { ProjectWiki.new(project, user) }
-
- before do
- create_temp_repo(subject.send(:path_to_repo))
- end
+ subject { project_wiki }
+ before { project_wiki.wiki }
describe "#path_with_namespace" do
it "returns the project path with namespace with the .wiki extension" do
@@ -60,23 +41,13 @@ describe ProjectWiki do
subject.wiki.should be_a Gollum::Wiki
end
- before do
- Gitlab::Shell.any_instance.stub(:add_repository) do
- create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git")
- end
- project.stub(:path_with_namespace).and_return("non-existant")
- end
-
it "creates a new wiki repo if one does not yet exist" do
- wiki = ProjectWiki.new(project, user)
- wiki.create_page("index", "test content").should_not == false
-
- FileUtils.rm_rf wiki.send(:path_to_repo)
+ project_wiki.create_page("index", "test content").should be_true
end
it "raises CouldNotCreateWikiError if it can't create the wiki repository" do
- ProjectWiki.any_instance.stub(:init_repo).and_return(false)
- expect { ProjectWiki.new(project, user).wiki }.to raise_exception(ProjectWiki::CouldNotCreateWikiError)
+ project_wiki.stub(:init_repo).and_return(false)
+ expect { project_wiki.send(:create_repo!) }.to raise_exception(ProjectWiki::CouldNotCreateWikiError)
end
end
@@ -149,6 +120,40 @@ describe ProjectWiki do
end
end
+ describe '#find_file' do
+ before do
+ file = Gollum::File.new(subject.wiki)
+ Gollum::Wiki.any_instance.
+ stub(:file).with('image.jpg', 'master', true).
+ and_return(file)
+ Gollum::File.any_instance.
+ stub(:mime_type).
+ and_return('image/jpeg')
+ Gollum::Wiki.any_instance.
+ stub(:file).with('non-existant', 'master', true).
+ and_return(nil)
+ end
+
+ after do
+ Gollum::Wiki.any_instance.unstub(:file)
+ Gollum::File.any_instance.unstub(:mime_type)
+ end
+
+ it 'returns the latest version of the file if it exists' do
+ file = subject.find_file('image.jpg')
+ file.mime_type.should == 'image/jpeg'
+ end
+
+ it 'returns nil if the page does not exist' do
+ subject.find_file('non-existant').should == nil
+ end
+
+ it 'returns a Gollum::File instance' do
+ file = subject.find_file('image.jpg')
+ file.should be_a Gollum::File
+ end
+ end
+
describe "#create_page" do
after do
destroy_page(subject.pages.first.page)
@@ -208,4 +213,26 @@ describe ProjectWiki do
end
end
+ private
+
+ def create_temp_repo(path)
+ FileUtils.mkdir_p path
+ system(*%W(git init --quiet --bare -- #{path}))
+ end
+
+ def remove_temp_repo(path)
+ FileUtils.rm_rf path
+ end
+
+ def commit_details
+ commit = {name: user.name, email: user.email, message: "test commit"}
+ end
+
+ def create_page(name, content)
+ subject.wiki.write_page(name, :markdown, content, commit_details)
+ end
+
+ def destroy_page(page)
+ subject.wiki.delete_page(page, commit_details)
+ end
end
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb
index 35b929c2f3e..af48c2c6d9e 100644
--- a/spec/models/protected_branch_spec.rb
+++ b/spec/models/protected_branch_spec.rb
@@ -17,7 +17,6 @@ describe ProtectedBranch do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe 'Validation' do
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index a4bed81c0f6..adeeac115c1 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -27,7 +27,6 @@ describe Service do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe "Test Button" do
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb
index a77c594aaf1..d179e9516e2 100644
--- a/spec/models/snippet_spec.rb
+++ b/spec/models/snippet_spec.rb
@@ -24,7 +24,6 @@ describe Snippet do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:author_id) }
end
describe "Validation" do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 0a665b7defb..7221328a45f 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -65,8 +65,6 @@ describe User do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:projects_limit) }
- it { should allow_mass_assignment_of(:projects_limit).as(:admin) }
end
describe 'validations' do
@@ -243,59 +241,23 @@ describe User do
it { user.first_name.should == 'John' }
end
- describe 'without defaults' do
+ describe 'with defaults' do
let(:user) { User.new }
- it "should not apply defaults to user" do
- user.projects_limit.should == 10
- user.can_create_group.should be_true
- user.theme_id.should == Gitlab::Theme::BASIC
+ it "should apply defaults to user" do
+ user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
+ user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
+ user.theme_id.should == Gitlab.config.gitlab.default_theme
end
end
- context 'as admin' do
- describe 'with defaults' do
- let(:user) { User.build_user({}, as: :admin) }
-
- it "should apply defaults to user" do
- user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
- user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
- user.theme_id.should == Gitlab.config.gitlab.default_theme
- end
- end
- describe 'with default overrides' do
- let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::BASIC}, as: :admin) }
-
- it "should apply defaults to user" do
- Gitlab.config.gitlab.default_projects_limit.should_not == 123
- Gitlab.config.gitlab.default_can_create_group.should_not be_true
- Gitlab.config.gitlab.default_theme.should_not == Gitlab::Theme::BASIC
- user.projects_limit.should == 123
- user.can_create_group.should be_true
- user.theme_id.should == Gitlab::Theme::BASIC
- end
- end
- end
-
- context 'as user' do
- describe 'with defaults' do
- let(:user) { User.build_user }
-
- it "should apply defaults to user" do
- user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
- user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
- user.theme_id.should == Gitlab.config.gitlab.default_theme
- end
- end
+ describe 'with default overrides' do
+ let(:user) { User.new(projects_limit: 123, can_create_group: false, can_create_team: true, theme_id: Gitlab::Theme::BASIC) }
- describe 'with default overrides' do
- let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) }
-
- it "should apply defaults to user" do
- user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
- user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
- user.theme_id.should == Gitlab.config.gitlab.default_theme
- end
+ it "should apply defaults to user" do
+ user.projects_limit.should == 123
+ user.can_create_group.should be_false
+ user.theme_id.should == Gitlab::Theme::BASIC
end
end
end
@@ -350,6 +312,40 @@ describe User do
end
end
+ describe :requires_ldap_check? do
+ let(:user) { User.new }
+
+ it 'is false when LDAP is disabled' do
+ # Create a condition which would otherwise cause 'true' to be returned
+ user.stub(ldap_user?: true)
+ user.last_credential_check_at = nil
+ expect(user.requires_ldap_check?).to be_false
+ end
+
+ context 'when LDAP is enabled' do
+ before { Gitlab.config.ldap.stub(enabled: true) }
+
+ it 'is false for non-LDAP users' do
+ user.stub(ldap_user?: false)
+ expect(user.requires_ldap_check?).to be_false
+ end
+
+ context 'and when the user is an LDAP user' do
+ before { user.stub(ldap_user?: true) }
+
+ it 'is true when the user has never had an LDAP check before' do
+ user.last_credential_check_at = nil
+ expect(user.requires_ldap_check?).to be_true
+ end
+
+ it 'is true when the last LDAP check happened over 1 hour ago' do
+ user.last_credential_check_at = 2.hours.ago
+ expect(user.requires_ldap_check?).to be_true
+ end
+ end
+ end
+ end
+
describe '#full_website_url' do
let(:user) { create(:user) }
@@ -393,4 +389,44 @@ describe User do
expect(user.short_website_url).to eq 'test.com'
end
end
+
+ describe "#starred?" do
+ it "determines if user starred a project" do
+ user = create :user
+ project1 = create :project, :public
+ project2 = create :project, :public
+
+ expect(user.starred?(project1)).to be_false
+ expect(user.starred?(project2)).to be_false
+
+ star1 = UsersStarProject.create!(project: project1, user: user)
+ expect(user.starred?(project1)).to be_true
+ expect(user.starred?(project2)).to be_false
+
+ star2 = UsersStarProject.create!(project: project2, user: user)
+ expect(user.starred?(project1)).to be_true
+ expect(user.starred?(project2)).to be_true
+
+ star1.destroy
+ expect(user.starred?(project1)).to be_false
+ expect(user.starred?(project2)).to be_true
+
+ star2.destroy
+ expect(user.starred?(project1)).to be_false
+ expect(user.starred?(project2)).to be_false
+ end
+ end
+
+ describe "#toggle_star" do
+ it "toggles stars" do
+ user = create :user
+ project = create :project, :public
+
+ expect(user.starred?(project)).to be_false
+ user.toggle_star(project)
+ expect(user.starred?(project)).to be_true
+ user.toggle_star(project)
+ expect(user.starred?(project)).to be_false
+ end
+ end
end
diff --git a/spec/models/users_group_spec.rb b/spec/models/users_group_spec.rb
index 05dd97d92d4..0b6f7a08198 100644
--- a/spec/models/users_group_spec.rb
+++ b/spec/models/users_group_spec.rb
@@ -20,7 +20,6 @@ describe UsersGroup do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:group_id) }
end
describe "Validation" do
diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb
index aa4b8cb449b..3f38164e964 100644
--- a/spec/models/users_project_spec.rb
+++ b/spec/models/users_project_spec.rb
@@ -20,7 +20,6 @@ describe UsersProject do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe "Validation" do
diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rb
index 20ee1416125..e9c04ee89cb 100644
--- a/spec/models/web_hook_spec.rb
+++ b/spec/models/web_hook_spec.rb
@@ -23,7 +23,6 @@ describe ProjectHook do
end
describe "Mass assignment" do
- it { should_not allow_mass_assignment_of(:project_id) }
end
describe "Validations" do
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 005c513af3c..cb42822b9bb 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -1,35 +1,12 @@
require "spec_helper"
describe WikiPage do
-
- def remove_temp_repo(path)
- FileUtils.rm_rf path
- end
-
- def commit_details
- commit = {name: user.name, email: user.email, message: "test commit"}
- end
-
- def create_page(name, content)
- wiki.wiki.write_page(name, :markdown, content, commit_details)
- end
-
- def destroy_page(title)
- page = wiki.wiki.paged(title)
- wiki.wiki.delete_page(page, commit_details)
- end
-
- let(:project) { create(:project) }
- let(:repository) { project.repository }
+ let(:project) { create(:empty_project) }
let(:user) { project.owner }
let(:wiki) { ProjectWiki.new(project, user) }
subject { WikiPage.new(wiki) }
- before do
- create_temp_repo(wiki.send(:path_to_repo))
- end
-
describe "#initialize" do
context "when initialized with an existing gollum page" do
before do
@@ -171,4 +148,22 @@ describe WikiPage do
end
end
+ private
+
+ def remove_temp_repo(path)
+ FileUtils.rm_rf path
+ end
+
+ def commit_details
+ commit = {name: user.name, email: user.email, message: "test commit"}
+ end
+
+ def create_page(name, content)
+ wiki.wiki.write_page(name, :markdown, content, commit_details)
+ end
+
+ def destroy_page(title)
+ page = wiki.wiki.paged(title)
+ wiki.wiki.delete_page(page, commit_details)
+ end
end
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb
index b145e620122..e7f91c5e46e 100644
--- a/spec/requests/api/branches_spec.rb
+++ b/spec/requests/api/branches_spec.rb
@@ -9,6 +9,8 @@ describe API::API, api: true do
let!(:project) { create(:project, creator_id: user.id) }
let!(:master) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) }
let!(:guest) { create(:users_project, user: user2, project: project, project_access: UsersProject::GUEST) }
+ let!(:branch_name) { 'feature' }
+ let!(:branch_sha) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
describe "GET /projects/:id/repository/branches" do
it "should return an array of project branches" do
@@ -21,11 +23,11 @@ describe API::API, api: true do
describe "GET /projects/:id/repository/branches/:branch" do
it "should return the branch information for a single branch" do
- get api("/projects/#{project.id}/repository/branches/new_design", user)
+ get api("/projects/#{project.id}/repository/branches/#{branch_name}", user)
response.status.should == 200
- json_response['name'].should == 'new_design'
- json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['name'].should == branch_name
+ json_response['commit']['id'].should == branch_sha
json_response['protected'].should == false
end
@@ -42,11 +44,11 @@ describe API::API, api: true do
describe "PUT /projects/:id/repository/branches/:branch/protect" do
it "should protect a single branch" do
- put api("/projects/#{project.id}/repository/branches/new_design/protect", user)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/protect", user)
response.status.should == 200
- json_response['name'].should == 'new_design'
- json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['name'].should == branch_name
+ json_response['commit']['id'].should == branch_sha
json_response['protected'].should == true
end
@@ -56,24 +58,24 @@ describe API::API, api: true do
end
it "should return a 403 error if guest" do
- put api("/projects/#{project.id}/repository/branches/new_design/protect", user2)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/protect", user2)
response.status.should == 403
end
it "should return success when protect branch again" do
- put api("/projects/#{project.id}/repository/branches/new_design/protect", user)
- put api("/projects/#{project.id}/repository/branches/new_design/protect", user)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/protect", user)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/protect", user)
response.status.should == 200
end
end
describe "PUT /projects/:id/repository/branches/:branch/unprotect" do
it "should unprotect a single branch" do
- put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/unprotect", user)
response.status.should == 200
- json_response['name'].should == 'new_design'
- json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['name'].should == branch_name
+ json_response['commit']['id'].should == branch_sha
json_response['protected'].should == false
end
@@ -83,8 +85,8 @@ describe API::API, api: true do
end
it "should return success when unprotect branch again" do
- put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user)
- put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/unprotect", user)
+ put api("/projects/#{project.id}/repository/branches/#{branch_name}/unprotect", user)
response.status.should == 200
end
end
@@ -92,35 +94,68 @@ describe API::API, api: true do
describe "POST /projects/:id/repository/branches" do
it "should create a new branch" do
post api("/projects/#{project.id}/repository/branches", user),
- branch_name: 'new_design',
- ref: '621491c677087aa243f165eab467bfdfbee00be1'
+ branch_name: 'feature1',
+ ref: branch_sha
response.status.should == 201
- json_response['name'].should == 'new_design'
- json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['name'].should == 'feature1'
+ json_response['commit']['id'].should == branch_sha
end
it "should deny for user without push access" do
post api("/projects/#{project.id}/repository/branches", user2),
- branch_name: 'new_design',
- ref: '621491c677087aa243f165eab467bfdfbee00be1'
-
+ branch_name: branch_name,
+ ref: branch_sha
response.status.should == 403
end
+
+ it 'should return 400 if branch name is invalid' do
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new design',
+ ref: branch_sha
+ response.status.should == 400
+ json_response['message'].should == 'Branch name invalid'
+ end
+
+ it 'should return 400 if branch already exists' do
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new_design1',
+ ref: branch_sha
+ response.status.should == 201
+
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new_design1',
+ ref: branch_sha
+ response.status.should == 400
+ json_response['message'].should == 'Branch already exists'
+ end
+
+ it 'should return 400 if ref name is invalid' do
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new_design3',
+ ref: 'foo'
+ response.status.should == 400
+ json_response['message'].should == 'Invalid reference name'
+ end
end
describe "DELETE /projects/:id/repository/branches/:branch" do
before { Repository.any_instance.stub(rm_branch: true) }
it "should remove branch" do
- delete api("/projects/#{project.id}/repository/branches/new_design", user)
+ delete api("/projects/#{project.id}/repository/branches/#{branch_name}", user)
response.status.should == 200
end
+ it 'should return 404 if branch not exists' do
+ delete api("/projects/#{project.id}/repository/branches/foobar", user)
+ response.status.should == 404
+ end
+
it "should remove protected branch" do
- project.protected_branches.create(name: 'new_design')
- delete api("/projects/#{project.id}/repository/branches/new_design", user)
+ project.protected_branches.create(name: branch_name)
+ delete api("/projects/#{project.id}/repository/branches/#{branch_name}", user)
response.status.should == 405
json_response['message'].should == 'Protected branch cant be removed'
end
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb
index e84122f2fbc..b43a202aec0 100644
--- a/spec/requests/api/files_spec.rb
+++ b/spec/requests/api/files_spec.rb
@@ -4,20 +4,22 @@ describe API::API, api: true do
include ApiHelpers
let(:user) { create(:user) }
let!(:project) { create(:project, namespace: user.namespace ) }
+ let(:file_path) { 'files/ruby/popen.rb' }
+
before { project.team << [user, :developer] }
describe "GET /projects/:id/repository/files" do
it "should return file info" do
params = {
- file_path: 'app/models/key.rb',
+ file_path: file_path,
ref: 'master',
}
get api("/projects/#{project.id}/repository/files", user), params
response.status.should == 200
- json_response['file_path'].should == 'app/models/key.rb'
- json_response['file_name'].should == 'key.rb'
- Base64.decode64(json_response['content']).lines.first.should == "class Key < ActiveRecord::Base\n"
+ json_response['file_path'].should == file_path
+ json_response['file_name'].should == 'popen.rb'
+ Base64.decode64(json_response['content']).lines.first.should == "require 'fileutils'\n"
end
it "should return a 400 bad request if no params given" do
@@ -74,7 +76,7 @@ describe API::API, api: true do
describe "PUT /projects/:id/repository/files" do
let(:valid_params) {
{
- file_path: 'spec/spec_helper.rb',
+ file_path: file_path,
branch_name: 'master',
content: 'puts 8',
commit_message: 'Changed file'
@@ -88,7 +90,7 @@ describe API::API, api: true do
put api("/projects/#{project.id}/repository/files", user), valid_params
response.status.should == 200
- json_response['file_path'].should == 'spec/spec_helper.rb'
+ json_response['file_path'].should == file_path
end
it "should return a 400 bad request if no params given" do
@@ -109,7 +111,7 @@ describe API::API, api: true do
describe "DELETE /projects/:id/repository/files" do
let(:valid_params) {
{
- file_path: 'spec/spec_helper.rb',
+ file_path: file_path,
branch_name: 'master',
commit_message: 'Changed file'
}
@@ -122,7 +124,7 @@ describe API::API, api: true do
delete api("/projects/#{project.id}/repository/files", user), valid_params
response.status.should == 200
- json_response['file_path'].should == 'spec/spec_helper.rb'
+ json_response['file_path'].should == file_path
end
it "should return a 400 bad request if no params given" do
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index dbe8043c633..6df5ef38961 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -155,9 +155,8 @@ describe API::API, api: true do
end
def pull(key, project)
- get(
+ post(
api("/internal/allowed"),
- ref: 'master',
key_id: key.id,
project: project.path_with_namespace,
action: 'git-upload-pack'
@@ -165,9 +164,9 @@ describe API::API, api: true do
end
def push(key, project)
- get(
+ post(
api("/internal/allowed"),
- ref: 'master',
+ changes: 'd14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master',
key_id: key.id,
project: project.path_with_namespace,
action: 'git-receive-pack'
@@ -175,7 +174,7 @@ describe API::API, api: true do
end
def archive(key, project)
- get(
+ post(
api("/internal/allowed"),
ref: 'master',
key_id: key.id,
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index dff7f20cb32..e8eebda95b4 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -4,7 +4,13 @@ describe API::API, api: true do
include ApiHelpers
let(:user) { create(:user) }
let!(:project) { create(:project, namespace: user.namespace ) }
+ let!(:closed_issue) { create(:closed_issue, author: user, assignee: user, project: project, state: :closed) }
let!(:issue) { create(:issue, author: user, assignee: user, project: project) }
+ let!(:label) do
+ create(:label, title: 'label', color: '#FFAABB', project: project)
+ end
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+
before { project.team << [user, :reporter] }
describe "GET /issues" do
@@ -28,6 +34,70 @@ describe API::API, api: true do
response.headers['Link'].should ==
'<http://www.example.com/api/v3/issues?page=1&per_page=3>; rel="first", <http://www.example.com/api/v3/issues?page=1&per_page=3>; rel="last"'
end
+
+ it 'should return an array of closed issues' do
+ get api('/issues?state=closed', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['id'].should == closed_issue.id
+ end
+
+ it 'should return an array of opened issues' do
+ get api('/issues?state=opened', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['id'].should == issue.id
+ end
+
+ it 'should return an array of all issues' do
+ get api('/issues?state=all', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 2
+ json_response.first['id'].should == issue.id
+ json_response.second['id'].should == closed_issue.id
+ end
+
+ it 'should return an array of labeled issues' do
+ get api("/issues?labels=#{label.title}", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an array of labeled issues when at least one label matches' do
+ get api("/issues?labels=#{label.title},foo,bar", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an empty array if no issue matches labels' do
+ get api('/issues?labels=foo,bar', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 0
+ end
+
+ it 'should return an array of labeled issues matching given state' do
+ get api("/issues?labels=#{label.title}&state=opened", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ json_response.first['state'].should == 'opened'
+ end
+
+ it 'should return an empty array if no issue matches labels and state filters' do
+ get api("/issues?labels=#{label.title}&state=closed", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 0
+ end
end
end
@@ -38,6 +108,29 @@ describe API::API, api: true do
json_response.should be_an Array
json_response.first['title'].should == issue.title
end
+
+ it 'should return an array of labeled project issues' do
+ get api("/projects/#{project.id}/issues?labels=#{label.title}", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an array of labeled project issues when at least one label matches' do
+ get api("/projects/#{project.id}/issues?labels=#{label.title},foo,bar", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an empty array if no project issue matches labels' do
+ get api("/projects/#{project.id}/issues?labels=foo,bar", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 0
+ end
end
describe "GET /projects/:id/issues/:issue_id" do
@@ -68,6 +161,14 @@ describe API::API, api: true do
post api("/projects/#{project.id}/issues", user), labels: 'label, label2'
response.status.should == 400
end
+
+ it 'should return 400 on invalid label names' do
+ post api("/projects/#{project.id}/issues", user),
+ title: 'new issue',
+ labels: 'label, ?'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
+ end
end
describe "PUT /projects/:id/issues/:issue_id to update only title" do
@@ -84,6 +185,58 @@ describe API::API, api: true do
title: 'updated title'
response.status.should == 404
end
+
+ it 'should return 400 on invalid label names' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ title: 'updated title',
+ labels: 'label, ?'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_id to update labels' do
+ let!(:label) { create(:label, title: 'dummy', project: project) }
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+
+ it 'should not update labels if not present' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ title: 'updated title'
+ response.status.should == 200
+ json_response['labels'].should == [label.title]
+ end
+
+ it 'should remove all labels' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: ''
+ response.status.should == 200
+ json_response['labels'].should == []
+ end
+
+ it 'should update labels' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'foo,bar'
+ response.status.should == 200
+ json_response['labels'].should include 'foo'
+ json_response['labels'].should include 'bar'
+ end
+
+ it 'should return 400 on invalid label names' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'label, ?'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
+ end
+
+ it 'should allow special label names' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'label:foo, label-bar,label_bar,label/bar'
+ response.status.should == 200
+ json_response['labels'].should include 'label:foo'
+ json_response['labels'].should include 'label-bar'
+ json_response['labels'].should include 'label_bar'
+ json_response['labels'].should include 'label/bar'
+ end
end
describe "PUT /projects/:id/issues/:issue_id to update state and label" do
@@ -92,7 +245,7 @@ describe API::API, api: true do
labels: 'label2', state_event: "close"
response.status.should == 200
- json_response['labels'].should == ['label2']
+ json_response['labels'].should include 'label2'
json_response['state'].should eq "closed"
end
end
diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb
new file mode 100644
index 00000000000..ee9088933a1
--- /dev/null
+++ b/spec/requests/api/labels_spec.rb
@@ -0,0 +1,167 @@
+require 'spec_helper'
+
+describe API::API, api: true do
+ include ApiHelpers
+
+ let(:user) { create(:user) }
+ let(:project) { create(:project, creator_id: user.id, namespace: user.namespace) }
+ let!(:label1) { create(:label, title: 'label1', project: project) }
+
+ before do
+ project.team << [user, :master]
+ end
+
+
+ describe 'GET /projects/:id/labels' do
+ it 'should return project labels' do
+ get api("/projects/#{project.id}/labels", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.size.should == 1
+ json_response.first['name'].should == label1.name
+ end
+ end
+
+ describe 'POST /projects/:id/labels' do
+ it 'should return created label' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'Foo',
+ color: '#FFAABB'
+ response.status.should == 201
+ json_response['name'].should == 'Foo'
+ json_response['color'].should == '#FFAABB'
+ end
+
+ it 'should return a 400 bad request if name not given' do
+ post api("/projects/#{project.id}/labels", user), color: '#FFAABB'
+ response.status.should == 400
+ end
+
+ it 'should return a 400 bad request if color not given' do
+ post api("/projects/#{project.id}/labels", user), name: 'Foobar'
+ response.status.should == 400
+ end
+
+ it 'should return 400 for invalid color' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'Foo',
+ color: '#FFAA'
+ response.status.should == 400
+ json_response['message'].should == 'Color is invalid'
+ end
+
+ it 'should return 400 for too long color code' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'Foo',
+ color: '#FFAAFFFF'
+ response.status.should == 400
+ json_response['message'].should == 'Color is invalid'
+ end
+
+ it 'should return 400 for invalid name' do
+ post api("/projects/#{project.id}/labels", user),
+ name: '?',
+ color: '#FFAABB'
+ response.status.should == 400
+ json_response['message'].should == 'Title is invalid'
+ end
+
+ it 'should return 409 if label already exists' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'label1',
+ color: '#FFAABB'
+ response.status.should == 409
+ json_response['message'].should == 'Label already exists'
+ end
+ end
+
+ describe 'DELETE /projects/:id/labels' do
+ it 'should return 200 for existing label' do
+ delete api("/projects/#{project.id}/labels", user), name: 'label1'
+ response.status.should == 200
+ end
+
+ it 'should return 404 for non existing label' do
+ delete api("/projects/#{project.id}/labels", user), name: 'label2'
+ response.status.should == 404
+ json_response['message'].should == 'Label not found'
+ end
+
+ it 'should return 400 for wrong parameters' do
+ delete api("/projects/#{project.id}/labels", user)
+ response.status.should == 400
+ end
+ end
+
+ describe 'PUT /projects/:id/labels' do
+ it 'should return 200 if name and colors are changed' do
+ put api("/projects/#{project.id}/labels", user),
+ name: 'label1',
+ new_name: 'New Label',
+ color: '#FFFFFF'
+ response.status.should == 200
+ json_response['name'].should == 'New Label'
+ json_response['color'].should == '#FFFFFF'
+ end
+
+ it 'should return 200 if name is changed' do
+ put api("/projects/#{project.id}/labels", user),
+ name: 'label1',
+ new_name: 'New Label'
+ response.status.should == 200
+ json_response['name'].should == 'New Label'
+ json_response['color'].should == label1.color
+ end
+
+ it 'should return 200 if colors is changed' do
+ put api("/projects/#{project.id}/labels", user),
+ name: 'label1',
+ color: '#FFFFFF'
+ response.status.should == 200
+ json_response['name'].should == label1.name
+ json_response['color'].should == '#FFFFFF'
+ end
+
+ it 'should return 404 if label does not exist' do
+ put api("/projects/#{project.id}/labels", user),
+ name: 'label2',
+ new_name: 'label3'
+ response.status.should == 404
+ end
+
+ it 'should return 400 if no label name given' do
+ put api("/projects/#{project.id}/labels", user), new_name: 'label2'
+ response.status.should == 400
+ end
+
+ it 'should return 400 if no new parameters given' do
+ put api("/projects/#{project.id}/labels", user), name: 'label1'
+ response.status.should == 400
+ end
+
+ it 'should return 400 for invalid name' do
+ put api("/projects/#{project.id}/labels", user),
+ name: 'label1',
+ new_name: '?',
+ color: '#FFFFFF'
+ response.status.should == 400
+ json_response['message'].should == 'Title is invalid'
+ end
+
+ it 'should return 400 for invalid name' do
+ put api("/projects/#{project.id}/labels", user),
+ name: 'label1',
+ color: '#FF'
+ response.status.should == 400
+ json_response['message'].should == 'Color is invalid'
+ end
+
+ it 'should return 400 for too long color code' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'Foo',
+ color: '#FFAAFFFF'
+ response.status.should == 400
+ json_response['message'].should == 'Color is invalid'
+ end
+ end
+end
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 3611d9d6dc3..06a25c5e3a5 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -78,9 +78,14 @@ describe API::API, api: true do
context 'between branches projects' do
it "should return merge_request" do
post api("/projects/#{project.id}/merge_requests", user),
- title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user
+ title: 'Test merge_request',
+ source_branch: 'stable',
+ target_branch: 'master',
+ author: user,
+ labels: 'label, label2'
response.status.should == 201
json_response['title'].should == 'Test merge_request'
+ json_response['labels'].should == ['label', 'label2']
end
it "should return 422 when source_branch equals target_branch" do
@@ -106,6 +111,18 @@ describe API::API, api: true do
target_branch: 'master', source_branch: 'stable'
response.status.should == 400
end
+
+ it 'should return 400 on invalid label names' do
+ post api("/projects/#{project.id}/merge_requests", user),
+ title: 'Test merge_request',
+ source_branch: 'stable',
+ target_branch: 'master',
+ author: user,
+ labels: 'label, ?'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should ==
+ ['is invalid']
+ end
end
context 'forked projects' do
@@ -235,6 +252,15 @@ describe API::API, api: true do
response.status.should == 200
json_response['target_branch'].should == 'wiki'
end
+
+ it 'should return 400 on invalid label names' do
+ put api("/projects/#{project.id}/merge_request/#{merge_request.id}",
+ user),
+ title: 'new issue',
+ labels: 'label, ?'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
+ end
end
describe "POST /projects/:id/merge_request/:merge_request_id/comments" do
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 41841e855fd..12a3a07ff76 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -10,13 +10,6 @@ describe API::API, api: true do
let(:snippet) { create(:project_snippet, author: user, project: project, title: 'example') }
let(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) }
let(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) }
- let(:issue_with_labels) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") }
- let(:merge_request_with_labels) do
- create(:merge_request, :simple, author: user, assignee: user,
- source_project: project, target_project: project, title: 'Test',
- label_list: 'label3, label4')
- end
-
describe "GET /projects" do
before { project }
@@ -634,46 +627,4 @@ describe API::API, api: true do
end
end
end
-
- describe 'GET /projects/:id/labels' do
- context 'with an issue' do
- before { issue_with_labels }
-
- it 'should return project labels' do
- get api("/projects/#{project.id}/labels", user)
- response.status.should == 200
- json_response.should be_an Array
- json_response.first['name'].should == issue_with_labels.labels.first.name
- json_response.last['name'].should == issue_with_labels.labels.last.name
- end
- end
-
- context 'with a merge request' do
- before { merge_request_with_labels }
-
- it 'should return project labels' do
- get api("/projects/#{project.id}/labels", user)
- response.status.should == 200
- json_response.should be_an Array
- json_response.first['name'].should == merge_request_with_labels.labels.first.name
- json_response.last['name'].should == merge_request_with_labels.labels.last.name
- end
- end
-
- context 'with an issue and a merge request' do
- before do
- issue_with_labels
- merge_request_with_labels
- end
-
- it 'should return project labels from both' do
- get api("/projects/#{project.id}/labels", user)
- response.status.should == 200
- json_response.should be_an Array
- all_labels = issue_with_labels.labels.map(&:name).to_a
- .concat(merge_request_with_labels.labels.map(&:name).to_a)
- json_response.map { |e| e['name'] }.should =~ all_labels
- end
- end
- end
end
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index 94850d0f1ae..17173aaeeac 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -3,6 +3,8 @@ require 'mime/types'
describe API::API, api: true do
include ApiHelpers
+ include RepoHelpers
+
let(:user) { create(:user) }
let(:user2) { create(:user) }
let!(:project) { create(:project, creator_id: user.id) }
@@ -21,20 +23,66 @@ describe API::API, api: true do
end
describe 'POST /projects/:id/repository/tags' do
- it 'should create a new tag' do
+ context 'lightweight tags' do
+ it 'should create a new tag' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v7.0.1',
+ ref: 'master'
+
+ response.status.should == 201
+ json_response['name'].should == 'v7.0.1'
+ end
+ end
+
+ # TODO: fix this test for CI
+ #context 'annotated tag' do
+ #it 'should create a new annotated tag' do
+ #post api("/projects/#{project.id}/repository/tags", user),
+ #tag_name: 'v7.1.0',
+ #ref: 'master',
+ #message: 'tag message'
+
+ #response.status.should == 201
+ #json_response['name'].should == 'v7.1.0'
+ # The message is not part of the JSON response.
+ # Additional changes to the gitlab_git gem may be required.
+ # json_response['message'].should == 'tag message'
+ #end
+ #end
+
+ it 'should deny for user without push access' do
+ post api("/projects/#{project.id}/repository/tags", user2),
+ tag_name: 'v1.9.0',
+ ref: '621491c677087aa243f165eab467bfdfbee00be1'
+ response.status.should == 403
+ end
+
+ it 'should return 400 if tag name is invalid' do
post api("/projects/#{project.id}/repository/tags", user),
- tag_name: 'v1.0.0',
+ tag_name: 'v 1.0.0',
ref: 'master'
+ response.status.should == 400
+ json_response['message'].should == 'Tag name invalid'
+ end
+ it 'should return 400 if tag already exists' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v8.0.0',
+ ref: 'master'
response.status.should == 201
- json_response['name'].should == 'v1.0.0'
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v8.0.0',
+ ref: 'master'
+ response.status.should == 400
+ json_response['message'].should == 'Tag already exists'
end
- it 'should deny for user without push access' do
- post api("/projects/#{project.id}/repository/tags", user2),
- tag_name: 'v1.0.0',
- ref: '621491c677087aa243f165eab467bfdfbee00be1'
- response.status.should == 403
+ it 'should return 400 if ref name is invalid' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'mytag',
+ ref: 'foo'
+ response.status.should == 400
+ json_response['message'].should == 'Invalid reference name'
end
end
@@ -47,7 +95,7 @@ describe API::API, api: true do
response.status.should == 200
json_response.should be_an Array
- json_response.first['name'].should == 'app'
+ json_response.first['name'].should == 'encoding'
json_response.first['type'].should == 'tree'
json_response.first['mode'].should == '040000'
end
@@ -92,7 +140,7 @@ describe API::API, api: true do
describe "GET /projects/:id/repository/raw_blobs/:sha" do
it "should get the raw file contents" do
- get api("/projects/#{project.id}/repository/raw_blobs/d1aff2896d99d7acc4d9780fbb716b113c45ecf7", user)
+ get api("/projects/#{project.id}/repository/raw_blobs/#{sample_blob.oid}", user)
response.status.should == 200
end
end
@@ -128,23 +176,23 @@ describe API::API, api: true do
end
end
- describe 'GET /GET /projects/:id/repository/compare' do
+ describe 'GET /projects/:id/repository/compare' do
it "should compare branches" do
- get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'simple_merge_request'
+ get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'feature'
response.status.should == 200
json_response['commits'].should be_present
json_response['diffs'].should be_present
end
it "should compare tags" do
- get api("/projects/#{project.id}/repository/compare", user), from: 'v1.0.1', to: 'v1.0.2'
+ get api("/projects/#{project.id}/repository/compare", user), from: 'v1.0.0', to: 'v1.1.0'
response.status.should == 200
json_response['commits'].should be_present
json_response['diffs'].should be_present
end
it "should compare commits" do
- get api("/projects/#{project.id}/repository/compare", user), from: 'b1e6a9dbf1c85', to: '1e689bfba395'
+ get api("/projects/#{project.id}/repository/compare", user), from: sample_commit.id, to: sample_commit.parent_id
response.status.should == 200
json_response['commits'].should be_empty
json_response['diffs'].should be_empty
@@ -152,7 +200,7 @@ describe API::API, api: true do
end
it "should compare commits in reverse order" do
- get api("/projects/#{project.id}/repository/compare", user), from: '1e689bfba395', to: 'b1e6a9dbf1c85'
+ get api("/projects/#{project.id}/repository/compare", user), from: sample_commit.parent_id, to: sample_commit.id
response.status.should == 200
json_response['commits'].should be_present
json_response['diffs'].should be_present
@@ -166,4 +214,18 @@ describe API::API, api: true do
json_response['compare_same_ref'].should be_true
end
end
+
+ describe 'GET /projects/:id/repository/contributors' do
+ it 'should return valid data' do
+ get api("/projects/#{project.id}/repository/contributors", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ contributor = json_response.first
+ contributor['email'].should == 'dmitriy.zaporozhets@gmail.com'
+ contributor['name'].should == 'Dmitriy Zaporozhets'
+ contributor['commits'].should == 13
+ contributor['additions'].should == 4081
+ contributor['deletions'].should == 29
+ end
+ end
end
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index c3eec56d133..8bbe9b5b736 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -97,19 +97,6 @@ describe API::API, api: true do
response.status.should == 201
end
- it "creating a user should respect default project limit" do
- limit = 123456
- Gitlab.config.gitlab.stub(:default_projects_limit).and_return(limit)
- attr = attributes_for(:user )
- expect {
- post api("/users", admin), attr
- }.to change { User.count }.by(1)
- user = User.find_by(username: attr[:username])
- user.projects_limit.should == limit
- user.theme_id.should == Gitlab::Theme::MARS
- Gitlab.config.gitlab.unstub(:default_projects_limit)
- end
-
it "should not create user with invalid email" do
post api("/users", admin), { email: "invalid email", password: 'password' }
response.status.should == 400
diff --git a/spec/seed_project.tar.gz b/spec/seed_project.tar.gz
deleted file mode 100644
index 8d32a927da8..00000000000
--- a/spec/seed_project.tar.gz
+++ /dev/null
Binary files differ
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index 6b89f213bec..fa99acabc78 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -1,14 +1,16 @@
require 'spec_helper'
describe GitPushService do
+ include RepoHelpers
+
let (:user) { create :user }
let (:project) { create :project }
let (:service) { GitPushService.new }
before do
@blankrev = '0000000000000000000000000000000000000000'
- @oldrev = 'b98a310def241a6fd9c9a9a3e7934c48e498fe81'
- @newrev = 'b19a04f53caeebf4fe5ec2327cb83e9253dc91bb'
+ @oldrev = sample_commit.parent_id
+ @newrev = sample_commit.id
@ref = 'refs/heads/master'
end
diff --git a/spec/services/milestones/group_service_spec.rb b/spec/services/milestones/group_service_spec.rb
new file mode 100644
index 00000000000..74eb0f99e0f
--- /dev/null
+++ b/spec/services/milestones/group_service_spec.rb
@@ -0,0 +1,70 @@
+require 'spec_helper'
+
+describe Milestones::GroupService do
+ let(:user) { create(:user) }
+ let(:user2) { create(:user) }
+ let(:group) { create(:group) }
+ let(:project1) { create(:project, group: group) }
+ let(:project2) { create(:project, path: 'gitlab-ci', group: group) }
+ let(:project3) { create(:project, path: 'cookbook-gitlab', group: group) }
+ let(:milestone1_project1) { create(:milestone, title: "Milestone v1.2", project: project1) }
+ let(:milestone1_project2) { create(:milestone, title: "Milestone v1.2", project: project2) }
+ let(:milestone1_project3) { create(:milestone, title: "Milestone v1.2", project: project3) }
+ let(:milestone2_project1) { create(:milestone, title: "VD-123", project: project1) }
+ let(:milestone2_project2) { create(:milestone, title: "VD-123", project: project2) }
+ let(:milestone2_project3) { create(:milestone, title: "VD-123", project: project3) }
+
+ describe 'execute' do
+ context 'with valid projects' do
+ before do
+ milestones =
+ [
+ milestone1_project1,
+ milestone1_project2,
+ milestone1_project3,
+ milestone2_project1,
+ milestone2_project2,
+ milestone2_project3
+ ]
+ @group_milestones = Milestones::GroupService.new(milestones).execute
+ end
+
+ it 'should have all project milestones' do
+ expect(@group_milestones.count).to eq(2)
+ end
+
+ it 'should have all project milestones titles' do
+ expect(@group_milestones.map { |group_milestone| group_milestone.title }).to match_array(['Milestone v1.2', 'VD-123'])
+ end
+
+ it 'should have all project milestones' do
+ expect(@group_milestones.map { |group_milestone| group_milestone.milestones.count }.sum).to eq(6)
+ end
+ end
+ end
+
+ describe 'milestone' do
+ context 'with valid title' do
+ before do
+ milestones =
+ [
+ milestone1_project1,
+ milestone1_project2,
+ milestone1_project3,
+ milestone2_project1,
+ milestone2_project2,
+ milestone2_project3
+ ]
+ @group_milestones = Milestones::GroupService.new(milestones).milestone('Milestone v1.2')
+ end
+
+ it 'should have exactly one group milestone' do
+ expect(@group_milestones.title).to eq('Milestone v1.2')
+ end
+
+ it 'should have all project milestones with the same title' do
+ expect(@group_milestones.milestones.count).to eq(3)
+ end
+ end
+ end
+end
diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb
index 106c14bc015..f59786efcf9 100644
--- a/spec/services/notes/create_service_spec.rb
+++ b/spec/services/notes/create_service_spec.rb
@@ -11,7 +11,6 @@ describe Notes::CreateService do
project.team << [user, :master]
opts = {
note: 'Awesome comment',
- description: 'please fix',
noteable_type: 'Issue',
noteable_id: issue.id
}
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 57a4240f7a2..df355f6f07a 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -95,6 +95,49 @@ describe NotificationService do
end
end
+ context 'issue note mention' do
+ let(:issue) { create(:issue, assignee: create(:user)) }
+ let(:mentioned_issue) { create(:issue, assignee: issue.assignee) }
+ let(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: '@all mentioned') }
+
+ before do
+ build_team(note.project)
+ end
+
+ describe :new_note do
+ it do
+ # Notify all team members
+ note.project.team.members.each do |member|
+ # User with disabled notification should not be notified
+ next if member.id == @u_disabled.id
+ should_email(member.id)
+ end
+ should_email(note.noteable.author_id)
+ should_email(note.noteable.assignee_id)
+
+ should_not_email(note.author_id)
+ should_not_email(@u_disabled.id)
+ should_not_email(@u_not_mentioned.id)
+ notification.new_note(note)
+ end
+
+ it 'filters out "mentioned in" notes' do
+ mentioned_note = Note.create_cross_reference_note(mentioned_issue, issue, issue.author, issue.project)
+
+ Notify.should_not_receive(:note_issue_email)
+ notification.new_note(mentioned_note)
+ end
+ end
+
+ def should_email(user_id)
+ Notify.should_receive(:note_issue_email).with(user_id, note.id)
+ end
+
+ def should_not_email(user_id)
+ Notify.should_not_receive(:note_issue_email).with(user_id, note.id)
+ end
+ end
+
context 'commit note' do
let(:note) { create(:note_on_commit) }
@@ -172,7 +215,7 @@ describe NotificationService do
end
def should_email(user_id)
- Notify.should_receive(:reassigned_issue_email).with(user_id, issue.id, issue.assignee_id, @u_disabled.id)
+ Notify.should_receive(:reassigned_issue_email).with(user_id, issue.id, nil, @u_disabled.id)
end
def should_not_email(user_id)
@@ -199,6 +242,26 @@ describe NotificationService do
Notify.should_not_receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id)
end
end
+
+ describe :reopen_issue do
+ it 'should send email to issue assignee and issue author' do
+ should_email(issue.assignee_id)
+ should_email(issue.author_id)
+ should_email(@u_watcher.id)
+ should_not_email(@u_participating.id)
+ should_not_email(@u_disabled.id)
+
+ notification.reopen_issue(issue, @u_disabled)
+ end
+
+ def should_email(user_id)
+ Notify.should_receive(:issue_status_changed_email).with(user_id, issue.id, 'reopened', @u_disabled.id)
+ end
+
+ def should_not_email(user_id)
+ Notify.should_not_receive(:issue_status_changed_email).with(user_id, issue.id, 'reopened', @u_disabled.id)
+ end
+ end
end
describe 'Merge Requests' do
@@ -236,7 +299,7 @@ describe NotificationService do
end
def should_email(user_id)
- Notify.should_receive(:reassigned_merge_request_email).with(user_id, merge_request.id, merge_request.assignee_id, merge_request.author_id)
+ Notify.should_receive(:reassigned_merge_request_email).with(user_id, merge_request.id, nil, merge_request.author_id)
end
def should_not_email(user_id)
@@ -279,6 +342,24 @@ describe NotificationService do
Notify.should_not_receive(:merged_merge_request_email).with(user_id, merge_request.id, @u_disabled.id)
end
end
+
+ describe :reopen_merge_request do
+ it do
+ should_email(merge_request.assignee_id)
+ should_email(@u_watcher.id)
+ should_not_email(@u_participating.id)
+ should_not_email(@u_disabled.id)
+ notification.reopen_mr(merge_request, @u_disabled)
+ end
+
+ def should_email(user_id)
+ Notify.should_receive(:merge_request_status_email).with(user_id, merge_request.id, 'reopened', @u_disabled.id)
+ end
+
+ def should_not_email(user_id)
+ Notify.should_not_receive(:merge_request_status_email).with(user_id, merge_request.id, 'reopened', @u_disabled.id)
+ end
+ end
end
describe 'Projects' do
@@ -312,6 +393,7 @@ describe NotificationService do
@u_disabled = create(:user, notification_level: Notification::N_DISABLED)
@u_mentioned = create(:user, username: 'mention', notification_level: Notification::N_PARTICIPATING)
@u_committer = create(:user, username: 'committer')
+ @u_not_mentioned = create(:user, username: 'regular', notification_level: Notification::N_PARTICIPATING)
project.team << [@u_watcher, :master]
project.team << [@u_participating, :master]
diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb
index 74c23418a28..9c97dad2ff0 100644
--- a/spec/services/projects/create_service_spec.rb
+++ b/spec/services/projects/create_service_spec.rb
@@ -55,95 +55,6 @@ describe Projects::CreateService do
it { File.exists?(@path).should be_false }
end
end
-
- context 'respect configured visibility setting' do
- before(:each) do
- @settings = double("settings")
- @settings.stub(:issues) { true }
- @settings.stub(:merge_requests) { true }
- @settings.stub(:wiki) { true }
- @settings.stub(:snippets) { true }
- Gitlab.config.gitlab.stub(restricted_visibility_levels: [])
- Gitlab.config.gitlab.stub(:default_projects_features).and_return(@settings)
- end
-
- context 'should be public when setting is public' do
- before do
- @settings.stub(:visibility_level) { Gitlab::VisibilityLevel::PUBLIC }
- @project = create_project(@user, @opts)
- end
-
- it { @project.public?.should be_true }
- end
-
- context 'should be private when setting is private' do
- before do
- @settings.stub(:visibility_level) { Gitlab::VisibilityLevel::PRIVATE }
- @project = create_project(@user, @opts)
- end
-
- it { @project.private?.should be_true }
- end
-
- context 'should be internal when setting is internal' do
- before do
- @settings.stub(:visibility_level) { Gitlab::VisibilityLevel::INTERNAL }
- @project = create_project(@user, @opts)
- end
-
- it { @project.internal?.should be_true }
- end
- end
-
- context 'respect configured visibility restrictions setting' do
- before(:each) do
- @settings = double("settings")
- @settings.stub(:issues) { true }
- @settings.stub(:merge_requests) { true }
- @settings.stub(:wiki) { true }
- @settings.stub(:snippets) { true }
- @settings.stub(:visibility_level) { Gitlab::VisibilityLevel::PRIVATE }
- @restrictions = [ Gitlab::VisibilityLevel::PUBLIC ]
- Gitlab.config.gitlab.stub(restricted_visibility_levels: @restrictions)
- Gitlab.config.gitlab.stub(:default_projects_features).and_return(@settings)
- end
-
- context 'should be private when option is public' do
- before do
- @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
- @project = create_project(@user, @opts)
- end
-
- it { @project.private?.should be_true }
- end
-
- context 'should be public when option is public for admin' do
- before do
- @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
- @project = create_project(@admin, @opts)
- end
-
- it { @project.public?.should be_true }
- end
-
- context 'should be private when option is private' do
- before do
- @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
- @project = create_project(@user, @opts)
- end
-
- it { @project.private?.should be_true }
- end
-
- context 'should be internal when option is internal' do
- before do
- @opts.merge!(visibility_level: Gitlab::VisibilityLevel::INTERNAL)
- @project = create_project(@user, @opts)
- end
-
- it { @project.internal?.should be_true }
- end
- end
end
def create_project(user, opts)
diff --git a/spec/services/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb
index b6573095dbd..0edc3a8e807 100644
--- a/spec/services/fork_service_spec.rb
+++ b/spec/services/projects/fork_service_spec.rb
@@ -5,44 +5,40 @@ describe Projects::ForkService do
before do
@from_namespace = create(:namespace)
@from_user = create(:user, namespace: @from_namespace )
- @from_project = create(:project, creator_id: @from_user.id, namespace: @from_namespace)
+ @from_project = create(:project, creator_id: @from_user.id,
+ namespace: @from_namespace, star_count: 107,
+ description: 'wow such project')
@to_namespace = create(:namespace)
@to_user = create(:user, namespace: @to_namespace)
end
context 'fork project' do
+ describe "successfully creates project in the user namespace" do
+ let(:to_project) { fork_project(@from_project, @to_user) }
- it "successfully creates project in the user namespace" do
- @to_project = fork_project(@from_project, @to_user)
-
- @to_project.owner.should == @to_user
- @to_project.namespace.should == @to_user.namespace
+ it { to_project.owner.should == @to_user }
+ it { to_project.namespace.should == @to_user.namespace }
+ it { to_project.star_count.should be_zero }
+ it { to_project.description.should == @from_project.description }
end
end
context 'fork project failure' do
-
it "fails due to transaction failure" do
- # make the mock gitlab-shell fail
@to_project = fork_project(@from_project, @to_user, false)
-
@to_project.errors.should_not be_empty
@to_project.errors[:base].should include("Fork transaction failed.")
end
-
end
context 'project already exists' do
-
it "should fail due to validation, not transaction failure" do
@existing_project = create(:project, creator_id: @to_user.id, name: @from_project.name, namespace: @to_namespace)
@to_project = fork_project(@from_project, @to_user)
-
@existing_project.persisted?.should be_true
@to_project.errors[:base].should include("Invalid fork destination")
@to_project.errors[:base].should_not include("Fork transaction failed.")
end
-
end
end
@@ -53,5 +49,4 @@ describe Projects::ForkService do
context.stub(gitlab_shell: shell)
context.execute
end
-
end
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb
index bb0470e3771..5a10174eb36 100644
--- a/spec/services/projects/update_service_spec.rb
+++ b/spec/services/projects/update_service_spec.rb
@@ -6,14 +6,14 @@ describe Projects::UpdateService do
@user = create :user
@admin = create :user, admin: true
@project = create :project, creator_id: @user.id, namespace: @user.namespace
- @opts = { project: {} }
+ @opts = {}
end
context 'should be private when updated to private' do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
update_project(@project, @user, @opts)
end
@@ -25,7 +25,7 @@ describe Projects::UpdateService do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::INTERNAL)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::INTERNAL)
update_project(@project, @user, @opts)
end
@@ -37,7 +37,7 @@ describe Projects::UpdateService do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
update_project(@project, @user, @opts)
end
@@ -48,7 +48,7 @@ describe Projects::UpdateService do
context 'respect configured visibility restrictions setting' do
before(:each) do
@restrictions = double("restrictions")
- @restrictions.stub(:restricted_visibility_levels) { [ Gitlab::VisibilityLevel::PUBLIC ] }
+ @restrictions.stub(:restricted_visibility_levels) { [ "public" ] }
Settings.stub_chain(:gitlab).and_return(@restrictions)
end
@@ -56,7 +56,7 @@ describe Projects::UpdateService do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
update_project(@project, @user, @opts)
end
@@ -68,7 +68,7 @@ describe Projects::UpdateService do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::INTERNAL)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::INTERNAL)
update_project(@project, @user, @opts)
end
@@ -80,7 +80,7 @@ describe Projects::UpdateService do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
update_project(@project, @user, @opts)
end
@@ -92,7 +92,7 @@ describe Projects::UpdateService do
before do
@created_private = @project.private?
- @opts[:project].merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
+ @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
update_project(@project, @admin, @opts)
end
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index daffe98a8ed..3217c571e67 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -19,7 +19,7 @@ describe 'Search::GlobalService' do
it 'should return public projects only' do
context = Search::GlobalService.new(nil, search: "searchable")
results = context.execute
- results[:projects].should match_array [public_project]
+ results.objects('projects').should match_array [public_project]
end
end
@@ -27,19 +27,19 @@ describe 'Search::GlobalService' do
it 'should return public, internal and private projects' do
context = Search::GlobalService.new(user, search: "searchable")
results = context.execute
- results[:projects].should match_array [public_project, found_project, internal_project]
+ results.objects('projects').should match_array [public_project, found_project, internal_project]
end
it 'should return only public & internal projects' do
context = Search::GlobalService.new(internal_user, search: "searchable")
results = context.execute
- results[:projects].should match_array [internal_project, public_project]
+ results.objects('projects').should match_array [internal_project, public_project]
end
it 'namespace name should be searchable' do
context = Search::GlobalService.new(user, search: found_project.namespace.path)
results = context.execute
- results[:projects].should match_array [found_project]
+ results.objects('projects').should match_array [found_project]
end
end
end
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb
index 3c2eec6cfd9..7497bdb0b3c 100644
--- a/spec/services/system_hooks_service_spec.rb
+++ b/spec/services/system_hooks_service_spec.rb
@@ -4,6 +4,7 @@ describe SystemHooksService do
let (:user) { create :user }
let (:project) { create :project }
let (:users_project) { create :users_project }
+ let (:key) { create(:key, user: user) }
context 'event data' do
it { event_data(user, :create).should include(:event_name, :name, :created_at, :email, :user_id) }
@@ -12,6 +13,8 @@ describe SystemHooksService do
it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) }
it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) }
+ it { event_data(key, :create).should include(:username, :key, :id) }
+ it { event_data(key, :destroy).should include(:username, :key, :id) }
end
context 'event names' do
@@ -21,6 +24,8 @@ describe SystemHooksService do
it { event_name(project, :destroy).should eq "project_destroy" }
it { event_name(users_project, :create).should eq "user_add_to_team" }
it { event_name(users_project, :destroy).should eq "user_remove_from_team" }
+ it { event_name(key, :create).should eq 'key_create' }
+ it { event_name(key, :destroy).should eq 'key_destroy' }
end
def event_data(*args)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2181238ae9f..6934cabadfa 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -38,14 +38,7 @@ RSpec.configure do |config|
config.include TestEnv
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
-
config.before(:suite) do
- TestEnv.init(init_repos: true, repos: false)
- end
- config.before(:each) do
- TestEnv.setup_stubs
+ TestEnv.init
end
end
diff --git a/spec/support/big_commits.rb b/spec/support/big_commits.rb
deleted file mode 100644
index 69daa709dd9..00000000000
--- a/spec/support/big_commits.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module BigCommits
- HUGE_COMMIT_ID = "7f92534f767fa20357a11c63f973ae3b79cc5b85"
- HUGE_COMMIT_MESSAGE = "pybments.rb version up. gitignore improved"
-
- BIG_COMMIT_ID = "d62200cad430565bd9f80befaf329297120330b5"
- BIG_COMMIT_MESSAGE = "clean-up code"
-end
-
diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb
index 7713e9f17d7..238ac7c6611 100644
--- a/spec/support/login_helpers.rb
+++ b/spec/support/login_helpers.rb
@@ -19,7 +19,8 @@ module LoginHelpers
Thread.current[:current_user] = user
end
+ # Requires Javascript driver.
def logout
- click_link "Logout" rescue nil
+ page.find(:css, ".icon-signout").click
end
end
diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb
index 3802e94ecf0..0d67e7ee4e6 100644
--- a/spec/support/mentionable_shared_examples.rb
+++ b/spec/support/mentionable_shared_examples.rb
@@ -11,7 +11,7 @@ def common_mentionable_setup
let(:mentioned_issue) { create :issue, project: mproject }
let(:other_issue) { create :issue, project: mproject }
- let(:mentioned_mr) { create :merge_request, source_project: mproject, source_branch: 'different' }
+ let(:mentioned_mr) { create :merge_request, :simple, source_project: mproject }
let(:mentioned_commit) { double('commit', sha: '1234567890abcdef').as_null_object }
# Override to add known commits to the repository stub.
@@ -29,11 +29,7 @@ def common_mentionable_setup
# unrecognized commits.
commitmap = { '123456' => mentioned_commit }
extra_commits.each { |c| commitmap[c.sha[0..5]] = c }
-
- repo = double('repository')
- repo.stub(:commit) { |sha| commitmap[sha] }
- mproject.stub(repository: repo)
-
+ mproject.repository.stub(:commit) { |sha| commitmap[sha] }
set_mentionable_text.call(ref_string)
end
end
diff --git a/spec/support/repo_helpers.rb b/spec/support/repo_helpers.rb
new file mode 100644
index 00000000000..4c4775da692
--- /dev/null
+++ b/spec/support/repo_helpers.rb
@@ -0,0 +1,99 @@
+module RepoHelpers
+ extend self
+
+ # Text file in repo
+ #
+ # Ex.
+ #
+ # # Get object
+ # blob = RepoHelpers.text_blob
+ #
+ # blob.path # => 'files/js/commit.js.coffee'
+ # blob.data # => 'class Commit...'
+ #
+ def sample_blob
+ OpenStruct.new(
+ oid: '5f53439ca4b009096571d3c8bc3d09d30e7431b3',
+ path: "files/js/commit.js.coffee",
+ data: <<eos
+class Commit
+ constructor: ->
+ $('.files .diff-file').each ->
+ new CommitFile(this)
+
+@Commit = Commit
+eos
+ )
+ end
+
+ def sample_commit
+ OpenStruct.new(
+ id: "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
+ parent_id: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9',
+ author_full_name: "Dmitriy Zaporozhets",
+ author_email: "dmitriy.zaporozhets@gmail.com",
+ files_changed_count: 2,
+ line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14',
+ line_code_path: 'files/ruby/popen.rb',
+ del_line_code: '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13',
+ message: <<eos
+Change some files
+Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
+eos
+ )
+ end
+
+ def sample_big_commit
+ OpenStruct.new(
+ id: "913c66a37b4a45b9769037c55c2d238bd0942d2e",
+ author_full_name: "Dmitriy Zaporozhets",
+ author_email: "dmitriy.zaporozhets@gmail.com",
+ message: <<eos
+Files, encoding and much more
+Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
+eos
+ )
+ end
+
+ def sample_image_commit
+ OpenStruct.new(
+ id: "2f63565e7aac07bcdadb654e253078b727143ec4",
+ author_full_name: "Dmitriy Zaporozhets",
+ author_email: "dmitriy.zaporozhets@gmail.com",
+ old_blob_id: '33f3729a45c02fc67d00adb1b8bca394b0e761d9',
+ new_blob_id: '2f63565e7aac07bcdadb654e253078b727143ec4',
+ message: <<eos
+Modified image
+Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
+eos
+ )
+ end
+
+ def sample_compare
+ changes = [
+ {
+ line_code: 'a5cc2925ca8258af241be7e5b0381edf30266302_20_20',
+ file_path: '.gitignore',
+ },
+ {
+ line_code: '7445606fbf8f3683cd42bdc54b05d7a0bc2dfc44_4_6',
+ file_path: '.gitmodules',
+ }
+ ]
+
+ commits = [
+ '5937ac0a7beb003549fc5fd26fc247adbce4a52e',
+ '570e7b2abdd848b95f2f578043fc23bd6f6fd24d',
+ '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9',
+ 'd14d6c0abdd253381df51a723d58691b2ee1ab08',
+ 'c1acaa58bbcbc3eafe538cb8274ba387047b69f8',
+ ].reverse # last commit is recent one
+
+ OpenStruct.new(
+ source_branch: 'master',
+ target_branch: 'feature',
+ changes: changes,
+ commits: commits
+ )
+ end
+end
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 85059dfa9e9..e67c29a6783 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -5,167 +5,63 @@ module TestEnv
# Test environment
#
- # all repositories and namespaces stored at
- # RAILS_APP/tmp/test-git-base-path
- #
- # Next shell methods are stubbed and return true
- # - mv_repository
- # - remove_repository
- # - add_key
- # - remove_key
+ # See gitlab.yml.example test section for paths
#
def init(opts = {})
RSpec::Mocks::setup(self)
# Disable mailer for spinach tests
disable_mailer if opts[:mailer] == false
- setup_stubs
-
- clear_test_repo_dir if opts[:init_repos] == true
- setup_test_repos(opts) if opts[:repos] == true
- end
-
- def disable_mailer
- NotificationService.any_instance.stub(mailer: double.as_null_object)
- end
- def enable_mailer
- NotificationService.any_instance.unstub(:mailer)
- end
+ # Clean /tmp/tests
+ tmp_test_path = Rails.root.join('tmp', 'tests')
- def setup_stubs()
- # Use tmp dir for FS manipulations
- repos_path = testing_path()
- ProjectWiki.any_instance.stub(:init_repo) do |path|
- create_temp_repo(File.join(repos_path, "#{path}.git"))
+ if File.directory?(tmp_test_path)
+ FileUtils.rm_r(tmp_test_path)
end
- Gitlab.config.gitlab_shell.stub(repos_path: repos_path)
+ FileUtils.mkdir_p(tmp_test_path)
- Gitlab.config.satellites.stub(path: satellite_path)
+ # Setup GitLab shell for test instance
+ setup_gitlab_shell
- Gitlab::Git::Repository.stub(repos_path: repos_path)
-
- Gitlab::Shell.any_instance.stub(
- add_repository: true,
- mv_repository: true,
- remove_repository: true,
- update_repository_head: true,
- add_key: true,
- remove_key: true,
- version: '6.3.0'
- )
-
- Gitlab::Satellite::MergeAction.any_instance.stub(
- merge!: true,
- )
-
- Gitlab::Satellite::Satellite.any_instance.stub(
- exists?: true,
- destroy: true,
- create: true,
- lock_files_dir: repos_path
- )
-
- MergeRequest.any_instance.stub(
- check_if_can_be_merged: true
- )
- Repository.any_instance.stub(
- size: 12.45
- )
- end
-
- def clear_repo_dir(namespace, name)
- setup_stubs
- # Clean any .wiki.git that may have been created
- FileUtils.rm_rf File.join(testing_path(), "#{name}.wiki.git")
+ # Create repository for FactoryGirl.create(:project)
+ setup_factory_repo
end
- def reset_satellite_dir
- setup_stubs
- [
- %W(git reset --hard --quiet),
- %W(git clean -fx --quiet),
- %W(git checkout --quiet origin/master)
- ].each do |git_cmd|
- system(*git_cmd, chdir: seed_satellite_path)
- end
- end
-
- # Create a repo and it's satellite
- def create_repo(namespace, name)
- setup_stubs
- repo = repo(namespace, name)
-
- # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq
- FileUtils.ln_sf(seed_repo_path, repo)
- create_satellite(repo, namespace, name)
- end
-
- private
-
- def testing_path
- Rails.root.join('tmp', 'test-git-base-path')
- end
-
- def seed_repo_path
- Rails.root.join('tmp', 'repositories', 'gitlabhq')
- end
-
- def seed_satellite_path
- Rails.root.join('tmp', 'satellite', 'gitlabhq')
- end
-
- def satellite_path
- "#{testing_path()}/satellite"
+ def disable_mailer
+ NotificationService.any_instance.stub(mailer: double.as_null_object)
end
- def repo(namespace, name)
- unless (namespace.nil? || namespace.path.nil? || namespace.path.strip.empty?)
- repo = File.join(testing_path(), "#{namespace.path}/#{name}.git")
- else
- repo = File.join(testing_path(), "#{name}.git")
- end
+ def enable_mailer
+ NotificationService.any_instance.unstub(:mailer)
end
- def satellite(namespace, name)
- unless (namespace.nil? || namespace.path.nil? || namespace.path.strip.empty?)
- satellite_repo = File.join(satellite_path, namespace.path, name)
- else
- satellite_repo = File.join(satellite_path, name)
+ def setup_gitlab_shell
+ unless File.directory?(Gitlab.config.gitlab_shell.path)
+ %x[rake gitlab:shell:install]
end
end
- def setup_test_repos(opts ={})
- create_repo(nil, 'gitlabhq') #unless opts[:repo].nil? || !opts[:repo].include?('')
- create_repo(nil, 'source_gitlabhq') #unless opts[:repo].nil? || !opts[:repo].include?('source_')
- create_repo(nil, 'target_gitlabhq') #unless opts[:repo].nil? || !opts[:repo].include?('target_')
- end
+ def setup_factory_repo
+ repo_path = repos_path + "/root/testme.git"
+ clone_url = 'https://gitlab.com/gitlab-org/gitlab-test.git'
- def clear_test_repo_dir
- setup_stubs
-
- # Remove tmp/test-git-base-path
- FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path
-
- # Recreate tmp/test-git-base-path
- FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path
-
- # Since much more is happening in satellites
- FileUtils.mkdir_p Gitlab.config.satellites.path
+ unless File.directory?(repo_path)
+ git_cmd = %W(git clone --bare #{clone_url} #{repo_path})
+ system(*git_cmd)
+ end
end
- # Create a testing satellite, and clone the source repo into it
- def create_satellite(source_repo, namespace, satellite_name)
- satellite_repo = satellite(namespace, satellite_name)
- # Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already
- satellite_dir = File.dirname(satellite_repo)
- FileUtils.mkdir_p(satellite_dir) unless File.exists?(satellite_dir)
- FileUtils.ln_sf(seed_satellite_path, satellite_repo)
+ def copy_repo(project)
+ base_repo_path = File.expand_path(repos_path + "/root/testme.git")
+ target_repo_path = File.expand_path(repos_path + "/#{project.namespace.path}/#{project.path}.git")
+ FileUtils.mkdir_p(target_repo_path)
+ FileUtils.cp_r("#{base_repo_path}/.", target_repo_path)
+ FileUtils.chmod_R 0755, target_repo_path
end
- def create_temp_repo(path)
- FileUtils.mkdir_p path
- system(*%W(git init --quiet --bare -- #{path}))
+ def repos_path
+ Gitlab.config.gitlab_shell.repos_path
end
end
diff --git a/spec/support/valid_commit.rb b/spec/support/valid_commit.rb
deleted file mode 100644
index 98bc59b573f..00000000000
--- a/spec/support/valid_commit.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module ValidCommit
- ID = "8470d70da67355c9c009e4401746b1d5410af2e3"
- MESSAGE = "notes controller refactored"
- AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
- AUTHOR_EMAIL = "dmitriy.zaporozhets@gmail.com"
-
- FILES = [".foreman", ".gitignore", ".rails_footnotes", ".rspec", ".travis.yml", "CHANGELOG", "Gemfile", "Gemfile.lock", "LICENSE", "Procfile", "Procfile.production", "README.md", "Rakefile", "VERSION", "app", "config.ru", "config", "db", "doc", "lib", "log", "public", "resque.sh", "script", "spec", "vendor"]
- FILES_COUNT = 26
-
- C_FILE_PATH = "app/models"
- C_FILES = [".gitkeep", "ability.rb", "commit.rb", "issue.rb", "key.rb", "mailer_observer.rb", "merge_request.rb", "note.rb", "project.rb", "protected_branch.rb", "repository.rb", "snippet.rb", "tree.rb", "user.rb", "users_project.rb", "web_hook.rb", "wiki.rb"]
-
- BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n}
- BLOB_FILE_PATH = "app/views/keys/show.html.haml"
-end
-
diff --git a/spec/support/valid_commit_with_alt_email.rb b/spec/support/valid_commit_with_alt_email.rb
deleted file mode 100644
index d6e364c41f1..00000000000
--- a/spec/support/valid_commit_with_alt_email.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-module ValidCommitWithAltEmail
- ID = "1e689bfba39525ead225eaf611948cfbe8ac34cf"
- MESSAGE = "fixed notes logic"
- AUTHOR_FULL_NAME = "Dmitriy Zaporozhets"
- AUTHOR_EMAIL = "dzaporozhets@sphereconsultinginc.com"
-end \ No newline at end of file
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index e6bf79b853c..4273fd1019a 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
describe PostReceive do
-
context "as a resque worker" do
it "reponds to #perform" do
PostReceive.new.should respond_to(:perform)
@@ -15,7 +14,7 @@ describe PostReceive do
it "fetches the correct project" do
Project.should_receive(:find_with_namespace).with(project.path_with_namespace).and_return(project)
- PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id)
+ PostReceive.new.perform(pwd(project), key_id, changes)
end
it "does not run if the author is not in the project" do
@@ -23,7 +22,7 @@ describe PostReceive do
project.should_not_receive(:execute_hooks)
- PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false
+ PostReceive.new.perform(pwd(project), key_id, changes).should be_false
end
it "asks the project to trigger all hooks" do
@@ -32,11 +31,15 @@ describe PostReceive do
project.should_receive(:execute_services)
project.should_receive(:update_merge_requests)
- PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id)
+ PostReceive.new.perform(pwd(project), key_id, changes)
end
end
def pwd(project)
File.join(Gitlab.config.gitlab_shell.repos_path, project.path_with_namespace)
end
+
+ def changes
+ 'd14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master'
+ end
end
diff --git a/vendor/assets/javascripts/highlight.pack.js b/vendor/assets/javascripts/highlight.pack.js
new file mode 100644
index 00000000000..17b457bf743
--- /dev/null
+++ b/vendor/assets/javascripts/highlight.pack.js
@@ -0,0 +1 @@
+var hljs=new function(){function j(v){return v.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function t(v){return v.nodeName.toLowerCase()}function h(w,x){var v=w&&w.exec(x);return v&&v.index==0}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^lang(uage)?-/,"")});return v.filter(function(x){return i(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+j(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=j(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+j(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};var E=function(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})};if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b="\\b("+D.bK.split(" ").join("|")+")\\b"}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?("+F.b+")\\.?":F.b}).concat([D.tE,D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(h(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(h(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&h(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){if(!I.k){return j(C)}var T="";var W=0;I.lR.lastIndex=0;var U=I.lR.exec(C);while(U){T+=j(C.substr(W,U.index-W));var V=E(I,U);if(V){H+=V[1];T+=w(V[0],j(U[0]))}else{T+=j(U[0])}W=I.lR.lastIndex;U=I.lR.exec(C)}return T+j(C.substr(W))}function F(){if(I.sL&&!f[I.sL]){return j(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):e(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=j(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=j(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=i(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D+=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:j(L)}}else{throw O}}}function e(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:j(y)};var w=v;x.forEach(function(z){if(!i(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function g(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=b.useBR?z.innerHTML.replace(/\n/g,"").replace(/<br>|<br [^>]*>/g,"\n").replace(/<[^>]*>/g,""):z.textContent;var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):e(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=g(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function d(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function k(){return Object.keys(f)}function i(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=e;this.fixMarkup=g;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=d;this.listLanguages=k;this.getLanguage=i;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/};this.CLCM={cN:"comment",b:"//",e:"$",c:[this.PWM]};this.CBCM={cN:"comment",b:"/\\*",e:"\\*/",c:[this.PWM]};this.HCM={cN:"comment",b:"#",e:"$",c:[this.PWM]};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.CSSNM={cN:"number",b:this.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0};this.RM={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("fix",function(a){return{c:[{b:/[^\u2401\u0001]+/,e:/[\u2401\u0001]/,eE:true,rB:true,rE:false,c:[{b:/([^\u2401\u0001=]+)/,e:/=([^\u2401\u0001=]+)/,rE:true,rB:false,cN:"attribute"},{b:/=/,e:/([\u2401\u0001])/,eE:true,eB:true,cN:"string"}]}],cI:true}});hljs.registerLanguage("nsis",function(a){var c={cN:"symbol",b:"\\$(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES32|COMMONFILES64|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES32|PROGRAMFILES64|PROGRAMFILES|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)"};var b={cN:"constant",b:"\\$+{[a-zA-Z0-9_]+}"};var f={cN:"variable",b:"\\$+[a-zA-Z0-9_]+",i:"\\(\\){}"};var e={cN:"constant",b:"\\$+\\([a-zA-Z0-9_]+\\)"};var g={cN:"params",b:"(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)"};var d={cN:"constant",b:"\\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)"};return{cI:false,k:{keyword:"Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI FunctionEnd GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText IntCmp IntCmpU IntFmt IntOp IsWindow LangString LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestSupportedOS MessageBox MiscButtonText Name Nop OutFile Page PageCallbacks PageExEnd Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath SectionEnd SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionGroupEnd SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetPluginUnload SetRebootFlag SetRegView SetShellVarContext SetSilent ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubCaption SubSectionEnd Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle",literal:"admin all auto both colored current false force hide highest lastused leave listonly none normal notset off on open print show silent silentlog smooth textonly true user "},c:[a.HCM,a.CBCM,{cN:"string",b:'"',e:'"',i:"\\n",c:[{cN:"symbol",b:"\\$(\\\\(n|r|t)|\\$)"},c,b,f,e]},{cN:"comment",b:";",e:"$",r:0},{cN:"function",bK:"Function PageEx Section SectionGroup SubSection",e:"$"},d,b,f,e,g,a.NM,{cN:"literal",b:a.IR+"::"+a.IR}]}});hljs.registerLanguage("haxe",function(a){var c="[a-zA-Z_$][a-zA-Z0-9_$]*";var b="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)";return{aliases:["hx"],k:{keyword:"break callback case cast catch class continue default do dynamic else enum extends extern for function here if implements import in inline interface never new override package private public return static super switch this throw trace try typedef untyped using var while",literal:"true false null"},c:[a.ASM,a.QSM,a.CLCM,a.CBCM,a.CNM,{cN:"class",bK:"class interface",e:"{",eE:true,c:[{bK:"extends implements"},a.TM]},{cN:"preprocessor",b:"#",e:"$",k:"if else elseif end error"},{cN:"function",bK:"function",e:"[{;]",eE:true,i:"\\S",c:[a.TM,{cN:"params",b:"\\(",e:"\\)",c:[a.ASM,a.QSM,a.CLCM,a.CBCM]},{cN:"type",b:":",e:b,r:10}]}]}});hljs.registerLanguage("erlang",function(i){var c="[a-z'][a-zA-Z0-9_']*";var o="("+c+":"+c+"|"+c+")";var f={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun let not of orelse|10 query receive rem try when xor",literal:"false true"};var l={cN:"comment",b:"%",e:"$"};var e={cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0};var g={b:"fun\\s+"+c+"/\\d+"};var n={b:o+"\\(",e:"\\)",rB:true,r:0,c:[{cN:"function_name",b:o,r:0},{b:"\\(",e:"\\)",eW:true,rE:true,r:0}]};var h={cN:"tuple",b:"{",e:"}",r:0};var a={cN:"variable",b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0};var m={cN:"variable",b:"[A-Z][a-zA-Z0-9_]*",r:0};var b={b:"#"+i.UIR,r:0,rB:true,c:[{cN:"record_name",b:"#"+i.UIR,r:0},{b:"{",e:"}",r:0}]};var k={bK:"fun receive if try case",e:"end",k:f};k.c=[l,g,i.inherit(i.ASM,{cN:""}),k,n,i.QSM,e,h,a,m,b];var j=[l,g,k,n,i.QSM,e,h,a,m,b];n.c[1].c=j;h.c=j;b.c[1].c=j;var d={cN:"params",b:"\\(",e:"\\)",c:j};return{aliases:["erl"],k:f,i:"(</|\\*=|\\+=|-=|/\\*|\\*/|\\(\\*|\\*\\))",c:[{cN:"function",b:"^"+c+"\\s*\\(",e:"->",rB:true,i:"\\(|#|//|/\\*|\\\\|:|;",c:[d,i.inherit(i.TM,{b:c})],starts:{e:";|\\.",k:f,c:j}},l,{cN:"pp",b:"^-",e:"\\.",r:0,eE:true,rB:true,l:"-"+i.IR,k:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior -spec",c:[d]},e,i.QSM,b,a,m,h,{b:/\.$/}]}});hljs.registerLanguage("cs",function(b){var a="abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await ascending descending from get group into join let orderby partial select set value var where yield";return{aliases:["csharp"],k:a,i:/::/,c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",v:[{b:"///",r:0},{b:"<!--|-->"},{b:"</?",e:">"}]}]},b.CLCM,b.CBCM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},b.ASM,b.QSM,b.CNM,{bK:"protected public private internal",e:/[{;=]/,k:a,c:[{bK:"class namespace interface",starts:{c:[b.TM]}},{b:b.IR+"\\s*\\(",rB:true,c:[b.TM]}]}]}});hljs.registerLanguage("protobuf",function(a){return{k:{keyword:"package import option optional required repeated group",built_in:"double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes",literal:"true false"},c:[a.QSM,a.NM,a.CLCM,{cN:"class",bK:"message enum service",e:/\{/,i:/\n/,c:[a.inherit(a.TM,{starts:{eW:true,eE:true}})]},{cN:"function",bK:"rpc",e:/;/,eE:true,k:"rpc returns"},{cN:"constant",b:/^\s*[A-Z_]+/,e:/\s*=/,eE:true}]}});hljs.registerLanguage("vim",function(a){return{l:/[!#@\w]+/,k:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw d|0 delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu g|0 go gr grepa gu gv ha h|0 helpf helpg helpt hi hid his i|0 ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs n|0 new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf q|0 quita qa r|0 rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv s|0 sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync t|0 tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up v|0 ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"abs acos add and append argc argidx argv asin atan atan2 browse browsedir bufexists buflisted bufloaded bufname bufnr bufwinnr byte2line byteidx call ceil changenr char2nr cindent clearmatches col complete complete_add complete_check confirm copy cos cosh count cscope_connection cursor deepcopy delete did_filetype diff_filler diff_hlID empty escape eval eventhandler executable exists exp expand extend feedkeys filereadable filewritable filter finddir findfile float2nr floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreground function garbagecollect get getbufline getbufvar getchar getcharmod getcmdline getcmdpos getcmdtype getcwd getfontname getfperm getfsize getftime getftype getline getloclist getmatches getpid getpos getqflist getreg getregtype gettabvar gettabwinvar getwinposx getwinposy getwinvar glob globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlexists hlID hostname iconv indent index input inputdialog inputlist inputrestore inputsave inputsecret insert invert isdirectory islocked items join keys len libcall libcallnr line line2byte lispindent localtime log log10 luaeval map maparg mapcheck match matchadd matcharg matchdelete matchend matchlist matchstr max min mkdir mode mzeval nextnonblank nr2char or pathshorten pow prevnonblank printf pumvisible py3eval pyeval range readfile reltime reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remove rename repeat resolve reverse round screenattr screenchar screencol screenrow search searchdecl searchpair searchpairpos searchpos server2client serverlist setbufvar setcmdpos setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar setwinvar sha256 shellescape shiftwidth simplify sin sinh sort soundfold spellbadword spellsuggest split sqrt str2float str2nr strchars strdisplaywidth strftime stridx string strlen strpart strridx strtrans strwidth submatch substitute synconcealed synID synIDattr synIDtrans synstack system tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname tolower toupper tr trunc type undofile undotree values virtcol visualmode wildmenumode winbufnr wincol winheight winline winnr winrestcmd winrestview winsaveview winwidth writefile xor"},i:/[{:]/,c:[a.NM,a.ASM,{cN:"string",b:/"((\\")|[^"\n])*("|\n)/},{cN:"variable",b:/[bwtglsav]:[\w\d_]*/},{cN:"function",bK:"function function!",e:"$",r:0,c:[a.TM,{cN:"params",b:"\\(",e:"\\)"}]}]}});hljs.registerLanguage("brainfuck",function(b){var a={cN:"literal",b:"[\\+\\-]",r:0};return{aliases:["bf"],c:[{cN:"comment",b:"[^\\[\\]\\.,\\+\\-<> \r\n]",rE:true,e:"[\\[\\]\\.,\\+\\-<> \r\n]",r:0},{cN:"title",b:"[\\[\\]]",r:0},{cN:"string",b:"[\\.,]",r:0},{b:/\+\+|\-\-/,rB:true,c:[a]},a]}});hljs.registerLanguage("ruby",function(f){var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var i="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor";var b={cN:"yardoctag",b:"@[A-Za-z]+"};var c={cN:"value",b:"#<",e:">"};var k={cN:"comment",v:[{b:"#",e:"$",c:[b]},{b:"^\\=begin",e:"^\\=end",c:[b],r:10},{b:"^__END__",e:"\\n$"}]};var d={cN:"subst",b:"#\\{",e:"}",k:i};var e={cN:"string",c:[f.BE,d],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:"%[qw]?\\(",e:"\\)"},{b:"%[qw]?\\[",e:"\\]"},{b:"%[qw]?{",e:"}"},{b:"%[qw]?<",e:">"},{b:"%[qw]?/",e:"/"},{b:"%[qw]?%",e:"%"},{b:"%[qw]?-",e:"-"},{b:"%[qw]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]};var a={cN:"params",b:"\\(",e:"\\)",k:i};var h=[e,c,k,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[f.inherit(f.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+f.IR+"::)?"+f.IR}]},k]},{cN:"function",bK:"def",e:" |$|;",r:0,c:[f.inherit(f.TM,{b:j}),a,k]},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[e,{b:j}],r:0},{cN:"symbol",b:f.UIR+"(\\!|\\?)?:",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+f.RSR+")\\s*",c:[c,k,{cN:"regexp",c:[f.BE,d],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];d.c=h;a.c=h;var g=[{r:1,cN:"output",b:"^\\s*=> ",e:"$",rB:true,c:[{cN:"status",b:"^\\s*=>"},{b:" ",e:"$",c:h}]},{r:1,cN:"input",b:"^[^ ][^=>]*>+ ",e:"$",rB:true,c:[{cN:"prompt",b:"^[^ ][^=>]*>+"},{b:" ",e:"$",c:h}]}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:i,c:g.concat(h)}});hljs.registerLanguage("nimrod",function(a){return{k:{keyword:"addr and as asm bind block break|0 case|0 cast const|0 continue|0 converter discard distinct|10 div do elif else|0 end|0 enum|0 except export finally for from generic if|0 import|0 in include|0 interface is isnot|10 iterator|10 let|0 macro method|10 mixin mod nil not notin|10 object|0 of or out proc|10 ptr raise ref|10 return shl shr static template|10 try|0 tuple type|0 using|0 var|0 when while|0 with without xor yield",literal:"shared guarded stdin stdout stderr result|10 true false"},c:[{cN:"decorator",b:/{\./,e:/\.}/,r:10},{cN:"string",b:/[a-zA-Z]\w*"/,e:/"/,c:[{b:/""/}]},{cN:"string",b:/([a-zA-Z]\w*)?"""/,e:/"""/},{cN:"string",b:/"/,e:/"/,i:/\n/,c:[{b:/\\./}]},{cN:"type",b:/\b[A-Z]\w+\b/,r:0},{cN:"type",b:/\b(int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|string|cstring|pointer|expr|stmt|void|auto|any|range|array|openarray|varargs|seq|set|clong|culong|cchar|cschar|cshort|cint|csize|clonglong|cfloat|cdouble|clongdouble|cuchar|cushort|cuint|culonglong|cstringarray|semistatic)\b/},{cN:"number",b:/\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/,r:0},{cN:"number",b:/\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/,r:0},{cN:"number",b:/\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/,r:0},{cN:"number",b:/\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/,r:0},a.HCM]}});hljs.registerLanguage("rust",function(a){return{aliases:["rs"],k:"alignof as be box break const continue crate do else enum extern false fn for if impl in let loop match mod mut offsetof once priv proc pub pure ref return self sizeof static struct super trait true type typeof unsafe unsized use virtual while yield int i8 i16 i32 i64 uint u8 u32 u64 float f32 f64 str char bool",i:"</",c:[a.CLCM,a.CBCM,a.inherit(a.QSM,{i:null}),{cN:"string",b:/r(#*)".*?"\1(?!#)/},{cN:"string",b:/'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/},{b:/'[a-zA-Z_][a-zA-Z0-9_]*/},{cN:"number",b:"\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)",r:0},{cN:"function",bK:"fn",e:"(\\(|<)",eE:true,c:[a.UTM]},{cN:"preprocessor",b:"#\\[",e:"\\]"},{bK:"type",e:"(=|<)",c:[a.UTM],i:"\\S"},{bK:"trait enum",e:"({|<)",c:[a.UTM],i:"\\S"},{b:a.IR+"::"},{b:"->"}]}});hljs.registerLanguage("ruleslanguage",function(a){return{k:{keyword:"BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM NUMDAYS READ_DATE STAGING",built_in:"IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME"},c:[a.CLCM,a.CBCM,a.ASM,a.QSM,a.CNM,{cN:"array",b:"#[a-zA-Z .]+"}]}});hljs.registerLanguage("rib",function(a){return{k:"ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry Hider Hyperboloid Identity Illuminate Imager Interior LightSource MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd TransformPoints Translate TrimCurve WorldBegin WorldEnd",i:"</",c:[a.HCM,a.CNM,a.ASM,a.QSM]}});hljs.registerLanguage("diff",function(a){return{aliases:["patch"],c:[{cN:"chunk",r:10,v:[{b:/^\@\@ +\-\d+,\d+ +\+\d+,\d+ +\@\@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}});hljs.registerLanguage("haml",function(a){return{cI:true,c:[{cN:"doctype",b:"^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$",r:10},{cN:"comment",b:"^\\s*(!=#|=#|-#|/).*$",r:0},{b:"^\\s*(-|=|!=)(?!#)",starts:{e:"\\n",sL:"ruby"}},{cN:"tag",b:"^\\s*%",c:[{cN:"title",b:"\\w+"},{cN:"value",b:"[#\\.]\\w+"},{b:"{\\s*",e:"\\s*}",eE:true,c:[{b:":\\w+\\s*=>",e:",\\s+",rB:true,eW:true,c:[{cN:"symbol",b:":\\w+"},{cN:"string",b:'"',e:'"'},{cN:"string",b:"'",e:"'"},{b:"\\w+",r:0}]}]},{b:"\\(\\s*",e:"\\s*\\)",eE:true,c:[{b:"\\w+\\s*=",e:"\\s+",rB:true,eW:true,c:[{cN:"attribute",b:"\\w+",r:0},{cN:"string",b:'"',e:'"'},{cN:"string",b:"'",e:"'"},{b:"\\w+",r:0}]}]}]},{cN:"bullet",b:"^\\s*[=~]\\s*",r:0},{b:"#{",starts:{e:"}",sL:"ruby"}}]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBCM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBCM,a.RM,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:true,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBCM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("glsl",function(a){return{k:{keyword:"atomic_uint attribute bool break bvec2 bvec3 bvec4 case centroid coherent const continue default discard dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 do double dvec2 dvec3 dvec4 else flat float for highp if iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray in inout int invariant isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 layout lowp mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 mediump noperspective out patch precision readonly restrict return sample sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow smooth struct subroutine switch uimage1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint uniform usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D usamplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 varying vec2 vec3 vec4 void volatile while writeonly",built_in:"gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffsetgl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_PerVertex gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicCounter atomicCounterDecrement atomicCounterIncrement barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow gl_TextureMatrix gl_TextureMatrixInverse",literal:"true false"},i:'"',c:[a.CLCM,a.CBCM,a.CNM,{cN:"preprocessor",b:"#",e:"$"}]}});hljs.registerLanguage("rsl",function(a){return{k:{keyword:"float color point normal vector matrix while for if do return else break extern continue",built_in:"abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp faceforward filterstep floor format fresnel incident length lightsource log match max min mod noise normalize ntransform opposite option phong pnoise pow printf ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan texture textureinfo trace transform vtransform xcomp ycomp zcomp"},i:"</",c:[a.CLCM,a.CBCM,a.QSM,a.ASM,a.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"shader",bK:"surface displacement light volume imager",e:"\\("},{cN:"shading",bK:"illuminate illuminance gather",e:"\\("}]}});hljs.registerLanguage("lua",function(b){var a="\\[=*\\[";var e="\\]=*\\]";var c={b:a,e:e,c:["self"]};var d=[{cN:"comment",b:"--(?!"+a+")",e:"$"},{cN:"comment",b:"--"+a,e:e,c:[c],r:10}];return{l:b.UIR,k:{keyword:"and break do else elseif end false for if in local nil not or repeat return then true until while",built_in:"_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug io math os package string table"},c:d.concat([{cN:"function",bK:"function",e:"\\)",c:[b.inherit(b.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{cN:"params",b:"\\(",eW:true,c:d}].concat(d)},b.CNM,b.ASM,b.QSM,{cN:"string",b:a,e:e,c:[c],r:5}])}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}});hljs.registerLanguage("markdown",function(a){return{aliases:["md","mkdown","mkd"],c:[{cN:"header",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{cN:"horizontal_rule",b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].+?[\\)\\]]",rB:true,c:[{cN:"link_label",b:"\\[",e:"\\]",eB:true,rE:true,r:0},{cN:"link_url",b:"\\]\\(",e:"\\)",eB:true,eE:true},{cN:"link_reference",b:"\\]\\[",e:"\\]",eB:true,eE:true}],r:10},{b:"^\\[.+\\]:",e:"$",rB:true,c:[{cN:"link_reference",b:"\\[",e:"\\]",eB:true,eE:true},{cN:"link_url",b:"\\s",e:"$"}]}]}});hljs.registerLanguage("css",function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",rB:true,eE:true,e:"\\("};return{cI:true,i:"[=/|']",c:[a.CBCM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.CSSNM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBCM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.CSSNM,a.QSM,a.ASM,a.CBCM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}});hljs.registerLanguage("capnproto",function(a){return{aliases:["capnp"],k:{keyword:"struct enum interface union group import using const annotation extends in of on as with from fixed",built_in:"Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 Text Data AnyPointer AnyStruct Capability List",literal:"true false"},c:[a.QSM,a.NM,a.HCM,{cN:"shebang",b:/@0x[\w\d]{16};/,i:/\n/},{cN:"number",b:/@\d+\b/},{cN:"class",bK:"struct enum",e:/\{/,i:/\n/,c:[a.inherit(a.TM,{starts:{eW:true,eE:true}})]},{cN:"class",bK:"interface",e:/\{/,i:/\n/,c:[a.inherit(a.TM,{starts:{eW:true,eE:true}})]}]}});hljs.registerLanguage("lisp",function(i){var l="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*";var m="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?";var k={cN:"shebang",b:"^#!",e:"$"};var b={cN:"literal",b:"\\b(t{1}|nil)\\b"};var e={cN:"number",v:[{b:m,r:0},{b:"#b[0-1]+(/[0-1]+)?"},{b:"#o[0-7]+(/[0-7]+)?"},{b:"#x[0-9a-f]+(/[0-9a-f]+)?"},{b:"#c\\("+m+" +"+m,e:"\\)"}]};var h=i.inherit(i.QSM,{i:null});var n={cN:"comment",b:";",e:"$"};var g={cN:"variable",b:"\\*",e:"\\*"};var o={cN:"keyword",b:"[:&]"+l};var d={b:"\\(",e:"\\)",c:["self",b,h,e]};var a={cN:"quoted",c:[e,h,g,o,d],v:[{b:"['`]\\(",e:"\\)"},{b:"\\(quote ",e:"\\)",k:{title:"quote"}}]};var c={cN:"quoted",b:"'"+l};var j={cN:"list",b:"\\(",e:"\\)"};var f={eW:true,r:0};j.c=[{cN:"title",b:l},f];f.c=[a,c,j,b,e,h,n,g,o];return{i:/\S/,c:[e,k,b,h,n,a,c,j]}});hljs.registerLanguage("profile",function(a){return{c:[a.CNM,{cN:"built_in",b:"{",e:"}$",eB:true,eE:true,c:[a.ASM,a.QSM],r:0},{cN:"filename",b:"[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}",e:":",eE:true},{cN:"header",b:"(ncalls|tottime|cumtime)",e:"$",k:"ncalls tottime|10 cumtime|10 filename",r:10},{cN:"summary",b:"function calls",e:"$",c:[a.CNM],r:10},a.ASM,a.QSM,{cN:"function",b:"\\(",e:"\\)$",c:[a.UTM],r:0}]}});hljs.registerLanguage("http",function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}});hljs.registerLanguage("java",function(b){var a="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws";return{aliases:["jsp"],k:a,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}],r:10},b.CLCM,b.CBCM,b.ASM,b.QSM,{bK:"protected public private",e:/[{;=]/,k:a,c:[{cN:"class",bK:"class interface",eW:true,eE:true,i:/[:"\[\]]/,c:[{bK:"extends implements",r:10},b.UTM]},{b:b.UIR+"\\s*\\(",rB:true,c:[b.UTM]}]},b.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("gherkin",function(a){return{k:"Feature Background Ability Business Need Scenario Scenarios Scenario Outline Scenario Template Examples Given And Then But When",c:[{cN:"keyword",b:"\\*"},{cN:"comment",b:"@[^@\r\n\t ]+",e:"$"},{cN:"string",b:"\\|",e:"\\$"},{cN:"variable",b:"<",e:">",},a.HCM,{cN:"string",b:'"""',e:'"""'},a.QSM]}});hljs.registerLanguage("fsharp",function(a){return{aliases:["fs"],k:"abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",c:[{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},{cN:"string",b:'"""',e:'"""'},{cN:"comment",b:"\\(\\*",e:"\\*\\)"},{cN:"class",bK:"type",e:"\\(|=|$",eE:true,c:[a.UTM]},{cN:"annotation",b:"\\[<",e:">\\]"},{cN:"attribute",b:"\\B('[A-Za-z])\\b",c:[a.BE]},a.CLCM,a.inherit(a.QSM,{i:null}),a.CNM]}});hljs.registerLanguage("mathematica",function(a){return{aliases:["mma"],l:"(\\$|\\b)"+a.IR+"\\b",k:"AbelianGroup Abort AbortKernels AbortProtect Above Abs Absolute AbsoluteCorrelation AbsoluteCorrelationFunction AbsoluteCurrentValue AbsoluteDashing AbsoluteFileName AbsoluteOptions AbsolutePointSize AbsoluteThickness AbsoluteTime AbsoluteTiming AccountingForm Accumulate Accuracy AccuracyGoal ActionDelay ActionMenu ActionMenuBox ActionMenuBoxOptions Active ActiveItem ActiveStyle AcyclicGraphQ AddOnHelpPath AddTo AdjacencyGraph AdjacencyList AdjacencyMatrix AdjustmentBox AdjustmentBoxOptions AdjustTimeSeriesForecast AffineTransform After AiryAi AiryAiPrime AiryAiZero AiryBi AiryBiPrime AiryBiZero AlgebraicIntegerQ AlgebraicNumber AlgebraicNumberDenominator AlgebraicNumberNorm AlgebraicNumberPolynomial AlgebraicNumberTrace AlgebraicRules AlgebraicRulesData Algebraics AlgebraicUnitQ Alignment AlignmentMarker AlignmentPoint All AllowedDimensions AllowGroupClose AllowInlineCells AllowKernelInitialization AllowReverseGroupClose AllowScriptLevelChange AlphaChannel AlternatingGroup AlternativeHypothesis Alternatives AmbientLight Analytic AnchoredSearch And AndersonDarlingTest AngerJ AngleBracket AngularGauge Animate AnimationCycleOffset AnimationCycleRepetitions AnimationDirection AnimationDisplayTime AnimationRate AnimationRepetitions AnimationRunning Animator AnimatorBox AnimatorBoxOptions AnimatorElements Annotation Annuity AnnuityDue Antialiasing Antisymmetric Apart ApartSquareFree Appearance AppearanceElements AppellF1 Append AppendTo Apply ArcCos ArcCosh ArcCot ArcCoth ArcCsc ArcCsch ArcSec ArcSech ArcSin ArcSinDistribution ArcSinh ArcTan ArcTanh Arg ArgMax ArgMin ArgumentCountQ ARIMAProcess ArithmeticGeometricMean ARMAProcess ARProcess Array ArrayComponents ArrayDepth ArrayFlatten ArrayPad ArrayPlot ArrayQ ArrayReshape ArrayRules Arrays Arrow Arrow3DBox ArrowBox Arrowheads AspectRatio AspectRatioFixed Assert Assuming Assumptions AstronomicalData Asynchronous AsynchronousTaskObject AsynchronousTasks AtomQ Attributes AugmentedSymmetricPolynomial AutoAction AutoDelete AutoEvaluateEvents AutoGeneratedPackage AutoIndent AutoIndentSpacings AutoItalicWords AutoloadPath AutoMatch Automatic AutomaticImageSize AutoMultiplicationSymbol AutoNumberFormatting AutoOpenNotebooks AutoOpenPalettes AutorunSequencing AutoScaling AutoScroll AutoSpacing AutoStyleOptions AutoStyleWords Axes AxesEdge AxesLabel AxesOrigin AxesStyle Axis BabyMonsterGroupB Back Background BackgroundTasksSettings Backslash Backsubstitution Backward Band BandpassFilter BandstopFilter BarabasiAlbertGraphDistribution BarChart BarChart3D BarLegend BarlowProschanImportance BarnesG BarOrigin BarSpacing BartlettHannWindow BartlettWindow BaseForm Baseline BaselinePosition BaseStyle BatesDistribution BattleLemarieWavelet Because BeckmannDistribution Beep Before Begin BeginDialogPacket BeginFrontEndInteractionPacket BeginPackage BellB BellY Below BenfordDistribution BeniniDistribution BenktanderGibratDistribution BenktanderWeibullDistribution BernoulliB BernoulliDistribution BernoulliGraphDistribution BernoulliProcess BernsteinBasis BesselFilterModel BesselI BesselJ BesselJZero BesselK BesselY BesselYZero Beta BetaBinomialDistribution BetaDistribution BetaNegativeBinomialDistribution BetaPrimeDistribution BetaRegularized BetweennessCentrality BezierCurve BezierCurve3DBox BezierCurve3DBoxOptions BezierCurveBox BezierCurveBoxOptions BezierFunction BilateralFilter Binarize BinaryFormat BinaryImageQ BinaryRead BinaryReadList BinaryWrite BinCounts BinLists Binomial BinomialDistribution BinomialProcess BinormalDistribution BiorthogonalSplineWavelet BipartiteGraphQ BirnbaumImportance BirnbaumSaundersDistribution BitAnd BitClear BitGet BitLength BitNot BitOr BitSet BitShiftLeft BitShiftRight BitXor Black BlackmanHarrisWindow BlackmanNuttallWindow BlackmanWindow Blank BlankForm BlankNullSequence BlankSequence Blend Block BlockRandom BlomqvistBeta BlomqvistBetaTest Blue Blur BodePlot BohmanWindow Bold Bookmarks Boole BooleanConsecutiveFunction BooleanConvert BooleanCountingFunction BooleanFunction BooleanGraph BooleanMaxterms BooleanMinimize BooleanMinterms Booleans BooleanTable BooleanVariables BorderDimensions BorelTannerDistribution Bottom BottomHatTransform BoundaryStyle Bounds Box BoxBaselineShift BoxData BoxDimensions Boxed Boxes BoxForm BoxFormFormatTypes BoxFrame BoxID BoxMargins BoxMatrix BoxRatios BoxRotation BoxRotationPoint BoxStyle BoxWhiskerChart Bra BracketingBar BraKet BrayCurtisDistance BreadthFirstScan Break Brown BrownForsytheTest BrownianBridgeProcess BrowserCategory BSplineBasis BSplineCurve BSplineCurve3DBox BSplineCurveBox BSplineCurveBoxOptions BSplineFunction BSplineSurface BSplineSurface3DBox BubbleChart BubbleChart3D BubbleScale BubbleSizes BulletGauge BusinessDayQ ButterflyGraph ButterworthFilterModel Button ButtonBar ButtonBox ButtonBoxOptions ButtonCell ButtonContents ButtonData ButtonEvaluator ButtonExpandable ButtonFrame ButtonFunction ButtonMargins ButtonMinHeight ButtonNote ButtonNotebook ButtonSource ButtonStyle ButtonStyleMenuListing Byte ByteCount ByteOrdering C CachedValue CacheGraphics CalendarData CalendarType CallPacket CanberraDistance Cancel CancelButton CandlestickChart Cap CapForm CapitalDifferentialD CardinalBSplineBasis CarmichaelLambda Cases Cashflow Casoratian Catalan CatalanNumber Catch CauchyDistribution CauchyWindow CayleyGraph CDF CDFDeploy CDFInformation CDFWavelet Ceiling Cell CellAutoOverwrite CellBaseline CellBoundingBox CellBracketOptions CellChangeTimes CellContents CellContext CellDingbat CellDynamicExpression CellEditDuplicate CellElementsBoundingBox CellElementSpacings CellEpilog CellEvaluationDuplicate CellEvaluationFunction CellEventActions CellFrame CellFrameColor CellFrameLabelMargins CellFrameLabels CellFrameMargins CellGroup CellGroupData CellGrouping CellGroupingRules CellHorizontalScrolling CellID CellLabel CellLabelAutoDelete CellLabelMargins CellLabelPositioning CellMargins CellObject CellOpen CellPrint CellProlog Cells CellSize CellStyle CellTags CellularAutomaton CensoredDistribution Censoring Center CenterDot CentralMoment CentralMomentGeneratingFunction CForm ChampernowneNumber ChanVeseBinarize Character CharacterEncoding CharacterEncodingsPath CharacteristicFunction CharacteristicPolynomial CharacterRange Characters ChartBaseStyle ChartElementData ChartElementDataFunction ChartElementFunction ChartElements ChartLabels ChartLayout ChartLegends ChartStyle Chebyshev1FilterModel Chebyshev2FilterModel ChebyshevDistance ChebyshevT ChebyshevU Check CheckAbort CheckAll Checkbox CheckboxBar CheckboxBox CheckboxBoxOptions ChemicalData ChessboardDistance ChiDistribution ChineseRemainder ChiSquareDistribution ChoiceButtons ChoiceDialog CholeskyDecomposition Chop Circle CircleBox CircleDot CircleMinus CirclePlus CircleTimes CirculantGraph CityData Clear ClearAll ClearAttributes ClearSystemCache ClebschGordan ClickPane Clip ClipboardNotebook ClipFill ClippingStyle ClipPlanes ClipRange Clock ClockGauge ClockwiseContourIntegral Close Closed CloseKernels ClosenessCentrality Closing ClosingAutoSave ClosingEvent ClusteringComponents CMYKColor Coarse Coefficient CoefficientArrays CoefficientDomain CoefficientList CoefficientRules CoifletWavelet Collect Colon ColonForm ColorCombine ColorConvert ColorData ColorDataFunction ColorFunction ColorFunctionScaling Colorize ColorNegate ColorOutput ColorProfileData ColorQuantize ColorReplace ColorRules ColorSelectorSettings ColorSeparate ColorSetter ColorSetterBox ColorSetterBoxOptions ColorSlider ColorSpace Column ColumnAlignments ColumnBackgrounds ColumnForm ColumnLines ColumnsEqual ColumnSpacings ColumnWidths CommonDefaultFormatTypes Commonest CommonestFilter CommonUnits CommunityBoundaryStyle CommunityGraphPlot CommunityLabels CommunityRegionStyle CompatibleUnitQ CompilationOptions CompilationTarget Compile Compiled CompiledFunction Complement CompleteGraph CompleteGraphQ CompleteKaryTree CompletionsListPacket Complex Complexes ComplexExpand ComplexInfinity ComplexityFunction ComponentMeasurements ComponentwiseContextMenu Compose ComposeList ComposeSeries Composition CompoundExpression CompoundPoissonDistribution CompoundPoissonProcess CompoundRenewalProcess Compress CompressedData Condition ConditionalExpression Conditioned Cone ConeBox ConfidenceLevel ConfidenceRange ConfidenceTransform ConfigurationPath Congruent Conjugate ConjugateTranspose Conjunction Connect ConnectedComponents ConnectedGraphQ ConnesWindow ConoverTest ConsoleMessage ConsoleMessagePacket ConsolePrint Constant ConstantArray Constants ConstrainedMax ConstrainedMin ContentPadding ContentsBoundingBox ContentSelectable ContentSize Context ContextMenu Contexts ContextToFilename ContextToFileName Continuation Continue ContinuedFraction ContinuedFractionK ContinuousAction ContinuousMarkovProcess ContinuousTimeModelQ ContinuousWaveletData ContinuousWaveletTransform ContourDetect ContourGraphics ContourIntegral ContourLabels ContourLines ContourPlot ContourPlot3D Contours ContourShading ContourSmoothing ContourStyle ContraharmonicMean Control ControlActive ControlAlignment ControllabilityGramian ControllabilityMatrix ControllableDecomposition ControllableModelQ ControllerDuration ControllerInformation ControllerInformationData ControllerLinking ControllerManipulate ControllerMethod ControllerPath ControllerState ControlPlacement ControlsRendering ControlType Convergents ConversionOptions ConversionRules ConvertToBitmapPacket ConvertToPostScript ConvertToPostScriptPacket Convolve ConwayGroupCo1 ConwayGroupCo2 ConwayGroupCo3 CoordinateChartData CoordinatesToolOptions CoordinateTransform CoordinateTransformData CoprimeQ Coproduct CopulaDistribution Copyable CopyDirectory CopyFile CopyTag CopyToClipboard CornerFilter CornerNeighbors Correlation CorrelationDistance CorrelationFunction CorrelationTest Cos Cosh CoshIntegral CosineDistance CosineWindow CosIntegral Cot Coth Count CounterAssignments CounterBox CounterBoxOptions CounterClockwiseContourIntegral CounterEvaluator CounterFunction CounterIncrements CounterStyle CounterStyleMenuListing CountRoots CountryData Covariance CovarianceEstimatorFunction CovarianceFunction CoxianDistribution CoxIngersollRossProcess CoxModel CoxModelFit CramerVonMisesTest CreateArchive CreateDialog CreateDirectory CreateDocument CreateIntermediateDirectories CreatePalette CreatePalettePacket CreateScheduledTask CreateTemporary CreateWindow CriticalityFailureImportance CriticalitySuccessImportance CriticalSection Cross CrossingDetect CrossMatrix Csc Csch CubeRoot Cubics Cuboid CuboidBox Cumulant CumulantGeneratingFunction Cup CupCap Curl CurlyDoubleQuote CurlyQuote CurrentImage CurrentlySpeakingPacket CurrentValue CurvatureFlowFilter CurveClosed Cyan CycleGraph CycleIndexPolynomial Cycles CyclicGroup Cyclotomic Cylinder CylinderBox CylindricalDecomposition D DagumDistribution DamerauLevenshteinDistance DampingFactor Darker Dashed Dashing DataCompression DataDistribution DataRange DataReversed Date DateDelimiters DateDifference DateFunction DateList DateListLogPlot DateListPlot DatePattern DatePlus DateRange DateString DateTicksFormat DaubechiesWavelet DavisDistribution DawsonF DayCount DayCountConvention DayMatchQ DayName DayPlus DayRange DayRound DeBruijnGraph Debug DebugTag Decimal DeclareKnownSymbols DeclarePackage Decompose Decrement DedekindEta Default DefaultAxesStyle DefaultBaseStyle DefaultBoxStyle DefaultButton DefaultColor DefaultControlPlacement DefaultDuplicateCellStyle DefaultDuration DefaultElement DefaultFaceGridsStyle DefaultFieldHintStyle DefaultFont DefaultFontProperties DefaultFormatType DefaultFormatTypeForStyle DefaultFrameStyle DefaultFrameTicksStyle DefaultGridLinesStyle DefaultInlineFormatType DefaultInputFormatType DefaultLabelStyle DefaultMenuStyle DefaultNaturalLanguage DefaultNewCellStyle DefaultNewInlineCellStyle DefaultNotebook DefaultOptions DefaultOutputFormatType DefaultStyle DefaultStyleDefinitions DefaultTextFormatType DefaultTextInlineFormatType DefaultTicksStyle DefaultTooltipStyle DefaultValues Defer DefineExternal DefineInputStreamMethod DefineOutputStreamMethod Definition Degree DegreeCentrality DegreeGraphDistribution DegreeLexicographic DegreeReverseLexicographic Deinitialization Del Deletable Delete DeleteBorderComponents DeleteCases DeleteContents DeleteDirectory DeleteDuplicates DeleteFile DeleteSmallComponents DeleteWithContents DeletionWarning Delimiter DelimiterFlashTime DelimiterMatching Delimiters Denominator DensityGraphics DensityHistogram DensityPlot DependentVariables Deploy Deployed Depth DepthFirstScan Derivative DerivativeFilter DescriptorStateSpace DesignMatrix Det DGaussianWavelet DiacriticalPositioning Diagonal DiagonalMatrix Dialog DialogIndent DialogInput DialogLevel DialogNotebook DialogProlog DialogReturn DialogSymbols Diamond DiamondMatrix DiceDissimilarity DictionaryLookup DifferenceDelta DifferenceOrder DifferenceRoot DifferenceRootReduce Differences DifferentialD DifferentialRoot DifferentialRootReduce DifferentiatorFilter DigitBlock DigitBlockMinimum DigitCharacter DigitCount DigitQ DihedralGroup Dilation Dimensions DiracComb DiracDelta DirectedEdge DirectedEdges DirectedGraph DirectedGraphQ DirectedInfinity Direction Directive Directory DirectoryName DirectoryQ DirectoryStack DirichletCharacter DirichletConvolve DirichletDistribution DirichletL DirichletTransform DirichletWindow DisableConsolePrintPacket DiscreteChirpZTransform DiscreteConvolve DiscreteDelta DiscreteHadamardTransform DiscreteIndicator DiscreteLQEstimatorGains DiscreteLQRegulatorGains DiscreteLyapunovSolve DiscreteMarkovProcess DiscretePlot DiscretePlot3D DiscreteRatio DiscreteRiccatiSolve DiscreteShift DiscreteTimeModelQ DiscreteUniformDistribution DiscreteVariables DiscreteWaveletData DiscreteWaveletPacketTransform DiscreteWaveletTransform Discriminant Disjunction Disk DiskBox DiskMatrix Dispatch DispersionEstimatorFunction Display DisplayAllSteps DisplayEndPacket DisplayFlushImagePacket DisplayForm DisplayFunction DisplayPacket DisplayRules DisplaySetSizePacket DisplayString DisplayTemporary DisplayWith DisplayWithRef DisplayWithVariable DistanceFunction DistanceTransform Distribute Distributed DistributedContexts DistributeDefinitions DistributionChart DistributionDomain DistributionFitTest DistributionParameterAssumptions DistributionParameterQ Dithering Div Divergence Divide DivideBy Dividers Divisible Divisors DivisorSigma DivisorSum DMSList DMSString Do DockedCells DocumentNotebook DominantColors DOSTextFormat Dot DotDashed DotEqual Dotted DoubleBracketingBar DoubleContourIntegral DoubleDownArrow DoubleLeftArrow DoubleLeftRightArrow DoubleLeftTee DoubleLongLeftArrow DoubleLongLeftRightArrow DoubleLongRightArrow DoubleRightArrow DoubleRightTee DoubleUpArrow DoubleUpDownArrow DoubleVerticalBar DoublyInfinite Down DownArrow DownArrowBar DownArrowUpArrow DownLeftRightVector DownLeftTeeVector DownLeftVector DownLeftVectorBar DownRightTeeVector DownRightVector DownRightVectorBar Downsample DownTee DownTeeArrow DownValues DragAndDrop DrawEdges DrawFrontFaces DrawHighlighted Drop DSolve Dt DualLinearProgramming DualSystemsModel DumpGet DumpSave DuplicateFreeQ Dynamic DynamicBox DynamicBoxOptions DynamicEvaluationTimeout DynamicLocation DynamicModule DynamicModuleBox DynamicModuleBoxOptions DynamicModuleParent DynamicModuleValues DynamicName DynamicNamespace DynamicReference DynamicSetting DynamicUpdating DynamicWrapper DynamicWrapperBox DynamicWrapperBoxOptions E EccentricityCentrality EdgeAdd EdgeBetweennessCentrality EdgeCapacity EdgeCapForm EdgeColor EdgeConnectivity EdgeCost EdgeCount EdgeCoverQ EdgeDashing EdgeDelete EdgeDetect EdgeForm EdgeIndex EdgeJoinForm EdgeLabeling EdgeLabels EdgeLabelStyle EdgeList EdgeOpacity EdgeQ EdgeRenderingFunction EdgeRules EdgeShapeFunction EdgeStyle EdgeThickness EdgeWeight Editable EditButtonSettings EditCellTagsSettings EditDistance EffectiveInterest Eigensystem Eigenvalues EigenvectorCentrality Eigenvectors Element ElementData Eliminate EliminationOrder EllipticE EllipticExp EllipticExpPrime EllipticF EllipticFilterModel EllipticK EllipticLog EllipticNomeQ EllipticPi EllipticReducedHalfPeriods EllipticTheta EllipticThetaPrime EmitSound EmphasizeSyntaxErrors EmpiricalDistribution Empty EmptyGraphQ EnableConsolePrintPacket Enabled Encode End EndAdd EndDialogPacket EndFrontEndInteractionPacket EndOfFile EndOfLine EndOfString EndPackage EngineeringForm Enter EnterExpressionPacket EnterTextPacket Entropy EntropyFilter Environment Epilog Equal EqualColumns EqualRows EqualTilde EquatedTo Equilibrium EquirippleFilterKernel Equivalent Erf Erfc Erfi ErlangB ErlangC ErlangDistribution Erosion ErrorBox ErrorBoxOptions ErrorNorm ErrorPacket ErrorsDialogSettings EstimatedDistribution EstimatedProcess EstimatorGains EstimatorRegulator EuclideanDistance EulerE EulerGamma EulerianGraphQ EulerPhi Evaluatable Evaluate Evaluated EvaluatePacket EvaluationCell EvaluationCompletionAction EvaluationElements EvaluationMode EvaluationMonitor EvaluationNotebook EvaluationObject EvaluationOrder Evaluator EvaluatorNames EvenQ EventData EventEvaluator EventHandler EventHandlerTag EventLabels ExactBlackmanWindow ExactNumberQ ExactRootIsolation ExampleData Except ExcludedForms ExcludePods Exclusions ExclusionsStyle Exists Exit ExitDialog Exp Expand ExpandAll ExpandDenominator ExpandFileName ExpandNumerator Expectation ExpectationE ExpectedValue ExpGammaDistribution ExpIntegralE ExpIntegralEi Exponent ExponentFunction ExponentialDistribution ExponentialFamily ExponentialGeneratingFunction ExponentialMovingAverage ExponentialPowerDistribution ExponentPosition ExponentStep Export ExportAutoReplacements ExportPacket ExportString Expression ExpressionCell ExpressionPacket ExpToTrig ExtendedGCD Extension ExtentElementFunction ExtentMarkers ExtentSize ExternalCall ExternalDataCharacterEncoding Extract ExtractArchive ExtremeValueDistribution FaceForm FaceGrids FaceGridsStyle Factor FactorComplete Factorial Factorial2 FactorialMoment FactorialMomentGeneratingFunction FactorialPower FactorInteger FactorList FactorSquareFree FactorSquareFreeList FactorTerms FactorTermsList Fail FailureDistribution False FARIMAProcess FEDisableConsolePrintPacket FeedbackSector FeedbackSectorStyle FeedbackType FEEnableConsolePrintPacket Fibonacci FieldHint FieldHintStyle FieldMasked FieldSize File FileBaseName FileByteCount FileDate FileExistsQ FileExtension FileFormat FileHash FileInformation FileName FileNameDepth FileNameDialogSettings FileNameDrop FileNameJoin FileNames FileNameSetter FileNameSplit FileNameTake FilePrint FileType FilledCurve FilledCurveBox Filling FillingStyle FillingTransform FilterRules FinancialBond FinancialData FinancialDerivative FinancialIndicator Find FindArgMax FindArgMin FindClique FindClusters FindCurvePath FindDistributionParameters FindDivisions FindEdgeCover FindEdgeCut FindEulerianCycle FindFaces FindFile FindFit FindGeneratingFunction FindGeoLocation FindGeometricTransform FindGraphCommunities FindGraphIsomorphism FindGraphPartition FindHamiltonianCycle FindIndependentEdgeSet FindIndependentVertexSet FindInstance FindIntegerNullVector FindKClan FindKClique FindKClub FindKPlex FindLibrary FindLinearRecurrence FindList FindMaximum FindMaximumFlow FindMaxValue FindMinimum FindMinimumCostFlow FindMinimumCut FindMinValue FindPermutation FindPostmanTour FindProcessParameters FindRoot FindSequenceFunction FindSettings FindShortestPath FindShortestTour FindThreshold FindVertexCover FindVertexCut Fine FinishDynamic FiniteAbelianGroupCount FiniteGroupCount FiniteGroupData First FirstPassageTimeDistribution FischerGroupFi22 FischerGroupFi23 FischerGroupFi24Prime FisherHypergeometricDistribution FisherRatioTest FisherZDistribution Fit FitAll FittedModel FixedPoint FixedPointList FlashSelection Flat Flatten FlattenAt FlatTopWindow FlipView Floor FlushPrintOutputPacket Fold FoldList Font FontColor FontFamily FontForm FontName FontOpacity FontPostScriptName FontProperties FontReencoding FontSize FontSlant FontSubstitutions FontTracking FontVariations FontWeight For ForAll Format FormatRules FormatType FormatTypeAutoConvert FormatValues FormBox FormBoxOptions FortranForm Forward ForwardBackward Fourier FourierCoefficient FourierCosCoefficient FourierCosSeries FourierCosTransform FourierDCT FourierDCTFilter FourierDCTMatrix FourierDST FourierDSTMatrix FourierMatrix FourierParameters FourierSequenceTransform FourierSeries FourierSinCoefficient FourierSinSeries FourierSinTransform FourierTransform FourierTrigSeries FractionalBrownianMotionProcess FractionalPart FractionBox FractionBoxOptions FractionLine Frame FrameBox FrameBoxOptions Framed FrameInset FrameLabel Frameless FrameMargins FrameStyle FrameTicks FrameTicksStyle FRatioDistribution FrechetDistribution FreeQ FrequencySamplingFilterKernel FresnelC FresnelS Friday FrobeniusNumber FrobeniusSolve FromCharacterCode FromCoefficientRules FromContinuedFraction FromDate FromDigits FromDMS Front FrontEndDynamicExpression FrontEndEventActions FrontEndExecute FrontEndObject FrontEndResource FrontEndResourceString FrontEndStackSize FrontEndToken FrontEndTokenExecute FrontEndValueCache FrontEndVersion FrontFaceColor FrontFaceOpacity Full FullAxes FullDefinition FullForm FullGraphics FullOptions FullSimplify Function FunctionExpand FunctionInterpolation FunctionSpace FussellVeselyImportance GaborFilter GaborMatrix GaborWavelet GainMargins GainPhaseMargins Gamma GammaDistribution GammaRegularized GapPenalty Gather GatherBy GaugeFaceElementFunction GaugeFaceStyle GaugeFrameElementFunction GaugeFrameSize GaugeFrameStyle GaugeLabels GaugeMarkers GaugeStyle GaussianFilter GaussianIntegers GaussianMatrix GaussianWindow GCD GegenbauerC General GeneralizedLinearModelFit GenerateConditions GeneratedCell GeneratedParameters GeneratingFunction Generic GenericCylindricalDecomposition GenomeData GenomeLookup GeodesicClosing GeodesicDilation GeodesicErosion GeodesicOpening GeoDestination GeodesyData GeoDirection GeoDistance GeoGridPosition GeometricBrownianMotionProcess GeometricDistribution GeometricMean GeometricMeanFilter GeometricTransformation GeometricTransformation3DBox GeometricTransformation3DBoxOptions GeometricTransformationBox GeometricTransformationBoxOptions GeoPosition GeoPositionENU GeoPositionXYZ GeoProjectionData GestureHandler GestureHandlerTag Get GetBoundingBoxSizePacket GetContext GetEnvironment GetFileName GetFrontEndOptionsDataPacket GetLinebreakInformationPacket GetMenusPacket GetPageBreakInformationPacket Glaisher GlobalClusteringCoefficient GlobalPreferences GlobalSession Glow GoldenRatio GompertzMakehamDistribution GoodmanKruskalGamma GoodmanKruskalGammaTest Goto Grad Gradient GradientFilter GradientOrientationFilter Graph GraphAssortativity GraphCenter GraphComplement GraphData GraphDensity GraphDiameter GraphDifference GraphDisjointUnion GraphDistance GraphDistanceMatrix GraphElementData GraphEmbedding GraphHighlight GraphHighlightStyle GraphHub Graphics Graphics3D Graphics3DBox Graphics3DBoxOptions GraphicsArray GraphicsBaseline GraphicsBox GraphicsBoxOptions GraphicsColor GraphicsColumn GraphicsComplex GraphicsComplex3DBox GraphicsComplex3DBoxOptions GraphicsComplexBox GraphicsComplexBoxOptions GraphicsContents GraphicsData GraphicsGrid GraphicsGridBox GraphicsGroup GraphicsGroup3DBox GraphicsGroup3DBoxOptions GraphicsGroupBox GraphicsGroupBoxOptions GraphicsGrouping GraphicsHighlightColor GraphicsRow GraphicsSpacing GraphicsStyle GraphIntersection GraphLayout GraphLinkEfficiency GraphPeriphery GraphPlot GraphPlot3D GraphPower GraphPropertyDistribution GraphQ GraphRadius GraphReciprocity GraphRoot GraphStyle GraphUnion Gray GrayLevel GreatCircleDistance Greater GreaterEqual GreaterEqualLess GreaterFullEqual GreaterGreater GreaterLess GreaterSlantEqual GreaterTilde Green Grid GridBaseline GridBox GridBoxAlignment GridBoxBackground GridBoxDividers GridBoxFrame GridBoxItemSize GridBoxItemStyle GridBoxOptions GridBoxSpacings GridCreationSettings GridDefaultElement GridElementStyleOptions GridFrame GridFrameMargins GridGraph GridLines GridLinesStyle GroebnerBasis GroupActionBase GroupCentralizer GroupElementFromWord GroupElementPosition GroupElementQ GroupElements GroupElementToWord GroupGenerators GroupMultiplicationTable GroupOrbits GroupOrder GroupPageBreakWithin GroupSetwiseStabilizer GroupStabilizer GroupStabilizerChain Gudermannian GumbelDistribution HaarWavelet HadamardMatrix HalfNormalDistribution HamiltonianGraphQ HammingDistance HammingWindow HankelH1 HankelH2 HankelMatrix HannPoissonWindow HannWindow HaradaNortonGroupHN HararyGraph HarmonicMean HarmonicMeanFilter HarmonicNumber Hash HashTable Haversine HazardFunction Head HeadCompose Heads HeavisideLambda HeavisidePi HeavisideTheta HeldGroupHe HeldPart HelpBrowserLookup HelpBrowserNotebook HelpBrowserSettings HermiteDecomposition HermiteH HermitianMatrixQ HessenbergDecomposition Hessian HexadecimalCharacter Hexahedron HexahedronBox HexahedronBoxOptions HiddenSurface HighlightGraph HighlightImage HighpassFilter HigmanSimsGroupHS HilbertFilter HilbertMatrix Histogram Histogram3D HistogramDistribution HistogramList HistogramTransform HistogramTransformInterpolation HitMissTransform HITSCentrality HodgeDual HoeffdingD HoeffdingDTest Hold HoldAll HoldAllComplete HoldComplete HoldFirst HoldForm HoldPattern HoldRest HolidayCalendar HomeDirectory HomePage Horizontal HorizontalForm HorizontalGauge HorizontalScrollPosition HornerForm HotellingTSquareDistribution HoytDistribution HTMLSave Hue HumpDownHump HumpEqual HurwitzLerchPhi HurwitzZeta HyperbolicDistribution HypercubeGraph HyperexponentialDistribution Hyperfactorial Hypergeometric0F1 Hypergeometric0F1Regularized Hypergeometric1F1 Hypergeometric1F1Regularized Hypergeometric2F1 Hypergeometric2F1Regularized HypergeometricDistribution HypergeometricPFQ HypergeometricPFQRegularized HypergeometricU Hyperlink HyperlinkCreationSettings Hyphenation HyphenationOptions HypoexponentialDistribution HypothesisTestData I Identity IdentityMatrix If IgnoreCase Im Image Image3D Image3DSlices ImageAccumulate ImageAdd ImageAdjust ImageAlign ImageApply ImageAspectRatio ImageAssemble ImageCache ImageCacheValid ImageCapture ImageChannels ImageClip ImageColorSpace ImageCompose ImageConvolve ImageCooccurrence ImageCorners ImageCorrelate ImageCorrespondingPoints ImageCrop ImageData ImageDataPacket ImageDeconvolve ImageDemosaic ImageDifference ImageDimensions ImageDistance ImageEffect ImageFeatureTrack ImageFileApply ImageFileFilter ImageFileScan ImageFilter ImageForestingComponents ImageForwardTransformation ImageHistogram ImageKeypoints ImageLevels ImageLines ImageMargins ImageMarkers ImageMeasurements ImageMultiply ImageOffset ImagePad ImagePadding ImagePartition ImagePeriodogram ImagePerspectiveTransformation ImageQ ImageRangeCache ImageReflect ImageRegion ImageResize ImageResolution ImageRotate ImageRotated ImageScaled ImageScan ImageSize ImageSizeAction ImageSizeCache ImageSizeMultipliers ImageSizeRaw ImageSubtract ImageTake ImageTransformation ImageTrim ImageType ImageValue ImageValuePositions Implies Import ImportAutoReplacements ImportString ImprovementImportance In IncidenceGraph IncidenceList IncidenceMatrix IncludeConstantBasis IncludeFileExtension IncludePods IncludeSingularTerm Increment Indent IndentingNewlineSpacings IndentMaxFraction IndependenceTest IndependentEdgeSetQ IndependentUnit IndependentVertexSetQ Indeterminate IndexCreationOptions Indexed IndexGraph IndexTag Inequality InexactNumberQ InexactNumbers Infinity Infix Information Inherited InheritScope Initialization InitializationCell InitializationCellEvaluation InitializationCellWarning InlineCounterAssignments InlineCounterIncrements InlineRules Inner Inpaint Input InputAliases InputAssumptions InputAutoReplacements InputField InputFieldBox InputFieldBoxOptions InputForm InputGrouping InputNamePacket InputNotebook InputPacket InputSettings InputStream InputString InputStringPacket InputToBoxFormPacket Insert InsertionPointObject InsertResults Inset Inset3DBox Inset3DBoxOptions InsetBox InsetBoxOptions Install InstallService InString Integer IntegerDigits IntegerExponent IntegerLength IntegerPart IntegerPartitions IntegerQ Integers IntegerString Integral Integrate Interactive InteractiveTradingChart Interlaced Interleaving InternallyBalancedDecomposition InterpolatingFunction InterpolatingPolynomial Interpolation InterpolationOrder InterpolationPoints InterpolationPrecision Interpretation InterpretationBox InterpretationBoxOptions InterpretationFunction InterpretTemplate InterquartileRange Interrupt InterruptSettings Intersection Interval IntervalIntersection IntervalMemberQ IntervalUnion Inverse InverseBetaRegularized InverseCDF InverseChiSquareDistribution InverseContinuousWaveletTransform InverseDistanceTransform InverseEllipticNomeQ InverseErf InverseErfc InverseFourier InverseFourierCosTransform InverseFourierSequenceTransform InverseFourierSinTransform InverseFourierTransform InverseFunction InverseFunctions InverseGammaDistribution InverseGammaRegularized InverseGaussianDistribution InverseGudermannian InverseHaversine InverseJacobiCD InverseJacobiCN InverseJacobiCS InverseJacobiDC InverseJacobiDN InverseJacobiDS InverseJacobiNC InverseJacobiND InverseJacobiNS InverseJacobiSC InverseJacobiSD InverseJacobiSN InverseLaplaceTransform InversePermutation InverseRadon InverseSeries InverseSurvivalFunction InverseWaveletTransform InverseWeierstrassP InverseZTransform Invisible InvisibleApplication InvisibleTimes IrreduciblePolynomialQ IsolatingInterval IsomorphicGraphQ IsotopeData Italic Item ItemBox ItemBoxOptions ItemSize ItemStyle ItoProcess JaccardDissimilarity JacobiAmplitude Jacobian JacobiCD JacobiCN JacobiCS JacobiDC JacobiDN JacobiDS JacobiNC JacobiND JacobiNS JacobiP JacobiSC JacobiSD JacobiSN JacobiSymbol JacobiZeta JankoGroupJ1 JankoGroupJ2 JankoGroupJ3 JankoGroupJ4 JarqueBeraALMTest JohnsonDistribution Join Joined JoinedCurve JoinedCurveBox JoinForm JordanDecomposition JordanModelDecomposition K KagiChart KaiserBesselWindow KaiserWindow KalmanEstimator KalmanFilter KarhunenLoeveDecomposition KaryTree KatzCentrality KCoreComponents KDistribution KelvinBei KelvinBer KelvinKei KelvinKer KendallTau KendallTauTest KernelExecute KernelMixtureDistribution KernelObject Kernels Ket Khinchin KirchhoffGraph KirchhoffMatrix KleinInvariantJ KnightTourGraph KnotData KnownUnitQ KolmogorovSmirnovTest KroneckerDelta KroneckerModelDecomposition KroneckerProduct KroneckerSymbol KuiperTest KumaraswamyDistribution Kurtosis KuwaharaFilter Label Labeled LabeledSlider LabelingFunction LabelStyle LaguerreL LambdaComponents LambertW LanczosWindow LandauDistribution Language LanguageCategory LaplaceDistribution LaplaceTransform Laplacian LaplacianFilter LaplacianGaussianFilter Large Larger Last Latitude LatitudeLongitude LatticeData LatticeReduce Launch LaunchKernels LayeredGraphPlot LayerSizeFunction LayoutInformation LCM LeafCount LeapYearQ LeastSquares LeastSquaresFilterKernel Left LeftArrow LeftArrowBar LeftArrowRightArrow LeftDownTeeVector LeftDownVector LeftDownVectorBar LeftRightArrow LeftRightVector LeftTee LeftTeeArrow LeftTeeVector LeftTriangle LeftTriangleBar LeftTriangleEqual LeftUpDownVector LeftUpTeeVector LeftUpVector LeftUpVectorBar LeftVector LeftVectorBar LegendAppearance Legended LegendFunction LegendLabel LegendLayout LegendMargins LegendMarkers LegendMarkerSize LegendreP LegendreQ LegendreType Length LengthWhile LerchPhi Less LessEqual LessEqualGreater LessFullEqual LessGreater LessLess LessSlantEqual LessTilde LetterCharacter LetterQ Level LeveneTest LeviCivitaTensor LevyDistribution Lexicographic LibraryFunction LibraryFunctionError LibraryFunctionInformation LibraryFunctionLoad LibraryFunctionUnload LibraryLoad LibraryUnload LicenseID LiftingFilterData LiftingWaveletTransform LightBlue LightBrown LightCyan Lighter LightGray LightGreen Lighting LightingAngle LightMagenta LightOrange LightPink LightPurple LightRed LightSources LightYellow Likelihood Limit LimitsPositioning LimitsPositioningTokens LindleyDistribution Line Line3DBox LinearFilter LinearFractionalTransform LinearModelFit LinearOffsetFunction LinearProgramming LinearRecurrence LinearSolve LinearSolveFunction LineBox LineBreak LinebreakAdjustments LineBreakChart LineBreakWithin LineColor LineForm LineGraph LineIndent LineIndentMaxFraction LineIntegralConvolutionPlot LineIntegralConvolutionScale LineLegend LineOpacity LineSpacing LineWrapParts LinkActivate LinkClose LinkConnect LinkConnectedQ LinkCreate LinkError LinkFlush LinkFunction LinkHost LinkInterrupt LinkLaunch LinkMode LinkObject LinkOpen LinkOptions LinkPatterns LinkProtocol LinkRead LinkReadHeld LinkReadyQ Links LinkWrite LinkWriteHeld LiouvilleLambda List Listable ListAnimate ListContourPlot ListContourPlot3D ListConvolve ListCorrelate ListCurvePathPlot ListDeconvolve ListDensityPlot Listen ListFourierSequenceTransform ListInterpolation ListLineIntegralConvolutionPlot ListLinePlot ListLogLinearPlot ListLogLogPlot ListLogPlot ListPicker ListPickerBox ListPickerBoxBackground ListPickerBoxOptions ListPlay ListPlot ListPlot3D ListPointPlot3D ListPolarPlot ListQ ListStreamDensityPlot ListStreamPlot ListSurfacePlot3D ListVectorDensityPlot ListVectorPlot ListVectorPlot3D ListZTransform Literal LiteralSearch LocalClusteringCoefficient LocalizeVariables LocationEquivalenceTest LocationTest Locator LocatorAutoCreate LocatorBox LocatorBoxOptions LocatorCentering LocatorPane LocatorPaneBox LocatorPaneBoxOptions LocatorRegion Locked Log Log10 Log2 LogBarnesG LogGamma LogGammaDistribution LogicalExpand LogIntegral LogisticDistribution LogitModelFit LogLikelihood LogLinearPlot LogLogisticDistribution LogLogPlot LogMultinormalDistribution LogNormalDistribution LogPlot LogRankTest LogSeriesDistribution LongEqual Longest LongestAscendingSequence LongestCommonSequence LongestCommonSequencePositions LongestCommonSubsequence LongestCommonSubsequencePositions LongestMatch LongForm Longitude LongLeftArrow LongLeftRightArrow LongRightArrow Loopback LoopFreeGraphQ LowerCaseQ LowerLeftArrow LowerRightArrow LowerTriangularize LowpassFilter LQEstimatorGains LQGRegulator LQOutputRegulatorGains LQRegulatorGains LUBackSubstitution LucasL LuccioSamiComponents LUDecomposition LyapunovSolve LyonsGroupLy MachineID MachineName MachineNumberQ MachinePrecision MacintoshSystemPageSetup Magenta Magnification Magnify MainSolve MaintainDynamicCaches Majority MakeBoxes MakeExpression MakeRules MangoldtLambda ManhattanDistance Manipulate Manipulator MannWhitneyTest MantissaExponent Manual Map MapAll MapAt MapIndexed MAProcess MapThread MarcumQ MardiaCombinedTest MardiaKurtosisTest MardiaSkewnessTest MarginalDistribution MarkovProcessProperties Masking MatchingDissimilarity MatchLocalNameQ MatchLocalNames MatchQ Material MathematicaNotation MathieuC MathieuCharacteristicA MathieuCharacteristicB MathieuCharacteristicExponent MathieuCPrime MathieuGroupM11 MathieuGroupM12 MathieuGroupM22 MathieuGroupM23 MathieuGroupM24 MathieuS MathieuSPrime MathMLForm MathMLText Matrices MatrixExp MatrixForm MatrixFunction MatrixLog MatrixPlot MatrixPower MatrixQ MatrixRank Max MaxBend MaxDetect MaxExtraBandwidths MaxExtraConditions MaxFeatures MaxFilter Maximize MaxIterations MaxMemoryUsed MaxMixtureKernels MaxPlotPoints MaxPoints MaxRecursion MaxStableDistribution MaxStepFraction MaxSteps MaxStepSize MaxValue MaxwellDistribution McLaughlinGroupMcL Mean MeanClusteringCoefficient MeanDegreeConnectivity MeanDeviation MeanFilter MeanGraphDistance MeanNeighborDegree MeanShift MeanShiftFilter Median MedianDeviation MedianFilter Medium MeijerG MeixnerDistribution MemberQ MemoryConstrained MemoryInUse Menu MenuAppearance MenuCommandKey MenuEvaluator MenuItem MenuPacket MenuSortingValue MenuStyle MenuView MergeDifferences Mesh MeshFunctions MeshRange MeshShading MeshStyle Message MessageDialog MessageList MessageName MessageOptions MessagePacket Messages MessagesNotebook MetaCharacters MetaInformation Method MethodOptions MexicanHatWavelet MeyerWavelet Min MinDetect MinFilter MinimalPolynomial MinimalStateSpaceModel Minimize Minors MinRecursion MinSize MinStableDistribution Minus MinusPlus MinValue Missing MissingDataMethod MittagLefflerE MixedRadix MixedRadixQuantity MixtureDistribution Mod Modal Mode Modular ModularLambda Module Modulus MoebiusMu Moment Momentary MomentConvert MomentEvaluate MomentGeneratingFunction Monday Monitor MonomialList MonomialOrder MonsterGroupM MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform Most MouseAnnotation MouseAppearance MouseAppearanceTag MouseButtons Mouseover MousePointerNote MousePosition MovingAverage MovingMedian MoyalDistribution MultiedgeStyle MultilaunchWarning MultiLetterItalics MultiLetterStyle MultilineFunction Multinomial MultinomialDistribution MultinormalDistribution MultiplicativeOrder Multiplicity Multiselection MultivariateHypergeometricDistribution MultivariatePoissonDistribution MultivariateTDistribution N NakagamiDistribution NameQ Names NamespaceBox Nand NArgMax NArgMin NBernoulliB NCache NDSolve NDSolveValue Nearest NearestFunction NeedCurrentFrontEndPackagePacket NeedCurrentFrontEndSymbolsPacket NeedlemanWunschSimilarity Needs Negative NegativeBinomialDistribution NegativeMultinomialDistribution NeighborhoodGraph Nest NestedGreaterGreater NestedLessLess NestedScriptRules NestList NestWhile NestWhileList NevilleThetaC NevilleThetaD NevilleThetaN NevilleThetaS NewPrimitiveStyle NExpectation Next NextPrime NHoldAll NHoldFirst NHoldRest NicholsGridLines NicholsPlot NIntegrate NMaximize NMaxValue NMinimize NMinValue NominalVariables NonAssociative NoncentralBetaDistribution NoncentralChiSquareDistribution NoncentralFRatioDistribution NoncentralStudentTDistribution NonCommutativeMultiply NonConstants None NonlinearModelFit NonlocalMeansFilter NonNegative NonPositive Nor NorlundB Norm Normal NormalDistribution NormalGrouping Normalize NormalizedSquaredEuclideanDistance NormalsFunction NormFunction Not NotCongruent NotCupCap NotDoubleVerticalBar Notebook NotebookApply NotebookAutoSave NotebookClose NotebookConvertSettings NotebookCreate NotebookCreateReturnObject NotebookDefault NotebookDelete NotebookDirectory NotebookDynamicExpression NotebookEvaluate NotebookEventActions NotebookFileName NotebookFind NotebookFindReturnObject NotebookGet NotebookGetLayoutInformationPacket NotebookGetMisspellingsPacket NotebookInformation NotebookInterfaceObject NotebookLocate NotebookObject NotebookOpen NotebookOpenReturnObject NotebookPath NotebookPrint NotebookPut NotebookPutReturnObject NotebookRead NotebookResetGeneratedCells Notebooks NotebookSave NotebookSaveAs NotebookSelection NotebookSetupLayoutInformationPacket NotebooksMenu NotebookWrite NotElement NotEqualTilde NotExists NotGreater NotGreaterEqual NotGreaterFullEqual NotGreaterGreater NotGreaterLess NotGreaterSlantEqual NotGreaterTilde NotHumpDownHump NotHumpEqual NotLeftTriangle NotLeftTriangleBar NotLeftTriangleEqual NotLess NotLessEqual NotLessFullEqual NotLessGreater NotLessLess NotLessSlantEqual NotLessTilde NotNestedGreaterGreater NotNestedLessLess NotPrecedes NotPrecedesEqual NotPrecedesSlantEqual NotPrecedesTilde NotReverseElement NotRightTriangle NotRightTriangleBar NotRightTriangleEqual NotSquareSubset NotSquareSubsetEqual NotSquareSuperset NotSquareSupersetEqual NotSubset NotSubsetEqual NotSucceeds NotSucceedsEqual NotSucceedsSlantEqual NotSucceedsTilde NotSuperset NotSupersetEqual NotTilde NotTildeEqual NotTildeFullEqual NotTildeTilde NotVerticalBar NProbability NProduct NProductFactors NRoots NSolve NSum NSumTerms Null NullRecords NullSpace NullWords Number NumberFieldClassNumber NumberFieldDiscriminant NumberFieldFundamentalUnits NumberFieldIntegralBasis NumberFieldNormRepresentatives NumberFieldRegulator NumberFieldRootsOfUnity NumberFieldSignature NumberForm NumberFormat NumberMarks NumberMultiplier NumberPadding NumberPoint NumberQ NumberSeparator NumberSigns NumberString Numerator NumericFunction NumericQ NuttallWindow NValues NyquistGridLines NyquistPlot O ObservabilityGramian ObservabilityMatrix ObservableDecomposition ObservableModelQ OddQ Off Offset OLEData On ONanGroupON OneIdentity Opacity Open OpenAppend Opener OpenerBox OpenerBoxOptions OpenerView OpenFunctionInspectorPacket Opening OpenRead OpenSpecialOptions OpenTemporary OpenWrite Operate OperatingSystem OptimumFlowData Optional OptionInspectorSettings OptionQ Options OptionsPacket OptionsPattern OptionValue OptionValueBox OptionValueBoxOptions Or Orange Order OrderDistribution OrderedQ Ordering Orderless OrnsteinUhlenbeckProcess Orthogonalize Out Outer OutputAutoOverwrite OutputControllabilityMatrix OutputControllableModelQ OutputForm OutputFormData OutputGrouping OutputMathEditExpression OutputNamePacket OutputResponse OutputSizeLimit OutputStream Over OverBar OverDot Overflow OverHat Overlaps Overlay OverlayBox OverlayBoxOptions Overscript OverscriptBox OverscriptBoxOptions OverTilde OverVector OwenT OwnValues PackingMethod PaddedForm Padding PadeApproximant PadLeft PadRight PageBreakAbove PageBreakBelow PageBreakWithin PageFooterLines PageFooters PageHeaderLines PageHeaders PageHeight PageRankCentrality PageWidth PairedBarChart PairedHistogram PairedSmoothHistogram PairedTTest PairedZTest PaletteNotebook PalettePath Pane PaneBox PaneBoxOptions Panel PanelBox PanelBoxOptions Paneled PaneSelector PaneSelectorBox PaneSelectorBoxOptions PaperWidth ParabolicCylinderD ParagraphIndent ParagraphSpacing ParallelArray ParallelCombine ParallelDo ParallelEvaluate Parallelization Parallelize ParallelMap ParallelNeeds ParallelProduct ParallelSubmit ParallelSum ParallelTable ParallelTry Parameter ParameterEstimator ParameterMixtureDistribution ParameterVariables ParametricFunction ParametricNDSolve ParametricNDSolveValue ParametricPlot ParametricPlot3D ParentConnect ParentDirectory ParentForm Parenthesize ParentList ParetoDistribution Part PartialCorrelationFunction PartialD ParticleData Partition PartitionsP PartitionsQ ParzenWindow PascalDistribution PassEventsDown PassEventsUp Paste PasteBoxFormInlineCells PasteButton Path PathGraph PathGraphQ Pattern PatternSequence PatternTest PauliMatrix PaulWavelet Pause PausedTime PDF PearsonChiSquareTest PearsonCorrelationTest PearsonDistribution PerformanceGoal PeriodicInterpolation Periodogram PeriodogramArray PermutationCycles PermutationCyclesQ PermutationGroup PermutationLength PermutationList PermutationListQ PermutationMax PermutationMin PermutationOrder PermutationPower PermutationProduct PermutationReplace Permutations PermutationSupport Permute PeronaMalikFilter Perpendicular PERTDistribution PetersenGraph PhaseMargins Pi Pick PIDData PIDDerivativeFilter PIDFeedforward PIDTune Piecewise PiecewiseExpand PieChart PieChart3D PillaiTrace PillaiTraceTest Pink Pivoting PixelConstrained PixelValue PixelValuePositions Placed Placeholder PlaceholderReplace Plain PlanarGraphQ Play PlayRange Plot Plot3D Plot3Matrix PlotDivision PlotJoined PlotLabel PlotLayout PlotLegends PlotMarkers PlotPoints PlotRange PlotRangeClipping PlotRangePadding PlotRegion PlotStyle Plus PlusMinus Pochhammer PodStates PodWidth Point Point3DBox PointBox PointFigureChart PointForm PointLegend PointSize PoissonConsulDistribution PoissonDistribution PoissonProcess PoissonWindow PolarAxes PolarAxesOrigin PolarGridLines PolarPlot PolarTicks PoleZeroMarkers PolyaAeppliDistribution PolyGamma Polygon Polygon3DBox Polygon3DBoxOptions PolygonBox PolygonBoxOptions PolygonHoleScale PolygonIntersections PolygonScale PolyhedronData PolyLog PolynomialExtendedGCD PolynomialForm PolynomialGCD PolynomialLCM PolynomialMod PolynomialQ PolynomialQuotient PolynomialQuotientRemainder PolynomialReduce PolynomialRemainder Polynomials PopupMenu PopupMenuBox PopupMenuBoxOptions PopupView PopupWindow Position Positive PositiveDefiniteMatrixQ PossibleZeroQ Postfix PostScript Power PowerDistribution PowerExpand PowerMod PowerModList PowerSpectralDensity PowersRepresentations PowerSymmetricPolynomial Precedence PrecedenceForm Precedes PrecedesEqual PrecedesSlantEqual PrecedesTilde Precision PrecisionGoal PreDecrement PredictionRoot PreemptProtect PreferencesPath Prefix PreIncrement Prepend PrependTo PreserveImageOptions Previous PriceGraphDistribution PrimaryPlaceholder Prime PrimeNu PrimeOmega PrimePi PrimePowerQ PrimeQ Primes PrimeZetaP PrimitiveRoot PrincipalComponents PrincipalValue Print PrintAction PrintForm PrintingCopies PrintingOptions PrintingPageRange PrintingStartingPageNumber PrintingStyleEnvironment PrintPrecision PrintTemporary Prism PrismBox PrismBoxOptions PrivateCellOptions PrivateEvaluationOptions PrivateFontOptions PrivateFrontEndOptions PrivateNotebookOptions PrivatePaths Probability ProbabilityDistribution ProbabilityPlot ProbabilityPr ProbabilityScalePlot ProbitModelFit ProcessEstimator ProcessParameterAssumptions ProcessParameterQ ProcessStateDomain ProcessTimeDomain Product ProductDistribution ProductLog ProgressIndicator ProgressIndicatorBox ProgressIndicatorBoxOptions Projection Prolog PromptForm Properties Property PropertyList PropertyValue Proportion Proportional Protect Protected ProteinData Pruning PseudoInverse Purple Put PutAppend Pyramid PyramidBox PyramidBoxOptions QBinomial QFactorial QGamma QHypergeometricPFQ QPochhammer QPolyGamma QRDecomposition QuadraticIrrationalQ Quantile QuantilePlot Quantity QuantityForm QuantityMagnitude QuantityQ QuantityUnit Quartics QuartileDeviation Quartiles QuartileSkewness QueueingNetworkProcess QueueingProcess QueueProperties Quiet Quit Quotient QuotientRemainder RadialityCentrality RadicalBox RadicalBoxOptions RadioButton RadioButtonBar RadioButtonBox RadioButtonBoxOptions Radon RamanujanTau RamanujanTauL RamanujanTauTheta RamanujanTauZ Random RandomChoice RandomComplex RandomFunction RandomGraph RandomImage RandomInteger RandomPermutation RandomPrime RandomReal RandomSample RandomSeed RandomVariate RandomWalkProcess Range RangeFilter RangeSpecification RankedMax RankedMin Raster Raster3D Raster3DBox Raster3DBoxOptions RasterArray RasterBox RasterBoxOptions Rasterize RasterSize Rational RationalFunctions Rationalize Rationals Ratios Raw RawArray RawBoxes RawData RawMedium RayleighDistribution Re Read ReadList ReadProtected Real RealBlockDiagonalForm RealDigits RealExponent Reals Reap Record RecordLists RecordSeparators Rectangle RectangleBox RectangleBoxOptions RectangleChart RectangleChart3D RecurrenceFilter RecurrenceTable RecurringDigitsForm Red Reduce RefBox ReferenceLineStyle ReferenceMarkers ReferenceMarkerStyle Refine ReflectionMatrix ReflectionTransform Refresh RefreshRate RegionBinarize RegionFunction RegionPlot RegionPlot3D RegularExpression Regularization Reinstall Release ReleaseHold ReliabilityDistribution ReliefImage ReliefPlot Remove RemoveAlphaChannel RemoveAsynchronousTask Removed RemoveInputStreamMethod RemoveOutputStreamMethod RemoveProperty RemoveScheduledTask RenameDirectory RenameFile RenderAll RenderingOptions RenewalProcess RenkoChart Repeated RepeatedNull RepeatedString Replace ReplaceAll ReplaceHeldPart ReplaceImageValue ReplaceList ReplacePart ReplacePixelValue ReplaceRepeated Resampling Rescale RescalingTransform ResetDirectory ResetMenusPacket ResetScheduledTask Residue Resolve Rest Resultant ResumePacket Return ReturnExpressionPacket ReturnInputFormPacket ReturnPacket ReturnTextPacket Reverse ReverseBiorthogonalSplineWavelet ReverseElement ReverseEquilibrium ReverseGraph ReverseUpEquilibrium RevolutionAxis RevolutionPlot3D RGBColor RiccatiSolve RiceDistribution RidgeFilter RiemannR RiemannSiegelTheta RiemannSiegelZ Riffle Right RightArrow RightArrowBar RightArrowLeftArrow RightCosetRepresentative RightDownTeeVector RightDownVector RightDownVectorBar RightTee RightTeeArrow RightTeeVector RightTriangle RightTriangleBar RightTriangleEqual RightUpDownVector RightUpTeeVector RightUpVector RightUpVectorBar RightVector RightVectorBar RiskAchievementImportance RiskReductionImportance RogersTanimotoDissimilarity Root RootApproximant RootIntervals RootLocusPlot RootMeanSquare RootOfUnityQ RootReduce Roots RootSum Rotate RotateLabel RotateLeft RotateRight RotationAction RotationBox RotationBoxOptions RotationMatrix RotationTransform Round RoundImplies RoundingRadius Row RowAlignments RowBackgrounds RowBox RowHeights RowLines RowMinHeight RowReduce RowsEqual RowSpacings RSolve RudvalisGroupRu Rule RuleCondition RuleDelayed RuleForm RulerUnits Run RunScheduledTask RunThrough RuntimeAttributes RuntimeOptions RussellRaoDissimilarity SameQ SameTest SampleDepth SampledSoundFunction SampledSoundList SampleRate SamplingPeriod SARIMAProcess SARMAProcess SatisfiabilityCount SatisfiabilityInstances SatisfiableQ Saturday Save Saveable SaveAutoDelete SaveDefinitions SawtoothWave Scale Scaled ScaleDivisions ScaledMousePosition ScaleOrigin ScalePadding ScaleRanges ScaleRangeStyle ScalingFunctions ScalingMatrix ScalingTransform Scan ScheduledTaskActiveQ ScheduledTaskData ScheduledTaskObject ScheduledTasks SchurDecomposition ScientificForm ScreenRectangle ScreenStyleEnvironment ScriptBaselineShifts ScriptLevel ScriptMinSize ScriptRules ScriptSizeMultipliers Scrollbars ScrollingOptions ScrollPosition Sec Sech SechDistribution SectionGrouping SectorChart SectorChart3D SectorOrigin SectorSpacing SeedRandom Select Selectable SelectComponents SelectedCells SelectedNotebook Selection SelectionAnimate SelectionCell SelectionCellCreateCell SelectionCellDefaultStyle SelectionCellParentStyle SelectionCreateCell SelectionDebuggerTag SelectionDuplicateCell SelectionEvaluate SelectionEvaluateCreateCell SelectionMove SelectionPlaceholder SelectionSetStyle SelectWithContents SelfLoops SelfLoopStyle SemialgebraicComponentInstances SendMail Sequence SequenceAlignment SequenceForm SequenceHold SequenceLimit Series SeriesCoefficient SeriesData SessionTime Set SetAccuracy SetAlphaChannel SetAttributes Setbacks SetBoxFormNamesPacket SetDelayed SetDirectory SetEnvironment SetEvaluationNotebook SetFileDate SetFileLoadingContext SetNotebookStatusLine SetOptions SetOptionsPacket SetPrecision SetProperty SetSelectedNotebook SetSharedFunction SetSharedVariable SetSpeechParametersPacket SetStreamPosition SetSystemOptions Setter SetterBar SetterBox SetterBoxOptions Setting SetValue Shading Shallow ShannonWavelet ShapiroWilkTest Share Sharpen ShearingMatrix ShearingTransform ShenCastanMatrix Short ShortDownArrow Shortest ShortestMatch ShortestPathFunction ShortLeftArrow ShortRightArrow ShortUpArrow Show ShowAutoStyles ShowCellBracket ShowCellLabel ShowCellTags ShowClosedCellArea ShowContents ShowControls ShowCursorTracker ShowGroupOpenCloseIcon ShowGroupOpener ShowInvisibleCharacters ShowPageBreaks ShowPredictiveInterface ShowSelection ShowShortBoxForm ShowSpecialCharacters ShowStringCharacters ShowSyntaxStyles ShrinkingDelay ShrinkWrapBoundingBox SiegelTheta SiegelTukeyTest Sign Signature SignedRankTest SignificanceLevel SignPadding SignTest SimilarityRules SimpleGraph SimpleGraphQ Simplify Sin Sinc SinghMaddalaDistribution SingleEvaluation SingleLetterItalics SingleLetterStyle SingularValueDecomposition SingularValueList SingularValuePlot SingularValues Sinh SinhIntegral SinIntegral SixJSymbol Skeleton SkeletonTransform SkellamDistribution Skewness SkewNormalDistribution Skip SliceDistribution Slider Slider2D Slider2DBox Slider2DBoxOptions SliderBox SliderBoxOptions SlideView Slot SlotSequence Small SmallCircle Smaller SmithDelayCompensator SmithWatermanSimilarity SmoothDensityHistogram SmoothHistogram SmoothHistogram3D SmoothKernelDistribution SocialMediaData Socket SokalSneathDissimilarity Solve SolveAlways SolveDelayed Sort SortBy Sound SoundAndGraphics SoundNote SoundVolume Sow Space SpaceForm Spacer Spacings Span SpanAdjustments SpanCharacterRounding SpanFromAbove SpanFromBoth SpanFromLeft SpanLineThickness SpanMaxSize SpanMinSize SpanningCharacters SpanSymmetric SparseArray SpatialGraphDistribution Speak SpeakTextPacket SpearmanRankTest SpearmanRho Spectrogram SpectrogramArray Specularity SpellingCorrection SpellingDictionaries SpellingDictionariesPath SpellingOptions SpellingSuggestionsPacket Sphere SphereBox SphericalBesselJ SphericalBesselY SphericalHankelH1 SphericalHankelH2 SphericalHarmonicY SphericalPlot3D SphericalRegion SpheroidalEigenvalue SpheroidalJoiningFactor SpheroidalPS SpheroidalPSPrime SpheroidalQS SpheroidalQSPrime SpheroidalRadialFactor SpheroidalS1 SpheroidalS1Prime SpheroidalS2 SpheroidalS2Prime Splice SplicedDistribution SplineClosed SplineDegree SplineKnots SplineWeights Split SplitBy SpokenString Sqrt SqrtBox SqrtBoxOptions Square SquaredEuclideanDistance SquareFreeQ SquareIntersection SquaresR SquareSubset SquareSubsetEqual SquareSuperset SquareSupersetEqual SquareUnion SquareWave StabilityMargins StabilityMarginsStyle StableDistribution Stack StackBegin StackComplete StackInhibit StandardDeviation StandardDeviationFilter StandardForm Standardize StandbyDistribution Star StarGraph StartAsynchronousTask StartingStepSize StartOfLine StartOfString StartScheduledTask StartupSound StateDimensions StateFeedbackGains StateOutputEstimator StateResponse StateSpaceModel StateSpaceRealization StateSpaceTransform StationaryDistribution StationaryWaveletPacketTransform StationaryWaveletTransform StatusArea StatusCentrality StepMonitor StieltjesGamma StirlingS1 StirlingS2 StopAsynchronousTask StopScheduledTask StrataVariables StratonovichProcess StreamColorFunction StreamColorFunctionScaling StreamDensityPlot StreamPlot StreamPoints StreamPosition Streams StreamScale StreamStyle String StringBreak StringByteCount StringCases StringCount StringDrop StringExpression StringForm StringFormat StringFreeQ StringInsert StringJoin StringLength StringMatchQ StringPosition StringQ StringReplace StringReplaceList StringReplacePart StringReverse StringRotateLeft StringRotateRight StringSkeleton StringSplit StringTake StringToStream StringTrim StripBoxes StripOnInput StripWrapperBoxes StrokeForm StructuralImportance StructuredArray StructuredSelection StruveH StruveL Stub StudentTDistribution Style StyleBox StyleBoxAutoDelete StyleBoxOptions StyleData StyleDefinitions StyleForm StyleKeyMapping StyleMenuListing StyleNameDialogSettings StyleNames StylePrint StyleSheetPath Subfactorial Subgraph SubMinus SubPlus SubresultantPolynomialRemainders SubresultantPolynomials Subresultants Subscript SubscriptBox SubscriptBoxOptions Subscripted Subset SubsetEqual Subsets SubStar Subsuperscript SubsuperscriptBox SubsuperscriptBoxOptions Subtract SubtractFrom SubValues Succeeds SucceedsEqual SucceedsSlantEqual SucceedsTilde SuchThat Sum SumConvergence Sunday SuperDagger SuperMinus SuperPlus Superscript SuperscriptBox SuperscriptBoxOptions Superset SupersetEqual SuperStar Surd SurdForm SurfaceColor SurfaceGraphics SurvivalDistribution SurvivalFunction SurvivalModel SurvivalModelFit SuspendPacket SuzukiDistribution SuzukiGroupSuz SwatchLegend Switch Symbol SymbolName SymletWavelet Symmetric SymmetricGroup SymmetricMatrixQ SymmetricPolynomial SymmetricReduction Symmetrize SymmetrizedArray SymmetrizedArrayRules SymmetrizedDependentComponents SymmetrizedIndependentComponents SymmetrizedReplacePart SynchronousInitialization SynchronousUpdating Syntax SyntaxForm SyntaxInformation SyntaxLength SyntaxPacket SyntaxQ SystemDialogInput SystemException SystemHelpPath SystemInformation SystemInformationData SystemOpen SystemOptions SystemsModelDelay SystemsModelDelayApproximate SystemsModelDelete SystemsModelDimensions SystemsModelExtract SystemsModelFeedbackConnect SystemsModelLabels SystemsModelOrder SystemsModelParallelConnect SystemsModelSeriesConnect SystemsModelStateFeedbackConnect SystemStub Tab TabFilling Table TableAlignments TableDepth TableDirections TableForm TableHeadings TableSpacing TableView TableViewBox TabSpacings TabView TabViewBox TabViewBoxOptions TagBox TagBoxNote TagBoxOptions TaggingRules TagSet TagSetDelayed TagStyle TagUnset Take TakeWhile Tally Tan Tanh TargetFunctions TargetUnits TautologyQ TelegraphProcess TemplateBox TemplateBoxOptions TemplateSlotSequence TemporalData Temporary TemporaryVariable TensorContract TensorDimensions TensorExpand TensorProduct TensorQ TensorRank TensorReduce TensorSymmetry TensorTranspose TensorWedge Tetrahedron TetrahedronBox TetrahedronBoxOptions TeXForm TeXSave Text Text3DBox Text3DBoxOptions TextAlignment TextBand TextBoundingBox TextBox TextCell TextClipboardType TextData TextForm TextJustification TextLine TextPacket TextParagraph TextRecognize TextRendering TextStyle Texture TextureCoordinateFunction TextureCoordinateScaling Therefore ThermometerGauge Thick Thickness Thin Thinning ThisLink ThompsonGroupTh Thread ThreeJSymbol Threshold Through Throw Thumbnail Thursday Ticks TicksStyle Tilde TildeEqual TildeFullEqual TildeTilde TimeConstrained TimeConstraint Times TimesBy TimeSeriesForecast TimeSeriesInvertibility TimeUsed TimeValue TimeZone Timing Tiny TitleGrouping TitsGroupT ToBoxes ToCharacterCode ToColor ToContinuousTimeModel ToDate ToDiscreteTimeModel ToeplitzMatrix ToExpression ToFileName Together Toggle ToggleFalse Toggler TogglerBar TogglerBox TogglerBoxOptions ToHeldExpression ToInvertibleTimeSeries TokenWords Tolerance ToLowerCase ToNumberField TooBig Tooltip TooltipBox TooltipBoxOptions TooltipDelay TooltipStyle Top TopHatTransform TopologicalSort ToRadicals ToRules ToString Total TotalHeight TotalVariationFilter TotalWidth TouchscreenAutoZoom TouchscreenControlPlacement ToUpperCase Tr Trace TraceAbove TraceAction TraceBackward TraceDepth TraceDialog TraceForward TraceInternal TraceLevel TraceOff TraceOn TraceOriginal TracePrint TraceScan TrackedSymbols TradingChart TraditionalForm TraditionalFunctionNotation TraditionalNotation TraditionalOrder TransferFunctionCancel TransferFunctionExpand TransferFunctionFactor TransferFunctionModel TransferFunctionPoles TransferFunctionTransform TransferFunctionZeros TransformationFunction TransformationFunctions TransformationMatrix TransformedDistribution TransformedField Translate TranslationTransform TransparentColor Transpose TreeForm TreeGraph TreeGraphQ TreePlot TrendStyle TriangleWave TriangularDistribution Trig TrigExpand TrigFactor TrigFactorList Trigger TrigReduce TrigToExp TrimmedMean True TrueQ TruncatedDistribution TsallisQExponentialDistribution TsallisQGaussianDistribution TTest Tube TubeBezierCurveBox TubeBezierCurveBoxOptions TubeBox TubeBSplineCurveBox TubeBSplineCurveBoxOptions Tuesday TukeyLambdaDistribution TukeyWindow Tuples TuranGraph TuringMachine Transparent UnateQ Uncompress Undefined UnderBar Underflow Underlined Underoverscript UnderoverscriptBox UnderoverscriptBoxOptions Underscript UnderscriptBox UnderscriptBoxOptions UndirectedEdge UndirectedGraph UndirectedGraphQ UndocumentedTestFEParserPacket UndocumentedTestGetSelectionPacket Unequal Unevaluated UniformDistribution UniformGraphDistribution UniformSumDistribution Uninstall Union UnionPlus Unique UnitBox UnitConvert UnitDimensions Unitize UnitRootTest UnitSimplify UnitStep UnitTriangle UnitVector Unprotect UnsameQ UnsavedVariables Unset UnsetShared UntrackedVariables Up UpArrow UpArrowBar UpArrowDownArrow Update UpdateDynamicObjects UpdateDynamicObjectsSynchronous UpdateInterval UpDownArrow UpEquilibrium UpperCaseQ UpperLeftArrow UpperRightArrow UpperTriangularize Upsample UpSet UpSetDelayed UpTee UpTeeArrow UpValues URL URLFetch URLFetchAsynchronous URLSave URLSaveAsynchronous UseGraphicsRange Using UsingFrontEnd V2Get ValidationLength Value ValueBox ValueBoxOptions ValueForm ValueQ ValuesData Variables Variance VarianceEquivalenceTest VarianceEstimatorFunction VarianceGammaDistribution VarianceTest VectorAngle VectorColorFunction VectorColorFunctionScaling VectorDensityPlot VectorGlyphData VectorPlot VectorPlot3D VectorPoints VectorQ Vectors VectorScale VectorStyle Vee Verbatim Verbose VerboseConvertToPostScriptPacket VerifyConvergence VerifySolutions VerifyTestAssumptions Version VersionNumber VertexAdd VertexCapacity VertexColors VertexComponent VertexConnectivity VertexCoordinateRules VertexCoordinates VertexCorrelationSimilarity VertexCosineSimilarity VertexCount VertexCoverQ VertexDataCoordinates VertexDegree VertexDelete VertexDiceSimilarity VertexEccentricity VertexInComponent VertexInDegree VertexIndex VertexJaccardSimilarity VertexLabeling VertexLabels VertexLabelStyle VertexList VertexNormals VertexOutComponent VertexOutDegree VertexQ VertexRenderingFunction VertexReplace VertexShape VertexShapeFunction VertexSize VertexStyle VertexTextureCoordinates VertexWeight Vertical VerticalBar VerticalForm VerticalGauge VerticalSeparator VerticalSlider VerticalTilde ViewAngle ViewCenter ViewMatrix ViewPoint ViewPointSelectorSettings ViewPort ViewRange ViewVector ViewVertical VirtualGroupData Visible VisibleCell VoigtDistribution VonMisesDistribution WaitAll WaitAsynchronousTask WaitNext WaitUntil WakebyDistribution WalleniusHypergeometricDistribution WaringYuleDistribution WatershedComponents WatsonUSquareTest WattsStrogatzGraphDistribution WaveletBestBasis WaveletFilterCoefficients WaveletImagePlot WaveletListPlot WaveletMapIndexed WaveletMatrixPlot WaveletPhi WaveletPsi WaveletScale WaveletScalogram WaveletThreshold WeaklyConnectedComponents WeaklyConnectedGraphQ WeakStationarity WeatherData WeberE Wedge Wednesday WeibullDistribution WeierstrassHalfPeriods WeierstrassInvariants WeierstrassP WeierstrassPPrime WeierstrassSigma WeierstrassZeta WeightedAdjacencyGraph WeightedAdjacencyMatrix WeightedData WeightedGraphQ Weights WelchWindow WheelGraph WhenEvent Which While White Whitespace WhitespaceCharacter WhittakerM WhittakerW WienerFilter WienerProcess WignerD WignerSemicircleDistribution WilksW WilksWTest WindowClickSelect WindowElements WindowFloating WindowFrame WindowFrameElements WindowMargins WindowMovable WindowOpacity WindowSelected WindowSize WindowStatusArea WindowTitle WindowToolbars WindowWidth With WolframAlpha WolframAlphaDate WolframAlphaQuantity WolframAlphaResult Word WordBoundary WordCharacter WordData WordSearch WordSeparators WorkingPrecision Write WriteString Wronskian XMLElement XMLObject Xnor Xor Yellow YuleDissimilarity ZernikeR ZeroSymmetric ZeroTest ZeroWidthTimes Zeta ZetaZero ZipfDistribution ZTest ZTransform $Aborted $ActivationGroupID $ActivationKey $ActivationUserRegistered $AddOnsDirectory $AssertFunction $Assumptions $AsynchronousTask $BaseDirectory $BatchInput $BatchOutput $BoxForms $ByteOrdering $Canceled $CharacterEncoding $CharacterEncodings $CommandLine $CompilationTarget $ConditionHold $ConfiguredKernels $Context $ContextPath $ControlActiveSetting $CreationDate $CurrentLink $DateStringFormat $DefaultFont $DefaultFrontEnd $DefaultImagingDevice $DefaultPath $Display $DisplayFunction $DistributedContexts $DynamicEvaluation $Echo $Epilog $ExportFormats $Failed $FinancialDataSource $FormatType $FrontEnd $FrontEndSession $GeoLocation $HistoryLength $HomeDirectory $HTTPCookies $IgnoreEOF $ImagingDevices $ImportFormats $InitialDirectory $Input $InputFileName $InputStreamMethods $Inspector $InstallationDate $InstallationDirectory $InterfaceEnvironment $IterationLimit $KernelCount $KernelID $Language $LaunchDirectory $LibraryPath $LicenseExpirationDate $LicenseID $LicenseProcesses $LicenseServer $LicenseSubprocesses $LicenseType $Line $Linked $LinkSupported $LoadedFiles $MachineAddresses $MachineDomain $MachineDomains $MachineEpsilon $MachineID $MachineName $MachinePrecision $MachineType $MaxExtraPrecision $MaxLicenseProcesses $MaxLicenseSubprocesses $MaxMachineNumber $MaxNumber $MaxPiecewiseCases $MaxPrecision $MaxRootDegree $MessageGroups $MessageList $MessagePrePrint $Messages $MinMachineNumber $MinNumber $MinorReleaseNumber $MinPrecision $ModuleNumber $NetworkLicense $NewMessage $NewSymbol $Notebooks $NumberMarks $Off $OperatingSystem $Output $OutputForms $OutputSizeLimit $OutputStreamMethods $Packages $ParentLink $ParentProcessID $PasswordFile $PatchLevelID $Path $PathnameSeparator $PerformanceGoal $PipeSupported $Post $Pre $PreferencesDirectory $PrePrint $PreRead $PrintForms $PrintLiteral $ProcessID $ProcessorCount $ProcessorType $ProductInformation $ProgramName $RandomState $RecursionLimit $ReleaseNumber $RootDirectory $ScheduledTask $ScriptCommandLine $SessionID $SetParentLink $SharedFunctions $SharedVariables $SoundDisplay $SoundDisplayFunction $SuppressInputFormHeads $SynchronousEvaluation $SyntaxHandler $System $SystemCharacterEncoding $SystemID $SystemWordLength $TemporaryDirectory $TemporaryPrefix $TextStyle $TimedOut $TimeUnit $TimeZone $TopDirectory $TraceOff $TraceOn $TracePattern $TracePostAction $TracePreAction $Urgent $UserAddOnsDirectory $UserBaseDirectory $UserDocumentsDirectory $UserName $Version $VersionNumber",c:[{cN:"comment",b:/\(\*/,e:/\*\)/},a.ASM,a.QSM,a.CNM,{cN:"list",b:/\{/,e:/\}/,i:/:/}]}});hljs.registerLanguage("swift",function(a){var e={keyword:"class deinit enum extension func import init let protocol static struct subscript typealias var break case continue default do else fallthrough if in for return switch where while as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__ associativity didSet get infix inout left mutating none nonmutating operator override postfix precedence prefix right set unowned unowned safe unsafe weak willSet",literal:"true false nil",built_in:"abs advance alignof alignofValue assert bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal false filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced join lexicographicalCompare map max maxElement min minElement nil numericCast partition posix print println quickSort reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith strideof strideofValue swap swift toString transcode true underestimateCount unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafePointers withVaList"};var g={cN:"type",b:"\\b[A-Z][\\w']*",r:0};var b={cN:"comment",b:"/\\*",e:"\\*/",c:[a.PWM,"self"]};var c={cN:"subst",b:/\\\(/,e:"\\)",k:e,c:[]};var f={cN:"number",b:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",r:0};var d=a.inherit(a.QSM,{c:[c,a.BE]});c.c=[f];return{k:e,c:[d,a.CLCM,b,g,f,{cN:"func",bK:"func",eE:true,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/,i:/\(/}),{cN:"generics",b:/\</,e:/\>/,i:/\>/},{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBCM],i:/["']/}],i:/\[|%/},{cN:"class",k:"struct protocol class extension enum",b:"(struct|protocol|class(?! (func|var))|extension|enum)",e:"\\{",eE:true,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/})]},{cN:"preprocessor",b:"(@assignment|@class_protocol|@exported|@final|@lazy|@noreturn|@NSCopying|@NSManaged|@objc|@optional|@required|@auto_closure|@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|@infix|@prefix|@postfix)"},]}});hljs.registerLanguage("php",function(b){var e={cN:"variable",b:"(\\$|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var a={cN:"preprocessor",b:/<\?(php)?|\?>/};var c={cN:"string",c:[b.BE,a],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},b.inherit(b.ASM,{i:null}),b.inherit(b.QSM,{i:null})]};var d={v:[b.BNM,b.CNM]};return{aliases:["php3","php4","php5","php6"],cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[b.CLCM,b.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"},a]},{cN:"comment",b:"__halt_compiler.+?;",eW:true,k:"__halt_compiler",l:b.UIR},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[b.BE]},a,e,{cN:"function",bK:"function",e:/[;{]/,eE:true,i:"\\$|\\[|%",c:[b.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",e,b.CBCM,c,d]}]},{cN:"class",bK:"class interface",e:"{",eE:true,i:/[:\(\$"]/,c:[{bK:"extends implements",r:10},b.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[b.UTM]},{bK:"use",e:";",c:[b.UTM]},{b:"=>"},c,d]}});hljs.registerLanguage("haskell",function(f){var g={cN:"comment",v:[{b:"--",e:"$"},{b:"{-",e:"-}",c:["self"]}]};var e={cN:"pragma",b:"{-#",e:"#-}"};var b={cN:"preprocessor",b:"^#",e:"$"};var d={cN:"type",b:"\\b[A-Z][\\w']*",r:0};var c={cN:"container",b:"\\(",e:"\\)",i:'"',c:[e,g,b,{cN:"type",b:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},f.inherit(f.TM,{b:"[_a-z][\\w']*"})]};var a={cN:"container",b:"{",e:"}",c:c.c};return{aliases:["hs"],k:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",c:[{cN:"module",b:"\\bmodule\\b",e:"where",k:"module where",c:[c,g],i:"\\W\\.|;"},{cN:"import",b:"\\bimport\\b",e:"$",k:"import|0 qualified as hiding",c:[c,g],i:"\\W\\.|;"},{cN:"class",b:"^(\\s*)?(class|instance)\\b",e:"where",k:"class family instance where",c:[d,c,g]},{cN:"typedef",b:"\\b(data|(new)?type)\\b",e:"$",k:"data family type newtype deriving",c:[e,g,d,c,a]},{cN:"default",bK:"default",e:"$",c:[d,c,g]},{cN:"infix",bK:"infix infixl infixr",e:"$",c:[f.CNM,g]},{cN:"foreign",b:"\\bforeign\\b",e:"$",k:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",c:[d,f.QSM,g]},{cN:"shebang",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},e,g,b,f.QSM,f.CNM,d,f.inherit(f.TM,{b:"^[_a-z][\\w']*"}),{b:"->|<-"}]}});hljs.registerLanguage("1c",function(b){var f="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*";var c="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт";var e="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон";var a={cN:"dquote",b:'""'};var d={cN:"string",b:'"',e:'"|$',c:[a]};var g={cN:"string",b:"\\|",e:'"|$',c:[a]};return{cI:true,l:f,k:{keyword:c,built_in:e},c:[b.CLCM,b.NM,d,g,{cN:"function",b:"(процедура|функция)",e:"$",l:f,k:"процедура функция",c:[b.inherit(b.TM,{b:f}),{cN:"tail",eW:true,c:[{cN:"params",b:"\\(",e:"\\)",l:f,k:"знач",c:[d,g]},{cN:"export",b:"экспорт",eW:true,l:f,k:"экспорт",c:[b.CLCM]}]},b.CLCM]},{cN:"preprocessor",b:"#",e:"$"},{cN:"date",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}});hljs.registerLanguage("x86asm",function(a){return{cI:true,l:"\\.?"+a.IR,k:{keyword:"lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63",literal:"ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l",pseudo:"db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times",preprocessor:"%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public ",built_in:"bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__"},c:[{cN:"comment",b:";",e:"$",r:0},{cN:"number",b:"\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*\\.?[0-9_]*(?:[pP](?:[+-]?[0-9_]+)?)?)\\b",r:0},{cN:"number",b:"\\$[0-9][0-9A-Fa-f]*",r:0},{cN:"number",b:"\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[HhXx]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b"},{cN:"number",b:"\\b(?:0[HhXx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b"},a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"string",b:"`",e:"[^\\\\]`",r:0},{cN:"string",b:"\\.[A-Za-z0-9]+",r:0},{cN:"label",b:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)",r:0},{cN:"label",b:"^\\s*%%[A-Za-z0-9_$#@~.?]*:",r:0},{cN:"argument",b:"%[0-9]+",r:0},{cN:"built_in",b:"%!S+",r:0}]}});hljs.registerLanguage("python",function(a){var f={cN:"prompt",b:/^(>>>|\.\.\.) /};var b={cN:"string",c:[a.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[f],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[f],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},a.ASM,a.QSM]};var d={cN:"number",r:0,v:[{b:a.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:a.CNR+"[lLjJ]?"}]};var e={cN:"params",b:/\(/,e:/\)/,c:["self",f,d,b]};var c={e:/:/,i:/[${=;\n]/,c:[a.UTM,e]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[f,d,b,a.HCM,a.inherit(c,{cN:"function",bK:"def",r:10}),a.inherit(c,{cN:"class",bK:"class"}),{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("smalltalk",function(a){var b="[a-z][a-zA-Z0-9_]*";var d={cN:"char",b:"\\$.{1}"};var c={cN:"symbol",b:"#"+a.UIR};return{aliases:["st"],k:"self super nil true false thisContext",c:[{cN:"comment",b:'"',e:'"'},a.ASM,{cN:"class",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},{cN:"method",b:b+":",r:0},a.CNM,c,d,{cN:"localvars",b:"\\|[ ]*"+b+"([ ]+"+b+")*[ ]*\\|",rB:true,e:/\|/,i:/\S/,c:[{b:"(\\|[ ]*)?"+b}]},{cN:"array",b:"\\#\\(",e:"\\)",c:[a.ASM,d,a.CNM,c]}]}});hljs.registerLanguage("tex",function(a){var d={cN:"command",b:"\\\\[a-zA-Zа-яА-я]+[\\*]?"};var c={cN:"command",b:"\\\\[^a-zA-Zа-яА-я0-9]"};var b={cN:"special",b:"[{}\\[\\]\\&#~]",r:0};return{c:[{b:"\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",rB:true,c:[d,c,{cN:"number",b:" *=",e:"-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",eB:true}],r:10},d,c,b,{cN:"formula",b:"\\$\\$",e:"\\$\\$",c:[d,c,b],r:0},{cN:"formula",b:"\\$",e:"\\$",c:[d,c,b],r:0},{cN:"comment",b:"%",e:"$",r:0}]}});hljs.registerLanguage("actionscript",function(a){var c="[a-zA-Z_$][a-zA-Z0-9_$]*";var b="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)";var d={cN:"rest_arg",b:"[.]{3}",e:c,r:10};return{aliases:["as"],k:{keyword:"as break case catch class const continue default delete do dynamic each else extends final finally for function get if implements import in include instanceof interface internal is namespace native new override package private protected public return set static super switch this throw try typeof use var void while with",literal:"true false null undefined"},c:[a.ASM,a.QSM,a.CLCM,a.CBCM,a.CNM,{cN:"package",bK:"package",e:"{",c:[a.TM]},{cN:"class",bK:"class interface",e:"{",eE:true,c:[{bK:"extends implements"},a.TM]},{cN:"preprocessor",bK:"import include",e:";"},{cN:"function",bK:"function",e:"[{;]",eE:true,i:"\\S",c:[a.TM,{cN:"params",b:"\\(",e:"\\)",c:[a.ASM,a.QSM,a.CLCM,a.CBCM,d]},{cN:"type",b:":",e:b,r:10}]}]}});hljs.registerLanguage("sql",function(a){var b={cN:"comment",b:"--",e:"$"};return{cI:true,i:/[<>]/,c:[{cN:"operator",bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate savepoint release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup",e:/;/,eW:true,k:{keyword:"abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length character_length charindex charset check checksum checksum_agg choose close coalesce coercibility collate collation collationproperty column columns columns_updated commit compress concat concat_ws concurrent connect connection connection_id consistent constraint constraints continue contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime data database databases datalength date_add date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec engine engines eomonth errors escape escaped event eventdata events except exception exec execute exists exp explain export_set extended external extract fast fetch field fields find_in_set first first_value floor flush for force foreign format found found_rows from from_base64 from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner innodb input insert install instr intersect into is is_free_lock is_ipv4 is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names national natural nchar next no no_write_to_binlog not now nullif nvarchar oct octet_length of old_password on only open optimize option optionally or ord order outer outfile output pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges procedure procedure_analyze processlist profile profiles public publishingservername purge quarter query quick quote quotename radians rand read references regexp relative relaylog release release_lock rename repair repeat replace replicate reset restore restrict return returns reverse revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll sec_to_time second section select serializable server session session_user set sha sha1 sha2 share show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sql_variant_property sqlstate sqrt square start starting status std stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short validate_password_strength value values var var_pop var_samp variables variance varp version view warnings week weekday weekofyear weight_string when whenever where with work write xml xor year yearweek zon",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int integer interval number numeric real serial smallint varchar varying int8 serial8 text"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM,a.CBCM,b]},a.CBCM,b]}});hljs.registerLanguage("nix",function(b){var a={keyword:"rec with let in inherit assert if else then",constant:"true false or and null",built_in:"import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation"};var g={cN:"subst",b:/\$\{/,e:/\}/,k:a};var d={cN:"variable",b:/[a-zA-Z0-9-_]+(\s*=)/};var e={cN:"string",b:"''",e:"''",c:[g]};var f={cN:"string",b:'"',e:'"',c:[g]};var c=[b.NM,b.HCM,b.CBCM,e,f,d];g.c=c;return{aliases:["nixos"],k:a,c:c}});hljs.registerLanguage("handlebars",function(b){var a="each in with if else unless bindattr action collection debugger log outlet template unbound view yield";return{aliases:["hbs","html.hbs","html.handlebars"],cI:true,sL:"xml",subLanguageMode:"continuous",c:[{cN:"expression",b:"{{",e:"}}",c:[{cN:"begin-block",b:"#[a-zA-Z- .]+",k:a},{cN:"string",b:'"',e:'"'},{cN:"end-block",b:"\\/[a-zA-Z- .]+",k:a},{cN:"variable",b:"[a-zA-Z-.]+",k:a}]}]}});hljs.registerLanguage("thrift",function(a){var b="bool byte i16 i32 i64 double string binary";return{k:{keyword:"namespace const typedef struct enum service exception void oneway set list map required optional",built_in:b,literal:"true false"},c:[a.QSM,a.NM,a.CLCM,a.CBCM,{cN:"class",bK:"struct enum service exception",e:/\{/,i:/\n/,c:[a.inherit(a.TM,{starts:{eW:true,eE:true}})]},{cN:"stl_container",b:"\\b(set|list|map)\\s*<",e:">",k:b,c:["self"]}]}});hljs.registerLanguage("vala",function(a){return{k:{keyword:"char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var",built_in:"DBus GLib CCode Gee Object",literal:"false true null"},c:[{cN:"class",bK:"class interface delegate namespace",e:"{",eE:true,i:"[^,:\\n\\s\\.]",c:[a.UTM]},a.CLCM,a.CBCM,{cN:"string",b:'"""',e:'"""',r:5},a.ASM,a.QSM,a.CNM,{cN:"preprocessor",b:"^#",e:"$",r:2},{cN:"constant",b:" [A-Z_]+ ",r:0}]}});hljs.registerLanguage("gradle",function(a){return{cI:true,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[a.CLCM,a.CBCM,a.ASM,a.QSM,a.NM,a.RM]}});hljs.registerLanguage("ini",function(a){return{cI:true,i:/\S/,c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM],r:0}]}]}});hljs.registerLanguage("livecodeserver",function(a){var e={cN:"variable",b:"\\b[gtps][A-Z]+[A-Za-z0-9_\\-]*\\b|\\$_[A-Z]+",r:0};var b={cN:"comment",e:"$",v:[a.CBCM,a.HCM,{b:"--"},{b:"[^:]//"}]};var d=a.inherit(a.TM,{v:[{b:"\\b_*rig[A-Z]+[A-Za-z0-9_\\-]*"},{b:"\\b_[a-z0-9\\-]+"}]});var c=a.inherit(a.TM,{b:"\\b([A-Za-z0-9_\\-]+)\\b"});return{cI:false,k:{keyword:"after byte bytes english the until http forever descending using line real8 with seventh for stdout finally element word fourth before black ninth sixth characters chars stderr uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat end repeat URL in try into switch to words https token binfile each tenth as ticks tick system real4 by dateItems without char character ascending eighth whole dateTime numeric short first ftp integer abbreviated abbr abbrev private case while if",constant:"SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five quote empty one true return cr linefeed right backslash null seven tab three two RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK",operator:"div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within contains ends with begins the keys of keys",built_in:"put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg base64Decode base64Encode baseConvert binaryDecode binaryEncode byteToNum cachedURL cachedURLs charToNum cipherNames commandNames compound compress constantNames cos date dateFormat decompress directories diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames global globals hasMemory hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge millisec millisecs millisecond milliseconds min monthNames num number numToByte numToChar offset open openfiles openProcesses openProcessIDs openSockets paramCount param params peerAddress pendingMessages platform processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLFirstChild revXMLMatchingNode revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error revXMLRPC_Execute revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sec secs seconds sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound stdDev sum sysError systemVersion tan tempName tick ticks time to toLower toUpper transpose trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus value variableNames version waitDepth weekdayNames wordOffset add breakpoint cancel clear local variable file word line folder directory URL close socket process combine constant convert create new alias folder directory decrypt delete variable word line folder directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime libURLSetStatusCallback load multiply socket process post seek rel relative read from process rename replace require resetAll revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split subtract union unload wait write"},c:[e,{cN:"keyword",b:"\\bend\\sif\\b"},{cN:"function",bK:"function",e:"$",c:[e,c,a.ASM,a.QSM,a.BNM,a.CNM,d]},{cN:"function",bK:"end",e:"$",c:[c,d]},{cN:"command",bK:"command on",e:"$",c:[e,c,a.ASM,a.QSM,a.BNM,a.CNM,d]},{cN:"command",bK:"end",e:"$",c:[c,d]},{cN:"preprocessor",b:"<\\?rev|<\\?lc|<\\?livecode",r:10},{cN:"preprocessor",b:"<\\?"},{cN:"preprocessor",b:"\\?>"},b,a.ASM,a.QSM,a.BNM,a.CNM,d],i:";$|^\\[|^="}});hljs.registerLanguage("d",function(x){var b={keyword:"abstract alias align asm assert auto body break byte case cast catch class const continue debug default delete deprecated do else enum export extern final finally for foreach foreach_reverse|10 goto if immutable import in inout int interface invariant is lazy macro mixin module new nothrow out override package pragma private protected public pure ref return scope shared static struct super switch synchronized template this throw try typedef typeid typeof union unittest version void volatile while with __FILE__ __LINE__ __gshared|10 __thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__",built_in:"bool cdouble cent cfloat char creal dchar delegate double dstring float function idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar wstring",literal:"false null true"};var c="(0|[1-9][\\d_]*)",q="(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)",h="0[bB][01_]+",v="([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)",y="0[xX]"+v,p="([eE][+-]?"+q+")",o="("+q+"(\\.\\d*|"+p+")|\\d+\\."+q+q+"|\\."+c+p+"?)",k="(0[xX]("+v+"\\."+v+"|\\.?"+v+")[pP][+-]?"+q+")",l="("+c+"|"+h+"|"+y+")",n="("+k+"|"+o+")";var z="\\\\(['\"\\?\\\\abfnrtv]|u[\\dA-Fa-f]{4}|[0-7]{1,3}|x[\\dA-Fa-f]{2}|U[\\dA-Fa-f]{8})|&[a-zA-Z\\d]{2,};";var m={cN:"number",b:"\\b"+l+"(L|u|U|Lu|LU|uL|UL)?",r:0};var j={cN:"number",b:"\\b("+n+"([fF]|L|i|[fF]i|Li)?|"+l+"(i|[fF]i|Li))",r:0};var s={cN:"string",b:"'("+z+"|.)",e:"'",i:"."};var r={b:z,r:0};var w={cN:"string",b:'"',c:[r],e:'"[cwd]?'};var f={cN:"string",b:'[rq]"',e:'"[cwd]?',r:5};var u={cN:"string",b:"`",e:"`[cwd]?"};var i={cN:"string",b:'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',r:10};var t={cN:"string",b:'q"\\{',e:'\\}"'};var e={cN:"shebang",b:"^#!",e:"$",r:5};var g={cN:"preprocessor",b:"#(line)",e:"$",r:5};var d={cN:"keyword",b:"@[a-zA-Z_][a-zA-Z_\\d]*"};var a={cN:"comment",b:"\\/\\+",c:["self"],e:"\\+\\/",r:10};return{l:x.UIR,k:b,c:[x.CLCM,x.CBCM,a,i,w,f,u,t,j,m,s,e,g,d]}});hljs.registerLanguage("vbnet",function(a){return{aliases:["vb"],cI:true,k:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},i:"//|{|}|endif|gosub|variant|wend",c:[a.inherit(a.QSM,{c:[{b:'""'}]}),{cN:"comment",b:"'",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"'''|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},a.CNM,{cN:"preprocessor",b:"#",e:"$",k:"if else elseif end region externalsource"}]}});hljs.registerLanguage("axapta",function(a){return{k:"false int abstract private char boolean static null if for true while long throw finally protected final return void enum else break new catch byte super case short default double public try this switch continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count order group by asc desc index hint like dispaly edit client server ttsbegin ttscommit str real date container anytype common div mod",c:[a.CLCM,a.CBCM,a.ASM,a.QSM,a.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"class",bK:"class interface",e:"{",eE:true,i:":",c:[{cN:"inheritance",bK:"extends implements",r:10},a.UTM]}]}});hljs.registerLanguage("perl",function(c){var d="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var f={cN:"subst",b:"[$@]\\{",e:"\\}",k:d};var g={b:"->{",e:"}"};var a={cN:"variable",v:[{b:/\$\d/},{b:/[\$\%\@](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/},{b:/[\$\%\@][^\s\w{]/,r:0}]};var e={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var h=[c.BE,f,a];var b=[a,c.HCM,e,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},g,{cN:"string",c:h,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[c.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[c.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+c.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[c.HCM,e,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[c.BE],r:0}]},{cN:"sub",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",r:5},{cN:"operator",b:"-\\w\\b",r:0}];f.c=b;g.c=b;return{aliases:["pl"],k:d,c:b}});hljs.registerLanguage("scala",function(a){var c={cN:"annotation",b:"@[A-Za-z]+"};var b={cN:"string",b:'u?r?"""',e:'"""',r:10};var d={cN:"symbol",b:"'\\w[\\w\\d_]*(?!')"};return{k:"type yield lazy override def with val var false true sealed abstract private trait object null if for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},a.CLCM,a.CBCM,b,a.QSM,d,{cN:"class",b:"((case )?class |object |trait )",e:"({|$)",eE:true,i:":",k:"case class trait object",c:[{bK:"extends with",r:10},a.UTM,{cN:"params",b:"\\(",e:"\\)",c:[a.QSM,b,c]}]},a.CNM,c]}});hljs.registerLanguage("cmake",function(a){return{aliases:["cmake.in"],cI:true,k:{keyword:"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile execute_process export find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install link_directories load_cache load_command macro mark_as_advanced message option output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_link_libraries try_compile try_run unset variable_watch while build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or",operator:"equal less greater strless strgreater strequal matches"},c:[{cN:"envvar",b:"\\${",e:"}"},a.HCM,a.QSM,a.NM]}});hljs.registerLanguage("ocaml",function(a){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external false for fun function functor if in include inherit initializer land lazy let lor lsl lsr lxor match method mod module mutable new object of open or private rec ref sig struct then to true try type val virtual when while with parser value",built_in:"bool char float int list unit array exn option int32 int64 nativeint format4 format6 lazy_t in_channel out_channel string"},i:/\/\//,c:[{cN:"string",b:'"""',e:'"""'},{cN:"comment",b:"\\(\\*",e:"\\*\\)",c:["self"]},{cN:"class",bK:"type",e:"\\(|=|$",eE:true,c:[a.UTM]},{cN:"annotation",b:"\\[<",e:">\\]"},a.CBCM,a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),a.CNM]}});hljs.registerLanguage("autohotkey",function(b){var d={cN:"escape",b:"`[\\s\\S]"};var c={cN:"comment",b:";",e:"$",r:0};var a=[{cN:"built_in",b:"A_[a-zA-Z0-9]+"},{cN:"built_in",bK:"ComSpec Clipboard ClipboardAll ErrorLevel"}];return{cI:true,k:{keyword:"Break Continue Else Gosub If Loop Return While",literal:"A true false NOT AND OR"},c:a.concat([d,b.inherit(b.QSM,{c:[d]}),c,{cN:"number",b:b.NR,r:0},{cN:"var_expand",b:"%",e:"%",i:"\\n",c:[d]},{cN:"label",c:[d],v:[{b:'^[^\\n";]+::(?!=)'},{b:'^[^\\n";]+:(?!=)',r:0}]},{b:",\\s*,",r:10}])}});hljs.registerLanguage("objectivec",function(a){var d={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView NSView NSViewController NSWindow NSWindowController NSSet NSUUID NSIndexSet UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection UIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"};var c=/[a-zA-Z@][a-zA-Z0-9_]*/;var b="@interface @class @protocol @implementation";return{aliases:["m","mm","objc","obj-c"],k:d,l:c,i:"</",c:[a.CLCM,a.CBCM,a.CNM,a.QSM,{cN:"string",v:[{b:'@"',e:'"',i:"\\n",c:[a.BE]},{b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"}]},{cN:"preprocessor",b:"#",e:"$",c:[{cN:"title",v:[{b:'"',e:'"'},{b:"<",e:">"}]}]},{cN:"class",b:"("+b.split(" ").join("|")+")\\b",e:"({|$)",eE:true,k:b,l:c,c:[a.UTM]},{cN:"variable",b:"\\."+a.UIR,r:0}]}});hljs.registerLanguage("avrasm",function(a){return{cI:true,l:"\\.?"+a.IR,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf",preprocessor:".byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"},c:[a.CBCM,{cN:"comment",b:";",e:"$",r:0},a.CNM,a.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"label",b:"^[A-Za-z0-9_.$]+:"},{cN:"preprocessor",b:"#",e:"$"},{cN:"localvars",b:"@[0-9]+"}]}});hljs.registerLanguage("vhdl",function(a){return{cI:true,k:{keyword:"abs access after alias all and architecture array assert attribute begin block body buffer bus case component configuration constant context cover disconnect downto default else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map mod nand new next nor not null of on open or others out package port postponed procedure process property protected pure range record register reject release rem report restrict restrict_guarantee return rol ror select sequence severity shared signal sla sll sra srl strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with xnor xor",typename:"boolean bit character severity_level integer time delay_length natural positive string bit_vector file_open_kind file_open_status std_ulogic std_ulogic_vector std_logic std_logic_vector unsigned signed boolean_vector integer_vector real_vector time_vector"},i:"{",c:[a.CBCM,{cN:"comment",b:"--",e:"$"},a.QSM,a.CNM,{cN:"literal",b:"'(U|X|0|1|Z|W|L|H|-)'",c:[a.BE]},{cN:"attribute",b:"'[A-Za-z](_?[A-Za-z0-9])*",c:[a.BE]}]}});hljs.registerLanguage("coffeescript",function(c){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module global window document"};var a="[A-Za-z$_][0-9A-Za-z$_]*";var f=c.inherit(c.TM,{b:a});var e={cN:"subst",b:/#\{/,e:/}/,k:b};var d=[c.BNM,c.inherit(c.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[c.BE]},{b:/'/,e:/'/,c:[c.BE]},{b:/"""/,e:/"""/,c:[c.BE,e]},{b:/"/,e:/"/,c:[c.BE,e]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[e,c.HCM]},{b:"//[gim]*",r:0},{b:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"}]},{cN:"property",b:"@"+a},{b:"`",e:"`",eB:true,eE:true,sL:"javascript"}];e.c=d;return{aliases:["coffee","cson","iced"],k:b,c:d.concat([{cN:"comment",b:"###",e:"###"},c.HCM,{cN:"function",b:"("+a+"\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",e:"[-=]>",rB:true,c:[f,{cN:"params",b:"\\(",rB:true,c:[{b:/\(/,e:/\)/,k:b,c:["self"].concat(d)}]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:true,i:/[:="\[\]]/,c:[f]},f]},{cN:"attribute",b:a+":",e:":",rB:true,eE:true,r:0}])}});hljs.registerLanguage("mizar",function(a){return{k:["environ vocabularies notations constructors definitions registrations theorems schemes requirements","begin end definition registration cluster existence pred func defpred deffunc theorem proof","let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from","be being by means equals implies iff redefine define now not or attr is mode suppose per cases set","thesis contradiction scheme reserve struct","correctness compatibility coherence symmetry assymetry reflexivity irreflexivity","connectedness uniqueness commutativity idempotence involutiveness projectivity"].join(" "),c:[{cN:"comment",b:"::",e:"$"}]}});hljs.registerLanguage("nginx",function(c){var b={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+c.UIR}]};var a={eW:true,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[c.HCM,{cN:"string",c:[c.BE,b],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:true,eE:true},{cN:"regexp",c:[c.BE,b],v:[{b:"\\s\\^",e:"\\s|{|;",rE:true},{b:"~\\*?\\s+",e:"\\s|{|;",rE:true},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},b]};return{aliases:["nginxconf"],c:[c.HCM,{b:c.UIR+"\\s",e:";|{",rB:true,c:[{cN:"title",b:c.UIR,starts:a}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("erlang-repl",function(a){return{k:{special_functions:"spawn spawn_link self",reserved:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"prompt",b:"^[0-9]+> ",r:10},{cN:"comment",b:"%",e:"$"},{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},a.ASM,a.QSM,{cN:"constant",b:"\\?(::)?([A-Z]\\w*(::)?)+"},{cN:"arrow",b:"->"},{cN:"ok",b:"ok"},{cN:"exclamation_mark",b:"!"},{cN:"function_or_atom",b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{cN:"variable",b:"[A-Z][a-zA-Z0-9_']*",r:0}]}});hljs.registerLanguage("r",function(a){var b="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[a.HCM,{b:b,l:b,k:{keyword:"function if in break next repeat else for return switch while try tryCatch|10 stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...|10",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",c:[a.BE],v:[{b:'"',e:'"'},{b:"'",e:"'"}]}]}});hljs.registerLanguage("json",function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}});hljs.registerLanguage("django",function(a){var b={cN:"filter",b:/\|[A-Za-z]+\:?/,k:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone",c:[{cN:"argument",b:/"/,e:/"/},{cN:"argument",b:/'/,e:/'/}]};return{aliases:["jinja"],cI:true,sL:"xml",subLanguageMode:"continuous",c:[{cN:"template_comment",b:/\{%\s*comment\s*%}/,e:/\{%\s*endcomment\s*%}/},{cN:"template_comment",b:/\{#/,e:/#}/},{cN:"template_tag",b:/\{%/,e:/%}/,k:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor in ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup by as ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim",c:[b]},{cN:"variable",b:/\{\{/,e:/}}/,c:[b]}]}});hljs.registerLanguage("delphi",function(b){var a="exports register file shl array record property for mod while set ally label uses raise not stored class safecall var interface or private static exit index inherited to else stdcall override shr asm far resourcestring finalization packed virtual out and protected library do xorwrite goto near function end div overload object unit begin string on inline repeat until destructor write message program with read initialization except default nil if case cdecl in downto threadvar of try pascal const external constructor type public then implementation finally published procedure";var e={cN:"comment",v:[{b:/\{/,e:/\}/,r:0},{b:/\(\*/,e:/\*\)/,r:10}]};var c={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]};var d={cN:"string",b:/(#\d+)+/};var f={b:b.IR+"\\s*=\\s*class\\s*\\(",rB:true,c:[b.TM]};var g={cN:"function",bK:"function constructor destructor procedure",e:/[:;]/,k:"function constructor|10 destructor|10 procedure|10",c:[b.TM,{cN:"params",b:/\(/,e:/\)/,k:a,c:[c,d]},e]};return{cI:true,k:a,i:/("|\$[G-Zg-z]|\/\*|<\/)/,c:[e,b.CLCM,c,d,b.NM,f,g]}});hljs.registerLanguage("vbscript",function(a){return{aliases:["vbs"],cI:true,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[a.inherit(a.QSM,{c:[{b:'""'}]}),{cN:"comment",b:/'/,e:/$/,r:0},a.CNM]}});hljs.registerLanguage("oxygene",function(b){var g="abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained";var a={cN:"comment",b:"{",e:"}",r:0};var e={cN:"comment",b:"\\(\\*",e:"\\*\\)",r:10};var c={cN:"string",b:"'",e:"'",c:[{b:"''"}]};var d={cN:"string",b:"(#\\d+)+"};var f={cN:"function",bK:"function constructor destructor procedure method",e:"[:;]",k:"function constructor|10 destructor|10 procedure|10 method|10",c:[b.TM,{cN:"params",b:"\\(",e:"\\)",k:g,c:[c,d]},a,e]};return{cI:true,k:g,i:'("|\\$[G-Zg-z]|\\/\\*|</)',c:[a,e,b.CLCM,c,d,b.NM,f,{cN:"class",b:"=\\bclass\\b",e:"end;",k:g,c:[c,d,a,e,b.CLCM,f]}]}});hljs.registerLanguage("mel",function(a){return{k:"int float string vector matrix if else switch case default while do for in break continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor animDisplay animView annotate appendStringArray applicationName applyAttrPreset applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem componentEditor compositingInterop computePolysetVolume condition cone confirmDialog connectAttr connectControl connectDynamic connectJoint connectionInfo constrain constrainValue constructionHistory container containsMultibyte contextInfo control convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected displayColor displayCull displayLevelOfDetail displayPref displayRGBColor displaySmoothness displayStats displayString displaySurface distanceDimContext distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor editorTemplate effector emit emitter enableDevice encodeString endString endsWith env equivalent equivalentTol erf error eval evalDeferred evalEcho event exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo filetest filletCurve filter filterCurve filterExpand filterStudioImport findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss geometryConstraint getApplicationVersionAsFloat getAttr getClassification getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation listNodeTypes listPanelCategories listRelatives listSets listTransforms listUnselected listerEditor loadFluid loadNewShelf loadPlugin loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration panelHistory paramDimContext paramDimension paramLocator parent parentConstraint particle particleExists particleInstancer particleRenderInfo partition pasteKey pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE registerPluginResource rehash reloadImage removeJoint removeMultiInstance removePanelCategory rename renameAttr renameSelectionList renameUI render renderGlobalsNode renderInfo renderLayerButton renderLayerParent renderLayerPostProcess renderLayerUnparent renderManip renderPartition renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor renderWindowSelectContext renderer reorder reorderDeformers requires reroot resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType selectedNodes selectionConnection separator setAttr setAttrEnumResource setAttrMapping setAttrNiceNameResource setConstraintRestPosition setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField shortNameOf showHelp showHidden showManipCtx showSelectionInTitle showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString stringToStringArray strip stripPrefixFromName stroke subdAutoProjection subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList textToShelf textureDisplacePlane textureHairColor texturePlacementContext textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper trace track trackCtx transferAttributes transformCompare transformLimits translator trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform",i:"</",c:[a.CNM,a.ASM,a.QSM,{cN:"string",b:"`",e:"`",c:[a.BE]},{cN:"variable",v:[{b:"\\$\\d"},{b:"[\\$\\%\\@](\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)"},{b:"\\*(\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)",r:0}]},a.CLCM,a.CBCM]}});hljs.registerLanguage("dos",function(a){return{aliases:["bat","cmd"],cI:true,k:{flow:"if else goto for in do call exit not exist errorlevel defined equ neq lss leq gtr geq",keyword:"shift cd dir echo setlocal endlocal set pause copy",stream:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux",winutils:"ping net ipconfig taskkill xcopy ren del"},c:[{cN:"envvar",b:"%%[^ ]"},{cN:"envvar",b:"%[^ ]+?%"},{cN:"envvar",b:"![^ ]+?!"},{cN:"number",b:"\\b\\d+",r:0},{cN:"comment",b:"@?rem",e:"$"}]}});hljs.registerLanguage("apache",function(a){var b={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:true,c:[a.HCM,{cN:"tag",b:"</?",e:">"},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",b]},b,a.QSM]}}],i:/\S/}});hljs.registerLanguage("scss",function(a){var c="[a-zA-Z-][a-zA-Z0-9_-]*";var f={cN:"variable",b:"(\\$"+c+")\\b"};var d={cN:"function",b:c+"\\(",rB:true,eE:true,e:"\\("};var b={cN:"hexcolor",b:"#[0-9A-Fa-f]+"};var e={cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[d,b,a.CSSNM,a.QSM,a.ASM,a.CBCM,{cN:"important",b:"!important"}]}};return{cI:true,i:"[=/|']",c:[a.CLCM,a.CBCM,d,{cN:"id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{cN:"pseudo",b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{cN:"pseudo",b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},f,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{cN:"value",b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{cN:"value",b:":",e:";",c:[d,f,b,a.CSSNM,a.QSM,a.ASM,{cN:"important",b:"!important"}]},{cN:"at_rule",b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[d,f,a.QSM,a.ASM,b,a.CSSNM,{cN:"preprocessor",b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}});hljs.registerLanguage("monkey",function(a){var b={v:[{cN:"number",b:"[$][a-fA-F0-9]+"},a.NM]};return{cI:true,k:{keyword:"public private property continue exit extern new try catch eachin not abstract final select case default const local global field end if then else elseif endif while wend repeat until forever for to step next return module inline throw",built_in:"DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI",literal:"true false null and or shl shr mod"},c:[{cN:"comment",b:"#rem",e:"#end"},{cN:"comment",b:"'",e:"$",r:0},{cN:"function",bK:"function method",e:"[(=:]|$",i:/\n/,c:[a.UTM,]},{cN:"class",bK:"class interface",e:"$",c:[{bK:"extends implements"},a.UTM]},{cN:"variable",b:"\\b(self|super)\\b"},{cN:"preprocessor",bK:"import",e:"$"},{cN:"preprocessor",b:"\\s*#",e:"$",k:"if else elseif endif end then"},{cN:"pi",b:"^\\s*strict\\b"},{bK:"alias",e:"=",c:[a.UTM]},a.QSM,b]}});hljs.registerLanguage("applescript",function(a){var b=a.inherit(a.QSM,{i:""});var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,b]};var c=[{cN:"comment",b:"--",e:"$"},{cN:"comment",b:"\\(\\*",e:"\\*\\)",c:["self",{b:"--",e:"$"}]},a.HCM];return{aliases:["osascript"],k:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the|0 then third through thru timeout times to transaction try until where while whose with without",constant:"AppleScript false linefeed return pi quote result space tab true",type:"alias application boolean class constant date file integer list number real record string text",command:"activate beep count delay launch log offset read round run say summarize write",property:"character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},c:[b,a.CNM,{cN:"type",b:"\\bPOSIX file\\b"},{cN:"command",b:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{cN:"constant",b:"\\b(text item delimiters|current application|missing value)\\b"},{cN:"keyword",b:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{cN:"property",b:"\\b(POSIX path|(date|time) string|quoted form)\\b"},{cN:"function_start",bK:"on",i:"[${=;\\n]",c:[a.UTM,d]}].concat(c),i:"//"}});hljs.registerLanguage("lasso",function(d){var b="[a-zA-Z_][a-zA-Z0-9_.]*";var i="<\\?(lasso(script)?|=)";var c="\\]|\\?>";var g={literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null bytes list queue set stack staticarray tie local var variable global data self inherited",keyword:"error_code error_msg error_pop error_push error_reset cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"};var a={cN:"comment",b:"<!--",e:"-->",r:0};var j={cN:"preprocessor",b:"\\[noprocess\\]",starts:{cN:"markup",e:"\\[/noprocess\\]",rE:true,c:[a]}};var e={cN:"preprocessor",b:"\\[/noprocess|"+i};var h={cN:"variable",b:"'"+b+"'"};var f=[d.CLCM,{cN:"javadoc",b:"/\\*\\*!",e:"\\*/",c:[d.PWM]},d.CBCM,d.inherit(d.CNM,{b:d.CNR+"|-?(infinity|nan)\\b"}),d.inherit(d.ASM,{i:null}),d.inherit(d.QSM,{i:null}),{cN:"string",b:"`",e:"`"},{cN:"variable",v:[{b:"[#$]"+b},{b:"#",e:"\\d+",i:"\\W"}]},{cN:"tag",b:"::\\s*",e:b,i:"\\W"},{cN:"attribute",v:[{b:"-"+d.UIR,r:0},{b:"(\\.\\.\\.)"}]},{cN:"subst",v:[{b:"->\\s*",c:[h]},{b:":=|/(?!\\w)=?|[-+*%=<>&|!?\\\\]+",r:0}]},{cN:"built_in",b:"\\.\\.?",r:0,c:[h]},{cN:"class",bK:"define",rE:true,e:"\\(|=>",c:[d.inherit(d.TM,{b:d.UIR+"(=(?!>))?"})]}];return{aliases:["ls","lassoscript"],cI:true,l:b+"|&[lg]t;",k:g,c:[{cN:"preprocessor",b:c,r:0,starts:{cN:"markup",e:"\\[|"+i,rE:true,r:0,c:[a]}},j,e,{cN:"preprocessor",b:"\\[no_square_brackets",starts:{e:"\\[/no_square_brackets\\]",l:b+"|&[lg]t;",k:g,c:[{cN:"preprocessor",b:c,r:0,starts:{cN:"markup",e:i,rE:true,c:[a]}},j,e].concat(f)}},{cN:"preprocessor",b:"\\[",r:0},{cN:"shebang",b:"^#!.+lasso9\\b",r:10}].concat(f)}});hljs.registerLanguage("cpp",function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c","h","c++","h++"],k:b,i:"</",c:[a.CLCM,a.CBCM,a.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},a.CNM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line pragma",c:[{b:'include\\s*[<"]',e:'[>"]',k:"include",i:"\\n"},a.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,c:["self"]},{b:a.IR+"::"}]}});hljs.registerLanguage("matlab",function(a){var b=[a.CNM,{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}]}];return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[a.UTM,{cN:"params",b:"\\(",e:"\\)"},{cN:"params",b:"\\[",e:"\\]"}]},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",c:b,r:0},{cN:"cell",b:"\\{",c:b,i:/:/,v:[{e:/\}'[\.']*/},{e:/\}/,r:0}]},{cN:"comment",b:"\\%",e:"$"}].concat(b)}});hljs.registerLanguage("scilab",function(a){var b=[a.CNM,{cN:"string",b:"'|\"",e:"'|\"",c:[a.BE,{b:"''"}]}];return{aliases:["sci"],k:{keyword:"abort break case clear catch continue do elseif else endfunction end for functionglobal if pause return resume select try then while%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp errorexec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isemptyisinfisnan isvector lasterror length load linspace list listfiles log10 log2 logmax min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand realround sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tantype typename warning zeros matrix"},i:'("|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function endfunction",e:"$",k:"function endfunction|10",c:[a.UTM,{cN:"params",b:"\\(",e:"\\)"}]},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",r:0,c:b},{cN:"comment",b:"//",e:"$"}].concat(b)}});hljs.registerLanguage("makefile",function(a){var b={cN:"variable",b:/\$\(/,e:/\)/,c:[a.BE]};return{aliases:["mk","mak"],c:[a.HCM,{b:/^\w+\s*\W*=/,rB:true,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:true,starts:{e:/$/,r:0,c:[b]}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,c:[a.QSM,b]}]}});hljs.registerLanguage("asciidoc",function(a){return{c:[{cN:"comment",b:"^/{4,}\\n",e:"\\n/{4,}$",r:10},{cN:"comment",b:"^//",e:"$",r:0},{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"header",b:"^(={1,5}) .+?( \\1)?$",r:10},{cN:"header",b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$",r:10},{cN:"attribute",b:"^:.+?:",e:"\\s",eE:true,r:10},{cN:"attribute",b:"^\\[.+?\\]$",r:0},{cN:"blockquote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"label",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"smartquote",b:"``.+?''",r:10},{cN:"smartquote",b:"`.+?'",r:10},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{cN:"horizontal_rule",b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:true,c:[{b:"(link|image:?):",r:0},{cN:"link_url",b:"\\w",e:"[^\\[]+",r:0},{cN:"link_label",b:"\\[",e:"\\]",eB:true,eE:true,r:0}],r:10}]}});hljs.registerLanguage("parser3",function(a){return{sL:"xml",r:0,c:[{cN:"comment",b:"^#",e:"$"},{cN:"comment",b:"\\^rem{",e:"}",r:10,c:[{b:"{",e:"}",c:["self"]}]},{cN:"preprocessor",b:"^@(?:BASE|USE|CLASS|OPTIONS)$",r:10},{cN:"title",b:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{cN:"variable",b:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{cN:"keyword",b:"\\^[\\w\\-\\.\\:]+"},{cN:"number",b:"\\^#[0-9a-fA-F]+"},a.CNM]}});hljs.registerLanguage("clojure",function(l){var e={built_in:"def cond apply if-not if-let if not not= = &lt; < > &lt;= <= >= == + / * - rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"};var f="[a-zA-Z_0-9\\!\\.\\?\\-\\+\\*\\/\\<\\=\\>\\&\\#\\$';]+";var a="[\\s:\\(\\{]+\\d+(\\.\\d+)?";var d={cN:"number",b:a,r:0};var j=l.inherit(l.QSM,{i:null});var o={cN:"comment",b:";",e:"$",r:0};var n={cN:"collection",b:"[\\[\\{]",e:"[\\]\\}]"};var c={cN:"comment",b:"\\^"+f};var b={cN:"comment",b:"\\^\\{",e:"\\}"};var h={cN:"attribute",b:"[:]"+f};var m={cN:"list",b:"\\(",e:"\\)"};var g={eW:true,k:{literal:"true false nil"},r:0};var i={k:e,l:f,cN:"title",b:f,starts:g};m.c=[{cN:"comment",b:"comment"},i,g];g.c=[m,j,c,b,o,h,n,d];n.c=[m,j,c,o,h,n,d];return{aliases:["clj"],i:/\S/,c:[o,m,{cN:"prompt",b:/^=> /,starts:{e:/\n\n|\Z/}}]}});hljs.registerLanguage("elixir",function(e){var f="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var g="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var i="and false then defined module in return redo retry end for true self when next until do begin unless nil break not case cond alias while ensure or include use alias fn quote";var c={cN:"subst",b:"#\\{",e:"}",l:f,k:i};var d={cN:"string",c:[e.BE,c],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]};var b={eW:true,rE:true,l:f,k:i,r:0};var h={cN:"function",bK:"def defmacro",e:/\bdo\b/,c:[e.inherit(e.TM,{b:g,starts:b})]};var j=e.inherit(h,{cN:"class",bK:"defmodule defrecord",e:/\bdo\b|$|;/});var a=[d,e.HCM,j,h,{cN:"constant",b:"(\\b[A-Z_]\\w*(.)?)+",r:0},{cN:"symbol",b:":",c:[d,{b:g}],r:0},{cN:"symbol",b:f+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"->"},{b:"("+e.RSR+")\\s*",c:[e.HCM,{cN:"regexp",i:"\\n",c:[e.BE,c],v:[{b:"/",e:"/[a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];c.c=a;b.c=a;return{l:f,k:i,c:a}});hljs.registerLanguage("typescript",function(a){return{aliases:["ts"],k:{keyword:"in if for while finally var new function|0 do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private get set super interface extendsstatic constructor implements enum export import declare",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void",},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:0},a.ASM,a.QSM,a.CLCM,a.CBCM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBCM,a.RM,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:true,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBCM],i:/["'\(]/}],i:/\[|%/,r:0},{cN:"constructor",bK:"constructor",e:/\{/,eE:true,r:10},{cN:"module",bK:"module",e:/\{/,eE:true,},{cN:"interface",bK:"interface",e:/\{/,eE:true,},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("go",function(a){var b={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer",constant:"true false iota nil",typename:"bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:b,i:"</",c:[a.CLCM,a.CBCM,a.QSM,{cN:"string",b:"'",e:"[^\\\\]'"},{cN:"string",b:"`",e:"`"},{cN:"number",b:"[^a-zA-Z_0-9](\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?",r:0},a.CNM]}}); \ No newline at end of file
diff --git a/vendor/assets/javascripts/highlightjs.min.js b/vendor/assets/javascripts/highlightjs.min.js
deleted file mode 100644
index d8acc5c5320..00000000000
--- a/vendor/assets/javascripts/highlightjs.min.js
+++ /dev/null
@@ -1 +0,0 @@
-var hljs=new function(){function k(v){return v.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("cs",function(b){var a="abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await ascending descending from get group into join let orderby partial select set value var where yield";return{k:a,c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},b.CLCM,b.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},b.ASM,b.QSM,b.CNM,{bK:"protected public private internal",e:/[{;=]/,k:a,c:[{bK:"class namespace interface",starts:{c:[b.TM]}},{b:b.IR+"\\s*\\(",rB:true,c:[b.TM]}]}]}});hljs.registerLanguage("ruby",function(e){var h="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor";var a={cN:"yardoctag",b:"@[A-Za-z]+"};var i={cN:"comment",v:[{b:"#",e:"$",c:[a]},{b:"^\\=begin",e:"^\\=end",c:[a],r:10},{b:"^__END__",e:"\\n$"}]};var c={cN:"subst",b:"#\\{",e:"}",k:g};var d={cN:"string",c:[e.BE,c],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:"%[qw]?\\(",e:"\\)"},{b:"%[qw]?\\[",e:"\\]"},{b:"%[qw]?{",e:"}"},{b:"%[qw]?<",e:">",r:10},{b:"%[qw]?/",e:"/",r:10},{b:"%[qw]?%",e:"%",r:10},{b:"%[qw]?-",e:"-",r:10},{b:"%[qw]?\\|",e:"\\|",r:10},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]};var b={cN:"params",b:"\\(",e:"\\)",k:g};var f=[d,i,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]},i]},{cN:"function",bK:"def",e:" |$|;",r:0,c:[e.inherit(e.TM,{b:h}),b,i]},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[d,{b:h}],r:0},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:[i,{cN:"regexp",c:[e.BE,c],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];c.c=f;b.c=f;return{k:g,c:f}});hljs.registerLanguage("diff",function(a){return{c:[{cN:"chunk",r:10,v:[{b:/^\@\@ +\-\d+,\d+ +\+\d+,\d+ +\@\@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}});hljs.registerLanguage("markdown",function(a){return{c:[{cN:"header",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{cN:"horizontal_rule",b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].+?[\\)\\]]",rB:true,c:[{cN:"link_label",b:"\\[",e:"\\]",eB:true,rE:true,r:0},{cN:"link_url",b:"\\]\\(",e:"\\)",eB:true,eE:true},{cN:"link_reference",b:"\\]\\[",e:"\\]",eB:true,eE:true,}],r:10},{b:"^\\[.+\\]:",e:"$",rB:true,c:[{cN:"link_reference",b:"\\[",e:"\\]",eB:true,eE:true},{cN:"link_url",b:"\\s",e:"$"}]}]}});hljs.registerLanguage("css",function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.NM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}});hljs.registerLanguage("http",function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}});hljs.registerLanguage("java",function(b){var a="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws";return{k:a,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}],r:10},b.CLCM,b.CBLCLM,b.ASM,b.QSM,{bK:"protected public private",e:/[{;=]/,k:a,c:[{cN:"class",bK:"class interface",eW:true,i:/[:"<>]/,c:[{bK:"extends implements",r:10},b.UTM]},{b:b.UIR+"\\s*\\(",rB:true,c:[b.UTM]}]},b.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("php",function(b){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var a={cN:"preprocessor",b:/<\?(php)?|\?>/};var c={cN:"string",c:[b.BE,a],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},b.inherit(b.ASM,{i:null}),b.inherit(b.QSM,{i:null})]};var d={v:[b.BNM,b.CNM]};return{cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[b.CLCM,b.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"},a]},{cN:"comment",b:"__halt_compiler.+?;",eW:true,k:"__halt_compiler",l:b.UIR},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[b.BE]},a,e,{cN:"function",bK:"function",e:/[;{]/,i:"\\$|\\[|%",c:[b.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",e,b.CBLCLM,c,d]}]},{cN:"class",bK:"class interface",e:"{",i:/[:\(\$"]/,c:[{bK:"extends implements",r:10},b.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[b.UTM]},{bK:"use",e:";",c:[b.UTM]},{b:"=>"},c,d]}});hljs.registerLanguage("python",function(a){var f={cN:"prompt",b:/^(>>>|\.\.\.) /};var b={cN:"string",c:[a.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[f],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[f],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/,},{b:/(b|br)"/,e:/"/,},a.ASM,a.QSM]};var d={cN:"number",r:0,v:[{b:a.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:a.CNR+"[lLjJ]?"}]};var e={cN:"params",b:/\(/,e:/\)/,c:["self",f,d,b]};var c={e:/:/,i:/[${=;\n]/,c:[a.UTM,e]};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[f,d,b,a.HCM,a.inherit(c,{cN:"function",bK:"def",r:10}),a.inherit(c,{cN:"class",bK:"class"}),{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("sql",function(a){return{cI:true,i:/[<>]/,c:[{cN:"operator",b:"\\b(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant|merge)\\b(?!:)",e:";",eW:true,k:{keyword:"all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number trigger if before after each row merge matched database",aggregate:"count sum min max avg"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM]},a.CBLCLM,{cN:"comment",b:"--",e:"$"}]}});hljs.registerLanguage("ini",function(a){return{cI:true,i:/\S/,c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM],r:0}]}]}});hljs.registerLanguage("perl",function(c){var d="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var f={cN:"subst",b:"[$@]\\{",e:"\\}",k:d};var g={b:"->{",e:"}"};var a={cN:"variable",v:[{b:/\$\d/},{b:/[\$\%\@\*](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/},{b:/[\$\%\@\*][^\s\w{]/,r:0}]};var e={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var h=[c.BE,f,a];var b=[a,c.HCM,e,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},g,{cN:"string",c:h,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[c.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[c.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+c.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[c.HCM,e,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[c.BE],r:0}]},{cN:"sub",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",r:5},{cN:"operator",b:"-\\w\\b",r:0}];f.c=b;g.c=b;return{k:d,c:b}});hljs.registerLanguage("objectivec",function(a){var d={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign self synchronized id nonatomic super unichar IBOutlet IBAction strong weak @private @protected @public @try @property @end @throw @catch @finally @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection UIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"};var c=/[a-zA-Z@][a-zA-Z0-9_]*/;var b="@interface @class @protocol @implementation";return{k:d,l:c,i:"</",c:[a.CLCM,a.CBLCLM,a.CNM,a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"preprocessor",b:"#import",e:"$",c:[{cN:"title",b:'"',e:'"'},{cN:"title",b:"<",e:">"}]},{cN:"preprocessor",b:"#",e:"$"},{cN:"class",b:"("+b.split(" ").join("|")+")\\b",e:"({|$)",k:b,l:c,c:[a.UTM]},{cN:"variable",b:"\\."+a.UIR,r:0}]}});hljs.registerLanguage("coffeescript",function(c){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module exports global window document"};var a="[A-Za-z$_][0-9A-Za-z$_]*";var f=c.inherit(c.TM,{b:a});var e={cN:"subst",b:/#\{/,e:/}/,k:b};var d=[c.BNM,c.inherit(c.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[c.BE]},{b:/'/,e:/'/,c:[c.BE]},{b:/"""/,e:/"""/,c:[c.BE,e]},{b:/"/,e:/"/,c:[c.BE,e]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[e,c.HCM]},{b:"//[gim]*",r:0},{b:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"}]},{cN:"property",b:"@"+a},{b:"`",e:"`",eB:true,eE:true,sL:"javascript"}];e.c=d;return{k:b,c:d.concat([{cN:"comment",b:"###",e:"###"},c.HCM,{cN:"function",b:"("+a+"\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",e:"[-=]>",rB:true,c:[f,{cN:"params",b:"\\(",rB:true,c:[{b:/\(/,e:/\)/,k:b,c:["self"].concat(d)}]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:true,i:/[:="\[\]]/,c:[f]},f]},{cN:"attribute",b:a+":",e:":",rB:true,eE:true,r:0}])}});hljs.registerLanguage("nginx",function(c){var b={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+c.UIR}]};var a={eW:true,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[c.HCM,{cN:"string",c:[c.BE,b],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:true,eE:true},{cN:"regexp",c:[c.BE,b],v:[{b:"\\s\\^",e:"\\s|{|;",rE:true},{b:"~\\*?\\s+",e:"\\s|{|;",rE:true},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},b]};return{c:[c.HCM,{b:c.UIR+"\\s",e:";|{",rB:true,c:[c.inherit(c.UTM,{starts:a})],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("json",function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}});hljs.registerLanguage("apache",function(a){var b={cN:"number",b:"[\\$%]\\d+"};return{cI:true,c:[a.HCM,{cN:"tag",b:"</?",e:">"},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",b]},b,a.QSM]}}],i:/\S/}});hljs.registerLanguage("cpp",function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c"],k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},a.CNM,{cN:"preprocessor",b:"#",e:"$",c:[{b:"include\\s*<",e:">",i:"\\n"},a.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10,c:["self"]}]}});hljs.registerLanguage("makefile",function(a){var b={cN:"variable",b:/\$\(/,e:/\)/,c:[a.BE]};return{c:[a.HCM,{b:/^\w+\s*\W*=/,rB:true,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:true,starts:{e:/$/,r:0,c:[b],}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,c:[a.QSM,b]}]}}); \ No newline at end of file
diff --git a/vendor/assets/javascripts/jquery.sticky.js b/vendor/assets/javascripts/jquery.sticky.js
new file mode 100755
index 00000000000..f7c9cd46ae9
--- /dev/null
+++ b/vendor/assets/javascripts/jquery.sticky.js
@@ -0,0 +1,170 @@
+// Sticky Plugin v1.0.0 for jQuery
+// =============
+// Author: Anthony Garand
+// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
+// Improvements by Leonardo C. Daronco (daronco)
+// Created: 2/14/2011
+// Date: 2/12/2012
+// Website: http://labs.anthonygarand.com/sticky
+// Description: Makes an element on the page stick on the screen as you scroll
+// It will only set the 'top' and 'position' of your element, you
+// might need to adjust the width in some cases.
+
+(function($) {
+ var defaults = {
+ topSpacing: 0,
+ bottomSpacing: 0,
+ className: 'is-sticky',
+ wrapperClassName: 'sticky-wrapper',
+ center: false,
+ getWidthFrom: '',
+ responsiveWidth: false
+ },
+ $window = $(window),
+ $document = $(document),
+ sticked = [],
+ windowHeight = $window.height(),
+ scroller = function() {
+ var scrollTop = $window.scrollTop(),
+ documentHeight = $document.height(),
+ dwh = documentHeight - windowHeight,
+ extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
+
+ for (var i = 0; i < sticked.length; i++) {
+ var s = sticked[i],
+ elementTop = s.stickyWrapper.offset().top,
+ etse = elementTop - s.topSpacing - extra;
+
+ if (scrollTop <= etse) {
+ if (s.currentTop !== null) {
+ s.stickyElement
+ .css('position', '')
+ .css('top', '');
+ s.stickyElement.trigger('sticky-end', [s]).parent().removeClass(s.className);
+ s.currentTop = null;
+ }
+ }
+ else {
+ var newTop = documentHeight - s.stickyElement.outerHeight()
+ - s.topSpacing - s.bottomSpacing - scrollTop - extra;
+ if (newTop < 0) {
+ newTop = newTop + s.topSpacing;
+ } else {
+ newTop = s.topSpacing;
+ }
+ if (s.currentTop != newTop) {
+ s.stickyElement
+ .css('position', 'fixed')
+ .css('top', newTop);
+
+ if (typeof s.getWidthFrom !== 'undefined') {
+ s.stickyElement.css('width', $(s.getWidthFrom).width());
+ }
+
+ s.stickyElement.trigger('sticky-start', [s]).parent().addClass(s.className);
+ s.currentTop = newTop;
+ }
+ }
+ }
+ },
+ resizer = function() {
+ windowHeight = $window.height();
+
+ for (var i = 0; i < sticked.length; i++) {
+ var s = sticked[i];
+ if (typeof s.getWidthFrom !== 'undefined' && s.responsiveWidth === true) {
+ s.stickyElement.css('width', $(s.getWidthFrom).width());
+ }
+ }
+ },
+ methods = {
+ init: function(options) {
+ var o = $.extend({}, defaults, options);
+ return this.each(function() {
+ var stickyElement = $(this);
+
+ var stickyId = stickyElement.attr('id');
+ var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName
+ var wrapper = $('<div></div>')
+ .attr('id', stickyId + '-sticky-wrapper')
+ .addClass(o.wrapperClassName);
+ stickyElement.wrapAll(wrapper);
+
+ if (o.center) {
+ stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
+ }
+
+ if (stickyElement.css("float") == "right") {
+ stickyElement.css({"float":"none"}).parent().css({"float":"right"});
+ }
+
+ var stickyWrapper = stickyElement.parent();
+ stickyWrapper.css('height', stickyElement.outerHeight());
+ sticked.push({
+ topSpacing: o.topSpacing,
+ bottomSpacing: o.bottomSpacing,
+ stickyElement: stickyElement,
+ currentTop: null,
+ stickyWrapper: stickyWrapper,
+ className: o.className,
+ getWidthFrom: o.getWidthFrom,
+ responsiveWidth: o.responsiveWidth
+ });
+ });
+ },
+ update: scroller,
+ unstick: function(options) {
+ return this.each(function() {
+ var unstickyElement = $(this);
+
+ var removeIdx = -1;
+ for (var i = 0; i < sticked.length; i++)
+ {
+ if (sticked[i].stickyElement.get(0) == unstickyElement.get(0))
+ {
+ removeIdx = i;
+ }
+ }
+ if(removeIdx != -1)
+ {
+ sticked.splice(removeIdx,1);
+ unstickyElement.unwrap();
+ unstickyElement.removeAttr('style');
+ }
+ });
+ }
+ };
+
+ // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
+ if (window.addEventListener) {
+ window.addEventListener('scroll', scroller, false);
+ window.addEventListener('resize', resizer, false);
+ } else if (window.attachEvent) {
+ window.attachEvent('onscroll', scroller);
+ window.attachEvent('onresize', resizer);
+ }
+
+ $.fn.sticky = function(method) {
+ if (methods[method]) {
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ } else if (typeof method === 'object' || !method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ $.error('Method ' + method + ' does not exist on jQuery.sticky');
+ }
+ };
+
+ $.fn.unstick = function(method) {
+ if (methods[method]) {
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ } else if (typeof method === 'object' || !method ) {
+ return methods.unstick.apply( this, arguments );
+ } else {
+ $.error('Method ' + method + ' does not exist on jQuery.sticky');
+ }
+
+ };
+ $(function() {
+ setTimeout(scroller, 0);
+ });
+})(jQuery);