summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api.rb1
-rw-r--r--lib/api/internal.rb6
-rw-r--r--lib/api/projects.rb5
-rw-r--r--lib/extracts_path.rb2
-rw-r--r--lib/gitlab/markdown.rb9
-rw-r--r--lib/tasks/sidekiq.rake10
6 files changed, 22 insertions, 11 deletions
diff --git a/lib/api.rb b/lib/api.rb
index d9dce7c70cc..da31a1519dd 100644
--- a/lib/api.rb
+++ b/lib/api.rb
@@ -9,7 +9,6 @@ module Gitlab
end
format :json
- error_format :json
helpers APIHelpers
mount Groups
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 5d74a761c05..d4f72d70d92 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -5,6 +5,12 @@ module Gitlab
#
# Check if ssh key has access to project code
#
+ # Params:
+ # key_id - SSH Key id
+ # project - project path with namespace
+ # action - git action (git-upload-pack or git-receive-pack)
+ # ref - branch name
+ #
get "/allowed" do
key = Key.find(params[:key_id])
project = Project.find_with_namespace(params[:project])
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 631ed535459..8f57e5ac79f 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -42,7 +42,8 @@ module Gitlab
:issues_enabled,
:wall_enabled,
:merge_requests_enabled,
- :wiki_enabled]
+ :wiki_enabled,
+ :namespace_id]
@project = ::Projects::CreateContext.new(current_user, attrs).execute
if @project.saved?
present @project, with: Entities::Project
@@ -292,7 +293,7 @@ module Gitlab
authorize! :download_code, user_project
page = params[:page] || 0
- per_page = params[:per_page] || 20
+ per_page = (params[:per_page] || 20).to_i
ref = params[:ref_name] || user_project.try(:default_branch) || 'master'
commits = user_project.repository.commits(ref, nil, per_page, page * per_page)
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index fb595e18b24..fd0050cfd5f 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -126,7 +126,7 @@ module ExtractsPath
@tree = TreeDecorator.new(@tree)
raise InvalidPathError if @tree.invalid?
- rescue NoMethodError, InvalidPathError
+ rescue RuntimeError, NoMethodError, InvalidPathError
not_found!
end
end
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index e7d6e3e6bd9..280f9f9730a 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -25,6 +25,8 @@ module Gitlab
# >> gfm(":trollface:")
# => "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
module Markdown
+ include IssuesHelper
+
attr_reader :html_options
# Public: Parse the provided text with GitLab-Flavored Markdown
@@ -163,8 +165,11 @@ module Gitlab
end
def reference_issue(identifier)
- if issue = @project.issues.where(id: identifier).first
- link_to("##{identifier}", project_issue_url(@project, issue), html_options.merge(title: "Issue: #{issue.title}", class: "gfm gfm-issue #{html_options[:class]}"))
+ if @project.issue_exists? identifier
+ url = url_for_issue(identifier)
+ title = title_for_issue(identifier)
+
+ link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}"))
end
end
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake
index cf99951e027..d0e9dfe46a1 100644
--- a/lib/tasks/sidekiq.rake
+++ b/lib/tasks/sidekiq.rake
@@ -1,19 +1,19 @@
namespace :sidekiq do
desc "GITLAB | Stop sidekiq"
task :stop do
- run "bundle exec sidekiqctl stop #{pidfile}"
+ system "bundle exec sidekiqctl stop #{pidfile}"
end
desc "GITLAB | Start sidekiq"
task :start do
- run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
+ system "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
end
-
+
desc "GITLAB | Start sidekiq with launchd on Mac OS X"
task :launchd do
- run "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1"
+ system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1"
end
-
+
def pidfile
Rails.root.join("tmp", "pids", "sidekiq.pid")
end