From 083f1e2f13e546e973cf7304adb00c81b1423ba6 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Mon, 29 Sep 2014 13:26:09 +0200 Subject: [PATCH 01/55] Fix dev user seed: multiple ID was used twice. --- db/fixtures/development/05_users.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/db/fixtures/development/05_users.rb b/db/fixtures/development/05_users.rb index c263dd232af..b697f58d4ef 100644 --- a/db/fixtures/development/05_users.rb +++ b/db/fixtures/development/05_users.rb @@ -16,14 +16,13 @@ Gitlab::Seeder.quiet do (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' - ]) + User.seed do |s| + s.username = "user#{i}" + s.name = "User #{i}" + s.email = "user#{i}@example.com" + s.confirmed_at = DateTime.now + s.password = '12345678' + end print '.' rescue ActiveRecord::RecordNotSaved print 'F' From e2e4dc5942221f37713c3414e1811cc85dfaeab9 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 27 Sep 2014 22:05:02 +0200 Subject: [PATCH 02/55] Use blob local instead of instance. --- app/views/projects/blob/_blob.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml index be785dacedb..6ad40e8fa1f 100644 --- a/app/views/projects/blob/_blob.html.haml +++ b/app/views/projects/blob/_blob.html.haml @@ -16,7 +16,7 @@ = link_to title, '#' %ul.blob-commit-info.bs-callout.bs-callout-info.hidden-xs - - blob_commit = @repository.last_commit_for_path(@commit.id, @blob.path) + - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path) = render blob_commit, project: @project %div#tree-content-holder.tree-content-holder From 81eacd1b2a591d3ce1f14d4119527ea9b290ba8f Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sun, 28 Sep 2014 11:02:29 +0200 Subject: [PATCH 03/55] Disable / hide MR edit blob button if cannot edit. --- app/helpers/tree_helper.rb | 31 ++++++++++++++++++---- app/views/projects/blob/_actions.html.haml | 8 +----- app/views/projects/diffs/_file.html.haml | 6 ++--- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index d815257a4e3..7d616589519 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -53,13 +53,34 @@ module TreeHelper File.join(*args) end - def allowed_tree_edit? - return false unless @repository.branch_names.include?(@ref) + def allowed_tree_edit?(project = nil, ref = nil) + project ||= @project + ref ||= @ref + return false unless project.repository.branch_names.include?(ref) - if @project.protected_branch? @ref - can?(current_user, :push_code_to_protected_branches, @project) + if project.protected_branch? ref + can?(current_user, :push_code_to_protected_branches, project) else - can?(current_user, :push_code, @project) + can?(current_user, :push_code, project) + end + end + + def edit_blob_link(project, ref, path, options = {}) + if project.repository.blob_at(ref, path).text? + text = 'Edit' + after = options[:after] || '' + from_mr = options[:from_merge_request_id] + link_opts = {} + link_opts[:from_merge_request_id] = from_mr if from_mr + cls = 'btn btn-small' + if allowed_tree_edit?(project, ref) + link_to text, project_edit_tree_path(project, tree_join(ref, path), + link_opts), class: cls + else + content_tag :span, text, class: cls + ' disabled' + end + after.html_safe + else + '' end end diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml index 64c19a57803..d8e190417af 100644 --- a/app/views/projects/blob/_actions.html.haml +++ b/app/views/projects/blob/_actions.html.haml @@ -1,11 +1,5 @@ .btn-group.tree-btn-group - -# only show edit link for text files - - if @blob.text? - - if allowed_tree_edit? - = link_to 'Edit', project_edit_tree_path(@project, @id), - class: 'btn btn-small' - - else - %span.btn.btn-small.disabled Edit + = edit_blob_link(@project, @ref, @path) = link_to 'Raw', project_raw_path(@project, @id), class: 'btn btn-small', target: '_blank' -# only show normal/blame view links for text files diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index 751df6a02e9..fc1faf73854 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -27,9 +27,9 @@   - if @merge_request && @merge_request.source_project - = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff_file.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do - Edit -   + = edit_blob_link(@merge_request.source_project, + @merge_request.source_branch, diff_file.new_path, + after: ' ', from_merge_request_id: @merge_request.id) = view_file_btn(@commit.id, diff_file, project) From f4efb19038d01225374c91cca9274cce3d728b3d Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Mon, 6 Oct 2014 23:37:27 +0200 Subject: [PATCH 04/55] Add tests for tree edit routes Critical because of possible confusion between /:id/preview and /:id for a path that ends in preview. --- config/routes.rb | 1 + spec/routing/project_routing_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 2534153758b..c0a970517b6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -198,6 +198,7 @@ Gitlab::Application.routes.draw do 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 + # Cannot be GET to differentiate from GET paths that end in preview. post :preview, on: :member end resources :new_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'new' diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 4b2eb42c709..8a7d76cc970 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -432,6 +432,26 @@ describe Projects::TreeController, "routing" do end end +describe Projects::EditTreeController, 'routing' do + it 'to #show' do + get('/gitlab/gitlabhq/edit/master/app/models/project.rb').should( + route_to('projects/edit_tree#show', + project_id: 'gitlab/gitlabhq', + id: 'master/app/models/project.rb')) + get('/gitlab/gitlabhq/edit/master/app/models/project.rb/preview').should( + route_to('projects/edit_tree#show', + project_id: 'gitlab/gitlabhq', + id: 'master/app/models/project.rb/preview')) + end + + it 'to #preview' do + post('/gitlab/gitlabhq/edit/master/app/models/project.rb/preview').should( + route_to('projects/edit_tree#preview', + project_id: 'gitlab/gitlabhq', + id: 'master/app/models/project.rb')) + end +end + # project_compare_index GET /:project_id/compare(.:format) compare#index {id: /[^\/]+/, project_id: /[^\/]+/} # POST /:project_id/compare(.:format) compare#create {id: /[^\/]+/, project_id: /[^\/]+/} # project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/} From 5700842ba8ca2f3100395a9fb98c759e78e63d96 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Wed, 15 Oct 2014 02:21:21 -0500 Subject: [PATCH 05/55] Add Markdown preview to more forms Enable Markdown previews when creating and editing issues, merge requests, and milestones, and when editing notes. --- .../javascripts/markdown_area.js.coffee | 45 +++++++++++++++ app/assets/javascripts/notes.js.coffee | 55 +------------------ .../stylesheets/generic/markdown_area.scss | 25 +++++++++ app/assets/stylesheets/sections/notes.scss | 10 ---- app/controllers/projects/notes_controller.rb | 4 -- app/controllers/projects_controller.rb | 4 ++ app/views/projects/_issuable_form.html.haml | 25 +++++---- app/views/projects/_md_preview.html.haml | 12 ++++ .../merge_requests/_new_submit.html.haml | 13 +++-- app/views/projects/milestones/_form.html.haml | 11 ++-- app/views/projects/notes/_form.html.haml | 22 ++------ app/views/projects/notes/_note.html.haml | 3 +- config/routes.rb | 5 +- features/project/issues/issues.feature | 27 +++++++++ features/project/merge_requests.feature | 31 +++++++++++ features/steps/project/merge_requests.rb | 4 ++ features/steps/shared/diff_note.rb | 14 ++--- features/steps/shared/markdown.rb | 39 +++++++++++++ features/steps/shared/note.rb | 12 ++-- spec/features/notes_on_merge_requests_spec.rb | 12 ++-- spec/routing/project_routing_spec.rb | 28 +++++----- 21 files changed, 260 insertions(+), 141 deletions(-) create mode 100644 app/views/projects/_md_preview.html.haml diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee index a0ebfc98ce6..a4bd4774dc9 100644 --- a/app/assets/javascripts/markdown_area.js.coffee +++ b/app/assets/javascripts/markdown_area.js.coffee @@ -24,6 +24,51 @@ $(document).ready -> "opacity": 0 "display": "none" + # Preview button + $(document).off "click", ".js-md-preview-button" + $(document).on "click", ".js-md-preview-button", (e) -> + ### + Shows the Markdown preview. + + Lets the server render GFM into Html and displays it. + ### + e.preventDefault() + form = $(this).closest("form") + # toggle tabs + form.find(".js-md-write-button").parent().removeClass "active" + form.find(".js-md-preview-button").parent().addClass "active" + + # toggle content + form.find(".md-write-holder").hide() + form.find(".md-preview-holder").show() + + preview = form.find(".js-md-preview") + mdText = form.find(".markdown-area").val() + if mdText.trim().length is 0 + preview.text "Nothing to preview." + else + preview.text "Loading..." + $.post($(this).data("url"), + md_text: mdText + ).success (previewData) -> + preview.html previewData + + # Write button + $(document).off "click", ".js-md-write-button" + $(document).on "click", ".js-md-write-button", (e) -> + ### + Shows the Markdown textarea. + ### + e.preventDefault() + form = $(this).closest("form") + # toggle tabs + form.find(".js-md-write-button").parent().addClass "active" + form.find(".js-md-preview-button").parent().removeClass "active" + + # toggle content + form.find(".md-write-holder").show() + form.find(".md-preview-holder").hide() + dropzone = $(".div-dropzone").dropzone( url: project_image_path_upload dictDefaultMessage: "" diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index ba8d7a9a2f5..b6bb0c42ad4 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -36,12 +36,6 @@ class Notes # delete note attachment $(document).on "click", ".js-note-attachment-delete", @removeAttachment - # Preview button - $(document).on "click", ".js-note-preview-button", @previewNote - - # Preview button - $(document).on "click", ".js-note-write-button", @writeNote - # reset main target form after submit $(document).on "ajax:complete", ".js-main-target-form", @resetMainTargetForm @@ -77,8 +71,6 @@ class Notes $(document).off "click", ".note-edit-cancel" $(document).off "click", ".js-note-delete" $(document).off "click", ".js-note-attachment-delete" - $(document).off "click", ".js-note-preview-button" - $(document).off "click", ".js-note-write-button" $(document).off "ajax:complete", ".js-main-target-form" $(document).off "click", ".js-choose-note-attachment-button" $(document).off "click", ".js-discussion-reply-button" @@ -165,47 +157,6 @@ class Notes # cleanup after successfully creating a diff/discussion note @removeDiscussionNoteForm(form) - ### - Shows write note textarea. - ### - writeNote: (e) -> - e.preventDefault() - form = $(this).closest("form") - # toggle tabs - form.find(".js-note-write-button").parent().addClass "active" - form.find(".js-note-preview-button").parent().removeClass "active" - - # toggle content - form.find(".note-write-holder").show() - form.find(".note-preview-holder").hide() - - ### - Shows the note preview. - - Lets the server render GFM into Html and displays it. - ### - previewNote: (e) -> - e.preventDefault() - form = $(this).closest("form") - # toggle tabs - form.find(".js-note-write-button").parent().removeClass "active" - form.find(".js-note-preview-button").parent().addClass "active" - - # toggle content - form.find(".note-write-holder").hide() - form.find(".note-preview-holder").show() - - preview = form.find(".js-note-preview") - noteText = form.find(".js-note-text").val() - if noteText.trim().length is 0 - preview.text "Nothing to preview." - else - preview.text "Loading..." - $.post($(this).data("url"), - note: noteText - ).success (previewData) -> - preview.html previewData - ### Called in response the main target form has been successfully submitted. @@ -220,7 +171,7 @@ class Notes form.find(".js-errors").remove() # reset text and preview - form.find(".js-note-write-button").click() + form.find(".js-md-write-button").click() form.find(".js-note-text").val("").trigger "input" ### @@ -270,8 +221,8 @@ class Notes form.removeClass "js-new-note-form" # setup preview buttons - form.find(".js-note-write-button, .js-note-preview-button").tooltip placement: "left" - previewButton = form.find(".js-note-preview-button") + form.find(".js-md-write-button, .js-md-preview-button").tooltip placement: "left" + previewButton = form.find(".js-md-preview-button") form.find(".js-note-text").on "input", -> if $(this).val().trim() isnt "" previewButton.removeClass("turn-off").addClass "turn-on" diff --git a/app/assets/stylesheets/generic/markdown_area.scss b/app/assets/stylesheets/generic/markdown_area.scss index fbfa72c5e5e..e8c21afabe1 100644 --- a/app/assets/stylesheets/generic/markdown_area.scss +++ b/app/assets/stylesheets/generic/markdown_area.scss @@ -50,3 +50,28 @@ margin-bottom: 0; transition: opacity 200ms ease-in-out; } + +.md-preview-holder { + background: #FFF; + border: 1px solid #ddd; + min-height: 100px; + padding: 5px; + font-size: 14px; + box-shadow: none; +} + +.new_note, +.edit_note, +.issuable-description, +.milestone-description, +.merge-request-form { + .nav-tabs { + margin-bottom: 0; + border: none; + + li a, + li.active a { + border: 1px solid #DDD; + } + } +} diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index 7eb42fddade..65ad46a4579 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -224,7 +224,6 @@ ul.notes { margin-bottom: 0; } - .note-preview-holder, .note_text { background: #FFF; border: 1px solid #ddd; @@ -243,15 +242,6 @@ ul.notes { .note_text { width: 100%; } - .nav-tabs { - margin-bottom: 0; - border: none; - - li a, - li.active a { - border: 1px solid #DDD; - } - } } /* loading indicator */ diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 7b08b79d236..2f1d631c14a 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -61,10 +61,6 @@ class Projects::NotesController < Projects::ApplicationController end end - def preview - render text: view_context.markdown(params[:note]) - end - private def note diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b3380a6ff23..aca091e7d2c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -183,6 +183,10 @@ class ProjectsController < ApplicationController render json: { star_count: @project.star_count } end + def markdown_preview + render text: view_context.markdown(params[:md_text]) + end + private def upload_path diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml index 6cdfab933b4..675b73a59cb 100644 --- a/app/views/projects/_issuable_form.html.haml +++ b/app/views/projects/_issuable_form.html.haml @@ -14,17 +14,20 @@ .form-group.issuable-description = f.label :description, 'Description', class: 'control-label' .col-sm-10 - = render 'projects/zen', f: f, attr: :description, - classes: 'description form-control' - .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 & dropping - or #{link_to 'selecting them', '#', class: 'markdown-selector' }. - .clearfix - .error-alert + + = render layout: 'projects/md_preview' do + = render 'projects/zen', f: f, attr: :description, + classes: 'description form-control' + .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 & dropping + or #{link_to 'selecting them', '#', class: 'markdown-selector' }. + + .clearfix + .error-alert %hr .form-group .issue-assignee diff --git a/app/views/projects/_md_preview.html.haml b/app/views/projects/_md_preview.html.haml new file mode 100644 index 00000000000..dbbf8e3bf97 --- /dev/null +++ b/app/views/projects/_md_preview.html.haml @@ -0,0 +1,12 @@ +%ul.nav.nav-tabs + %li.active + = link_to '#md-write-holder', class: 'js-md-write-button' do + Write + %li + = link_to '#md-preview-holder', class: 'js-md-preview-button', data: { url: markdown_preview_project_path(@project) } do + Preview +%div + .md-write-holder + = yield + .md-preview-holder.hide + .js-md-preview diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index d4666eacd7e..76813e688b5 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -21,12 +21,13 @@ .form-group .light = f.label :description, "Description" - = render 'projects/zen', f: f, attr: :description, - classes: 'description form-control' - .clearfix.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 & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. - .error-alert + = render layout: 'projects/md_preview' do + = render 'projects/zen', f: f, attr: :description, + classes: 'description form-control' + .clearfix.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 & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. + .error-alert .form-group .issue-assignee = f.label :assignee_id do diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml index 5fb01a11cc5..0f51a347f01 100644 --- a/app/views/projects/milestones/_form.html.haml +++ b/app/views/projects/milestones/_form.html.haml @@ -18,13 +18,14 @@ .col-sm-10 = f.text_field :title, maxlength: 255, class: "form-control" %p.hint Required - .form-group + .form-group.milestone-description = f.label :description, "Description", class: "control-label" .col-sm-10 - = render 'projects/zen', f: f, attr: :description, classes: 'description form-control' - .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' }. + = render layout: 'projects/md_preview' do + = render 'projects/zen', f: f, attr: :description, classes: 'description form-control' + .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' }. .clearfix .error-alert .col-md-6 diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index c68b3817e79..05946162d3b 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -5,23 +5,13 @@ = f.hidden_field :noteable_id = f.hidden_field :noteable_type - %ul.nav.nav-tabs - %li.active - = link_to '#note-write-holder', class: 'js-note-write-button' do - Write - %li - = link_to '#note-preview-holder', class: 'js-note-preview-button', data: { url: preview_project_notes_path(@project) } do - Preview - %div - .note-write-holder - = render 'projects/zen', f: f, attr: :note, - classes: 'note_text js-note-text' - .light.clearfix - .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }} - .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }. + = render layout: 'projects/md_preview' do + = render 'projects/zen', f: f, attr: :note, + classes: 'note_text js-note-text' + .light.clearfix + .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }} + .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }. - .note-preview-holder.hide - .js-note-preview .note-form-actions .buttons diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index 814bf19970c..aa52ff35d0c 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -38,7 +38,8 @@ .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' + = render layout: 'projects/md_preview' do + = f.text_area :note, class: 'note_text js-note-text markdown-area js-gfm-input turn-on' .form-actions.clearfix = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button" diff --git a/config/routes.rb b/config/routes.rb index 2534153758b..5dbb238ba6b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -186,6 +186,7 @@ Gitlab::Application.routes.draw do post :unarchive post :upload_image post :toggle_star + post :markdown_preview get :autocomplete_sources get :import put :retry_import @@ -328,10 +329,6 @@ Gitlab::Application.routes.draw do member do delete :delete_attachment end - - collection do - post :preview - end end end end diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index 4db8551559b..e7fbe2bd6f1 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -159,3 +159,30 @@ Feature: Project Issues Given project "Shop" has "Tasks-closed" closed issue with task markdown When I visit issue page "Tasks-closed" Then Task checkboxes should be disabled + + # Issue description preview + + @javascript + Scenario: I can't preview without text + Given I click link "New Issue" + And I haven't written any description text + Then I should not see the Markdown preview button + + @javascript + Scenario: I can preview with text + Given I click link "New Issue" + And I write a description like "Nice" + Then I should see the Markdown preview button + + @javascript + Scenario: I preview an issue description + Given I click link "New Issue" + And I preview a description text like "Bug fixed :smile:" + Then I should see the Markdown preview + And I should not see the Markdown text field + + @javascript + Scenario: I can edit after preview + Given I click link "New Issue" + And I preview a description text like "Bug fixed :smile:" + Then I should see the Markdown edit button diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index d20358a7dc6..f1adf0bd34d 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -187,3 +187,34 @@ Feature: Project Merge Requests And I visit merge request page "MR-task-open" And I click link "Close" Then Task checkboxes should be disabled + + # Description preview + + @javascript + Scenario: I can't preview without text + Given I visit merge request page "Bug NS-04" + And I click link "Edit" + And I haven't written any description text + Then I should not see the Markdown preview button + + @javascript + Scenario: I can preview with text + Given I visit merge request page "Bug NS-04" + And I click link "Edit" + And I write a description like "Nice" + Then I should see the Markdown preview button + + @javascript + Scenario: I preview a merge request description + Given I visit merge request page "Bug NS-04" + And I click link "Edit" + And I preview a description text like "Bug fixed :smile:" + Then I should see the Markdown preview + And I should not see the Markdown text field + + @javascript + Scenario: I can edit after preview + Given I visit merge request page "Bug NS-04" + And I click link "Edit" + And I preview a description text like "Bug fixed :smile:" + Then I should see the Markdown edit button diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index fae0cec53a6..32bee9a563f 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -10,6 +10,10 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps click_link "New Merge Request" end + step 'I click link "Edit"' do + click_link 'Edit' + end + step 'I click link "Bug NS-04"' do click_link "Bug NS-04" end diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 10f3ed90b56..bd22e95daee 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -32,7 +32,7 @@ module SharedDiffNote 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") + find('.js-md-preview-button').trigger('click') end end @@ -41,7 +41,7 @@ module SharedDiffNote 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") + find('.js-md-preview-button').trigger('click') end end @@ -73,7 +73,7 @@ module SharedDiffNote step 'I should not see the diff comment preview button' do within(diff_file_selector) do - page.should have_css(".js-note-preview-button", visible: false) + page.should have_css('.js-md-preview-button', visible: false) end end @@ -131,25 +131,25 @@ module SharedDiffNote step 'I should see the diff comment preview' do within("#{diff_file_selector} form") do - page.should have_css(".js-note-preview", visible: false) + page.should have_css('.js-md-preview', visible: false) end end step 'I should see the diff comment edit button' do within(diff_file_selector) do - page.should have_css(".js-note-write-button", visible: true) + page.should have_css('.js-md-write-button', visible: true) end end step 'I should see the diff comment preview button' do within(diff_file_selector) do - page.should have_css(".js-note-preview-button", visible: true) + page.should have_css('.js-md-preview-button', visible: true) end end step 'I should see two separate previews' do within(diff_file_selector) do - page.should have_css(".js-note-preview", visible: true, count: 2) + page.should have_css('.js-md-preview', visible: true, count: 2) page.should have_content("Should fix it") page.should have_content("DRY this up") end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 8bf138065b0..f3e61aa8e49 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -54,4 +54,43 @@ EOT 'div.description li.task-list-item input[type="checkbox"]:disabled' ) end + + step 'I should not see the Markdown preview' do + find('.gfm-form').should have_css('.js-md-preview', visible: false) + end + + step 'I should not see the Markdown preview button' do + find('.gfm-form').should have_css('.js-md-preview-button', visible: false) + end + + step 'I should not see the Markdown text field' do + find('.gfm-form').should have_css('textarea', visible: false) + end + + step 'I should see the Markdown edit button' do + find('.gfm-form').should have_css('.js-md-write-button', visible: true) + end + + step 'I should see the Markdown preview' do + find('.gfm-form').should have_css('.js-md-preview', visible: true) + end + + step 'I should see the Markdown preview button' do + find('.gfm-form').should have_css('.js-md-preview-button', visible: true) + end + + step 'I write a description like "Nice"' do + find('.gfm-form').fill_in 'Description', with: 'Nice' + end + + step 'I preview a description text like "Bug fixed :smile:"' do + within('.gfm-form') do + fill_in 'Description', with: 'Bug fixed :smile:' + find('.js-md-preview-button').trigger('click') + end + end + + step 'I haven\'t written any description text' do + find('.gfm-form').fill_in 'Description', with: '' + end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 2b2cb47a715..e298312f065 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -23,7 +23,7 @@ module SharedNote step 'I preview a comment text like "Bug fixed :smile:"' do within(".js-main-target-form") do fill_in "note[note]", with: "Bug fixed :smile:" - find(".js-note-preview-button").trigger("click") + find('.js-md-preview-button').trigger('click') end end @@ -51,13 +51,13 @@ module SharedNote step 'I should not see the comment preview' do within(".js-main-target-form") do - page.should have_css(".js-note-preview", visible: false) + page.should have_css('.js-md-preview', visible: false) end end step 'I should not see the comment preview button' do within(".js-main-target-form") do - page.should have_css(".js-note-preview-button", visible: false) + page.should have_css('.js-md-preview-button', visible: false) end end @@ -81,19 +81,19 @@ module SharedNote step 'I should see the comment edit button' do within(".js-main-target-form") do - page.should have_css(".js-note-write-button", visible: true) + page.should have_css('.js-md-write-button', visible: true) end end step 'I should see the comment preview' do within(".js-main-target-form") do - page.should have_css(".js-note-preview", visible: true) + page.should have_css('.js-md-preview', visible: true) end end step 'I should see the comment preview button' do within(".js-main-target-form") do - page.should have_css(".js-note-preview-button", visible: true) + page.should have_css('.js-md-preview-button', visible: true) end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 92f3a6c0929..bf3c12012e5 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -20,7 +20,7 @@ describe 'Comments' 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) } + within('.js-main-target-form') { should have_css('.js-md-preview-button', visible: false) } end describe "with text" do @@ -32,7 +32,7 @@ describe 'Comments' do 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) } + within('.js-main-target-form') { should have_css('.js-md-preview-button', visible: true) } end end end @@ -41,7 +41,7 @@ describe 'Comments' do before do within(".js-main-target-form") do fill_in "note[note]", with: "This is awsome!" - find(".js-note-preview-button").trigger("click") + find('.js-md-preview-button').trigger('click') click_button "Add Comment" end end @@ -49,7 +49,7 @@ describe 'Comments' do 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-md-preview', visible: false) } within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } end end @@ -172,11 +172,11 @@ describe 'Comments' 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") + find('.js-md-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") + find('.js-md-preview-button').trigger('click') end end end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 4b2eb42c709..112082d8890 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -53,14 +53,15 @@ shared_examples "RESTful project resources" do end end -# projects POST /projects(.:format) projects#create -# new_project GET /projects/new(.:format) projects#new -# fork_project POST /:id/fork(.:format) projects#fork -# files_project GET /:id/files(.:format) projects#files -# edit_project GET /:id/edit(.:format) projects#edit -# project GET /:id(.:format) projects#show -# PUT /:id(.:format) projects#update -# DELETE /:id(.:format) projects#destroy +# projects POST /projects(.:format) projects#create +# new_project GET /projects/new(.:format) projects#new +# fork_project POST /:id/fork(.:format) projects#fork +# files_project GET /:id/files(.:format) projects#files +# edit_project GET /:id/edit(.:format) projects#edit +# project GET /:id(.:format) projects#show +# PUT /:id(.:format) projects#update +# DELETE /:id(.:format) projects#destroy +# markdown_preview_project POST /:id/markdown_preview(.:format) projects#markdown_preview describe ProjectsController, "routing" do it "to #create" do post("/projects").should route_to('projects#create') @@ -93,6 +94,12 @@ describe ProjectsController, "routing" do it "to #destroy" do delete("/gitlab/gitlabhq").should route_to('projects#destroy', id: 'gitlab/gitlabhq') end + + it 'to #markdown_preview' do + post('/gitlab/gitlabhq/markdown_preview').should( + route_to('projects#markdown_preview', id: 'gitlab/gitlabhq') + ) + end end # pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages @@ -392,15 +399,10 @@ describe Projects::IssuesController, "routing" do end end -# preview_project_notes POST /:project_id/notes/preview(.:format) notes#preview # project_notes GET /:project_id/notes(.:format) notes#index # POST /:project_id/notes(.:format) notes#create # project_note DELETE /:project_id/notes/:id(.:format) notes#destroy describe Projects::NotesController, "routing" do - it "to #preview" do - post("/gitlab/gitlabhq/notes/preview").should route_to('projects/notes#preview', project_id: 'gitlab/gitlabhq') - end - it_behaves_like "RESTful project resources" do let(:actions) { [:index, :create, :destroy] } let(:controller) { 'notes' } From cd3eabd71236d2be1430d2dbf23aad91d73aa783 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Thu, 16 Oct 2014 22:45:13 -0500 Subject: [PATCH 06/55] Use GET instead of POST for Markdown previews --- app/assets/javascripts/markdown_area.js.coffee | 2 +- config/routes.rb | 2 +- spec/routing/project_routing_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee index a4bd4774dc9..0ca7070dc8b 100644 --- a/app/assets/javascripts/markdown_area.js.coffee +++ b/app/assets/javascripts/markdown_area.js.coffee @@ -48,7 +48,7 @@ $(document).ready -> preview.text "Nothing to preview." else preview.text "Loading..." - $.post($(this).data("url"), + $.get($(this).data("url"), md_text: mdText ).success (previewData) -> preview.html previewData diff --git a/config/routes.rb b/config/routes.rb index 5dbb238ba6b..3edc78cee33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -186,7 +186,7 @@ Gitlab::Application.routes.draw do post :unarchive post :upload_image post :toggle_star - post :markdown_preview + get :markdown_preview get :autocomplete_sources get :import put :retry_import diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 112082d8890..f1f5ac96a62 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -61,7 +61,7 @@ end # project GET /:id(.:format) projects#show # PUT /:id(.:format) projects#update # DELETE /:id(.:format) projects#destroy -# markdown_preview_project POST /:id/markdown_preview(.:format) projects#markdown_preview +# markdown_preview_project GET /:id/markdown_preview(.:format) projects#markdown_preview describe ProjectsController, "routing" do it "to #create" do post("/projects").should route_to('projects#create') @@ -96,7 +96,7 @@ describe ProjectsController, "routing" do end it 'to #markdown_preview' do - post('/gitlab/gitlabhq/markdown_preview').should( + get('/gitlab/gitlabhq/markdown_preview').should( route_to('projects#markdown_preview', id: 'gitlab/gitlabhq') ) end From e1491465de441b386c72726f0b869104d1c15680 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Thu, 16 Oct 2014 23:10:50 -0500 Subject: [PATCH 07/55] Refactor Markdown preview tests Create a new shared module for common issue/merge request behavior, use `expect` syntax instead of `should`, and avoid `visible: false` in the `have_css` matcher. --- features/project/merge_requests.feature | 8 +++---- features/steps/project/merge_requests.rb | 5 +--- features/steps/shared/diff_note.rb | 18 +++++++------- features/steps/shared/issuable.rb | 15 ++++++++++++ features/steps/shared/markdown.rb | 14 +++++------ features/steps/shared/note.rb | 12 +++++----- spec/features/notes_on_merge_requests_spec.rb | 24 ++++++++++++------- 7 files changed, 57 insertions(+), 39 deletions(-) create mode 100644 features/steps/shared/issuable.rb diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index f1adf0bd34d..f8a43e1ee36 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -193,21 +193,21 @@ Feature: Project Merge Requests @javascript Scenario: I can't preview without text Given I visit merge request page "Bug NS-04" - And I click link "Edit" + And I click link "Edit" for the merge request And I haven't written any description text Then I should not see the Markdown preview button @javascript Scenario: I can preview with text Given I visit merge request page "Bug NS-04" - And I click link "Edit" + And I click link "Edit" for the merge request And I write a description like "Nice" Then I should see the Markdown preview button @javascript Scenario: I preview a merge request description Given I visit merge request page "Bug NS-04" - And I click link "Edit" + And I click link "Edit" for the merge request And I preview a description text like "Bug fixed :smile:" Then I should see the Markdown preview And I should not see the Markdown text field @@ -215,6 +215,6 @@ Feature: Project Merge Requests @javascript Scenario: I can edit after preview Given I visit merge request page "Bug NS-04" - And I click link "Edit" + And I click link "Edit" for the merge request And I preview a description text like "Bug fixed :smile:" Then I should see the Markdown edit button diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index 32bee9a563f..d5e060bdbe8 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -1,5 +1,6 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps include SharedAuthentication + include SharedIssuable include SharedProject include SharedNote include SharedPaths @@ -10,10 +11,6 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps click_link "New Merge Request" end - step 'I click link "Edit"' do - click_link 'Edit' - end - step 'I click link "Bug NS-04"' do click_link "Bug NS-04" end diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index bd22e95daee..8871b93edb6 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -32,7 +32,7 @@ module SharedDiffNote 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-md-preview-button').trigger('click') + find('.js-md-preview-button').click end end @@ -41,7 +41,7 @@ module SharedDiffNote within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do fill_in "note[note]", with: "DRY this up" - find('.js-md-preview-button').trigger('click') + find('.js-md-preview-button').click end end @@ -73,7 +73,7 @@ module SharedDiffNote step 'I should not see the diff comment preview button' do within(diff_file_selector) do - page.should have_css('.js-md-preview-button', visible: false) + expect(page).not_to have_css('.js-md-preview-button') end end @@ -131,27 +131,27 @@ module SharedDiffNote step 'I should see the diff comment preview' do within("#{diff_file_selector} form") do - page.should have_css('.js-md-preview', visible: false) + expect(page).to have_css('.js-md-preview') end end step 'I should see the diff comment edit button' do within(diff_file_selector) do - page.should have_css('.js-md-write-button', visible: true) + expect(page).to have_css('.js-md-write-button') end end step 'I should see the diff comment preview button' do within(diff_file_selector) do - page.should have_css('.js-md-preview-button', visible: true) + expect(page).to have_css('.js-md-preview-button') end end step 'I should see two separate previews' do within(diff_file_selector) do - page.should have_css('.js-md-preview', visible: true, count: 2) - page.should have_content("Should fix it") - page.should have_content("DRY this up") + expect(page).to have_css('.js-md-preview', count: 2) + expect(page).to have_content("Should fix it") + expect(page).to have_content("DRY this up") end end diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb new file mode 100644 index 00000000000..a0150e90380 --- /dev/null +++ b/features/steps/shared/issuable.rb @@ -0,0 +1,15 @@ +module SharedIssuable + include Spinach::DSL + + def edit_issuable + find('.issue-btn-group').click_link 'Edit' + end + + step 'I click link "Edit" for the merge request' do + edit_issuable + end + + step 'I click link "Edit" for the issue' do + edit_issuable + end +end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index f3e61aa8e49..df4514b5646 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -56,27 +56,27 @@ EOT end step 'I should not see the Markdown preview' do - find('.gfm-form').should have_css('.js-md-preview', visible: false) + expect(find('.gfm-form')).not_to have_css('.js-md-preview') end step 'I should not see the Markdown preview button' do - find('.gfm-form').should have_css('.js-md-preview-button', visible: false) + expect(find('.gfm-form')).not_to have_css('.js-md-preview-button') end step 'I should not see the Markdown text field' do - find('.gfm-form').should have_css('textarea', visible: false) + expect(find('.gfm-form')).not_to have_css('textarea') end step 'I should see the Markdown edit button' do - find('.gfm-form').should have_css('.js-md-write-button', visible: true) + expect(find('.gfm-form')).to have_css('.js-md-write-button') end step 'I should see the Markdown preview' do - find('.gfm-form').should have_css('.js-md-preview', visible: true) + expect(find('.gfm-form')).to have_css('.js-md-preview') end step 'I should see the Markdown preview button' do - find('.gfm-form').should have_css('.js-md-preview-button', visible: true) + expect(find('.gfm-form')).to have_css('.js-md-preview-button') end step 'I write a description like "Nice"' do @@ -86,7 +86,7 @@ EOT step 'I preview a description text like "Bug fixed :smile:"' do within('.gfm-form') do fill_in 'Description', with: 'Bug fixed :smile:' - find('.js-md-preview-button').trigger('click') + find('.js-md-preview-button').click() end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index e298312f065..a83f74228af 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -23,7 +23,7 @@ module SharedNote step 'I preview a comment text like "Bug fixed :smile:"' do within(".js-main-target-form") do fill_in "note[note]", with: "Bug fixed :smile:" - find('.js-md-preview-button').trigger('click') + find('.js-md-preview-button').click end end @@ -51,13 +51,13 @@ module SharedNote step 'I should not see the comment preview' do within(".js-main-target-form") do - page.should have_css('.js-md-preview', visible: false) + expect(page).not_to have_css('.js-md-preview') end end step 'I should not see the comment preview button' do within(".js-main-target-form") do - page.should have_css('.js-md-preview-button', visible: false) + expect(page).not_to have_css('.js-md-preview-button') end end @@ -81,19 +81,19 @@ module SharedNote step 'I should see the comment edit button' do within(".js-main-target-form") do - page.should have_css('.js-md-write-button', visible: true) + expect(page).to have_css('.js-md-write-button') end end step 'I should see the comment preview' do within(".js-main-target-form") do - page.should have_css('.js-md-preview', visible: true) + expect(page).to have_css('.js-md-preview') end end step 'I should see the comment preview button' do within(".js-main-target-form") do - page.should have_css('.js-md-preview-button', visible: true) + expect(page).to have_css('.js-md-preview-button') end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index bf3c12012e5..36394265abf 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -19,8 +19,10 @@ describe 'Comments' 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-md-preview-button', visible: false) } + within('.js-main-target-form') do + expect(page).not_to have_link('Cancel') + expect(page).not_to have_css('.js-md-preview-button', visible: true) + end end describe "with text" do @@ -31,8 +33,10 @@ describe 'Comments' do 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-md-preview-button', visible: true) } + within(".js-main-target-form") do + expect(page).not_to have_css(".js-comment-button[disabled]") + expect(page).to have_css('.js-md-preview-button') + end end end end @@ -41,15 +45,17 @@ describe 'Comments' do before do within(".js-main-target-form") do fill_in "note[note]", with: "This is awsome!" - find('.js-md-preview-button').trigger('click') + find('.js-md-preview-button').click click_button "Add Comment" 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-md-preview', visible: false) } + within(".js-main-target-form") do + expect(page).to have_no_field("note[note]", with: "This is awesome!") + expect(page).not_to have_css('.js-md-preview', visible: true) + end within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } end end @@ -172,11 +178,11 @@ describe 'Comments' 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-md-preview-button').trigger('click') + find('.js-md-preview-button').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-md-preview-button').trigger('click') + find('.js-md-preview-button').click end end end From e06f0ead9843df2688ca2f341a3b37d4d56a955d Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Thu, 16 Oct 2014 23:36:52 -0500 Subject: [PATCH 08/55] Fix Markdown preview tests Update Spinach tests for Markdown previews for the new-ish tab UI that replaced the old preview/edit toggle button. --- features/project/commits/comments.feature | 8 +++--- .../project/commits/diff_comments.feature | 6 ++--- features/project/issues/issues.feature | 8 +++--- features/steps/shared/diff_note.rb | 12 +++++---- features/steps/shared/markdown.rb | 24 ++++++++++------- features/steps/shared/note.rb | 26 ++++++++++--------- spec/features/notes_on_merge_requests_spec.rb | 1 - 7 files changed, 47 insertions(+), 38 deletions(-) diff --git a/features/project/commits/comments.feature b/features/project/commits/comments.feature index e176752cfbf..a45245917e3 100644 --- a/features/project/commits/comments.feature +++ b/features/project/commits/comments.feature @@ -16,12 +16,12 @@ Feature: Project Commits Comments @javascript Scenario: I can't preview without text Given I haven't written any comment text - Then I should not see the comment preview button + Then The comment preview tab should say there is nothing to do @javascript Scenario: I can preview with text - Given I write a comment like "Nice" - Then I should see the comment preview button + Given I write a comment like ":+1: Nice" + Then The comment preview tab should be display rendered Markdown @javascript Scenario: I preview a comment @@ -32,7 +32,7 @@ Feature: Project Commits Comments @javascript Scenario: I can edit after preview Given I preview a comment text like "Bug fixed :smile:" - Then I should see the comment edit button + Then I should see the comment write tab @javascript Scenario: I have a reset form after posting from preview diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature index a145ec84b78..9c4cc723d1b 100644 --- a/features/project/commits/diff_comments.feature +++ b/features/project/commits/diff_comments.feature @@ -58,13 +58,13 @@ Feature: Project Commits Diff Comments Scenario: I can't preview without text Given I open a diff comment form And I haven't written any diff comment text - Then I should not see the diff comment preview button + Then The diff comment preview tab should say there is nothing to do @javascript Scenario: I can preview with text Given I open a diff comment form And I write a diff comment like ":-1: I don't like this" - Then I should see the diff comment preview button + Then The diff comment preview tab should display rendered Markdown @javascript Scenario: I preview a diff comment @@ -75,7 +75,7 @@ Feature: Project Commits Diff Comments @javascript Scenario: I can edit after preview Given I preview a diff comment text like "Should fix it :smile:" - Then I should see the diff comment edit button + Then I should see the diff comment write tab @javascript Scenario: The form gets removed after posting diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index e7fbe2bd6f1..9970be0c596 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -166,13 +166,13 @@ Feature: Project Issues Scenario: I can't preview without text Given I click link "New Issue" And I haven't written any description text - Then I should not see the Markdown preview button + Then The Markdown preview tab should say there is nothing to do @javascript Scenario: I can preview with text Given I click link "New Issue" - And I write a description like "Nice" - Then I should see the Markdown preview button + And I write a description like ":+1: Nice" + Then The Markdown preview tab should display rendered Markdown @javascript Scenario: I preview an issue description @@ -185,4 +185,4 @@ Feature: Project Issues Scenario: I can edit after preview Given I click link "New Issue" And I preview a description text like "Bug fixed :smile:" - Then I should see the Markdown edit button + Then I should see the Markdown write tab diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 8871b93edb6..aa31a09e326 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -71,9 +71,10 @@ module SharedDiffNote end end - step 'I should not see the diff comment preview button' do + step 'The diff comment preview tab should say there is nothing to do' do within(diff_file_selector) do - expect(page).not_to have_css('.js-md-preview-button') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_content('Nothing to preview.') end end @@ -135,15 +136,16 @@ module SharedDiffNote end end - step 'I should see the diff comment edit button' do + step 'I should see the diff comment write tab' do within(diff_file_selector) do expect(page).to have_css('.js-md-write-button') end end - step 'I should see the diff comment preview button' do + step 'The diff comment preview tab should display rendered Markdown' do within(diff_file_selector) do - expect(page).to have_css('.js-md-preview-button') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_css('img.emoji') end end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index df4514b5646..10da67a6ba8 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -56,18 +56,21 @@ EOT end step 'I should not see the Markdown preview' do - expect(find('.gfm-form')).not_to have_css('.js-md-preview') + expect(find('.gfm-form')).not_to have_css('.js-md-preview', visible: true) end - step 'I should not see the Markdown preview button' do - expect(find('.gfm-form')).not_to have_css('.js-md-preview-button') + step 'The Markdown preview tab should say there is nothing to do' do + within(".gfm-form") do + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_content('Nothing to preview.') + end end step 'I should not see the Markdown text field' do - expect(find('.gfm-form')).not_to have_css('textarea') + expect(find('.gfm-form')).not_to have_css('textarea', visible: true) end - step 'I should see the Markdown edit button' do + step 'I should see the Markdown write tab' do expect(find('.gfm-form')).to have_css('.js-md-write-button') end @@ -75,12 +78,15 @@ EOT expect(find('.gfm-form')).to have_css('.js-md-preview') end - step 'I should see the Markdown preview button' do - expect(find('.gfm-form')).to have_css('.js-md-preview-button') + step 'The Markdown preview tab should display rendered Markdown' do + within(".gfm-form") do + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_css('img.emoji') + end end - step 'I write a description like "Nice"' do - find('.gfm-form').fill_in 'Description', with: 'Nice' + step 'I write a description like ":+1: Nice"' do + find('.gfm-form').fill_in 'Description', with: ':+1: Nice' end step 'I preview a description text like "Bug fixed :smile:"' do diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index a83f74228af..9802614ec72 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -33,9 +33,9 @@ module SharedNote end end - step 'I write a comment like "Nice"' do + step 'I write a comment like ":+1: Nice"' do within(".js-main-target-form") do - fill_in "note[note]", with: "Nice" + fill_in "note[note]", with: ":+1: Nice" end end @@ -51,13 +51,14 @@ module SharedNote step 'I should not see the comment preview' do within(".js-main-target-form") do - expect(page).not_to have_css('.js-md-preview') + expect(page).not_to have_css('.js-md-preview', visible: true) end end - step 'I should not see the comment preview button' do + step 'The comment preview tab should say there is nothing to do' do within(".js-main-target-form") do - expect(page).not_to have_css('.js-md-preview-button') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_content('Nothing to preview.') end end @@ -79,24 +80,25 @@ module SharedNote end end - step 'I should see the comment edit button' do + step 'I should see the comment write tab' do within(".js-main-target-form") do expect(page).to have_css('.js-md-write-button') end end + step 'The comment preview tab should be display rendered Markdown' do + within(".js-main-target-form") do + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_css('img.emoji') + end + end + step 'I should see the comment preview' do within(".js-main-target-form") do expect(page).to have_css('.js-md-preview') end end - step 'I should see the comment preview button' do - within(".js-main-target-form") do - expect(page).to have_css('.js-md-preview-button') - end - end - step 'I should see comment "XML attached"' do within(".note") do page.should have_content("XML attached") diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 36394265abf..3a99a260498 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -21,7 +21,6 @@ describe 'Comments' do find(".js-main-target-form input[type=submit]").value.should == "Add Comment" within('.js-main-target-form') do expect(page).not_to have_link('Cancel') - expect(page).not_to have_css('.js-md-preview-button', visible: true) end end From de53bc9d8470d94ec1b956cc2ea1df077c4d034d Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Thu, 16 Oct 2014 23:38:08 -0500 Subject: [PATCH 09/55] Add new Markdown preview test Add a test to make sure that Markdown previews are available when editing an existing issue. --- features/project/issues/issues.feature | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index 9970be0c596..28ea44530fe 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -186,3 +186,10 @@ Feature: Project Issues Given I click link "New Issue" And I preview a description text like "Bug fixed :smile:" Then I should see the Markdown write tab + + @javascript + Scenario: I can preview when editing an existing issue + Given I click link "Release 0.4" + And I click link "Edit" for the issue + And I preview a description text like "Bug fixed :smile:" + Then I should see the Markdown write tab From f9e423b499795e599d25f76c3ef519cac8ac6db0 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Sat, 18 Oct 2014 18:16:20 -0500 Subject: [PATCH 10/55] Fix long line in view --- app/views/projects/_md_preview.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/projects/_md_preview.html.haml b/app/views/projects/_md_preview.html.haml index dbbf8e3bf97..cb75149434f 100644 --- a/app/views/projects/_md_preview.html.haml +++ b/app/views/projects/_md_preview.html.haml @@ -3,7 +3,8 @@ = link_to '#md-write-holder', class: 'js-md-write-button' do Write %li - = link_to '#md-preview-holder', class: 'js-md-preview-button', data: { url: markdown_preview_project_path(@project) } do + = link_to '#md-preview-holder', class: 'js-md-preview-button', + data: { url: markdown_preview_project_path(@project) } do Preview %div .md-write-holder From 74c82ae32583ebf335f310a29ffb22d75b356863 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Sat, 18 Oct 2014 18:24:12 -0500 Subject: [PATCH 11/55] Fix houndci warnings --- features/steps/shared/diff_note.rb | 4 ++-- features/steps/shared/markdown.rb | 6 +++--- features/steps/shared/note.rb | 2 +- spec/features/notes_on_merge_requests_spec.rb | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index aa31a09e326..7f1dde16c17 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -152,8 +152,8 @@ module SharedDiffNote step 'I should see two separate previews' do within(diff_file_selector) do expect(page).to have_css('.js-md-preview', count: 2) - expect(page).to have_content("Should fix it") - expect(page).to have_content("DRY this up") + expect(page).to have_content('Should fix it') + expect(page).to have_content('DRY this up') end end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 10da67a6ba8..8dfb8ed72e9 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -60,7 +60,7 @@ EOT end step 'The Markdown preview tab should say there is nothing to do' do - within(".gfm-form") do + within('.gfm-form') do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_content('Nothing to preview.') end @@ -79,7 +79,7 @@ EOT end step 'The Markdown preview tab should display rendered Markdown' do - within(".gfm-form") do + within('.gfm-form') do find('.js-md-preview-button').click expect(find('.js-md-preview')).to have_css('img.emoji') end @@ -92,7 +92,7 @@ EOT step 'I preview a description text like "Bug fixed :smile:"' do within('.gfm-form') do fill_in 'Description', with: 'Bug fixed :smile:' - find('.js-md-preview-button').click() + find('.js-md-preview-button').click end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 9802614ec72..52d8c7e50fa 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -35,7 +35,7 @@ module SharedNote step 'I write a comment like ":+1: Nice"' do within(".js-main-target-form") do - fill_in "note[note]", with: ":+1: Nice" + fill_in 'note[note]', with: ':+1: Nice' end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 3a99a260498..6d3cc3ae159 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -32,8 +32,8 @@ describe 'Comments' do end it 'should have enable submit button and preview button' do - within(".js-main-target-form") do - expect(page).not_to have_css(".js-comment-button[disabled]") + within('.js-main-target-form') do + expect(page).not_to have_css('.js-comment-button[disabled]') expect(page).to have_css('.js-md-preview-button') end end @@ -51,8 +51,8 @@ describe 'Comments' do it 'should be added and form reset' do should have_content("This is awsome!") - within(".js-main-target-form") do - expect(page).to have_no_field("note[note]", with: "This is awesome!") + within('.js-main-target-form') do + expect(page).to have_no_field('note[note]', with: 'This is awesome!') expect(page).not_to have_css('.js-md-preview', visible: true) end within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } From 5bb8aff5ddcc1debb4406303477c1ddbe618d058 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Sat, 18 Oct 2014 18:43:45 -0500 Subject: [PATCH 12/55] Fix more Markdown preview tests --- features/project/merge_requests.feature | 8 ++++---- features/steps/project/issues/issues.rb | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index f8a43e1ee36..7c029f05d75 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -195,14 +195,14 @@ Feature: Project Merge Requests Given I visit merge request page "Bug NS-04" And I click link "Edit" for the merge request And I haven't written any description text - Then I should not see the Markdown preview button + Then The Markdown preview tab should say there is nothing to do @javascript Scenario: I can preview with text Given I visit merge request page "Bug NS-04" And I click link "Edit" for the merge request - And I write a description like "Nice" - Then I should see the Markdown preview button + And I write a description like ":+1: Nice" + Then The Markdown preview tab should display rendered Markdown @javascript Scenario: I preview a merge request description @@ -217,4 +217,4 @@ Feature: Project Merge Requests Given I visit merge request page "Bug NS-04" And I click link "Edit" for the merge request And I preview a description text like "Bug fixed :smile:" - Then I should see the Markdown edit button + Then I should see the Markdown write tab diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 640603562dd..c0ae5208541 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -1,5 +1,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps include SharedAuthentication + include SharedIssuable include SharedProject include SharedNote include SharedPaths From 7a5072c5a8f03cd7342a5f8e74e1fde0250ce360 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Mon, 20 Oct 2014 21:53:17 -0500 Subject: [PATCH 13/55] Fix test assertions Make sure we're asserting the correct thing when testing visible and invisible DOM elements. --- features/steps/shared/diff_note.rb | 8 ++++---- features/steps/shared/markdown.rb | 10 +++++----- features/steps/shared/note.rb | 8 ++++---- spec/features/notes_on_merge_requests_spec.rb | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 7f1dde16c17..28964d54a8f 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -132,26 +132,26 @@ module SharedDiffNote step 'I should see the diff comment preview' do within("#{diff_file_selector} form") do - expect(page).to have_css('.js-md-preview') + expect(page).to have_css('.js-md-preview', visible: true) end end step 'I should see the diff comment write tab' do within(diff_file_selector) do - expect(page).to have_css('.js-md-write-button') + expect(page).to have_css('.js-md-write-button', visible: true) end end step 'The diff comment preview tab should display rendered Markdown' do within(diff_file_selector) do find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji') + expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end step 'I should see two separate previews' do within(diff_file_selector) do - expect(page).to have_css('.js-md-preview', count: 2) + expect(page).to have_css('.js-md-preview', visible: true, count: 2) expect(page).to have_content('Should fix it') expect(page).to have_content('DRY this up') end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 8dfb8ed72e9..e71700880cd 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -56,7 +56,7 @@ EOT end step 'I should not see the Markdown preview' do - expect(find('.gfm-form')).not_to have_css('.js-md-preview', visible: true) + expect(find('.gfm-form .js-md-preview')).not_to be_visible end step 'The Markdown preview tab should say there is nothing to do' do @@ -67,21 +67,21 @@ EOT end step 'I should not see the Markdown text field' do - expect(find('.gfm-form')).not_to have_css('textarea', visible: true) + expect(find('.gfm-form textarea')).not_to be_visible end step 'I should see the Markdown write tab' do - expect(find('.gfm-form')).to have_css('.js-md-write-button') + expect(find('.gfm-form')).to have_css('.js-md-write-button', visible: true) end step 'I should see the Markdown preview' do - expect(find('.gfm-form')).to have_css('.js-md-preview') + expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true) end step 'The Markdown preview tab should display rendered Markdown' do within('.gfm-form') do find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji') + expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 52d8c7e50fa..17adec3eda1 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -51,7 +51,7 @@ module SharedNote step 'I should not see the comment preview' do within(".js-main-target-form") do - expect(page).not_to have_css('.js-md-preview', visible: true) + expect(find('.js-md-preview')).not_to be_visible end end @@ -82,20 +82,20 @@ module SharedNote step 'I should see the comment write tab' do within(".js-main-target-form") do - expect(page).to have_css('.js-md-write-button') + expect(page).to have_css('.js-md-write-button', visible: true) end end step 'The comment preview tab should be display rendered Markdown' do within(".js-main-target-form") do find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji') + expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end step 'I should see the comment preview' do within(".js-main-target-form") do - expect(page).to have_css('.js-md-preview') + expect(page).to have_css('.js-md-preview', visible: true) end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 6d3cc3ae159..cac409b9139 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -34,7 +34,7 @@ describe 'Comments' do it 'should have enable submit button and preview button' do within('.js-main-target-form') do expect(page).not_to have_css('.js-comment-button[disabled]') - expect(page).to have_css('.js-md-preview-button') + expect(page).to have_css('.js-md-preview-button', visible: true) end end end @@ -53,7 +53,7 @@ describe 'Comments' do should have_content("This is awsome!") within('.js-main-target-form') do expect(page).to have_no_field('note[note]', with: 'This is awesome!') - expect(page).not_to have_css('.js-md-preview', visible: true) + expect(page).to have_css('.js-md-preview', visible: :hidden) end within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } end From 7cfaf890cb52cc91b9332ce7479f3187c6e7d51f Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Sun, 23 Nov 2014 01:08:29 -0800 Subject: [PATCH 14/55] remove extra upgrade details, add missing config Update 7.5 update guide: * Remove unnecessary upgrade details (they were completed in 7.4 upgrade and only needed one time) * Add missing Nginx config details --- doc/update/7.4-to-7.5.md | 93 ++-------------------------------------- 1 file changed, 3 insertions(+), 90 deletions(-) diff --git a/doc/update/7.4-to-7.5.md b/doc/update/7.4-to-7.5.md index c12becc1e14..673eab3c56e 100644 --- a/doc/update/7.4-to-7.5.md +++ b/doc/update/7.4-to-7.5.md @@ -71,21 +71,10 @@ There are new configuration options available for gitlab.yml. View them with the git diff origin/7-4-stable:config/gitlab.yml.example origin/7-5-stable:config/gitlab.yml.example ``` -#### Change timeout for unicorn - -``` -# set timeout to 60 -sudo -u git -H editor config/unicorn.rb -``` - -#### Change nginx https settings - -* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-5-stable/lib/support/nginx/gitlab-ssl but with your setting - -#### MySQL Databases: Update database.yml config file - -* Add `collation: utf8_general_ci` to config/database.yml as seen in [config/database.yml.mysql](config/database.yml.mysql) +#### Change Nginx settings +* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as [`lib/support/nginx/gitlab`](/lib/support/nginx/gitlab) but with your settings +* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as [`lib/support/nginx/gitlab-ssl`](/lib/support/nginx/gitlab-ssl) but with your setting ### 6. Start application @@ -104,82 +93,6 @@ To make sure you didn't miss anything run a more thorough check with: If all items are green, then congratulations upgrade is complete! - -### 8. Optional optimizations for GitLab setups with MySQL databases - -Only applies if running MySQL database created with GitLab 6.7 or earlier. If you are not experiencing any issues you may not need the following instructions however following them will bring your database in line with the latest recommended installation configuration and help avoid future issues. Be sure to follow these directions exactly. These directions should be safe for any MySQL instance but to be sure make a current MySQL database backup beforehand. - -``` -# Stop GitLab -sudo service gitlab stop - -# Secure your MySQL installation (added in GitLab 6.2) -sudo mysql_secure_installation - -# Login to MySQL -mysql -u root -p - -# do not type the 'mysql>', this is part of the prompt - -# Convert all tables to use the InnoDB storage engine (added in GitLab 6.8) -SELECT CONCAT('ALTER TABLE gitlabhq_production.', table_name, ' ENGINE=InnoDB;') AS 'Copy & run these SQL statements:' FROM information_schema.tables WHERE table_schema = 'gitlabhq_production' AND `ENGINE` <> 'InnoDB' AND `TABLE_TYPE` = 'BASE TABLE'; - -# If previous query returned results, copy & run all outputed SQL statements - -# Convert all tables to correct character set -SET foreign_key_checks = 0; -SELECT CONCAT('ALTER TABLE gitlabhq_production.', table_name, ' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') AS 'Copy & run these SQL statements:' FROM information_schema.tables WHERE table_schema = 'gitlabhq_production' AND `TABLE_COLLATION` <> 'utf8_unicode_ci' AND `TABLE_TYPE` = 'BASE TABLE'; - -# If previous query returned results, copy & run all outputed SQL statements - -# turn foreign key checks back on -SET foreign_key_checks = 1; - -# Find MySQL users -mysql> SELECT user FROM mysql.user WHERE user LIKE '%git%'; - -# If git user exists and gitlab user does not exist -# you are done with the database cleanup tasks -mysql> \q - -# If both users exist skip to Delete gitlab user - -# Create new user for GitLab (changed in GitLab 6.4) -# change $password in the command below to a real password you pick -mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password'; - -# Grant the git user necessary permissions on the database -mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost'; - -# Delete the old gitlab user -mysql> DELETE FROM mysql.user WHERE user='gitlab'; - -# Quit the database session -mysql> \q - -# Try connecting to the new database with the new user -sudo -u git -H mysql -u git -p -D gitlabhq_production - -# Type the password you replaced $password with earlier - -# You should now see a 'mysql>' prompt - -# Quit the database session -mysql> \q - -# Update database configuration details -# See config/database.yml.mysql for latest recommended configuration details -# Remove the reaping_frequency setting line if it exists (removed in GitLab 6.8) -# Set production -> pool: 10 (updated in GitLab 5.3) -# Set production -> username: git -# Set production -> password: the password your replaced $password with earlier -sudo -u git -H editor /home/git/gitlab/config/database.yml - -# Run thorough check -sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production -``` - - ## Things went south? Revert to previous version (7.4) ### 1. Revert the code to the previous version From e69db3ba5b386b69998f30536a1a2b3c0e748df9 Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Sun, 23 Nov 2014 01:11:06 -0800 Subject: [PATCH 15/55] update order of upgrade guide GitLab needs to be stopped when backup is took. --- doc/release/monthly.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index c50bfc21f8f..b391d8ca6ab 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -91,9 +91,9 @@ List any major changes here, so the user is aware of them before starting to upg - Web server changes - File structure changes -#### 1. Make backup +#### 1. Stop server -#### 2. Stop server +#### 2. Make backup #### 3. Do users need to update dependencies like `git`? From 762d8d3271c17f295a45d59701c7354fc9702a3d Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Sun, 23 Nov 2014 02:14:29 -0800 Subject: [PATCH 16/55] add details on backing up your SSH host keys Users need to backup SSH host keys if they want to do a complete restore to the same domain and not have users get the `WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!` message. --- doc/raketasks/backup_restore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index d2f0d6e7bc1..25e71c99dd3 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -137,7 +137,7 @@ with the name of your bucket: Please be informed that a backup does not store your configuration files. If you use an Omnibus package 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. +If you have a manual installation please consider backing up your `gitlab.yml` file, any SSL keys and certificates, and your [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079). ## Restore a previously created backup From f69095fa3d3e3840d7b07e757ec2e7d69cc49ff5 Mon Sep 17 00:00:00 2001 From: fabien Date: Wed, 3 Dec 2014 10:41:26 +0100 Subject: [PATCH 17/55] Update gemnasium-gitlab-service to version 0.2.3 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7871f49d0bf..f6525efb585 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -158,7 +158,7 @@ GEM dotenv (>= 0.7) thor (>= 0.13.6) formatador (0.2.4) - gemnasium-gitlab-service (0.2.2) + gemnasium-gitlab-service (0.2.3) rugged (~> 0.19) gherkin-ruby (0.3.1) racc From 4acf25169336b9d7a20782d5ad954a40db8764e0 Mon Sep 17 00:00:00 2001 From: zertrin Date: Thu, 4 Dec 2014 15:58:08 +0100 Subject: [PATCH 18/55] Fix typo in the README.md for docker The container name has been previously renamed to "gitlab_app". --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 1fbf703e25c..58982a238a8 100644 --- a/docker/README.md +++ b/docker/README.md @@ -39,7 +39,7 @@ After creating this run GitLab: sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_image ``` -It might take a while before the docker container is responding to queries. You can follow the configuration process with `docker logs -f gitlab`. +It might take a while before the docker container is responding to queries. You can follow the configuration process with `docker logs -f gitlab_app`. You can then go to `http://localhost:8080/` (or `http://192.168.59.103:8080/` if you use boot2docker). You can login with username `root` and password `5iveL!fe`. From 8b6a2829ce400dda594500d2a8822dfdb11d8781 Mon Sep 17 00:00:00 2001 From: Scott Stamp Date: Mon, 8 Dec 2014 23:04:34 +0000 Subject: [PATCH 19/55] Example callback URL was incorrect (referencing /users/auth/github/callback, not /users/auth/twitter/callback) --- doc/integration/twitter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/integration/twitter.md b/doc/integration/twitter.md index d1b52927d30..b9e501c5ec1 100644 --- a/doc/integration/twitter.md +++ b/doc/integration/twitter.md @@ -13,7 +13,7 @@ To enable the Twitter OmniAuth provider you must register your application with something else descriptive. - Description: Create a description. - Website: The URL to your GitLab installation. 'https://gitlab.example.com' - - Callback URL: 'https://gitlab.example.com/users/auth/github/callback' + - Callback URL: 'https://gitlab.example.com/users/auth/twitter/callback' - Agree to the "Rules of the Road." ![Twitter App Details](twitter_app_details.png) From 82eb0a44d7afa3b6ab77b8f7c9386740496a72e1 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 9 Dec 2014 14:51:15 +0100 Subject: [PATCH 20/55] Add security tips about file and paths --- doc/development/shell_commands.md | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md index 23c8365c340..1e51ad73e32 100644 --- a/doc/development/shell_commands.md +++ b/doc/development/shell_commands.md @@ -1,5 +1,8 @@ # Guidelines for shell commands in the GitLab codebase +This document contains guidelines for working with processes and files in the GitLab codebase. +These guidelines are meant to make your code more reliable _and_ secure. + ## References - [Google Ruby Security Reviewer's Guide](https://code.google.com/p/ruby-security/wiki/Guide) @@ -109,3 +112,63 @@ logs = IO.popen(%W(git log), chdir: repo_dir).read ``` Note that unlike `Gitlab::Popen.popen`, `IO.popen` does not capture standard error. + +## Avoid user input at the start of path strings + +Various methods for opening and reading files in Ruby can be used to read the +standard output of a process instead of a file. The following two commands do +roughly the same: + +``` +`touch /tmp/pawned-by-backticks` +File.read('|touch /tmp/pawned-by-file-read') +``` + +The key is to open a 'file' whose name starts with a `|`. +Affected methods include Kernel#open, File::read, File::open, IO::open and IO::read. + +You can protect against this behavior of 'open' and 'read' by ensuring that an +attacker cannot control the start of the filename string you are opening. For +instance, the following is sufficient to protect against accidentally starting +a shell command with `|`: + +``` +# we assume repo_path is not controlled by the attacker (user) +path = File.join(repo_path, user_input) +# path cannot start with '|' now. +File.read(path) +``` + +## Guard against path traversal + +Path traversal is a security where the program (GitLab) tries to restrict user +access to a certain directory on disk, but the user manages to open a file +outside that directory by taking advantage of the `../` path notation. + +``` +# Suppose the user gave us a path and they are trying to trick us +user_input = '../other-repo.git/other-file' + +# We look up the repo path somewhere +repo_path = 'repositories/user-repo.git' + +# The intention of the code below is to open a file under repo_path, but +# because the user used '..' she can 'break out' into +# 'repositories/other-repo.git' +full_path = File.join(repo_path, user_input) +File.open(full_path) do # Oops! +``` + +A good way to protect against this is to compare the full path with its +'absolute path' according to Ruby's `File.absolute_path`. + +``` +full_path = File.join(repo_path, user_input) +if full_path != File.absolute_path(full_path) + raise "Invalid path: #{full_path.inspect}" +end + +File.open(full_path) do # Etc. +``` + +A check like this could have avoided CVE-2013-4583. From 22368fb8e8d684fd540120c33233cf0c42825f3e Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 10 Dec 2014 15:52:56 +0100 Subject: [PATCH 21/55] Add a failing route spec for file named diff. --- spec/routing/project_routing_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index ea584c9802d..0c76dd5a089 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -415,6 +415,7 @@ describe Projects::BlobController, "routing" do it "to #show" do get("/gitlab/gitlabhq/blob/master/app/models/project.rb").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/project.rb') get("/gitlab/gitlabhq/blob/master/app/models/compare.rb").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/compare.rb') + get("/gitlab/gitlabhq/blob/master/app/models/diff.js").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/diff.js') get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end From 1d0dfd50cc7a795b948bc19d701518681b3c9439 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 10 Dec 2014 15:54:01 +0100 Subject: [PATCH 22/55] Do not check for format on blob diff path. --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index f2984069b71..7483ea42e12 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -190,7 +190,7 @@ Gitlab::Application.routes.draw do end scope module: :projects do - resources :blob, only: [:show, :destroy], constraints: { id: /.+/ } do + resources :blob, only: [:show, :destroy], constraints: { id: /.+/, format: false } do get :diff, on: :member end resources :raw, only: [:show], constraints: {id: /.+/} From eceda17f0911bd62dba83d193df680f7cedc8cd9 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 10 Dec 2014 17:24:11 +0100 Subject: [PATCH 23/55] Markdown dropzone image icon should not be clickable. --- app/assets/stylesheets/generic/markdown_area.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/generic/markdown_area.scss b/app/assets/stylesheets/generic/markdown_area.scss index fbfa72c5e5e..b174392dbfc 100644 --- a/app/assets/stylesheets/generic/markdown_area.scss +++ b/app/assets/stylesheets/generic/markdown_area.scss @@ -20,6 +20,7 @@ opacity: 0; font-size: 50px; transition: opacity 200ms ease-in-out; + pointer-events: none; } .div-dropzone-spinner { From 9c9dc64a40d0a3c9e7265436e82dbe055320be97 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 11 Dec 2014 13:25:59 +0200 Subject: [PATCH 24/55] Update CHANGELOG Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index ab84b36d749..762c45150bf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,7 +17,7 @@ v 7.6.0 - - Change maximum avatar file size from 100KB to 200KB - - - + - Enable Markdown preview for issues, merge requests, milestones, and notes (Vinnie Okada) - In the docker directory is a container template based on the Omnibus packages. - Update Sidekiq to version 2.17.8 - Add author filter to project issues and merge requests pages From cd4c65c159627ead220bcadbe1a58ced0017851b Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 11 Dec 2014 13:17:43 +0100 Subject: [PATCH 25/55] Use shell invocation according to the shell commands guidelines. --- lib/tasks/gitlab/shell.rake | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 202e55c89ad..84bc9e304b6 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -17,15 +17,19 @@ namespace :gitlab do # Clone if needed unless File.directory?(target_dir) - sh(*%W(git clone #{args.repo} #{target_dir})) + Gitlab::Popen.popen(%W(git clone -- #{args.repo} #{target_dir})) end # Make sure we're on the right tag Dir.chdir(target_dir) do # First try to checkout without fetching # to avoid stalling tests if the Internet is down. - reset = "git reset --hard $(git describe #{args.tag} || git describe origin/#{args.tag})" - sh "#{reset} || git fetch origin && #{reset}" + reset_status = reset_to_commit(args) + + if reset_status != 0 + Gitlab::Popen.popen(%W(git fetch origin)) + reset_to_commit(args) + end config = { user: user, @@ -54,7 +58,7 @@ namespace :gitlab do File.open("config.yml", "w+") {|f| f.puts config.to_yaml} # Launch installation process - sh "bin/install" + Gitlab::Popen.popen(%W(bin/install)) end # Required for debian packaging with PKGR: Setup .ssh/environment with @@ -118,5 +122,17 @@ namespace :gitlab do puts "Quitting...".red exit 1 end + + def reset_to_commit(args) + tag, status = Gitlab::Popen.popen(%W(git describe -- #{args.tag})) + + if status != 0 + tag, status = Gitlab::Popen.popen(%W(git describe -- origin/#{args.tag})) + end + + tag = tag.strip + reset, reset_status = Gitlab::Popen.popen(%W(git reset --hard #{tag})) + reset_status + end end From 0ff2c67d4be386907cf4d84f3cb3eba5ef284290 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 11 Dec 2014 13:35:10 +0100 Subject: [PATCH 26/55] The 'shell commands' guide also covers files/paths --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06897eec839..2195ea6e739 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,6 +75,7 @@ If you can, please submit a merge request with the fix or improvements including 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 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). +1. Also have a look at the [shell command guidelines](doc/development/shell_commands.md) if your code reads or opens files, or handles paths to files on disk. 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. From bd43cf065384745e4386237ad0f5d4eb14868034 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 12 Dec 2014 10:17:07 +0100 Subject: [PATCH 27/55] Use system where only return result is needed. --- lib/tasks/gitlab/shell.rake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 84bc9e304b6..ce5bec39c9d 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -17,17 +17,17 @@ namespace :gitlab do # Clone if needed unless File.directory?(target_dir) - Gitlab::Popen.popen(%W(git clone -- #{args.repo} #{target_dir})) + system(%W(git clone -- #{args.repo} #{target_dir})) end # Make sure we're on the right tag Dir.chdir(target_dir) do # First try to checkout without fetching # to avoid stalling tests if the Internet is down. - reset_status = reset_to_commit(args) + reseted = reset_to_commit(args) - if reset_status != 0 - Gitlab::Popen.popen(%W(git fetch origin)) + unless reseted + system(%W(git fetch origin)) reset_to_commit(args) end @@ -58,7 +58,7 @@ namespace :gitlab do File.open("config.yml", "w+") {|f| f.puts config.to_yaml} # Launch installation process - Gitlab::Popen.popen(%W(bin/install)) + system(%W(bin/install)) end # Required for debian packaging with PKGR: Setup .ssh/environment with @@ -126,13 +126,12 @@ namespace :gitlab do def reset_to_commit(args) tag, status = Gitlab::Popen.popen(%W(git describe -- #{args.tag})) - if status != 0 + unless status.zero? tag, status = Gitlab::Popen.popen(%W(git describe -- origin/#{args.tag})) end tag = tag.strip - reset, reset_status = Gitlab::Popen.popen(%W(git reset --hard #{tag})) - reset_status + system(%W(git reset --hard #{tag})) end end From e5951cf4aec15fc58730f88454d2b6d71ff25802 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 12 Dec 2014 10:42:55 +0100 Subject: [PATCH 28/55] Don't forget to splat. --- lib/tasks/gitlab/shell.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index ce5bec39c9d..9af93300e08 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -17,7 +17,7 @@ namespace :gitlab do # Clone if needed unless File.directory?(target_dir) - system(%W(git clone -- #{args.repo} #{target_dir})) + system(*%W(git clone -- #{args.repo} #{target_dir})) end # Make sure we're on the right tag @@ -27,7 +27,7 @@ namespace :gitlab do reseted = reset_to_commit(args) unless reseted - system(%W(git fetch origin)) + system(*%W(git fetch origin)) reset_to_commit(args) end @@ -58,7 +58,7 @@ namespace :gitlab do File.open("config.yml", "w+") {|f| f.puts config.to_yaml} # Launch installation process - system(%W(bin/install)) + system(*%W(bin/install)) end # Required for debian packaging with PKGR: Setup .ssh/environment with @@ -131,7 +131,7 @@ namespace :gitlab do end tag = tag.strip - system(%W(git reset --hard #{tag})) + system(*%W(git reset --hard #{tag})) end end From f28a12a559ef5492b583f0ae5dff5dcb49c7afe1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 12 Dec 2014 13:15:42 +0200 Subject: [PATCH 29/55] Add strict validation to snippet file names Signed-off-by: Dmitriy Zaporozhets --- app/models/snippet.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/snippet.rb b/app/models/snippet.rb index a47fbca3260..44fbff345b4 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -29,7 +29,9 @@ class Snippet < ActiveRecord::Base validates :author, presence: true validates :title, presence: true, length: { within: 0..255 } - validates :file_name, presence: true, length: { within: 0..255 } + validates :file_name, presence: true, length: { within: 0..255 }, + format: { with: Gitlab::Regex.path_regex, + message: Gitlab::Regex.path_regex_message } validates :content, presence: true validates :visibility_level, inclusion: { in: Gitlab::VisibilityLevel.values } @@ -72,7 +74,7 @@ class Snippet < ActiveRecord::Base def visibility_level_field visibility_level - end + end class << self def search(query) From 118bd7178b2be5f8a8fbcfa6af66e9e6d299b658 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 12 Dec 2014 13:28:48 +0200 Subject: [PATCH 30/55] Sanitize snippet file name in raw headers Signed-off-by: Dmitriy Zaporozhets --- app/controllers/projects/snippets_controller.rb | 2 +- app/controllers/snippets_controller.rb | 2 +- app/models/snippet.rb | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 9d5dd8a95cc..25c887deafa 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -68,7 +68,7 @@ class Projects::SnippetsController < Projects::ApplicationController @snippet.content, type: 'text/plain; charset=utf-8', disposition: 'inline', - filename: @snippet.file_name + filename: @snippet.sanitized_file_name ) end diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index bf3312fedc8..312e561b522 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -79,7 +79,7 @@ class SnippetsController < ApplicationController @snippet.content, type: 'text/plain; charset=utf-8', disposition: 'inline', - filename: @snippet.file_name + filename: @snippet.sanitized_file_name ) end diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 44fbff345b4..9aba42a0622 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -64,6 +64,10 @@ class Snippet < ActiveRecord::Base file_name end + def sanitized_file_name + file_name.gsub(/[^a-zA-Z0-9_\-\.]+/, '') + end + def mode nil end From bfebab1c10345a4a36490efaf2297c6f2f97f0d6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 12 Dec 2014 15:55:06 +0200 Subject: [PATCH 31/55] Fix snippet factory Signed-off-by: Dmitriy Zaporozhets --- spec/factories.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/factories.rb b/spec/factories.rb index 58060131638..50580cd1334 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -5,10 +5,14 @@ FactoryGirl.define do Faker::Lorem.sentence end - sequence :name, aliases: [:file_name] do + sequence :name do Faker::Name.name end + sequence :file_name do + Faker::Internet.user_name + end + sequence(:url) { Faker::Internet.uri('http') } factory :user, aliases: [:author, :assignee, :owner, :creator] do @@ -18,7 +22,7 @@ FactoryGirl.define do password "12345678" password_confirmation { password } confirmed_at { Time.now } - confirmation_token { nil } + confirmation_token { nil } trait :admin do admin true From 2497273030e80bd7e4f891c7500901c0a38abea1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 12 Dec 2014 16:35:05 +0200 Subject: [PATCH 32/55] Update CHANGELOG with snippet validation change Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 762c45150bf..2061237fb42 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,7 +16,7 @@ v 7.6.0 - Mobile UI improvements - - Change maximum avatar file size from 100KB to 200KB - - + - Strict validation for snippet file names - Enable Markdown preview for issues, merge requests, milestones, and notes (Vinnie Okada) - In the docker directory is a container template based on the Omnibus packages. - Update Sidekiq to version 2.17.8 From 0cfca15292570197ec08bc9aa2bd550a0bcefc2d Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Sat, 13 Dec 2014 20:09:26 +0100 Subject: [PATCH 33/55] Added process for green tests Signed-off-by: Jeroen van Baarsen --- PROCESS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PROCESS.md b/PROCESS.md index 1dd28d6b670..310b98c9324 100644 --- a/PROCESS.md +++ b/PROCESS.md @@ -104,3 +104,10 @@ This merge request has been closed because a request for more information has no ### Accepting merge requests Is there a request on [the feature request forum](http://feedback.gitlab.com/forums/176466-general) that is similar to this? If so, can you make a comment with a link to it? Please be aware that new functionality that is not marked [accepting merge/pull requests](http://feedback.gitlab.com/forums/176466-general/status/796455) on the forum might not make it into GitLab. You might be asked to make changes and even after implementing them your feature might still be declined. If you want to reduce the chance of this happening please have a discussion in the forum first. + +### Only accepting merge requests with green tests + +We can only accept a merge requests if all the tests are green, can you please +make sure the tests of this merge requests are green? If the failing test has +nothing do to with your merge request, you might want to rebase with master to +see if that makes the tests green again. From 4eb3c47d4ec3e6750ae79e14eb008ce92fda96fd Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Sun, 14 Dec 2014 15:13:09 +0100 Subject: [PATCH 34/55] Fixed a lot of already defined notices Signed-off-by: Jeroen van Baarsen --- app/models/commit.rb | 8 ++++---- app/models/project_wiki.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/commit.rb b/app/models/commit.rb index 212229649fc..37dd371ec00 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -10,12 +10,12 @@ class Commit # Used to prevent 500 error on huge commits by suppressing diff # # User can force display of diff above this size - DIFF_SAFE_FILES = 100 - DIFF_SAFE_LINES = 5000 + DIFF_SAFE_FILES = 100 unless defined?(DIFF_SAFE_FILES) + DIFF_SAFE_LINES = 5000 unless defined?(DIFF_SAFE_LINES) # Commits above this size will not be rendered in HTML - DIFF_HARD_LIMIT_FILES = 1000 - DIFF_HARD_LIMIT_LINES = 50000 + DIFF_HARD_LIMIT_FILES = 1000 unless defined?(DIFF_HARD_LIMIT_FILES) + DIFF_HARD_LIMIT_LINES = 50000 unless defined?(DIFF_HARD_LIMIT_LINES) class << self def decorate(commits) diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 770a26ed894..f8a28ca9866 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -5,7 +5,7 @@ class ProjectWiki 'Markdown' => :markdown, 'RDoc' => :rdoc, 'AsciiDoc' => :asciidoc - } + } unless defined?(MARKUPS) class CouldNotCreateWikiError < StandardError; end From d11e048d7fea208a89dab80712925eaf34f69627 Mon Sep 17 00:00:00 2001 From: Ryunosuke SATO Date: Sun, 14 Dec 2014 23:47:13 +0900 Subject: [PATCH 35/55] Add missing webhook doc for tag event --- doc/web_hooks/web_hooks.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index f19517c0f18..e17d21b990d 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -54,6 +54,29 @@ Triggered when you push to the repository except when pushing tags. } ``` +## Tag events + +Triggered when you create (or delete) tags to the repository. + +**Request body:** + +```json +{ + "ref": "refs/tags/v1.0.0", + "before": "0000000000000000000000000000000000000000", + "after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", + "user_id": 1, + "user_name": "John Smith", + "project_id": 1, + "repository": { + "name": "jsmith", + "url": "ssh://git@example.com/jsmith/example.git", + "description": "", + "homepage": "http://example.com/jsmith/example" + } +} +``` + ## Issues events Triggered when a new issue is created or an existing issue was updated/closed/reopened. From 6b1f2e433963a3cd70aeab01d45a1c4bf617bc05 Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Sun, 14 Dec 2014 14:37:38 +0100 Subject: [PATCH 36/55] Added Code of Conduct Signed-off-by: Jeroen van Baarsen --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2195ea6e739..9531b27089b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -142,3 +142,17 @@ Please ensure you support the feature you contribute through all of these steps. 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). + +## Code of conduct +As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. + +Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. + +Instances of abusive, harassing, or otherwise unacceptable behavior can be +reported by emailing contact@gitlab.com + +This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) From 5ad463e0e89084133c764f20d030aae33b9aa907 Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Mon, 15 Dec 2014 10:41:30 +0100 Subject: [PATCH 37/55] Rephrase of the text Signed-off-by: Jeroen van Baarsen --- PROCESS.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PROCESS.md b/PROCESS.md index 310b98c9324..5cc25de05a4 100644 --- a/PROCESS.md +++ b/PROCESS.md @@ -107,7 +107,7 @@ Is there a request on [the feature request forum](http://feedback.gitlab.com/for ### Only accepting merge requests with green tests -We can only accept a merge requests if all the tests are green, can you please -make sure the tests of this merge requests are green? If the failing test has -nothing do to with your merge request, you might want to rebase with master to -see if that makes the tests green again. +We can only accept a merge request if all the tests are green. I've just +restarted the build. When the tests are still not passing after this restart and +you're sure that is does not have anything to do with your code changes, please +rebase with master to see if that solves the issue. From 83de96ae3a5acbbaf8b94a04b6c160e6819d91a2 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 15 Dec 2014 14:01:55 +0200 Subject: [PATCH 38/55] add kerberos dependency --- doc/install/installation.md | 2 +- doc/update/7.5-to-7.6.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 263259bc2f9..f55a0e73199 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -54,7 +54,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 pkg-config cmake + 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 libkrb5-dev Make sure you have the right version of Git installed diff --git a/doc/update/7.5-to-7.6.md b/doc/update/7.5-to-7.6.md index deee73fe560..a5d76c341af 100644 --- a/doc/update/7.5-to-7.6.md +++ b/doc/update/7.5-to-7.6.md @@ -45,6 +45,8 @@ sudo -u git -H git checkout v2.2.0 ### 4. Install libs, migrations, etc. ```bash +sudo apt-get install libkrb5-dev + cd /home/git/gitlab # MySQL installations (note: the line below states '--without ... postgres') From 71789468d306c7974fcf27442c83d7fc131e94fa Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 15 Dec 2014 13:43:36 +0100 Subject: [PATCH 39/55] Add documentation for the Sidekiq MemoryKiller --- doc/operations/README.md | 3 ++ doc/operations/sidekiq_memory_killer.md | 38 +++++++++++++++++++++++++ doc/operations/sidekiq_restarter.md | 10 +++++++ 3 files changed, 51 insertions(+) create mode 100644 doc/operations/README.md create mode 100644 doc/operations/sidekiq_memory_killer.md create mode 100644 doc/operations/sidekiq_restarter.md diff --git a/doc/operations/README.md b/doc/operations/README.md new file mode 100644 index 00000000000..31b1b583b0c --- /dev/null +++ b/doc/operations/README.md @@ -0,0 +1,3 @@ +# GitLab operations + +- [Sidekiq MemoryKiller](sidekiq_memory_killer.md) diff --git a/doc/operations/sidekiq_memory_killer.md b/doc/operations/sidekiq_memory_killer.md new file mode 100644 index 00000000000..867b01b0d5a --- /dev/null +++ b/doc/operations/sidekiq_memory_killer.md @@ -0,0 +1,38 @@ +# Sidekiq MemoryKiller + +The GitLab Rails application code suffers from memory leaks. For web requests +this problem is made manageable using +[unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer) which +restarts Unicorn worker processes in between requests when needed. The Sidekiq +MemoryKiller applies the same approach to the Sidekiq processes used by GitLab +to process background jobs. + +Unlike unicorn-worker-killer, which is enabled by default for all GitLab +installations since GitLab 6.4, the Sidekiq MemoryKiller is enabled by default +_only_ for Omnibus packages. The reason for this is that the MemoryKiller +relies on Runit to restart Sidekiq after a memory-induced shutdown and GitLab +installations from source do not all use Runit or an equivalent. + +With the default settings, the MemoryKiller will cause a Sidekiq restart no +more often than once every 15 minutes, with the restart causing about one +minute of delay for incoming background jobs. + +## Configuring the MemoryKiller + +The MemoryKiller is controlled using environment variables. + +- `SIDEKIQ_MEMORY_KILLER_MAX_RSS`: if this variable is set, and its value is + greater than 0, then after each Sidekiq job, the MemoryKiller will check the + RSS of the Sidekiq process that executed the job. If the RSS of the Sidekiq + process (expressed in kilobytes) exceeds SIDEKIQ_MEMORY_KILLER_MAX_RSS, a + delayed shutdown is triggered. The default value for Omnibus packages is set + [in the omnibus-gitlab + repository](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/attributes/default.rb). +- `SIDEKIQ_MEMORY_KILLER_GRACE_TIME`: defaults 900 seconds (15 minutes). When + a shutdown is triggered, the Sidekiq process will keep working normally for + another 15 minutes. +- `SIDEKIQ_MEMORY_KILLER_SHUTDOWN_WAIT`: defaults to 30 seconds. When the grace + time has expired, the MemoryKiller tells Sidekiq to stop accepting new jobs. + Existing jobs get 30 seconds to finish. After that, the MemoryKiller tells + Sidekiq to shut down, and an external supervision mechanism (e.g. Runit) must + restart Sidekiq. diff --git a/doc/operations/sidekiq_restarter.md b/doc/operations/sidekiq_restarter.md new file mode 100644 index 00000000000..ab28c9def18 --- /dev/null +++ b/doc/operations/sidekiq_restarter.md @@ -0,0 +1,10 @@ +# Sidekiq MemoryKiller + +The GitLab Rails application code suffers from memory leaks. For web requests +this problem is made manageable using +[unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer) which +restarts Unicorn worker processes in between requests when needed. The Sidekiq +MemoryKiller applies the same approach to the Sidekiq processes used by GitLab +to process background jobs. + + From e61e7a17b433cfe88910d21d00be90d909ca83bc Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 15 Dec 2014 13:44:47 +0100 Subject: [PATCH 40/55] Remove unfinished file with the wrong name --- doc/operations/sidekiq_restarter.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 doc/operations/sidekiq_restarter.md diff --git a/doc/operations/sidekiq_restarter.md b/doc/operations/sidekiq_restarter.md deleted file mode 100644 index ab28c9def18..00000000000 --- a/doc/operations/sidekiq_restarter.md +++ /dev/null @@ -1,10 +0,0 @@ -# Sidekiq MemoryKiller - -The GitLab Rails application code suffers from memory leaks. For web requests -this problem is made manageable using -[unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer) which -restarts Unicorn worker processes in between requests when needed. The Sidekiq -MemoryKiller applies the same approach to the Sidekiq processes used by GitLab -to process background jobs. - - From c4a56797a4c3a818c0ac6e57e2ea3acb76f3f1eb Mon Sep 17 00:00:00 2001 From: skv-headless Date: Mon, 15 Dec 2014 16:10:56 +0300 Subject: [PATCH 41/55] transfer error handler --- app/assets/javascripts/application.js.coffee | 6 ------ app/controllers/projects_controller.rb | 3 +++ app/views/projects/transfer.js.haml | 7 +------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index e9a28c12159..4cda8b75d8e 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -51,12 +51,6 @@ window.ajaxGet = (url) -> window.showAndHide = (selector) -> -window.errorMessage = (message) -> - ehtml = $("

") - ehtml.addClass("error_message") - ehtml.html(message) - ehtml - window.split = (val) -> return val.split( /,\s*/ ) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index fcff6952d38..e541b6fd872 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -44,6 +44,9 @@ class ProjectsController < ApplicationController def transfer ::Projects::TransferService.new(project, current_user, project_params).execute + if @project.errors[:namespace_id].present? + flash[:alert] = @project.errors[:namespace_id].first + end end def show diff --git a/app/views/projects/transfer.js.haml b/app/views/projects/transfer.js.haml index 10b0de98c04..6d083c5c516 100644 --- a/app/views/projects/transfer.js.haml +++ b/app/views/projects/transfer.js.haml @@ -1,7 +1,2 @@ -- if @project.errors[:namespace_id].present? - :plain - $("#tab-transfer .errors-holder").replaceWith(errorMessage('#{escape_javascript(@project.errors[:namespace_id].first)}')); - $("#tab-transfer .form-actions input").removeAttr('disabled').removeClass('disabled'); -- else - :plain +:plain location.href = "#{edit_project_path(@project)}"; From d117927131351e319db947e83ef4b9ec228d5030 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 15 Dec 2014 15:17:10 +0100 Subject: [PATCH 42/55] Add link to 'operations' README --- doc/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/README.md b/doc/README.md index 896224fe930..3c8f8ad3d03 100644 --- a/doc/README.md +++ b/doc/README.md @@ -23,6 +23,7 @@ - [Welcome message](customization/welcome_message.md) Add a custom welcome message to the sign-in page. - [Issue closing](customization/issue_closing.md) Customize how to close an issue from commit messages. - [Libravatar](customization/libravatar.md) Use Libravatar for user avatars. +- [Operations](operations/README.md) Keeping GitLab up and running ## Contributor documentation From 4ab728bfe89adbc8f9d430e80f0582b1775a50d5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 15 Dec 2014 16:31:23 +0200 Subject: [PATCH 43/55] Fix random Argument error when update note In some strange cases Ruby thinks `system` is not AR field but Kernel.system call and raises exception during save. It should prevent this random wierd behaviour Signed-off-by: Dmitriy Zaporozhets --- app/models/note.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/note.rb b/app/models/note.rb index 5bf645bbd1d..5996298be22 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -502,6 +502,6 @@ class Note < ActiveRecord::Base end def editable? - !system + !read_attribute(:system) end end From 842ac35ae4f6aac8bd3f2ab8649a6e07576f89fa Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 15 Dec 2014 19:47:38 +0200 Subject: [PATCH 44/55] Update changelog --- CHANGELOG | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2061237fb42..0ddae406cf6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,18 +3,12 @@ v 7.6.0 - New rugged version - Add CRON=1 backup setting for quiet backups - Fix failing wiki restore - - - Add optional Sidekiq MemoryKiller middleware (enabled via SIDEKIQ_MAX_RSS env variable) - - - - - Monokai highlighting style now more faithful to original design (Mark Riedesel) - Create project with repository in synchrony - Added ability to create empty repo or import existing one if project does not have repository - - - - - Reactivate highlight.js language autodetection - Mobile UI improvements - - - Change maximum avatar file size from 100KB to 200KB - Strict validation for snippet file names - Enable Markdown preview for issues, merge requests, milestones, and notes (Vinnie Okada) @@ -22,6 +16,11 @@ v 7.6.0 - Update Sidekiq to version 2.17.8 - Add author filter to project issues and merge requests pages - Atom feed for user activity + - Support multiple omniauth providers for the same user + - Rendering cross reference in issue title and tooltip for merge request + - Show username in comments + - Possibility to create Milestones or Labels when Issues are disabled + - Fix bug with showing gpg signature in tag v 7.5.2 - Don't log Sidekiq arguments by default From f06f69b9da81337db14324783b45ea5f55fcf735 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Sun, 14 Dec 2014 19:01:59 -0600 Subject: [PATCH 45/55] Add theme type css class --- app/helpers/application_helper.rb | 4 ++++ app/views/layouts/admin.html.haml | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/layouts/errors.html.haml | 2 +- app/views/layouts/explore.html.haml | 2 +- app/views/layouts/group.html.haml | 2 +- app/views/layouts/navless.html.haml | 2 +- app/views/layouts/profile.html.haml | 2 +- app/views/layouts/project_settings.html.haml | 2 +- app/views/layouts/projects.html.haml | 2 +- app/views/layouts/public_group.html.haml | 2 +- app/views/layouts/public_projects.html.haml | 2 +- app/views/layouts/public_users.html.haml | 2 +- app/views/layouts/search.html.haml | 2 +- app/views/profiles/update.js.erb | 4 ++-- lib/gitlab/theme.rb | 14 ++++++++++++++ 16 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 021bd0a494c..01aa4a60d4c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -114,6 +114,10 @@ module ApplicationHelper Gitlab::Theme.css_class_by_id(current_user.try(:theme_id)) end + def theme_type + Gitlab::Theme.type_css_class_by_id(current_user.try(:theme_id)) + end + def user_color_scheme_class COLOR_SCHEMES[current_user.try(:color_scheme_id)] if defined?(current_user) end diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 207ab22f4c7..744ecaa0297 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: "Admin area" - %body{class: "#{app_theme} admin", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} admin", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/head_panel", title: "Admin area" %nav.main-nav.navbar-collapse.collapse diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7d0819aa93e..e35a3915d0e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: "Dashboard" - %body{class: "#{app_theme} application", :'data-page' => body_data_page } + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page } = render "layouts/broadcast" = render "layouts/head_panel", title: "Dashboard" %nav.main-nav.navbar-collapse.collapse diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml index 16df9c10fbb..e7d875173e6 100644 --- a/app/views/layouts/errors.html.haml +++ b/app/views/layouts/errors.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: "Error" - %body{class: "#{app_theme} application"} + %body{class: "#{app_theme} #{theme_type} application"} = render "layouts/head_panel", title: "" if current_user .container.navless-container = render "layouts/flash" diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml index d023846c5eb..9813d846542 100644 --- a/app/views/layouts/explore.html.haml +++ b/app/views/layouts/explore.html.haml @@ -2,7 +2,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: page_title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" - if current_user = render "layouts/head_panel", title: page_title diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml index f22fb236cb5..6ad285e2468 100644 --- a/app/views/layouts/group.html.haml +++ b/app/views/layouts/group.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: group_head_title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/head_panel", title: "group: #{@group.name}" %nav.main-nav.navbar-collapse.collapse diff --git a/app/views/layouts/navless.html.haml b/app/views/layouts/navless.html.haml index 2c5fffe384f..730f3d09277 100644 --- a/app/views/layouts/navless.html.haml +++ b/app/views/layouts/navless.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: @title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/head_panel", title: @title .container.navless-container diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index 1d0ab84d26f..c57047bb1f3 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: "Profile" - %body{class: "#{app_theme} profile", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} profile", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/head_panel", title: "Profile" %nav.main-nav.navbar-collapse.collapse diff --git a/app/views/layouts/project_settings.html.haml b/app/views/layouts/project_settings.html.haml index c8b8f4ba971..fd233452215 100644 --- a/app/views/layouts/project_settings.html.haml +++ b/app/views/layouts/project_settings.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: @project.name_with_namespace - %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } + %body{class: "#{app_theme} #{theme_type} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } = render "layouts/broadcast" = render "layouts/head_panel", title: project_title(@project) = render "layouts/init_auto_complete" diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml index 8ad2f165946..fb64c40e8bb 100644 --- a/app/views/layouts/projects.html.haml +++ b/app/views/layouts/projects.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: project_head_title - %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } + %body{class: "#{app_theme} #{theme_type} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } = render "layouts/broadcast" = render "layouts/head_panel", title: project_title(@project) = render "layouts/init_auto_complete" diff --git a/app/views/layouts/public_group.html.haml b/app/views/layouts/public_group.html.haml index a289b784725..b97b0cf92cb 100644 --- a/app/views/layouts/public_group.html.haml +++ b/app/views/layouts/public_group.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: group_head_title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/public_head_panel", title: "group: #{@group.name}" %nav.main-nav.navbar-collapse.collapse diff --git a/app/views/layouts/public_projects.html.haml b/app/views/layouts/public_projects.html.haml index 2a9230244f8..4819b9b135f 100644 --- a/app/views/layouts/public_projects.html.haml +++ b/app/views/layouts/public_projects.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: @project.name_with_namespace - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/public_head_panel", title: project_title(@project) %nav.main-nav.navbar-collapse.collapse diff --git a/app/views/layouts/public_users.html.haml b/app/views/layouts/public_users.html.haml index 4aa258fea0d..fdba0f099a9 100644 --- a/app/views/layouts/public_users.html.haml +++ b/app/views/layouts/public_users.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: @title - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/public_head_panel", title: @title .container.navless-container diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml index 084ff7ec830..6d001e7ee1c 100644 --- a/app/views/layouts/search.html.haml +++ b/app/views/layouts/search.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en"} = render "layouts/head", title: "Search" - %body{class: "#{app_theme} application", :'data-page' => body_data_page} + %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page} = render "layouts/broadcast" = render "layouts/head_panel", title: "Search" .container.navless-container diff --git a/app/views/profiles/update.js.erb b/app/views/profiles/update.js.erb index 04b5cf4827d..e664ac2a52a 100644 --- a/app/views/profiles/update.js.erb +++ b/app/views/profiles/update.js.erb @@ -1,6 +1,6 @@ // Remove body class for any previous theme, re-add current one -$('body').removeClass('ui_basic ui_mars ui_modern ui_gray ui_color') -$('body').addClass('<%= app_theme %>') +$('body').removeClass('ui_basic ui_mars ui_modern ui_gray ui_color light_theme dark_theme') +$('body').addClass('<%= app_theme %> <%= theme_type %>') // Re-render the header to reflect the new theme $('header').html('<%= escape_javascript(render("layouts/head_panel", title: "Profile")) %>') diff --git a/lib/gitlab/theme.rb b/lib/gitlab/theme.rb index b7c50cb734d..a7c83a880f6 100644 --- a/lib/gitlab/theme.rb +++ b/lib/gitlab/theme.rb @@ -19,5 +19,19 @@ module Gitlab return themes[id] end + + def self.type_css_class_by_id(id) + types = { + BASIC => 'light_theme', + MARS => 'dark_theme', + MODERN => 'dark_theme', + GRAY => 'dark_theme', + COLOR => 'dark_theme' + } + + id ||= Gitlab.config.gitlab.default_theme + + types[id] + end end end From 15303bbfd76ae91fcba6202c5449425cb3c99829 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Tue, 16 Dec 2014 13:57:40 +0200 Subject: [PATCH 46/55] add kerberos to Gemfile --- Gemfile | 1 + Gemfile.lock | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Gemfile b/Gemfile index b4ca5969277..ce9b83308f3 100644 --- a/Gemfile +++ b/Gemfile @@ -28,6 +28,7 @@ gem 'omniauth-google-oauth2' gem 'omniauth-twitter' gem 'omniauth-github' gem 'omniauth-shibboleth' +gem 'omniauth-kerberos' # Extracting information from a git repository # Provide access to Gitlab::Git library diff --git a/Gemfile.lock b/Gemfile.lock index 4bcb1eb0de5..a93935ff5cb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -322,6 +322,11 @@ GEM omniauth-google-oauth2 (0.2.5) omniauth (> 1.0) omniauth-oauth2 (~> 1.1) + omniauth-kerberos (0.2.0) + omniauth-multipassword + timfel-krb5-auth (~> 0.8) + omniauth-multipassword (0.4.1) + omniauth (~> 1.0) omniauth-oauth (1.0.1) oauth omniauth (~> 1.0) @@ -531,6 +536,7 @@ GEM thread_safe (0.3.4) tilt (1.4.1) timers (1.1.0) + timfel-krb5-auth (0.8) tinder (1.9.3) eventmachine (~> 1.0) faraday (~> 0.8) @@ -655,6 +661,7 @@ DEPENDENCIES omniauth (~> 1.1.3) omniauth-github omniauth-google-oauth2 + omniauth-kerberos omniauth-shibboleth omniauth-twitter org-ruby (= 0.9.9) From c981d693380e5c5c0b66aa654e63cf653f1e5f42 Mon Sep 17 00:00:00 2001 From: kfei Date: Tue, 16 Dec 2014 09:04:52 -0800 Subject: [PATCH 47/55] Update the Omnibus package in Dockerfile From 7.5.2 to 7.5.3. Signed-off-by: kfei --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index aea59916c7a..41514e76687 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update -q \ # If the Omnibus package version below is outdated please contribute a merge request to update it. # If you run GitLab Enterprise Edition point it to a location where you have downloaded it. RUN TMP_FILE=$(mktemp); \ - wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.5.2-omnibus.5.2.1.ci-1_amd64.deb \ + wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.5.3-omnibus.5.2.1.ci-1_amd64.deb \ && dpkg -i $TMP_FILE \ && rm -f $TMP_FILE From e9f974dc12cb7ab37f1fc089f0525bd491572a5c Mon Sep 17 00:00:00 2001 From: kfei Date: Tue, 16 Dec 2014 22:11:50 -0800 Subject: [PATCH 48/55] Reduce the size of Docker image 1) Add `--no-install-recommends` option to `apt-get install`, this avoids lots of (~30MB) unnecessary packages. 2) Add `ca-certificates` package for `wget` fetching stuffs from Amazon S3. 3) There is no need to run `apt-get clean` for an image derived from official Ubuntu since they already cleaned (see also: http://goo.gl/B2SQRB) all the garbages produced by `apt-get`. Signed-off-by: kfei --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index aea59916c7a..2cc01f24098 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,10 +2,10 @@ FROM ubuntu:14.04 # Install required packages RUN apt-get update -q \ - && DEBIAN_FRONTEND=noninteractive apt-get install -qy \ + && DEBIAN_FRONTEND=noninteractive apt-get install -qy --no-install-recommends \ + ca-certificates \ openssh-server \ - wget \ - && apt-get clean + wget # Download & Install GitLab # If the Omnibus package version below is outdated please contribute a merge request to update it. From 98e64610b2b5ad8340d763d3fd370bc11d0ad700 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Wed, 17 Dec 2014 08:27:03 +0100 Subject: [PATCH 49/55] Move development information to the GitLab Development Kit. --- README.md | 46 +++---------------------------------- doc/install/installation.md | 6 +++-- 2 files changed, 7 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index f303e8e7383..abf8331fa8e 100644 --- a/README.md +++ b/README.md @@ -66,55 +66,15 @@ Since 2011 a minor or major version of GitLab is released on the 22nd of every m For updating the the Omnibus installation please see the [update documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update.md). For manual installations there is an [upgrader script](doc/update/upgrader.md) and there are [upgrade guides](doc/update). -## Run in production mode - -The Installation guide contains instructions on how to download an init script and run it automatically on boot. You can also start the init script manually: - - sudo service gitlab start - -or by directly calling the script: - - sudo /etc/init.d/gitlab start - -Please login with `root` / `5iveL!fe` - ## Install a development environment 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 +If you do not use the GitLab Development Development kit you need to install and setup all the dependencies yourself, this is a lot of work and error prone. +One small thing you also have to do when installing it yourself is to copy the example development unicorn configuration file: cp config/unicorn.rb.example.development config/unicorn.rb -## Run in development mode - -Start it with [Foreman](https://github.com/ddollar/foreman) - - bundle exec foreman start -p 3000 - -or start each component separately: - - bundle exec rails s - bin/background_jobs start - -And surf to [localhost:3000](http://localhost:3000/) and login with `root` / `5iveL!fe`. - -## Run the tests - -- Run all tests: - - bundle exec rake test - -- [RSpec](http://rspec.info/) unit and functional tests. - - All RSpec tests: `bundle exec rake spec` - - Single RSpec file: `bundle exec rspec spec/controllers/commit_controller_spec.rb` - -- [Spinach](https://github.com/codegram/spinach) integration tests. - - All Spinach tests: `bundle exec rake spinach` - - Single Spinach test: `bundle exec spinach features/project/issues/milestones.feature` +Instructions on how to start Gitlab and how to run the tests can be found in the [development section of the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit#development). ## Documentation diff --git a/doc/install/installation.md b/doc/install/installation.md index 263259bc2f9..c856bfc9693 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -383,15 +383,17 @@ NOTE: Supply `SANITIZE=true` environment variable to `gitlab:check` to omit proj ### 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: +Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has created a default admin account for you. You can use it to log in: root 5iveL!fe -**Important Note:** Please go over to your profile page and immediately change the password, so nobody can access your GitLab by using this login information later on. +**Important Note:** Please login to the server before exposing it to the public internet. On login you'll be prompted to change the password. **Enjoy!** +You can use `sudo service gitlab start` and `sudo service gitlab stop` to start and stop GitLab. + ## Advanced Setup Tips ### Using HTTPS From 3f129fd618bb5f6568ab95c7c7f4450c897bd3c2 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Wed, 17 Dec 2014 11:07:10 +0100 Subject: [PATCH 50/55] Include default credentials in the readme and make all headers the same. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index abf8331fa8e..afcaaf0f0fa 100644 --- a/README.md +++ b/README.md @@ -52,17 +52,18 @@ On [about.gitlab.com](https://about.gitlab.com/) you can find more information a Please see [the installation page on the GitLab website](https://about.gitlab.com/installation/) for the various options. Since a manual installation is a lot of work and error prone we strongly recommend the fast and reliable [Omnibus package installation](https://about.gitlab.com/downloads/) (deb/rpm). +You can access new installation with the login `root` and password `5iveL!fe`, after login you are required to set a unique password. ## Third-party applications There are a lot of applications and API wrappers for GitLab. Find them [on our website](https://about.gitlab.com/applications/). -### New versions +## New versions Since 2011 a minor or major version of GitLab is released on the 22nd of every month. Patch and security releases come out when needed. New features are detailed on the [blog](https://about.gitlab.com/blog/) and in the [changelog](CHANGELOG). For more information about the release process see the release [documentation](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/release). Features that will likely be in the next releases can be found on the [feature request forum](http://feedback.gitlab.com/forums/176466-general) with the status [started](http://feedback.gitlab.com/forums/176466-general/status/796456) and [completed](http://feedback.gitlab.com/forums/176466-general/status/796457). -### Upgrading +## Upgrading For updating the the Omnibus installation please see the [update documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update.md). For manual installations there is an [upgrader script](doc/update/upgrader.md) and there are [upgrade guides](doc/update). From 918245094c05d2dfaf566a06e4e4b47cd1e15a27 Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Wed, 17 Dec 2014 18:00:43 -0500 Subject: [PATCH 51/55] Added update guide for updating to 7.6 --- doc/install/installation.md | 6 +++--- ...x-or-7.x-to-7.5.md => 6.x-or-7.x-to-7.6.md} | 18 +++++++++--------- doc/update/7.5-to-7.6.md | 6 ++---- 3 files changed, 14 insertions(+), 16 deletions(-) rename doc/update/{6.x-or-7.x-to-7.5.md => 6.x-or-7.x-to-7.6.md} (95%) diff --git a/doc/install/installation.md b/doc/install/installation.md index 539e1c396e4..aa04116779e 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -181,9 +181,9 @@ 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-5-stable gitlab + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-6-stable gitlab -**Note:** You can change `7-5-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! +**Note:** You can change `7-6-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! ### Configure It @@ -278,7 +278,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da 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[v2.2.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production + sudo -u git -H bundle exec rake gitlab:shell:install[v2.4.0] REDIS_URL=unix:/var/run/redis/redis.sock 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: diff --git a/doc/update/6.x-or-7.x-to-7.5.md b/doc/update/6.x-or-7.x-to-7.6.md similarity index 95% rename from doc/update/6.x-or-7.x-to-7.5.md rename to doc/update/6.x-or-7.x-to-7.6.md index c9b95c62611..80a7b082261 100644 --- a/doc/update/6.x-or-7.x-to-7.5.md +++ b/doc/update/6.x-or-7.x-to-7.6.md @@ -70,7 +70,7 @@ sudo -u git -H git checkout -- db/schema.rb # local changes will be restored aut For GitLab Community Edition: ```bash -sudo -u git -H git checkout 7-5-stable +sudo -u git -H git checkout 7-6-stable ``` OR @@ -78,7 +78,7 @@ OR For GitLab Enterprise Edition: ```bash -sudo -u git -H git checkout 7-5-stable-ee +sudo -u git -H git checkout 7-6-stable-ee ``` ## 4. Install additional packages @@ -119,7 +119,7 @@ sudo apt-get install pkg-config cmake ```bash cd /home/git/gitlab-shell sudo -u git -H git fetch -sudo -u git -H git checkout v2.2.0 +sudo -u git -H git checkout v2.4.0 ``` ## 7. Install libs, migrations, etc. @@ -154,14 +154,14 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab 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-5-stable:config/gitlab.yml.example +git diff 6-0-stable:config/gitlab.yml.example 7-6-stable:config/gitlab.yml.example ``` -* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-5-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-5-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/v2.2.0/config.yml.example but with your settings. -* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-5-stable/lib/support/nginx/gitlab but with your settings. -* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-5-stable/lib/support/nginx/gitlab-ssl but with your settings. +* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-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-6-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/v2.4.0/config.yml.example but with your settings. +* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-stable/lib/support/nginx/gitlab but with your settings. +* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-stable/lib/support/nginx/gitlab-ssl but with your settings. * Copy rack attack middleware config ```bash diff --git a/doc/update/7.5-to-7.6.md b/doc/update/7.5-to-7.6.md index a5d76c341af..11058c211ca 100644 --- a/doc/update/7.5-to-7.6.md +++ b/doc/update/7.5-to-7.6.md @@ -1,7 +1,5 @@ # From 7.5 to 7.6 -**7.6 is not yet released. This is a preliminary upgrade guide.** - ### 0. Stop server sudo service gitlab stop @@ -39,7 +37,7 @@ sudo -u git -H git checkout 7-6-stable-ee ```bash cd /home/git/gitlab-shell sudo -u git -H git fetch -sudo -u git -H git checkout v2.2.0 +sudo -u git -H git checkout v2.4.0 ``` ### 4. Install libs, migrations, etc. @@ -72,7 +70,7 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). View them with the command below and apply them to your current `gitlab.yml`. ``` -git diff origin/7-5-stable:config/gitlab.yml.example origin/7-6-stable:config/gitlab.yml.example +git diff origin/7-6-stable:config/gitlab.yml.example origin/7-6-stable:config/gitlab.yml.example ``` #### Change Nginx settings From 7813363fd79d758980d30354aea0d0d21af92612 Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Wed, 17 Dec 2014 18:02:58 -0500 Subject: [PATCH 52/55] Fixed version reference --- doc/update/6.x-or-7.x-to-7.6.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/update/6.x-or-7.x-to-7.6.md b/doc/update/6.x-or-7.x-to-7.6.md index 80a7b082261..883a654dcd8 100644 --- a/doc/update/6.x-or-7.x-to-7.6.md +++ b/doc/update/6.x-or-7.x-to-7.6.md @@ -1,6 +1,6 @@ -# From 6.x or 7.x to 7.5 +# From 6.x or 7.x to 7.6 -This allows you to upgrade any version of GitLab from 6.0 and up (including 7.0 and up) to 7.5. +This allows you to upgrade any version of GitLab from 6.0 and up (including 7.0 and up) to 7.6. ## Global issue numbers From a55feb14f162a0b3b11a7c21fd4149ca8c105bc4 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Thu, 18 Dec 2014 09:22:34 +0100 Subject: [PATCH 53/55] Fix Rake tasks doc README: add top level h1 and link to missing to features.md. --- doc/raketasks/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/raketasks/README.md b/doc/raketasks/README.md index 9e2f697bca6..770b7a70fe0 100644 --- a/doc/raketasks/README.md +++ b/doc/raketasks/README.md @@ -1,5 +1,8 @@ +# Rake tasks + - [Backup restore](backup_restore.md) - [Cleanup](cleanup.md) +- [Features](features.md) - [Maintenance](maintenance.md) and self-checks - [User management](user_management.md) - [Web hooks](web_hooks.md) From 6d747cfd3a41d6e2f396855ef7f29f400ea3f4a8 Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Thu, 18 Dec 2014 09:50:20 -0500 Subject: [PATCH 54/55] Added link to the configuration sample for OmniAuth providers when using Omnibus. --- doc/integration/omniauth.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index 00adae58dfa..15b4fb622af 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -7,6 +7,7 @@ OmniAuth does not prevent standard GitLab authentication or LDAP (if configured) - [Initial OmniAuth Configuration](#initial-omniauth-configuration) - [Supported Providers](#supported-providers) - [Enable OmniAuth for an Existing User](#enable-omniauth-for-an-existing-user) +- [OmniAuth configuration sample when using Omnibus GitLab](https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master#omniauth-google-twitter-github-login) ## Initial OmniAuth Configuration From 1e22b494e2618e004ad816ed92b8aca70fa037e5 Mon Sep 17 00:00:00 2001 From: Xavier Perseguers Date: Fri, 19 Dec 2014 13:49:33 +0100 Subject: [PATCH 55/55] [BUGFIX] Invalid branch in comparison --- doc/update/7.5-to-7.6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/update/7.5-to-7.6.md b/doc/update/7.5-to-7.6.md index 11058c211ca..35cd437fdc4 100644 --- a/doc/update/7.5-to-7.6.md +++ b/doc/update/7.5-to-7.6.md @@ -70,7 +70,7 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). View them with the command below and apply them to your current `gitlab.yml`. ``` -git diff origin/7-6-stable:config/gitlab.yml.example origin/7-6-stable:config/gitlab.yml.example +git diff origin/7-5-stable:config/gitlab.yml.example origin/7-6-stable:config/gitlab.yml.example ``` #### Change Nginx settings