Commit afc4a75499b6678a643e6b62f703f8e7e1eb0f0a
1 parent
82c3f626
Exists in
master
and in
4 other branches
Use Rails.root.join where appropriate
Showing
11 changed files
with
17 additions
and
17 deletions
Show diff stats
app/controllers/application_controller.rb
@@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base | @@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base | ||
105 | end | 105 | end |
106 | 106 | ||
107 | def render_404 | 107 | def render_404 |
108 | - render file: File.join(Rails.root, "public", "404"), layout: false, status: "404" | 108 | + render file: Rails.root.join("public", "404"), layout: false, status: "404" |
109 | end | 109 | end |
110 | 110 | ||
111 | def require_non_empty_project | 111 | def require_non_empty_project |
app/models/merge_request.rb
app/roles/repository.rb
@@ -155,7 +155,7 @@ module Repository | @@ -155,7 +155,7 @@ module Repository | ||
155 | 155 | ||
156 | # Build file path | 156 | # Build file path |
157 | file_name = self.code + "-" + commit.id.to_s + ".tar.gz" | 157 | file_name = self.code + "-" + commit.id.to_s + ".tar.gz" |
158 | - storage_path = File.join(Rails.root, "tmp", "repositories", self.code) | 158 | + storage_path = Rails.root.join("tmp", "repositories", self.code) |
159 | file_path = File.join(storage_path, file_name) | 159 | file_path = File.join(storage_path, file_name) |
160 | 160 | ||
161 | # Put files into a directory before archiving | 161 | # Put files into a directory before archiving |
config/initializers/1_settings.rb
@@ -112,7 +112,7 @@ class Settings < Settingslogic | @@ -112,7 +112,7 @@ class Settings < Settingslogic | ||
112 | 112 | ||
113 | def backup_path | 113 | def backup_path |
114 | t = app['backup_path'] || "backups/" | 114 | t = app['backup_path'] || "backups/" |
115 | - t = /^\//.match(t) ? t : File.join(Rails.root + t) | 115 | + t = /^\//.match(t) ? t : Rails.root .join(t) |
116 | t | 116 | t |
117 | end | 117 | end |
118 | 118 |
db/fixtures/test/001_repo.rb
@@ -3,13 +3,13 @@ require 'fileutils' | @@ -3,13 +3,13 @@ require 'fileutils' | ||
3 | print "Unpacking seed repository..." | 3 | print "Unpacking seed repository..." |
4 | 4 | ||
5 | SEED_REPO = 'seed_project.tar.gz' | 5 | SEED_REPO = 'seed_project.tar.gz' |
6 | -REPO_PATH = File.join(Rails.root, 'tmp', 'repositories') | 6 | +REPO_PATH = Rails.root.join('tmp', 'repositories') |
7 | 7 | ||
8 | # Make whatever directories we need to make | 8 | # Make whatever directories we need to make |
9 | FileUtils.mkdir_p(REPO_PATH) | 9 | FileUtils.mkdir_p(REPO_PATH) |
10 | 10 | ||
11 | # Copy the archive to the repo path | 11 | # Copy the archive to the repo path |
12 | -FileUtils.cp(File.join(Rails.root, 'spec', SEED_REPO), REPO_PATH) | 12 | +FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH) |
13 | 13 | ||
14 | # chdir to the repo path | 14 | # chdir to the repo path |
15 | FileUtils.cd(REPO_PATH) do | 15 | FileUtils.cd(REPO_PATH) do |
lib/gitlab/backend/gitolite_config.rb
@@ -10,7 +10,7 @@ module Gitlab | @@ -10,7 +10,7 @@ module Gitlab | ||
10 | attr_reader :config_tmp_dir, :ga_repo, :conf | 10 | attr_reader :config_tmp_dir, :ga_repo, :conf |
11 | 11 | ||
12 | def config_tmp_dir | 12 | def config_tmp_dir |
13 | - @config_tmp_dir ||= File.join(Rails.root, 'tmp',"gitlabhq-gitolite-#{Time.now.to_i}") | 13 | + @config_tmp_dir ||= Rails.root.join('tmp',"gitlabhq-gitolite-#{Time.now.to_i}") |
14 | end | 14 | end |
15 | 15 | ||
16 | def ga_repo | 16 | def ga_repo |
@@ -19,7 +19,7 @@ module Gitlab | @@ -19,7 +19,7 @@ module Gitlab | ||
19 | 19 | ||
20 | def apply | 20 | def apply |
21 | Timeout::timeout(30) do | 21 | Timeout::timeout(30) do |
22 | - File.open(File.join(Rails.root, 'tmp', "gitlabhq-gitolite.lock"), "w+") do |f| | 22 | + File.open(Rails.root.join('tmp', "gitlabhq-gitolite.lock"), "w+") do |f| |
23 | begin | 23 | begin |
24 | # Set exclusive lock | 24 | # Set exclusive lock |
25 | # to prevent race condition | 25 | # to prevent race condition |
lib/gitlab/logger.rb
lib/gitlab/merge.rb
@@ -28,7 +28,7 @@ module Gitlab | @@ -28,7 +28,7 @@ module Gitlab | ||
28 | 28 | ||
29 | def process | 29 | def process |
30 | Grit::Git.with_timeout(30.seconds) do | 30 | Grit::Git.with_timeout(30.seconds) do |
31 | - lock_file = File.join(Rails.root, "tmp", "merge_repo_#{project.path}.lock") | 31 | + lock_file = Rails.root.join("tmp", "merge_repo_#{project.path}.lock") |
32 | 32 | ||
33 | File.open(lock_file, "w+") do |f| | 33 | File.open(lock_file, "w+") do |f| |
34 | f.flock(File::LOCK_EX) | 34 | f.flock(File::LOCK_EX) |
@@ -36,7 +36,7 @@ module Gitlab | @@ -36,7 +36,7 @@ module Gitlab | ||
36 | unless project.satellite.exists? | 36 | unless project.satellite.exists? |
37 | raise "You should run: rake gitlab:app:enable_automerge" | 37 | raise "You should run: rake gitlab:app:enable_automerge" |
38 | end | 38 | end |
39 | - | 39 | + |
40 | project.satellite.clear | 40 | project.satellite.clear |
41 | 41 | ||
42 | Dir.chdir(project.satellite.path) do | 42 | Dir.chdir(project.satellite.path) do |
lib/gitlab/satellite.rb
1 | module Gitlab | 1 | module Gitlab |
2 | class Satellite | 2 | class Satellite |
3 | - | 3 | + |
4 | PARKING_BRANCH = "__parking_branch" | 4 | PARKING_BRANCH = "__parking_branch" |
5 | 5 | ||
6 | attr_accessor :project | 6 | attr_accessor :project |
@@ -14,7 +14,7 @@ module Gitlab | @@ -14,7 +14,7 @@ module Gitlab | ||
14 | end | 14 | end |
15 | 15 | ||
16 | def path | 16 | def path |
17 | - File.join(Rails.root, "tmp", "repo_satellites", project.path) | 17 | + Rails.root.join("tmp", "repo_satellites", project.path) |
18 | end | 18 | end |
19 | 19 | ||
20 | def exists? | 20 | def exists? |
@@ -36,6 +36,6 @@ module Gitlab | @@ -36,6 +36,6 @@ module Gitlab | ||
36 | end | 36 | end |
37 | end | 37 | end |
38 | end | 38 | end |
39 | - | 39 | + |
40 | end | 40 | end |
41 | end | 41 | end |
spec/models/project_spec.rb
@@ -125,7 +125,7 @@ describe Project do | @@ -125,7 +125,7 @@ describe Project do | ||
125 | 125 | ||
126 | it "should return path to repo" do | 126 | it "should return path to repo" do |
127 | project = Project.new(path: "somewhere") | 127 | project = Project.new(path: "somewhere") |
128 | - project.path_to_repo.should == File.join(Rails.root, "tmp", "repositories", "somewhere") | 128 | + project.path_to_repo.should == Rails.root.join("tmp", "repositories", "somewhere") |
129 | end | 129 | end |
130 | 130 | ||
131 | it "returns the full web URL for this repo" do | 131 | it "returns the full web URL for this repo" do |
spec/support/stubbed_repository.rb
@@ -5,11 +5,11 @@ module StubbedRepository | @@ -5,11 +5,11 @@ module StubbedRepository | ||
5 | if new_record? || path == 'newproject' | 5 | if new_record? || path == 'newproject' |
6 | # There are a couple Project specs and features that expect the Project's | 6 | # There are a couple Project specs and features that expect the Project's |
7 | # path to be in the returned path, so let's patronize them. | 7 | # path to be in the returned path, so let's patronize them. |
8 | - File.join(Rails.root, 'tmp', 'repositories', path) | 8 | + Rails.root.join('tmp', 'repositories', path) |
9 | else | 9 | else |
10 | # For everything else, just give it the path to one of our real seeded | 10 | # For everything else, just give it the path to one of our real seeded |
11 | # repos. | 11 | # repos. |
12 | - File.join(Rails.root, 'tmp', 'repositories', 'gitlabhq') | 12 | + Rails.root.join('tmp', 'repositories', 'gitlabhq') |
13 | end | 13 | end |
14 | end | 14 | end |
15 | 15 |