diff options
82 files changed, 550 insertions, 132 deletions
diff --git a/.gitignore b/.gitignore index aa822771ec2..d151849b713 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ doc/code/* public/uploads.* public/assets/ .envrc +dump.rdb diff --git a/.travis.yml b/.travis.yml index 6163f92b55d..9bab337f336 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,12 @@ env: matrix: - TASK=spinach DB=mysql - TASK=spec:api DB=mysql + - TASK=spec:feature DB=mysql - TASK=spec:other DB=mysql - TASK=jasmine:ci DB=mysql - TASK=spinach DB=postgresql - - TASK=spec:api DB=mysql + - TASK=spec:api DB=postgresql + - TASK=spec:feature DB=postgresql - TASK=spec:other DB=postgresql - TASK=jasmine:ci DB=postgresql before_install: diff --git a/CHANGELOG b/CHANGELOG index cdd8e9b665f..3ef46f4484e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,8 @@ v 6.8.0 - Option to disable standard login - Clean old created archives from repository downloads directory - Fix download link for huge MR diffs + - Expose event and mergerequest timestamps in API + - Fix emails on push service when only one commit is pushed v 6.7.3 - Fix the merge notification email not being sent (Pierre de La Morinerie) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6aa42509cf..290804e6187 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,8 +106,10 @@ For examples of feedback on merge requests please look at already [closed merge 1. It conforms to the following style guides ## Style guides - -1. [Ruby style guide](https://github.com/bbatsov/ruby-style-guide) -1. [Rails style guide](https://github.com/bbatsov/rails-style-guide) -1. [CoffeeScript style guide](https://github.com/polarmobile/coffeescript-style-guide) -1. [Shell command guidelines](doc/development/shell_commands.md) +1. [Ruby](https://github.com/bbatsov/ruby-style-guide) +2. [Rails](https://github.com/bbatsov/rails-style-guide) +3. [Formatting](https://github.com/thoughtbot/guides/tree/master/style#formatting) +4. [Naming](https://github.com/thoughtbot/guides/tree/master/style#naming) +8. [Testing](https://github.com/thoughtbot/guides/tree/master/style#testing) +7. [CoffeeScript](https://github.com/thoughtbot/guides/tree/master/style#coffeescript) +9. [Shell commands](doc/development/shell_commands.md) @@ -131,7 +131,7 @@ gem "gitlab-flowdock-git-hook", "~> 0.4.2" gem "gemnasium-gitlab-service", "~> 0.2" # Slack integration -gem "slack-notifier", "~> 0.2.0" +gem "slack-notifier", "~> 0.3.2" # d3 gem "d3_rails", "~> 3.1.4" @@ -232,4 +232,4 @@ end group :production do gem "gitlab_meta", '6.0' -end +end
\ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 0407538e846..155e03e5456 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -462,7 +462,7 @@ GEM rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) six (0.2.0) - slack-notifier (0.2.0) + slack-notifier (0.3.2) slim (2.0.2) temple (~> 0.6.6) tilt (>= 1.3.3, < 2.1) @@ -644,7 +644,7 @@ DEPENDENCIES simplecov sinatra six - slack-notifier (~> 0.2.0) + slack-notifier (~> 0.3.2) slim spinach-rails spring (= 1.1.1) diff --git a/PROCESS.md b/PROCESS.md index d606eae4d81..23dbfd0c699 100644 --- a/PROCESS.md +++ b/PROCESS.md @@ -100,3 +100,10 @@ It's been at least 2 weeks (and a new release) since we heard from you. I'm clos This merge request has been closed because a request for more information has not been reacted to for more than 2 weeks. If you respond and conform to the merge request guidelines in our \[contributing guidelines\]\(https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#pull-requests) we will reopen this merge request. +### 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. diff --git a/README.md b/README.md index 7764e0a29f2..3f3453a267a 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,14 @@ * Manage git repositories with fine grained access controls that keep your code secure * Perform code reviews and enhance collaboration with merge requests * Each project can also have an issue tracker and a wiki -* Used by more than 50,000 organizations, GitLab is the most popular solution to manage git repositories on-premises +* Used by more than 100,000 organizations, GitLab is the most popular solution to manage git repositories on-premises * Completely free and open source (MIT Expat license) * Powered by Ruby on Rails +### Canonical source + +* The source of GitLab Communinity Edition is [hosted on GitLab Cloud](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. + ### Code status * [![build status](https://ci.gitlab.org/projects/1/status.png?ref=master)](https://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) @@ -81,8 +85,12 @@ or by directly calling the script sudo /etc/init.d/gitlab start +Please login with root / 5iveL!fe + ### Run in development mode +Consider setting up the development environment with [the cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md#installation). + Copy the example development unicorn configuration file cp config/unicorn.rb.example.development config/unicorn.rb @@ -96,6 +104,8 @@ or start each component separately bundle exec rails s script/background_jobs start +And surf to [localhost:3000](http://localhost:3000/) and login with root / 5iveL!fe + ### Run the tests * Run all tests @@ -1 +1 @@ -6.8.0.pre +6.8.0 diff --git a/app/assets/stylesheets/sections/editor.scss b/app/assets/stylesheets/sections/editor.scss index 057f7b7fd44..f62f46ee168 100644 --- a/app/assets/stylesheets/sections/editor.scss +++ b/app/assets/stylesheets/sections/editor.scss @@ -26,9 +26,6 @@ float: left; } - .commit-btn { - @extend .save-btn; - } .message { display: inline-block; margin: 5px 8px 0 8px; diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index cfd5d5d9424..c9c7b6ecced 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -54,7 +54,6 @@ ul.notes { .diff-file, .discussion-hidden, .notes { - @extend .borders; background-color: #F9F9F9; } .diff-file .notes { diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 872b9500130..745da9c49e4 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -108,8 +108,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.check_if_can_be_merged end render json: {merge_status: @merge_request.merge_status_name} - rescue Gitlab::SatelliteNotExistError - render json: {merge_status: :no_satellite} end def automerge diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index 818c5d971e9..0b99165bf62 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -8,7 +8,8 @@ class Projects::TagsController < Projects::ApplicationController before_filter :authorize_admin_project!, only: [:destroy] def index - @tags = Kaminari.paginate_array(@repository.tags.reverse).page(params[:page]).per(30) + sorted = VersionSorter.rsort(@repository.tag_names) + @tags = Kaminari.paginate_array(sorted).page(params[:page]).per(30) end def create diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 9444d5a6b77..bcd9e0d5219 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -7,7 +7,7 @@ class Projects::WikisController < Projects::ApplicationController before_filter :load_project_wiki def pages - @wiki_pages = @project_wiki.pages + @wiki_pages = Kaminari.paginate_array(@project_wiki.pages).page(params[:page]).per(30) end def show diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index e943045e414..9bb3efc41d8 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -5,7 +5,7 @@ module ProjectsHelper def link_to_project project link_to project do - title = content_tag(:span, project.name, class: 'projet-name') + title = content_tag(:span, project.name, class: 'project-name') if project.namespace namespace = content_tag(:span, "#{project.namespace.human_name} / ", class: 'namespace-name') diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index 46aa34d13da..9f99c11ea30 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -26,7 +26,7 @@ module Emails if @commits.length > 1 @target_url = project_compare_url(@project, from: @commits.first, to: @commits.last) else - @target_url = project_commit_url(@project, @compare.commit) + @target_url = project_commit_url(@project, @commits.first) end mail(from: sender(author_id), diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 431c1e33f55..76f311ed0b4 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -47,7 +47,11 @@ class WikiPage # The formatted title of this page. def title - @attributes[:title] || "" + if @attributes[:title] + @attributes[:title].gsub(/-+/, ' ') + else + "" + end end # Sets the title of this page. @@ -57,12 +61,16 @@ class WikiPage # The raw content of this page. def content - @attributes[:content] + @attributes[:content] ||= if @page + @page.raw_data + end end # The processed/formatted content of this page. def formatted_content - @attributes[:formatted_content] + @attributes[:formatted_content] ||= if @page + @page.formatted_data + end end # The markup format for the page. @@ -163,8 +171,6 @@ class WikiPage def set_attributes attributes[:slug] = @page.escaped_url_path attributes[:title] = @page.title - attributes[:content] = @page.raw_data - attributes[:formatted_content] = @page.formatted_data attributes[:format] = @page.format end diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index bbd60bc6224..41760f8b1e3 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -93,6 +93,10 @@ Milestones %span.light.pull-right = Milestone.count + %p + Monthly active users + %span.light.pull-right + = User.where("current_sign_in_at > ?", 30.days.ago).count .col-md-4 %h4 Features diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 16e5948b472..724fe1d6b3a 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -12,7 +12,7 @@ %br Each project can also have an issue tracker and a wiki. %br - Used by more than 50,000 organizations, GitLab is the most popular solution to manage git repositories on-premises. + Used by more than 100,000 organizations, GitLab is the most popular solution to manage git repositories on-premises. %br Read more about GitLab at #{link_to "www.gitlab.com", "https://www.gitlab.com/", target: "_blank"}. diff --git a/app/views/help/ssh.html.haml b/app/views/help/ssh.html.haml index 8ae1ed1ab6e..75419c3dd01 100644 --- a/app/views/help/ssh.html.haml +++ b/app/views/help/ssh.html.haml @@ -3,4 +3,4 @@ .help_body = preserve do - = markdown File.read(Rails.root.join("doc", "ssh", "ssh.md")) + = markdown File.read(Rails.root.join("doc", "ssh", "ssh.md")).gsub("$your_email", current_user.email) diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index 3e8dae0b230..991d4f0c6d8 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -21,6 +21,6 @@ \— %br - if @project - You're receiving this notification because you are a member of the #{link_to @project.name_with_namespace, project_url(@project)} project team. + You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, project_url(@project)} project team. - if @target_url #{link_to "View it on GitLab", @target_url} diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 48e6ea91d94..82ec68c9165 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -25,7 +25,7 @@ - unless empty_repo .col-md-4 .project-home-links - = link_to pluralize(@repository.round_commit_count, 'commit'), project_commits_path(@project, @ref || @repository.root_ref) - = link_to pluralize(@repository.branch_names.count, 'branch'), project_branches_path(@project) - = link_to pluralize(@repository.tag_names.count, 'tag'), project_tags_path(@project) + = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref) + = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project) + = link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project) %span.light.prepend-left-20= repository_size diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 91d0de8e47c..84703229fe6 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -13,11 +13,11 @@ %br .form-group = f.label :title, class: 'control-label' do - %strong= "Subject *" + %strong= 'Title *' .col-sm-10 = f.text_field :title, maxlength: 255, class: "form-control js-gfm-input", autofocus: true, required: true .form-group - = f.label :description, "Details", class: 'control-label' + = f.label :description, 'Description', class: 'control-label' .col-sm-10 = f.text_area :description, class: "form-control js-gfm-input", rows: 14 %p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. diff --git a/app/views/projects/issues/_issues.html.haml b/app/views/projects/issues/_issues.html.haml index 3b5e398c327..e85ff3a7865 100644 --- a/app/views/projects/issues/_issues.html.haml +++ b/app/views/projects/issues/_issues.html.haml @@ -54,7 +54,7 @@ .clearfix .issues_bulk_update.hide = form_tag bulk_update_project_issues_path(@project), method: :post do - = select_tag('update[status]', options_for_select(['Open', 'Closed']), prompt: "Status") + = select_tag('update[status]', options_for_select([['Open', 'open'], ['Closed', 'closed']]), prompt: "Status") = project_users_select_tag('update[assignee_id]', placeholder: 'Assignee') = select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone") = hidden_field_tag 'update[issues_ids]', [] diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index 53f3e67ff2c..08122fb884f 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -7,13 +7,13 @@ New tag %p - Tags give ability to mark specific points in history as being important + Tags give the ability to mark specific points in history as being important %hr - unless @tags.empty? %ul.bordered-list - @tags.each do |tag| - = render 'tag', tag: tag + = render 'tag', tag: @repository.find_tag(tag) = paginate @tags, theme: 'gitlab' diff --git a/app/views/projects/wikis/edit.html.haml b/app/views/projects/wikis/edit.html.haml index 49dd7b00ca4..5347caf000a 100644 --- a/app/views/projects/wikis/edit.html.haml +++ b/app/views/projects/wikis/edit.html.haml @@ -3,7 +3,7 @@ = render 'main_links' %h3.page-title Editing - - %span.light #{@page.title.titleize} + %span.light #{@page.title} %hr = render 'form' diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml index 7001bbd17c1..7bc566cf7f5 100644 --- a/app/views/projects/wikis/history.html.haml +++ b/app/views/projects/wikis/history.html.haml @@ -1,7 +1,7 @@ = render 'nav' %h3.page-title %span.light History for - = link_to @page.title.titleize, project_wiki_path(@project, @page) + = link_to @page.title, project_wiki_path(@project, @page) %table.table %thead diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml index 7a890816568..74317faf9d6 100644 --- a/app/views/projects/wikis/pages.html.haml +++ b/app/views/projects/wikis/pages.html.haml @@ -5,7 +5,8 @@ - @wiki_pages.each do |wiki_page| %li %h4 - = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) + = link_to wiki_page.title, project_wiki_path(@project, wiki_page) %small (#{wiki_page.format}) .pull-right %small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)} += paginate @wiki_pages, theme: 'gitlab' diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml index 024ef068d08..cb923e4ca32 100644 --- a/app/views/projects/wikis/show.html.haml +++ b/app/views/projects/wikis/show.html.haml @@ -1,6 +1,6 @@ = render 'nav' %h3.page-title - = @page.title.titleize + = @page.title = render 'main_links' - if @page.historical? .warning_message diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 11df7a5ff15..a266810dc45 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -20,7 +20,7 @@ production: &base https: false # Uncomment and customize the last line to run in a non-root path - # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. + # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. # Note that four settings need to be changed for this to work. # 1) In your application.rb file: config.relative_url_root = "/gitlab" # 2) In your gitlab.yml file: relative_url_root: /gitlab @@ -69,7 +69,7 @@ production: &base # If a commit message matches this regular expression, all issues referenced from the matched text will be closed. # This happens when the commit is pushed or merged into the default branch of a project. # When not specified the default issue_closing_pattern as specified below will be used. - # issue_closing_pattern: '([Cc]lose[sd]|[Ff]ixe[sd]) +#\d+' + # issue_closing_pattern: '([Cc]lose[sd]|[Ff]ixe[sd]) #(\d+)' ## Default project features settings default_projects_features: @@ -107,7 +107,7 @@ production: &base # ## :project_id - GitLab project identifier # ## :issues_tracker_id - Project Name or Id in external issue tracker # new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new" - # + # # jira: # title: "Atlassian Jira" # project_url: "http://jira.sample/issues/?jql=project=:issues_tracker_id" @@ -179,6 +179,7 @@ production: &base # see https://github.com/gitlabhq/gitlab-public-wiki/wiki/Custom-omniauth-provider-configurations # The 'app_id' and 'app_secret' parameters are always passed as the first two # arguments, followed by optional 'args' which can be either a hash or an array. + # Documentation for this is available at http://doc.gitlab.com/ce/integration/omniauth.html providers: # - { name: 'google_oauth2', app_id: 'YOUR APP ID', # app_secret: 'YOUR APP SECRET', diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index ce672372a3d..4e8b3f304d0 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -1,5 +1,5 @@ class Settings < Settingslogic - source "#{Rails.root}/config/gitlab.yml" + source ENV.fetch('GITLAB_CONFIG') { "#{Rails.root}/config/gitlab.yml" } namespace Rails.env class << self @@ -90,7 +90,7 @@ Settings.gitlab['signup_enabled'] ||= false Settings.gitlab['signin_enabled'] ||= true if Settings.gitlab['signin_enabled'].nil? Settings.gitlab['restricted_visibility_levels'] = Settings.send(:verify_constant_array, Gitlab::VisibilityLevel, Settings.gitlab['restricted_visibility_levels'], []) Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil? -Settings.gitlab['issue_closing_pattern'] = '([Cc]loses|[Ff]ixes) #(\d+)' if Settings.gitlab['issue_closing_pattern'].nil? +Settings.gitlab['issue_closing_pattern'] = '([Cc]lose[sd]|[Ff]ixe[sd]) #(\d+)' if Settings.gitlab['issue_closing_pattern'].nil? Settings.gitlab['default_projects_features'] ||= {} Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil? Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil? diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 50669ece7a8..d5cb110e881 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -223,6 +223,7 @@ Devise.setup do |config| method: Gitlab.config.ldap['method'], bind_dn: Gitlab.config.ldap['bind_dn'], password: Gitlab.config.ldap['password'], + filter: Gitlab.config.ldap['user_filter'], name_proc: email_stripping_proc end @@ -244,4 +245,4 @@ Devise.setup do |config| config.omniauth provider['name'].to_sym, *provider_arguments end -end +end
\ No newline at end of file diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 98400290113..62a54bc8c63 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,7 +9,9 @@ require 'securerandom' def find_secure_token token_file = Rails.root.join('.secret') - if File.exist? token_file + if ENV.key?('SECRET_KEY_BASE') + ENV['SECRET_KEY_BASE'] + elsif File.exist? token_file # Use the existing token. File.read(token_file).chomp else diff --git a/config/routes.rb b/config/routes.rb index 709b66d3e06..f23542cc893 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -327,5 +327,7 @@ Gitlab::Application.routes.draw do end end + get ':id' => "groups#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} + root to: "dashboard#show" end diff --git a/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb b/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb new file mode 100644 index 00000000000..1f6d85d5f66 --- /dev/null +++ b/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb @@ -0,0 +1,11 @@ +class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration + def up + change_column :merge_request_diffs, :state, :string, null: true, + default: nil + end + + def down + change_column :merge_request_diffs, :state, :string, null: false, + default: 'collected' + end +end diff --git a/db/schema.rb b/db/schema.rb index 9033aa92ac9..265d556bd27 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140407135544) do +ActiveRecord::Schema.define(version: 20140414131055) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -109,10 +109,10 @@ ActiveRecord::Schema.define(version: 20140407135544) do add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree create_table "merge_request_diffs", force: true do |t| - t.string "state", default: "collected", null: false + t.string "state" t.text "st_commits" t.text "st_diffs" - t.integer "merge_request_id", null: false + t.integer "merge_request_id", null: false t.datetime "created_at" t.datetime "updated_at" end diff --git a/doc/README.md b/doc/README.md index 6c8fe3a96ce..b73d7bb38e1 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,7 +6,7 @@ + [Public access](public_access/public_access.md) Learn how you can allow public and internal access to a project. + [SSH](ssh/README.md) Setup your ssh keys and deploy keys for secure access to your projects. + [Web hooks](web_hooks/web_hooks.md) Let GitLab notify you when new code has been pushed to your project. -+ [Workflow](workflow/workflow.md) Learn how to use Git and GitLab together. ++ [Workflow](workflow/README.md) Learn how to use Git and GitLab together. **Administrator documentation** diff --git a/doc/api/README.md b/doc/api/README.md index a2925674f85..b1740f35792 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -1,6 +1,6 @@ # GitLab API -## End-points +## Resources + [Users](users.md) + [Session](session.md) diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 483c4188713..4e864ae1078 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -1,15 +1,21 @@ ## List merge requests -Get all merge requests for this project. This function takes pagination parameters -`page` and `per_page` to restrict the list of merge requests. +Get all merge requests for this project. +The `state` parameter can be used to get only merge requests with a +given state (`opened`, `closed`, or `merged`) or all of them (`all`). +The pagination parameters `page` and `per_page` can be used to restrict the +list of merge requests. ``` GET /projects/:id/merge_requests +GET /projects/:id/merge_requests?state=opened +GET /projects/:id/merge_requests?state=all ``` Parameters: + `id` (required) - The ID of a project ++ `state` (optional) - Return `all` requests or just those that are `merged`, `opened` or `closed` ```json [ diff --git a/doc/install/installation.md b/doc/install/installation.md index 0c99ef81815..579656eda2f 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -128,7 +128,7 @@ GitLab Shell is an ssh access and repository management software developed speci cd /home/git # Clone gitlab shell - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.1 + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.3 cd gitlab-shell @@ -173,13 +173,13 @@ 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 6-7-stable gitlab + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable gitlab # Go to gitlab dir cd /home/git/gitlab **Note:** -You can change `6-6-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! +You can change `6-8-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! ## Configure it @@ -232,20 +232,21 @@ Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup. ## Configure GitLab DB settings - # PostgreSQL + # PostgreSQL only: sudo -u git cp config/database.yml.postgresql config/database.yml - # Make sure to update username/password in config/database.yml. + # MySQL only: + sudo -u git cp config/database.yml.mysql config/database.yml + + # MySQL and remote PostgreSQL only: + # Update username/password in config/database.yml. # You only need to adapt the production settings (first part). # If you followed the database guide then please do as follows: # Change 'secure password' with the value you have given to $password # You can keep the double quotes around the password sudo -u git -H editor config/database.yml - or - # Mysql - sudo -u git cp config/database.yml.mysql config/database.yml - + # PostgreSQL and MySQL: # Make config/database.yml readable to git only sudo -u git -H chmod o-rwx config/database.yml @@ -372,7 +373,7 @@ nobody can access your GitLab by using this login information later on. ## Additional markup styles Apart from the always supported markdown style there are other rich text files that GitLab can display. -But you might have to install a depency to do so. +But you might have to install a dependency to do so. Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information. For example, reStructuredText markup language support requires python-docutils: @@ -420,9 +421,9 @@ These steps are fairly general and you will need to figure out the exact details * Stop GitLab `sudo service gitlab stop` -* Add provider specific configuration options to your `config/gitlab.yml` (you can use the [auth providers section of the example config](https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/gitlab.yml.example) as a reference) +* Add provider specific configuration options to your `config/gitlab.yml` (you can use the [auth providers section of the example config](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example) as a reference) -* Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/masterGemfile) +* Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile) `gem "omniauth-your-auth-provider"` * If you're using MySQL, install the new Omniauth provider gem by running the following command: `sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment` diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 56a2a5efeb0..62e21dc72bb 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -43,18 +43,24 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab ## CPU -- 1 core works for under 100 users but the responsiveness might suffer -- **2 cores** is the **recommended** number of cores and supports up to 100 users -- 4 cores supports up to 1,000 users -- 8 cores supports up to 10,000 users +- 1 core works supports up to 100 users but the application will not be responsive +- **2 cores** is the **recommended** number of cores and supports up to 500 users +- 4 cores supports up to 2,000 users +- 8 cores supports up to 5,000 users +- 16 cores supports up to 10,0000 users +- 32 cores supports up to 20,0000 users +- 64 cores supports up to 40,0000 users ## Memory -- 512MB is too little memory, GitLab will be very slow and you will need 250MB of swap -- 768MB is the minimal memory size but we advise against this +- 512MB is the abolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this - 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates using swap space) -- **2GB** is the **recommended** memory size and supports up to 1,000 users -- 4GB supports up to 10,000 users +- **2GB** is the **recommended** memory size and supports up to 500 users +- 4GB supports up to 2,000 users +- 8GB supports up to 5,000 users +- 16GB supports up to 10,000 users +- 32GB supports up to 20,000 users +- 64GB supports up to 40,000 users ## Storage diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index a4491432caf..84a5a8e8c28 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -21,6 +21,7 @@ Before configuring individual OmniAuth providers there are a few global settings ``` 2. Find the section dealing with OmniAuth. The section will look similar to the following.<br /> + ``` ## OmniAuth settings omniauth: @@ -50,6 +51,7 @@ Before configuring individual OmniAuth providers there are a few global settings # app_secret: 'YOUR APP SECRET', # args: { scope: 'user:email' } } ``` + 3. Change `enabled` to `true`. 4. Consider the next two configuration options: `allow_single_sign_on` and `block_auto_created_users`. * `allow_single_sign_on` defaults to `false`. If `false` users must be created manually or they will not be able to diff --git a/doc/integration/slack.md b/doc/integration/slack.md new file mode 100644 index 00000000000..057871a4b8e --- /dev/null +++ b/doc/integration/slack.md @@ -0,0 +1,34 @@ +# Slack integration + +### On Slack + +To enable Slack integration you must create an Incoming WebHooks integration on Slack; + + +1. Sign in to [Slack](https://slack.com) (https://YOURSUBDOMAIN.slack.com/services) +2. Click on the Integrations menu at the top of the page. +3. Add a new Integration. +4. Pick Incoming WebHooks +5. Choose the channel name you want to send notifications to, in the Settings section +6. Add Integrations. + * Optional step; You can change bot's name and avatar by clicking "change the name of your bot", and "change the icon" after that you have to click "Save settings". + +Now, Slack is ready to get external hooks. Before you leave this page don't forget to get the Token that you'll need on GitLab. You can find it by clicking Expand button, located in the "Instructions for creating Incoming WebHooks" section. It's a random alpha-numeric text 24 characters long. + +### On GitLab + +After Slack is ready we need to setup GitLab. Here are the steps to achieve this. + + +1. Sign in to GitLab +2. Pick the repository you want. +3. Navigate to Settings -> Services -> Slack +4. Fill in your Slack details + * Mark as active it + * Type your subdomain's prefix (If your subdomain is https://somedomain.slack.com you only have to type the somedomain) + * Type in the token you got from Slack + * Type in the channel name you want to use (eg. #announcements) + +Have fun :) + +_P.S. You can set "branch,pushed,Compare changes" as highlight words on your Slack profile settings, so that you can be aware of new commits when somebody pushes them._ diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 2949e320f3c..284e4e16595 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -17,6 +17,10 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab #### 3. Do users need to update dependencies like `git`? +- Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) + +- Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) + #### 4. Get latest code #### 5. Does GitLab shell need to be updated? @@ -54,16 +58,32 @@ Check if changed since last release (~22nd of last month depending on when last * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) -## Make a release branch +## Release Schedule After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: -* 1-7th: official merge window (see contributing guide) -* 8-14th: work on bugfixes, sponsored features and GitLab EE -* 15th: code freeze (stop merging into master except essential bugfixes) -* 18th: release candidate 1 (VERSION x.x.0.rc1, annotated tag and tweet about x.x.0.rc1, release on GitLab Cloud) -* 20st: optional release candidate 2 (x.x.0.rc2, only if rc1 had problems) -* 22nd: release (VERSION x.x.0, create x-x-stable branch, annotated tag tag, blog and tweet) +* 1-7th: Official merge window (see contributing guide). +* 8-14th: Work on bugfixes, sponsored features and GitLab EE. +* 15th: Code freeze + - Stop merging into master, except essential bugfixes + - Select a Release Manager +* 18th: Release Candidate 1 + - Set VERSION to x.x.0.rc1 + - Create annotated tag x.x.0.rc1 + - Push the changes to GitLab.com, dev.gitlab.com, GitHub + - Tweet about the release + - Create a new branch on cloud for rc1 + - Deploy the new branch on Cloud after tests pass +* 20st: Optional release candidate 2 (x.x.0.rc2, only if rc1 had problems) +* 22nd: Release + - Create x-x-stable branch and push to the repositories + - QA + - Fix anything coming out of the QA + - Set VERSION to x.x.0 + - Create annotated tag x.x.0 + - Push VERSION + Tag to master, merge into x-x-stable + - Publish blog for new release + - Tweet to blog (see below) * 23nd: optional patch releases (x.x.1, x.x.2, etc., only if there are serious problems) * 24-end of month: release GitLab EE and GitLab CI @@ -72,3 +92,14 @@ After making the release branch new commits are cherry-picked from master. When * Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. * Select and thank the the Most Valuable Person (MVP) of this release. * Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. + +# Tweet + +Send out a tweet to share the good news with the world. For a major/minor release, list the features in short and link to the blog post. + +For a RC, make sure to explain what a RC is. + +A patch release tweet should specify the fixes it brings and link to the corresponding blog post. + + + diff --git a/doc/release/patch.md b/doc/release/patch.md new file mode 100644 index 00000000000..30bb39b4e49 --- /dev/null +++ b/doc/release/patch.md @@ -0,0 +1,25 @@ +# Things to do when doing a patch release +NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). + +## When to do a patch release + +Do a patch release when there is a critical regression that needs to be adresses before the next monthly release. +Otherwise include it in the monthly release and note there was a regression fix in the release announcement. + +## Release Procedure + +1. Verify that the issue can be repoduced +1. Create an issue on private GitLab development server +1. Name the issue "Release X.X.X CE and X.X.X EE", this will make searching easier +1. Fix the issue on a feature branch, do this on the private GitLab development server +1. Consider creating and testing workarounds +1. After the branch is merged into master, cherry pick the commit(s) into the current stable branch +1. In a separate commit in the stable branch, update the VERSION and CHANGELOG +1. For EE, update the CHANGELOG-EE if it is EE specific fix. Otherwise, merge the stable CE branch and add to CHANGELOG-EE "Merge community edition changes for version X.X.X" +1. Create an annotated tag vX.X.X for CE and another patch release for EE +1. Make sure that the build has passed and no tests are failing +1. Push the code and the tags to all the CE and EE repositories +1. Apply the patch to GitLab Cloud and the private GitLab development server +1. Send tweets about the release from @gitlabhq, tweet should include the most important feature that the release is addressing as well as the link to the changelog +1. Build new packages with the latest version + diff --git a/doc/release/security.md b/doc/release/security.md index 56a44b5d1da..2fe0a948ad2 100644 --- a/doc/release/security.md +++ b/doc/release/security.md @@ -13,14 +13,8 @@ Please report suspected security vulnerabilities in private to support@gitlab.co 1. Verify that the issue can be repoduced 1. Acknowledge the issue to the researcher that disclosed it -1. Fix the issue on a feature branch, do this on the private GitLab development server and update the VERSION and CHANGELOG in this branch -1. Consider creating and testing workarounds +1. Do the steps from [patch release document](doc/release/patch.md), starting with "Create an issue on private GitLab development server" 1. Create feature branches for the blog post on GitLab.com and link them from the code branch -1. Merge the code feature branch into master -1. Cherry-pick the code into the latest stable branch -1. Create an annotated tag vX.X.X for CE and another patch release for EE -1. Push the code and the tags to all the CE and EE repositories -1. Apply the patch to GitLab Cloud and the private GitLab development server 1. Merge and publish the blog posts 1. Send tweets about the release from @gitlabhq 1. Send out an email to the subscribers mailing list on MailChimp diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md new file mode 100644 index 00000000000..63023fd384b --- /dev/null +++ b/doc/update/6.7-to-6.8.md @@ -0,0 +1,131 @@ +# From 6.7 to 6.8 + +### 0. Backup + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 1. Stop server + +```bash +sudo service gitlab stop +``` + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch --all +``` + +For Gitlab Community Edition: + +```bash +sudo -u git -H git checkout 6-8-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +sudo -u git -H git checkout 6-8-stable-ee +``` + +### 3. Update gitlab-shell (and its config) + +```bash +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v1.9.3 +``` + +### 4. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL installations (note: the line below states '--without ... postgres') +sudo -u git -H bundle install --without development test postgres --deployment + +# PostgreSQL installations (note: the line below states '--without ... mysql') +sudo -u git -H bundle install --without development test mysql --deployment + + +# Run database migrations +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production + +# Clean up assets and cache +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production + +# Update init.d script +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab + +# Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) +sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab + +# Close access to gitlab-satellites for others +sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites +``` + +### 5. Update config files + +#### New configuration options for gitlab.yml + +There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired. + +``` +git diff 6-7-stable:config/gitlab.yml.example 6-8-stable:config/gitlab.yml.example +``` + +#### MySQL? Remove reaping frequency + +If you are using MySQL as a database, remove `reaping_frequency` from you database.yml to prevent crashes. [Relevant commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/5163a8fcb9cfd63435560fda00173b76df2ccc93). + +#### HTTPS? Disable gzip + +If you are using HTTPS, disable gzip as in [this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/563fec734912d81cd7caea6fa8ec2b397fb72a9b) to prevent BREACH attacks. + +#### Turn on asset compression + +To improve performance, enable gzip asset compression as seen [in this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/8af94ed75505f0253823b9b2d44320fecea5b5fb). + +### 6. Update Init script + +```bash +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab +sudo chmod +x /etc/init.d/gitlab +``` + +### 7. Start application + + sudo service gitlab start + sudo service nginx restart + +### 8. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade is complete! + +## Things went south? Revert to previous version (6.7) + +### 1. Revert the code to the previous version +Follow the [`upgrade guide from 6.6 to 6.7`](6.6-to-6.7.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production +``` +If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. diff --git a/doc/update/README.md b/doc/update/README.md index 06e3764616f..9ce48a019e8 100644 --- a/doc/update/README.md +++ b/doc/update/README.md @@ -1,5 +1,5 @@ -+ [The indivual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update) -+ [Uprader](upgrader.md) ++ [The individual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update) ++ [Upgrader](upgrader.md) + [Ruby](ruby.md) + [Patch versions](patch_versions.md) + [MySQL to PostgreSQL](mysql_to_postgresql.md) diff --git a/doc/workflow/authorization_for_merge_requests.md b/doc/workflow/authorization_for_merge_requests.md new file mode 100644 index 00000000000..4e07d7c04c5 --- /dev/null +++ b/doc/workflow/authorization_for_merge_requests.md @@ -0,0 +1,32 @@ +There are two main ways to have a merge request flow with GitLab: working with protected branches in a single repository, or working with forks of an authoritative project. + +## Protected branch flow + +With the protected branch flow everybody works within the same GitLab project. +The project maintainers get Master access and the regular developers get Developer access. +The maintainers mark the authoritative branches as 'Protected'. +The developers push feature branches to the project and create merge requests to have their feature branches reviewed and merged into one of the protected branches. +Only users with Master access can merge changes into a protected branch. + +### Advantages + +- fewer projects means less clutter +- developers need to consider only one remote repository + +### Disadvantages + +- manual setup of protected branch required for each new project + +## Forking workflow + +With the forking workflow the maintainers get Master access and the regular developers get Reporter access to the authoritative repository, which prohibits them from pushing any changes to it. +Developers create forks of the authoritative project and push their feature branches to their own forks. +To get their changes into master they need to create a merge request across forks. + +### Advantages + +- in an appropriately configured GitLab group, new projects automatically get the required access restrictions for regular developers: fewer manual steps to configure authorization for new projects + +### Disadvantages + +- the project need to keep their forks up to date, which requires more advanced Git skills (managing multiple remotes) diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 65e7d094f2d..a819ee37d7f 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -83,7 +83,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps Then 'I should see the existing page in the pages list' do page.should have_content current_user.name - page.should have_content @page.title.titleize + page.should have_content @page.title end def wiki diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 9fa8506926c..abe6fceff14 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -117,22 +117,22 @@ module API class ProjectEntity < Grape::Entity expose :id, :iid expose (:project_id) { |entity| entity.project.id } + expose :title, :description + expose :state, :created_at, :updated_at end class Milestone < ProjectEntity - expose :title, :description, :due_date, :state, :updated_at, :created_at + expose :due_date end class Issue < ProjectEntity - expose :title, :description expose :label_list, as: :labels expose :milestone, using: Entities::Milestone expose :assignee, :author, using: Entities::UserBasic - expose :state, :updated_at, :created_at end class MergeRequest < ProjectEntity - expose :target_branch, :source_branch, :title, :state, :upvotes, :downvotes, :description + expose :target_branch, :source_branch, :upvotes, :downvotes expose :author, :assignee, using: Entities::UserBasic expose :source_project_id, :target_project_id end @@ -158,6 +158,7 @@ module API expose :title, :project_id, :action_name expose :target_id, :target_type, :author_id expose :data, :target_title + expose :created_at end class Namespace < Grape::Entity diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index e2d2d034444..4b88b0f84c1 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -19,14 +19,24 @@ module API # # Parameters: # id (required) - The ID of a project + # state (optional) - Return requests "merged", "opened" or "closed" # # Example: # GET /projects/:id/merge_requests + # GET /projects/:id/merge_requests?state=opened + # GET /projects/:id/merge_requests?state=closed # get ":id/merge_requests" do authorize! :read_merge_request, user_project - present paginate(user_project.merge_requests), with: Entities::MergeRequest + mrs = case params["state"] + when "opened" then user_project.merge_requests.opened + when "closed" then user_project.merge_requests.closed + when "merged" then user_project.merge_requests.merged + else user_project.merge_requests + end + + present paginate(mrs), with: Entities::MergeRequest end # Show MR diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 85615f282c4..5f17aa60b8b 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -118,7 +118,7 @@ module Gitlab # merge the source branch into the satellite # will raise CommandFailed when merge fails - repo.git.merge(default_options({no_ff: true}), "-m #{message}", "source/#{merge_request.source_branch}") + repo.git.merge(default_options({no_ff: true}), "-m#{message}", "source/#{merge_request.source_branch}") rescue Grit::Git::CommandFailed => ex handle_exception(ex) end diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index 8c62778d90d..c6e4d3351cf 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -1,10 +1,4 @@ module Gitlab - class SatelliteNotExistError < StandardError - def initialize(msg = "Satellite doesn't exist") - super - end - end - module Satellite class Satellite include Gitlab::Popen diff --git a/lib/tasks/spec.rake b/lib/tasks/spec.rake index b760a607f7e..49fbe1bd47a 100644 --- a/lib/tasks/spec.rake +++ b/lib/tasks/spec.rake @@ -1,7 +1,7 @@ Rake::Task["spec"].clear if Rake::Task.task_defined?('spec') namespace :spec do - desc 'GITLAB | Run feature specs' + desc 'GITLAB | Run request specs' task :api do cmds = [ %W(rake gitlab:setup), @@ -10,11 +10,20 @@ namespace :spec do run_commands(cmds) end + desc 'GITLAB | Run feature specs' + task :feature do + cmds = [ + %W(rake gitlab:setup), + %W(rspec spec --tag @feature) + ] + run_commands(cmds) + end + desc 'GITLAB | Run other specs' task :other do cmds = [ %W(rake gitlab:setup), - %W(rspec spec --tag ~@api) + %W(rspec spec --tag ~@api --tag ~@feature) ] run_commands(cmds) end diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 102a1b928f5..120448ae335 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Admin::Hooks" do +describe "Admin::Hooks", feature: true do before do @project = create(:project) login_as :admin diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 23370891244..3b3d027ab75 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Admin::Projects" do +describe "Admin::Projects", feature: true do before do @project = create(:project) login_as :admin diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 8d69b595aee..1aba40966c4 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Admin::Users" do +describe "Admin::Users", feature: true do before { login_as :admin } describe "GET /admin/users" do diff --git a/spec/features/admin/security_spec.rb b/spec/features/admin/security_spec.rb index 6306832628b..21b0d8b965e 100644 --- a/spec/features/admin/security_spec.rb +++ b/spec/features/admin/security_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Admin::Projects" do +describe "Admin::Projects", feature: true do describe "GET /admin/projects" do subject { admin_projects_path } diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index 62f44690349..9fd2933b2cc 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Dashboard Issues Feed" do +describe "Dashboard Issues Feed", feature: true do describe "GET /issues" do let!(:user) { create(:user) } let!(:project1) { create(:project) } diff --git a/spec/features/atom/dashboard_spec.rb b/spec/features/atom/dashboard_spec.rb index 6257ad5c895..e5d9f8ab5d5 100644 --- a/spec/features/atom/dashboard_spec.rb +++ b/spec/features/atom/dashboard_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Dashboard Feed" do +describe "Dashboard Feed", feature: true do describe "GET /" do let!(:user) { create(:user) } diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index c9bbdad380f..6ff03ec862c 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Issues Feed" do +describe "Issues Feed", feature: true do describe "GET /issues" do let!(:user) { create(:user) } let!(:project) { create(:project) } diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb index 07be6b81441..9f50d1c9738 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/features/gitlab_flavored_markdown_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "GitLab Flavored Markdown", features: true do +describe "GitLab Flavored Markdown", feature: true do let(:project) { create(:project) } let(:issue) { create(:issue, project: project) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index b9dab7846b1..e62517ad710 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Issues" do +describe "Issues", feature: true do let(:project) { create(:project) } before do diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 25a86b11fa9..cfb6deb1834 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "On a merge request", js: true do +describe "On a merge request", js: true, feature: true do let!(:merge_request) { create(:merge_request, :simple) } let!(:project) { merge_request.source_project } let!(:note) { create(:note_on_merge_request, :with_attachment, project: project) } diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index b67ce3c67f1..e8364bbb962 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Profile account page" do +describe "Profile account page", feature: true do before(:each) { enable_observers } after(:each) {disable_observers} let(:user) { create(:user) } diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 9d5f9d5a2e2..1e24782c39a 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Projects" do +describe "Projects", feature: true do before(:each) { enable_observers } after(:each) {disable_observers} before { login_as :user } diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 3ca59da493b..f12eb124296 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Search" do +describe "Search", feature: true do before do ActiveRecord::Base.observers.enable(:user_observer) login_as :user diff --git a/spec/features/security/dashboard_access_spec.rb b/spec/features/security/dashboard_access_spec.rb index adec5926c6f..1cca82cef64 100644 --- a/spec/features/security/dashboard_access_spec.rb +++ b/spec/features/security/dashboard_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Dashboard access" do +describe "Dashboard access", feature: true do describe "GET /dashboard" do subject { dashboard_path } diff --git a/spec/features/security/group/group_access_spec.rb b/spec/features/security/group/group_access_spec.rb index c262d76ab54..b65e1d2dbf6 100644 --- a/spec/features/security/group/group_access_spec.rb +++ b/spec/features/security/group/group_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Group access" do +describe "Group access", feature: true do describe "GET /projects/new" do it { new_group_path.should be_allowed_for :admin } it { new_group_path.should be_allowed_for :user } diff --git a/spec/features/security/group/internal_group_access_spec.rb b/spec/features/security/group/internal_group_access_spec.rb index 79a6aee41b5..da5c6eb4e91 100644 --- a/spec/features/security/group/internal_group_access_spec.rb +++ b/spec/features/security/group/internal_group_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Group with internal project access" do +describe "Group with internal project access", feature: true do describe "Group" do let(:group) { create(:group) } diff --git a/spec/features/security/group/mixed_group_access_spec.rb b/spec/features/security/group/mixed_group_access_spec.rb index 028cd32d2bb..c9889d99590 100644 --- a/spec/features/security/group/mixed_group_access_spec.rb +++ b/spec/features/security/group/mixed_group_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Group access" do +describe "Group access", feature: true do describe "Group" do let(:group) { create(:group) } diff --git a/spec/features/security/group/public_group_access_spec.rb b/spec/features/security/group/public_group_access_spec.rb index f0ed7649eb5..2e76ab154ff 100644 --- a/spec/features/security/group/public_group_access_spec.rb +++ b/spec/features/security/group/public_group_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Group with public project access" do +describe "Group with public project access", feature: true do describe "Group" do let(:group) { create(:group) } diff --git a/spec/features/security/profile_access_spec.rb b/spec/features/security/profile_access_spec.rb index 078c257538f..4efc0ffdcd3 100644 --- a/spec/features/security/profile_access_spec.rb +++ b/spec/features/security/profile_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Users Security" do +describe "Users Security", feature: true do describe "Project" do before do @u1 = create(:user) diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index 152cf66dcfd..f6ab47ed91b 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Internal Project Access" do +describe "Internal Project Access", feature: true do let(:project) { create(:project, :internal) } let(:master) { create(:user) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index 0402ff39735..8a0fcb8e9ff 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Private Project Access" do +describe "Private Project Access", feature: true do let(:project) { create(:project) } let(:master) { create(:user) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index 7e6a39fad69..eb511bfefe0 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Public Project Access" do +describe "Public Project Access", feature: true do let(:project) { create(:project) } let(:master) { create(:user) } diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index ed9e44fb47e..7b831c48611 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Users' do +describe 'Users', feature: true do describe "GET /users/sign_up" do before do Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 22d60429ccd..e86a60a42b5 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -502,7 +502,7 @@ describe Notify do end end - describe 'email on push' do + describe 'email on push with multiple commits' do let(:example_site_path) { root_path } let(:user) { create(:user) } let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, 'cd5c4bac', 'b1e6a9db') } @@ -537,4 +537,40 @@ describe Notify do should have_body_text /#{diff_path}/ end end + + describe 'email on push with a single commit' do + let(:example_site_path) { root_path } + let(:user) { create(:user) } + let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, '8716fc78', 'b1e6a9db') } + let(:commits) { Commit.decorate(compare.commits) } + let(:diff_path) { project_commit_path(project, commits.first) } + + subject { Notify.repository_push_email(project.id, 'devs@company.name', user.id, 'master', compare) } + + it 'is sent as the author' do + sender = subject.header[:from].addrs[0] + sender.display_name.should eq(user.name) + sender.address.should eq(gitlab_sender) + end + + it 'is sent to recipient' do + should deliver_to 'devs@company.name' + end + + it 'has the correct subject' do + should have_subject /New push to repository/ + end + + it 'includes commits list' do + should have_body_text /tree css fixes/ + end + + it 'includes diffs' do + should have_body_text /Checkout wiki pages for installation information/ + end + + it 'contains a link to the diff' do + should have_body_text /#{diff_path}/ + end + end end diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 2af164bd99b..005c513af3c 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -155,4 +155,20 @@ describe WikiPage do end end + describe "#title" do + before do + create_page("Title", "content") + @page = wiki.find_page("Title") + end + + after do + destroy_page("Title") + end + + it "should be replace a hyphen to a space" do + @page.title = "Import-existing-repositories-into-GitLab" + @page.title.should == "Import existing repositories into GitLab" + end + end + end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 3918498e22f..db7c30e1ab8 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -7,6 +7,8 @@ describe API::API, api: true do let(:user) { create(:user) } let!(:project) {create(:project, creator_id: user.id, namespace: user.namespace) } let!(:merge_request) { create(:merge_request, :simple, author: user, assignee: user, source_project: project, target_project: project, title: "Test") } + let!(:merge_request_closed) { create(:merge_request, state: "closed", author: user, assignee: user, source_project: project, target_project: project, title: "Closed test") } + let!(:merge_request_merged) { create(:merge_request, state: "merged", author: user, assignee: user, source_project: project, target_project: project, title: "Merged test") } let!(:note) { create(:note_on_merge_request, author: user, project: project, noteable: merge_request, note: "a comment on a MR") } before { project.team << [user, :reporters] @@ -21,12 +23,42 @@ describe API::API, api: true do end context "when authenticated" do - it "should return an array of merge_requests" do + it "should return an array of all merge_requests" do get api("/projects/#{project.id}/merge_requests", user) response.status.should == 200 json_response.should be_an Array + json_response.length.should == 3 json_response.first['title'].should == merge_request.title end + it "should return an array of all merge_requests" do + get api("/projects/#{project.id}/merge_requests?state", user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 3 + json_response.first['title'].should == merge_request.title + end + it "should return an array of open merge_requests" do + get api("/projects/#{project.id}/merge_requests?state=opened", user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 1 + json_response.first['title'].should == merge_request.title + end + it "should return an array of closed merge_requests" do + get api("/projects/#{project.id}/merge_requests?state=closed", user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 2 + json_response.first['title'].should == merge_request_closed.title + json_response.second['title'].should == merge_request_merged.title + end + it "should return an array of merged merge_requests" do + get api("/projects/#{project.id}/merge_requests?state=merged", user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 1 + json_response.first['title'].should == merge_request_merged.title + end end end diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 9b67cd432bc..a2d2a35140c 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -238,3 +238,14 @@ end describe "Authentication", "routing" do # pending end + +describe "Groups", "routing" do + it "to #show" do + get("/groups/1").should route_to('groups#show', id: '1') + end + + it "also display group#show on the short path" do + get("/1").should route_to('groups#show', id: '1') + end +end + |