diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-15 14:57:55 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-15 14:57:55 -0800 |
commit | e683d054533f4faf9c1c778c8be729d76e435708 (patch) | |
tree | efc31315ed066b7ce9d2d45dd7733f7ac28f1501 | |
parent | 3d3c7efa3e03c34dd48fa7ca959f11af204ffe75 (diff) | |
parent | 500dab098b0b2f2c3f7444576d38fe239b4ed2ed (diff) | |
download | gitlab-ce-e683d054533f4faf9c1c778c8be729d76e435708.tar.gz |
Merge branch 'master' of github.com:gitlabhq/gitlabhq
23 files changed, 49 insertions, 64 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 52db44bf822..97aa2d9bdb4 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController super end - def after_sign_up_path_for(resource) + def after_sign_up_path_for(_resource) new_user_session_path end - def after_inactive_sign_up_path_for(resource) + def after_inactive_sign_up_path_for(_resource) new_user_session_path end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 5a96a208e93..d316213b1fd 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -108,7 +108,7 @@ module TreeHelper end end - def up_dir_path(tree) + def up_dir_path file = File.join(@path, "..") tree_join(@ref, file) end diff --git a/app/models/commit.rb b/app/models/commit.rb index 37dd371ec00..baccf286740 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -75,11 +75,11 @@ class Commit return no_commit_message if title.blank? - title_end = title.index(/\n/) + title_end = title.index("\n") if (!title_end && title.length > 100) || (title_end && title_end > 100) title[0..79] << "…".html_safe else - title.split(/\n/, 2).first + title.split("\n", 2).first end end @@ -87,11 +87,11 @@ class Commit # # cut off, ellipses (`&hellp;`) are prepended to the commit message. def description - title_end = safe_message.index(/\n/) + title_end = safe_message.index("\n") @description ||= if (!title_end && safe_message.length > 100) || (title_end && title_end > 100) "…".html_safe << safe_message[80..-1] else - safe_message.split(/\n/, 2)[1].try(:chomp) + safe_message.split("\n", 2)[1].try(:chomp) end end diff --git a/app/models/key.rb b/app/models/key.rb index 095c73d8baf..65a426d1f8b 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -89,7 +89,7 @@ class Key < ActiveRecord::Base end if cmd_status.zero? - cmd_output.gsub /([\d\h]{2}:)+[\d\h]{2}/ do |match| + cmd_output.gsub /(\h{2}:)+\h{2}/ do |match| self.fingerprint = match end end diff --git a/app/models/project_services/campfire_service.rb b/app/models/project_services/campfire_service.rb index 0736ddab99b..3116c311052 100644 --- a/app/models/project_services/campfire_service.rb +++ b/app/models/project_services/campfire_service.rb @@ -60,9 +60,9 @@ class CampfireService < Service message << "[#{project.name_with_namespace}] " message << "#{push[:user_name]} " - if before =~ /000000/ + if before.include?('000000') message << "pushed new branch #{ref} \n" - elsif after =~ /000000/ + elsif after.include?('000000') message << "removed branch #{ref} \n" else message << "pushed #{push[:total_commits_count]} commits to #{ref}. " diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index 6ef4b210c56..aafc3efa970 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -58,12 +58,12 @@ class HipchatService < Service message = "" message << "#{push[:user_name]} " - if before =~ /000000/ + if before.include?('000000') message << "pushed new branch <a href=\""\ "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\ " to <a href=\"#{project.web_url}\">"\ "#{project.name_with_namespace.gsub!(/\s/, "")}</a>\n" - elsif after =~ /000000/ + elsif after.include?('000000') message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n" else message << "pushed to branch <a href=\""\ diff --git a/app/models/project_services/pushover_service.rb b/app/models/project_services/pushover_service.rb index f247fde7762..a9b23f97ba0 100644 --- a/app/models/project_services/pushover_service.rb +++ b/app/models/project_services/pushover_service.rb @@ -80,9 +80,9 @@ class PushoverService < Service before = push_data[:before] after = push_data[:after] - if before =~ /000000/ + if before.include?('000000') message = "#{push_data[:user_name]} pushed new branch \"#{ref}\"." - elsif after =~ /000000/ + elsif after.include?('000000') message = "#{push_data[:user_name]} deleted branch \"#{ref}\"." else message = "#{push_data[:user_name]} push to branch \"#{ref}\"." diff --git a/app/models/project_services/slack_message.rb b/app/models/project_services/slack_message.rb index d0ddb1f162c..6c6446db45f 100644 --- a/app/models/project_services/slack_message.rb +++ b/app/models/project_services/slack_message.rb @@ -77,11 +77,11 @@ class SlackMessage end def new_branch? - before =~ /000000/ + before.include?('000000') end def removed_branch? - after =~ /000000/ + after.include?('000000') end def branch_url diff --git a/app/models/user.rb b/app/models/user.rb index 6e5ac9b39c8..743410c22e3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -488,7 +488,7 @@ class User < ActiveRecord::Base end def temp_oauth_email? - email =~ /\Atemp-email-for-oauth/ + email.start_with?('temp-email-for-oauth') end def public_profile? diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index a9ea7daabc8..872b886c575 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -111,23 +111,23 @@ class GitPushService ref_parts = ref.split('/') # Return if this is not a push to a branch (e.g. new commits) - ref_parts[1] =~ /heads/ && oldrev != Gitlab::Git::BLANK_SHA + ref_parts[1].include?('heads') && oldrev != Gitlab::Git::BLANK_SHA end def push_to_new_branch?(ref, oldrev) ref_parts = ref.split('/') - ref_parts[1] =~ /heads/ && oldrev == Gitlab::Git::BLANK_SHA + ref_parts[1].include?('heads') && oldrev == Gitlab::Git::BLANK_SHA end def push_remove_branch?(ref, newrev) ref_parts = ref.split('/') - ref_parts[1] =~ /heads/ && newrev == Gitlab::Git::BLANK_SHA + ref_parts[1].include?('heads') && newrev == Gitlab::Git::BLANK_SHA end def push_to_branch?(ref) - ref =~ /refs\/heads/ + ref.include?('refs/heads') end def is_default_branch?(ref) diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index fb8f812dad8..5a89c5d2936 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -118,7 +118,7 @@ class NotificationService return true unless note.noteable_type.present? # ignore gitlab service messages - return true if note.note =~ /\A_Status changed to closed_/ + return true if note.note.start_with?('_Status changed to closed_') return true if note.cross_reference? && note.system == true opts = { noteable_type: note.noteable_type, project_id: note.project_id } diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index fa6aecb6661..17bcf8d3631 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -19,6 +19,7 @@ = csrf_meta_tags = include_gon %meta{name: 'viewport', content: 'width=device-width, initial-scale=1.0'} + %meta{name: 'theme-color', content: '#474D57'} = render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id') = render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id') diff --git a/app/views/projects/_blob_editor.html.haml b/app/views/projects/_blob_editor.html.haml new file mode 100644 index 00000000000..1fb74b55c41 --- /dev/null +++ b/app/views/projects/_blob_editor.html.haml @@ -0,0 +1,15 @@ +.file-holder.file + .file-title + %i.icon-file + %span.file_name + %span.monospace.light #{ref} + - if local_assigns[:path] + = ': ' + local_assigns[:path] + .file-content.code + %pre.js-edit-mode-pane#editor + = params[:content] || local_assigns[:blob_data] + - if local_assigns[:path] + .js-edit-mode-pane#preview.hide + .center + %h2 + %i.icon-spinner.icon-spin diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index 5ccde05063e..7e0789853af 100644 --- a/app/views/projects/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml @@ -6,21 +6,7 @@ = link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do - .file-holder.file - .file-title - %i.fa.fa-file - %span.file_name - %span.monospace.light #{@ref}: - = @path - %span.options - .btn-group.tree-btn-group - = link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message } - .file-content.code - %pre.js-edit-mode-pane#editor - .js-edit-mode-pane#preview.hide - .center - %h2 - %i.fa.fa-spinner.fa-spin + = render 'projects/blob_editor', ref: @ref, path: @path, blob_data: @blob.data = render 'shared/commit_message_container', params: params, placeholder: "Update #{@blob.name}" = hidden_field_tag 'last_commit', @last_commit @@ -34,7 +20,6 @@ ace.config.loadModule("ace/ext/searchbox"); var ace_mode = "#{@blob.language.try(:ace_mode)}"; var editor = ace.edit("editor"); - editor.setValue("#{escape_javascript(@blob.data)}"); if (ace_mode) { editor.getSession().setMode('ace/mode/' + ace_mode); } diff --git a/app/views/projects/new_tree/show.html.haml b/app/views/projects/new_tree/show.html.haml index f09d3659774..cf7b768694f 100644 --- a/app/views/projects/new_tree/show.html.haml +++ b/app/views/projects/new_tree/show.html.haml @@ -19,12 +19,7 @@ Encoding .col-sm-10 = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control' - .file-holder - .file-title - %i.fa.fa-file - .file-content.code - %pre#editor= params[:content] - + = render 'projects/blob_editor', ref: @ref = render 'shared/commit_message_container', params: params, placeholder: 'Add new file' = hidden_field_tag 'content', '', id: 'file-content' diff --git a/app/views/projects/tree/_tree.html.haml b/app/views/projects/tree/_tree.html.haml index 1159fcadffd..68ccd4d61bb 100644 --- a/app/views/projects/tree/_tree.html.haml +++ b/app/views/projects/tree/_tree.html.haml @@ -35,7 +35,7 @@ - if @path.present? %tr.tree-item %td.tree-item-file-name - = link_to "..", project_tree_path(@project, up_dir_path(tree)), class: 'prepend-left-10' + = link_to "..", project_tree_path(@project, up_dir_path), class: 'prepend-left-10' %td %td.hidden-xs diff --git a/config/routes.rb b/config/routes.rb index 245d6185639..9deddf3eade 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -154,8 +154,8 @@ Gitlab::Application.routes.draw do end end - match "/u/:username" => "users#show", as: :user, - constraints: {username: /(?:[^.]|\.(?!atom$))+/, format: /atom/}, via: :get + get '/u/:username' => 'users#show', as: :user, + constraints: { username: /(?:[^.]|\.(?!atom$))+/, format: /atom/ } # # Dashboard Area diff --git a/features/project/commits/comments.feature b/features/project/commits/comments.feature index a45245917e3..afcf0fdbb07 100644 --- a/features/project/commits/comments.feature +++ b/features/project/commits/comments.feature @@ -14,11 +14,6 @@ Feature: Project Commits Comments Then I should not see the cancel comment button @javascript - Scenario: I can't preview without text - Given I haven't written any comment text - 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 ":+1: Nice" Then The comment preview tab should be display rendered Markdown diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature index 9c4cc723d1b..56b9a13678d 100644 --- a/features/project/commits/diff_comments.feature +++ b/features/project/commits/diff_comments.feature @@ -55,12 +55,6 @@ Feature: Project Commits Diff Comments Then I should see a discussion reply button @javascript - Scenario: I can't preview without text - Given I open a diff comment form - And I haven't written any diff comment text - 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" diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 28964d54a8f..510e0f0f938 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -80,7 +80,7 @@ module SharedDiffNote step 'I should not see the diff comment text field' do within(diff_file_selector) do - page.should have_css(".js-note-text", visible: false) + expect(find('.js-note-text')).not_to be_visible end end @@ -115,7 +115,7 @@ module SharedDiffNote end step 'I should see add a diff comment button' do - page.should have_css(".js-add-diff-note-button", visible: false) + page.should have_css('.js-add-diff-note-button', visible: true) end step 'I should see an empty diff comment form' do diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 17adec3eda1..625bcc0b266 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -64,7 +64,7 @@ module SharedNote step 'I should not see the comment text field' do within(".js-main-target-form") do - page.should have_css(".js-note-text", visible: false) + expect(find('.js-note-text')).not_to be_visible end end diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 180e50611cf..a999cff09c0 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -25,8 +25,8 @@ module API # project. This applies the correct project permissions to # the wiki repository as well. access = - if project_path =~ /\.wiki\Z/ - project_path.sub!(/\.wiki\Z/, '') + if project_path.end_with?('.wiki') + project_path.chomp!('.wiki') Gitlab::GitAccessWiki.new else Gitlab::GitAccess.new diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 3c693546c09..fef2afd7333 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -25,7 +25,7 @@ namespace :gitlab do puts "Processing #{repo_path}".yellow - if path =~ /\.wiki\Z/ + if path.end_with?('.wiki') puts " * Skipping wiki repo" next end |