Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
b6a0693a3831
Commit
b6a0693a
authored
Sep 26, 2012
by
Robert Speicher
Browse files
Use Rails.root.join where appropriate
parent
813a80527314
Changes
11
Hide whitespace changes
Inline
Side-by-side
app/controllers/application_controller.rb
View file @
b6a0693a
...
...
@@ -105,7 +105,7 @@
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
...
...
app/models/merge_request.rb
View file @
b6a0693a
require
File
.
join
(
Rails
.
root
,
"app/models/commit"
)
require
Rails
.
root
.
join
(
"app/models/commit"
)
class
MergeRequest
<
ActiveRecord
::
Base
include
IssueCommonality
...
...
app/roles/repository.rb
View file @
b6a0693a
...
...
@@ -155,7 +155,7 @@
# 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
...
...
config/initializers/1_settings.rb
View file @
b6a0693a
...
...
@@ -112,7 +112,7 @@
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
...
...
db/fixtures/test/001_repo.rb
View file @
b6a0693a
...
...
@@ -3,9 +3,9 @@
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
...
...
@@ -7,9 +7,9 @@
# 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
...
...
lib/gitlab/backend/gitolite_config.rb
View file @
b6a0693a
...
...
@@ -10,7 +10,7 @@
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
...
...
@@ -19,7 +19,7 @@
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
...
...
lib/gitlab/logger.rb
View file @
b6a0693a
...
...
@@ -15,7 +15,7 @@
end
def
self
.
build
new
(
File
.
join
(
Rails
.
root
,
"log"
,
file_name
))
new
(
Rails
.
root
.
join
(
"log"
,
file_name
))
end
end
end
lib/gitlab/merge.rb
View file @
b6a0693a
...
...
@@ -28,7 +28,7 @@
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
)
...
...
@@ -36,7 +36,7 @@
unless
project
.
satellite
.
exists?
raise
"You should run: rake gitlab:app:enable_automerge"
end
project
.
satellite
.
clear
Dir
.
chdir
(
project
.
satellite
.
path
)
do
...
...
lib/gitlab/satellite.rb
View file @
b6a0693a
module
Gitlab
class
Satellite
PARKING_BRANCH
=
"__parking_branch"
attr_accessor
:project
...
...
@@ -14,7 +14,7 @@
end
def
path
File
.
join
(
Rails
.
root
,
"tmp"
,
"repo_satellites"
,
project
.
path
)
Rails
.
root
.
join
(
"tmp"
,
"repo_satellites"
,
project
.
path
)
end
def
exists?
...
...
@@ -36,6 +36,6 @@
end
end
end
end
end
spec/models/project_spec.rb
View file @
b6a0693a
...
...
@@ -125,7 +125,7 @@
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
...
...
spec/support/stubbed_repository.rb
View file @
b6a0693a
...
...
@@ -5,7 +5,7 @@
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.
...
...
@@ -9,7 +9,7 @@
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment