Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--app/helpers/application_helper.rb47
-rw-r--r--app/helpers/search_helper.rb78
-rw-r--r--app/views/projects/issues/_form.html.haml2
-rw-r--r--app/views/projects/merge_requests/edit.html.haml2
-rw-r--r--app/views/projects/milestones/_form.html.haml2
-rw-r--r--app/views/projects/milestones/_merge_request.html.haml2
-rw-r--r--app/views/projects/milestones/show.html.haml2
-rw-r--r--config/initializers/smtp_settings.rb.sample12
-rw-r--r--doc/update/5.4-to-6.0.md2
-rw-r--r--doc/update/6.1-to-6.2.md21
-rw-r--r--features/steps/project/project_merge_requests.rb20
-rw-r--r--spec/features/issues_spec.rb2
-rw-r--r--spec/helpers/application_helper_spec.rb17
-rw-r--r--spec/helpers/search_helper_spec.rb64
15 files changed, 203 insertions, 72 deletions
diff --git a/VERSION b/VERSION
index 3685c83b0eb..6abaeb2f907 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.2.0.beta1
+6.2.0
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 0e48889ebf8..e2d97901410 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -98,51 +98,6 @@ module ApplicationHelper
grouped_options_for_select(options, @ref || @project.default_branch)
end
- def search_autocomplete_source
- return unless current_user
-
- projects = current_user.authorized_projects.map { |p| { label: "project: #{simple_sanitize(p.name_with_namespace)}", url: project_path(p) } }
- groups = current_user.authorized_groups.map { |group| { label: "group: #{simple_sanitize(group.name)}", url: group_path(group) } }
-
- default_nav = [
- { label: "My Profile settings", url: profile_path },
- { label: "My SSH Keys", url: profile_keys_path },
- { label: "My Dashboard", url: root_path },
- { label: "Admin Section", url: admin_root_path },
- ]
-
- help_nav = [
- { label: "help: API Help", url: help_api_path },
- { label: "help: Markdown Help", url: help_markdown_path },
- { label: "help: Permissions Help", url: help_permissions_path },
- { label: "help: Public Access Help", url: help_public_access_path },
- { label: "help: Rake Tasks Help", url: help_raketasks_path },
- { label: "help: SSH Keys Help", url: help_ssh_path },
- { label: "help: System Hooks Help", url: help_system_hooks_path },
- { label: "help: Web Hooks Help", url: help_web_hooks_path },
- { label: "help: Workflow Help", url: help_workflow_path },
- ]
-
- project_nav = []
- if @project && @project.repository.exists? && @project.repository.root_ref
- project_nav = [
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Files", url: project_tree_path(@project, @ref || @project.repository.root_ref) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Commits", url: project_commits_path(@project, @ref || @project.repository.root_ref) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Network", url: project_network_path(@project, @ref || @project.repository.root_ref) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Graph", url: project_graph_path(@project, @ref || @project.repository.root_ref) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Issues", url: project_issues_path(@project) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Merge Requests", url: project_merge_requests_path(@project) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Milestones", url: project_milestones_path(@project) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Snippets", url: project_snippets_path(@project) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Team", url: project_team_index_path(@project) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Wall", url: project_wall_path(@project) },
- { label: "#{simple_sanitize(@project.name_with_namespace)} - Wiki", url: project_wikis_path(@project) },
- ]
- end
-
- [groups, projects, default_nav, project_nav, help_nav].flatten.to_json
- end
-
def emoji_autocomplete_source
# should be an array of strings
# so to_s can be called, because it is sufficient and to_json is too slow
@@ -192,7 +147,7 @@ module ApplicationHelper
alt: "Sign in with #{provider.to_s.titleize}")
end
- def simple_sanitize str
+ def simple_sanitize(str)
sanitize(str, tags: %w(a span))
end
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
new file mode 100644
index 00000000000..33c5e4fb9db
--- /dev/null
+++ b/app/helpers/search_helper.rb
@@ -0,0 +1,78 @@
+module SearchHelper
+ def search_autocomplete_source
+ return unless current_user
+
+ [
+ groups_autocomplete,
+ projects_autocomplete,
+ default_autocomplete,
+ project_autocomplete,
+ help_autocomplete
+ ].flatten.to_json
+ end
+
+ private
+
+ # Autocomplete results for various settings pages
+ def default_autocomplete
+ [
+ { label: "My Profile settings", url: profile_path },
+ { label: "My SSH Keys", url: profile_keys_path },
+ { label: "My Dashboard", url: root_path },
+ { label: "Admin Section", url: admin_root_path },
+ ]
+ end
+
+ # Autocomplete results for internal help pages
+ def help_autocomplete
+ [
+ { label: "help: API Help", url: help_api_path },
+ { label: "help: Markdown Help", url: help_markdown_path },
+ { label: "help: Permissions Help", url: help_permissions_path },
+ { label: "help: Public Access Help", url: help_public_access_path },
+ { label: "help: Rake Tasks Help", url: help_raketasks_path },
+ { label: "help: SSH Keys Help", url: help_ssh_path },
+ { label: "help: System Hooks Help", url: help_system_hooks_path },
+ { label: "help: Web Hooks Help", url: help_web_hooks_path },
+ { label: "help: Workflow Help", url: help_workflow_path },
+ ]
+ end
+
+ # Autocomplete results for the current project, if it's defined
+ def project_autocomplete
+ if @project && @project.repository.exists? && @project.repository.root_ref
+ prefix = simple_sanitize(@project.name_with_namespace)
+ ref = @ref || @project.repository.root_ref
+
+ [
+ { label: "#{prefix} - Files", url: project_tree_path(@project, ref) },
+ { label: "#{prefix} - Commits", url: project_commits_path(@project, ref) },
+ { label: "#{prefix} - Network", url: project_network_path(@project, ref) },
+ { label: "#{prefix} - Graph", url: project_graph_path(@project, ref) },
+ { label: "#{prefix} - Issues", url: project_issues_path(@project) },
+ { label: "#{prefix} - Merge Requests", url: project_merge_requests_path(@project) },
+ { label: "#{prefix} - Milestones", url: project_milestones_path(@project) },
+ { label: "#{prefix} - Snippets", url: project_snippets_path(@project) },
+ { label: "#{prefix} - Team", url: project_team_index_path(@project) },
+ { label: "#{prefix} - Wall", url: project_wall_path(@project) },
+ { label: "#{prefix} - Wiki", url: project_wikis_path(@project) },
+ ]
+ else
+ []
+ end
+ end
+
+ # Autocomplete results for the current user's groups
+ def groups_autocomplete
+ current_user.authorized_groups.map do |group|
+ { label: "group: #{simple_sanitize(group.name)}", url: group_path(group) }
+ end
+ end
+
+ # Autocomplete results for the current user's projects
+ def projects_autocomplete
+ current_user.authorized_projects.map do |p|
+ { label: "project: #{simple_sanitize(p.name_with_namespace)}", url: project_path(p) }
+ end
+ end
+end
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index 6acad9134d1..05cfb2788be 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -1,5 +1,5 @@
%div.issue-form-holder
- %h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
+ %h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}"
= form_for [@project, @issue] do |f|
-if @issue.errors.any?
.alert.alert-error
diff --git a/app/views/projects/merge_requests/edit.html.haml b/app/views/projects/merge_requests/edit.html.haml
index 67a1541d9bf..839c63986ab 100644
--- a/app/views/projects/merge_requests/edit.html.haml
+++ b/app/views/projects/merge_requests/edit.html.haml
@@ -1,4 +1,4 @@
%h3.page-title
- = "Edit merge request ##{@merge_request.id}"
+ = "Edit merge request ##{@merge_request.iid}"
%hr
= render 'form'
diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml
index 78e4cd2243e..b2fd1a9284d 100644
--- a/app/views/projects/milestones/_form.html.haml
+++ b/app/views/projects/milestones/_form.html.haml
@@ -1,4 +1,4 @@
-%h3.page-title= @milestone.new_record? ? "New Milestone" : "Edit Milestone ##{@milestone.id}"
+%h3.page-title= @milestone.new_record? ? "New Milestone" : "Edit Milestone ##{@milestone.iid}"
.back-link
= link_to project_milestones_path(@project) do
← To milestones
diff --git a/app/views/projects/milestones/_merge_request.html.haml b/app/views/projects/milestones/_merge_request.html.haml
index 7f815894069..8e30a42a608 100644
--- a/app/views/projects/milestones/_merge_request.html.haml
+++ b/app/views/projects/milestones/_merge_request.html.haml
@@ -1,5 +1,5 @@
%li
= link_to [@project, merge_request] do
- %span.badge.badge-info ##{merge_request.id}
+ %span.badge.badge-info ##{merge_request.iid}
–
= link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request]
diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml
index 2e115026ed3..a5bd7a29019 100644
--- a/app/views/projects/milestones/show.html.haml
+++ b/app/views/projects/milestones/show.html.haml
@@ -1,6 +1,6 @@
= render "projects/issues/head"
%h3.page-title
- Milestone ##{@milestone.id}
+ Milestone ##{@milestone.iid}
%small
= @milestone.expires_at
.pull-right
diff --git a/config/initializers/smtp_settings.rb.sample b/config/initializers/smtp_settings.rb.sample
index e62ad0f4b71..9ebb1dde6f9 100644
--- a/config/initializers/smtp_settings.rb.sample
+++ b/config/initializers/smtp_settings.rb.sample
@@ -1,11 +1,11 @@
# To enable smtp email delivery for your GitLab instance do next:
-# 1. Change config/environments/production.rb to use smtp
-# config.action_mailer.delivery_method = :smtp
-# 2. Rename this file to smtp_settings.rb
-# 3. Edit settings inside this file
-# 4. Restart GitLab instance
+# 1. Rename this file to smtp_settings.rb
+# 2. Edit settings inside this file
+# 3. Restart GitLab instance
#
-if Gitlab::Application.config.action_mailer.delivery_method == :smtp
+if Rails.env.production? do
+ Gitlab::Application.config.action_mailer.delivery_method = :smtp
+
ActionMailer::Base.smtp_settings = {
address: "email.server.com",
port: 456,
diff --git a/doc/update/5.4-to-6.0.md b/doc/update/5.4-to-6.0.md
index 31379d81aba..fc010cd8181 100644
--- a/doc/update/5.4-to-6.0.md
+++ b/doc/update/5.4-to-6.0.md
@@ -91,7 +91,7 @@ Note: We switched from Puma in GitLab 5.4 to unicorn in GitLab 6.0.
```bash
sudo rm /etc/init.d/gitlab
-sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/init.d/gitlab
+sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/6-0-stable/lib/support/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
diff --git a/doc/update/6.1-to-6.2.md b/doc/update/6.1-to-6.2.md
index b46ade1be18..e7f6c2a5ba7 100644
--- a/doc/update/6.1-to-6.2.md
+++ b/doc/update/6.1-to-6.2.md
@@ -24,7 +24,14 @@ sudo -u git -H git fetch
sudo -u git -H git checkout 6-2-stable
```
-### 3. Install libs, migrations, etc.
+### 3. Install additional packages
+
+```bash
+# Add support for lograte for better log file handling
+sudo apt-get install logrotate
+```
+
+### 4. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
@@ -42,7 +49,7 @@ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
```
-### 4. Update config files
+### 5. Update config files
* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/6-2-stable/config/gitlab.yml.example but with your settings.
* Make `/home/git/gitlab/config/unicorn.rb` same as https://github.com/gitlabhq/gitlabhq/blob/6-2-stable/config/unicorn.rb.example but with your settings.
@@ -51,8 +58,12 @@ sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
```
* Uncomment `config.middleware.use Rack::Attack` in `/home/git/gitlab/config/application.rb`
+* Set up logrotate
+```bash
+sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
+```
-### 5. Update Init script
+### 6. Update Init script
```bash
sudo rm /etc/init.d/gitlab
@@ -60,12 +71,12 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/6
sudo chmod +x /etc/init.d/gitlab
```
-### 6. Start application
+### 7. Start application
sudo service gitlab start
sudo service nginx restart
-### 7. Check application status
+### 8. Check application status
Check if GitLab and its environment are configured correctly:
diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb
index 7c70482deb5..6c794ef8f13 100644
--- a/features/steps/project/project_merge_requests.rb
+++ b/features/steps/project/project_merge_requests.rb
@@ -21,7 +21,9 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
Then 'I should see merge request "Wiki Feature"' do
- page.should have_content "Wiki Feature"
+ within '.merge-request' do
+ page.should have_content "Wiki Feature"
+ end
end
Then 'I should see closed merge request "Bug NS-04"' do
@@ -56,16 +58,20 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
And 'I submit new merge request "Wiki Feature"' do
- #this must come first, so that the target branch is set by the time the "select" for "notes_refactoring" is executed
- select project.path_with_namespace, :from => "merge_request_target_project_id"
- fill_in "merge_request_title", :with => "Wiki Feature"
- select "master", :from => "merge_request_source_branch"
+ fill_in "merge_request_title", with: "Wiki Feature"
+
+ # this must come first, so that the target branch is set
+ # by the time the "select" for "notes_refactoring" is executed
+ select project.path_with_namespace, from: "merge_request_target_project_id"
+ select "master", from: "merge_request_source_branch"
+
find(:select, "merge_request_target_project_id", {}).value.should == project.id.to_s
find(:select, "merge_request_source_project_id", {}).value.should == project.id.to_s
- #using "notes_refactoring" because "Bug NS-04" uses master/stable, this will fail merge_request validation if the branches are the same
+ # using "notes_refactoring" because "Bug NS-04" uses master/stable,
+ # this will fail merge_request validation if the branches are the same
find(:select, "merge_request_target_branch", {}).find(:option, "notes_refactoring", {}).value.should == "notes_refactoring"
- select "notes_refactoring", :from => "merge_request_target_branch"
+ select "notes_refactoring", from: "merge_request_target_branch"
click_button "Submit merge request"
end
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index 0c09279e3dc..8cb984946b4 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -24,7 +24,7 @@ describe "Issues" do
end
it "should open new issue popup" do
- page.should have_content("Issue ##{issue.id}")
+ page.should have_content("Issue ##{issue.iid}")
end
describe "fill in" do
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 0d066be5b45..d63a2de8806 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -123,4 +123,21 @@ describe ApplicationHelper do
end
end
+ describe "simple_sanitize" do
+ let(:a_tag) { '<a href="#">Foo</a>' }
+
+ it "allows the a tag" do
+ simple_sanitize(a_tag).should == a_tag
+ end
+
+ it "allows the span tag" do
+ input = '<span class="foo">Bar</span>'
+ simple_sanitize(input).should == input
+ end
+
+ it "disallows other tags" do
+ input = "<strike><b>#{a_tag}</b></strike>"
+ simple_sanitize(input).should == a_tag
+ end
+ end
end
diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb
new file mode 100644
index 00000000000..55b6b6b4dad
--- /dev/null
+++ b/spec/helpers/search_helper_spec.rb
@@ -0,0 +1,64 @@
+require 'spec_helper'
+
+describe SearchHelper do
+ # Override simple_sanitize for our testing purposes
+ def simple_sanitize(str)
+ str
+ end
+
+ describe 'search_autocomplete_source' do
+ context "with no current user" do
+ before { stub!(:current_user).and_return(nil) }
+
+ it "it returns nil" do
+ search_autocomplete_source.should be_nil
+ end
+ end
+
+ context "with a user" do
+ let(:user) { create(:user) }
+ let(:result) { JSON.parse(search_autocomplete_source) }
+
+ before do
+ stub!(:current_user).and_return(user)
+ end
+
+ it "includes Help sections" do
+ result.select { |h| h['label'] =~ /^help:/ }.length.should == 9
+ end
+
+ it "includes default sections" do
+ result.count { |h| h['label'] =~ /^(My|Admin)\s/ }.should == 4
+ end
+
+ it "includes the user's groups" do
+ create(:group).add_owner(user)
+ result.count { |h| h['label'] =~ /^group:/ }.should == 1
+ end
+
+ it "includes the user's projects" do
+ create(:project, namespace: create(:namespace, owner: user))
+ result.count { |h| h['label'] =~ /^project:/ }.should == 1
+ end
+
+ context "with a current project" do
+ before { @project = create(:project_with_code) }
+
+ it "includes project-specific sections" do
+ result.count { |h| h['label'] =~ /^#{@project.name_with_namespace} - / }.should == 11
+ end
+
+ it "uses @ref in urls if defined" do
+ @ref = "foo_bar"
+ result.count { |h| h['url'] == project_tree_path(@project, @ref) }.should == 1
+ end
+ end
+
+ context "with no current project" do
+ it "does not include project-specific sections" do
+ result.count { |h| h['label'] =~ /Files$/ }.should == 0
+ end
+ end
+ end
+ end
+end