Skip to content
Snippets Groups Projects
Commit afc4a754 authored by Robert Speicher's avatar Robert Speicher
Browse files

Use Rails.root.join where appropriate

parent 82c3f626
No related branches found
No related tags found
1 merge request!1568Routing overhaul
Loading
Loading
@@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base
end
 
def render_404
render file: File.join(Rails.root, "public", "404"), layout: false, status: "404"
render file: Rails.root.join("public", "404"), layout: false, status: "404"
end
 
def require_non_empty_project
Loading
Loading
require File.join(Rails.root, "app/models/commit")
require Rails.root.join("app/models/commit")
 
class MergeRequest < ActiveRecord::Base
include IssueCommonality
Loading
Loading
Loading
Loading
@@ -155,7 +155,7 @@ module Repository
 
# Build file path
file_name = self.code + "-" + commit.id.to_s + ".tar.gz"
storage_path = File.join(Rails.root, "tmp", "repositories", self.code)
storage_path = Rails.root.join("tmp", "repositories", self.code)
file_path = File.join(storage_path, file_name)
 
# Put files into a directory before archiving
Loading
Loading
Loading
Loading
@@ -112,7 +112,7 @@ class Settings < Settingslogic
 
def backup_path
t = app['backup_path'] || "backups/"
t = /^\//.match(t) ? t : File.join(Rails.root + t)
t = /^\//.match(t) ? t : Rails.root .join(t)
t
end
 
Loading
Loading
Loading
Loading
@@ -3,13 +3,13 @@ require 'fileutils'
print "Unpacking seed repository..."
 
SEED_REPO = 'seed_project.tar.gz'
REPO_PATH = File.join(Rails.root, 'tmp', 'repositories')
REPO_PATH = Rails.root.join('tmp', 'repositories')
 
# Make whatever directories we need to make
FileUtils.mkdir_p(REPO_PATH)
 
# Copy the archive to the repo path
FileUtils.cp(File.join(Rails.root, 'spec', SEED_REPO), REPO_PATH)
FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH)
 
# chdir to the repo path
FileUtils.cd(REPO_PATH) do
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module Gitlab
attr_reader :config_tmp_dir, :ga_repo, :conf
 
def config_tmp_dir
@config_tmp_dir ||= File.join(Rails.root, 'tmp',"gitlabhq-gitolite-#{Time.now.to_i}")
@config_tmp_dir ||= Rails.root.join('tmp',"gitlabhq-gitolite-#{Time.now.to_i}")
end
 
def ga_repo
Loading
Loading
@@ -19,7 +19,7 @@ module Gitlab
 
def apply
Timeout::timeout(30) do
File.open(File.join(Rails.root, 'tmp', "gitlabhq-gitolite.lock"), "w+") do |f|
File.open(Rails.root.join('tmp', "gitlabhq-gitolite.lock"), "w+") do |f|
begin
# Set exclusive lock
# to prevent race condition
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ module Gitlab
end
 
def self.build
new(File.join(Rails.root, "log", file_name))
new(Rails.root.join("log", file_name))
end
end
end
Loading
Loading
@@ -28,7 +28,7 @@ module Gitlab
 
def process
Grit::Git.with_timeout(30.seconds) do
lock_file = File.join(Rails.root, "tmp", "merge_repo_#{project.path}.lock")
lock_file = Rails.root.join("tmp", "merge_repo_#{project.path}.lock")
 
File.open(lock_file, "w+") do |f|
f.flock(File::LOCK_EX)
Loading
Loading
@@ -36,7 +36,7 @@ module Gitlab
unless project.satellite.exists?
raise "You should run: rake gitlab:app:enable_automerge"
end
project.satellite.clear
 
Dir.chdir(project.satellite.path) do
Loading
Loading
module Gitlab
class Satellite
PARKING_BRANCH = "__parking_branch"
 
attr_accessor :project
Loading
Loading
@@ -14,7 +14,7 @@ module Gitlab
end
 
def path
File.join(Rails.root, "tmp", "repo_satellites", project.path)
Rails.root.join("tmp", "repo_satellites", project.path)
end
 
def exists?
Loading
Loading
@@ -36,6 +36,6 @@ module Gitlab
end
end
end
end
end
Loading
Loading
@@ -125,7 +125,7 @@ describe Project do
 
it "should return path to repo" do
project = Project.new(path: "somewhere")
project.path_to_repo.should == File.join(Rails.root, "tmp", "repositories", "somewhere")
project.path_to_repo.should == Rails.root.join("tmp", "repositories", "somewhere")
end
 
it "returns the full web URL for this repo" do
Loading
Loading
Loading
Loading
@@ -5,11 +5,11 @@ module StubbedRepository
if new_record? || path == 'newproject'
# There are a couple Project specs and features that expect the Project's
# path to be in the returned path, so let's patronize them.
File.join(Rails.root, 'tmp', 'repositories', path)
Rails.root.join('tmp', 'repositories', path)
else
# For everything else, just give it the path to one of our real seeded
# repos.
File.join(Rails.root, 'tmp', 'repositories', 'gitlabhq')
Rails.root.join('tmp', 'repositories', 'gitlabhq')
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment