Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
afc4a754
Commit
afc4a754
authored
Sep 26, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Rails.root.join where appropriate
parent
82c3f626
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
17 additions
and
17 deletions
+17
-17
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
app/roles/repository.rb
app/roles/repository.rb
+1
-1
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-1
db/fixtures/test/001_repo.rb
db/fixtures/test/001_repo.rb
+2
-2
lib/gitlab/backend/gitolite_config.rb
lib/gitlab/backend/gitolite_config.rb
+2
-2
lib/gitlab/logger.rb
lib/gitlab/logger.rb
+1
-1
lib/gitlab/merge.rb
lib/gitlab/merge.rb
+2
-2
lib/gitlab/satellite.rb
lib/gitlab/satellite.rb
+3
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/support/stubbed_repository.rb
spec/support/stubbed_repository.rb
+2
-2
No files found.
app/controllers/application_controller.rb
View file @
afc4a754
...
@@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base
...
@@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base
end
end
def
render_404
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
end
def
require_non_empty_project
def
require_non_empty_project
...
...
app/models/merge_request.rb
View file @
afc4a754
require
File
.
join
(
Rails
.
root
,
"app/models/commit"
)
require
Rails
.
root
.
join
(
"app/models/commit"
)
class
MergeRequest
<
ActiveRecord
::
Base
class
MergeRequest
<
ActiveRecord
::
Base
include
IssueCommonality
include
IssueCommonality
...
...
app/roles/repository.rb
View file @
afc4a754
...
@@ -155,7 +155,7 @@ module Repository
...
@@ -155,7 +155,7 @@ module Repository
# Build file path
# Build file path
file_name
=
self
.
code
+
"-"
+
commit
.
id
.
to_s
+
".tar.gz"
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
)
file_path
=
File
.
join
(
storage_path
,
file_name
)
# Put files into a directory before archiving
# Put files into a directory before archiving
...
...
config/initializers/1_settings.rb
View file @
afc4a754
...
@@ -112,7 +112,7 @@ class Settings < Settingslogic
...
@@ -112,7 +112,7 @@ class Settings < Settingslogic
def
backup_path
def
backup_path
t
=
app
[
'backup_path'
]
||
"backups/"
t
=
app
[
'backup_path'
]
||
"backups/"
t
=
/^\//
.
match
(
t
)
?
t
:
File
.
join
(
Rails
.
root
+
t
)
t
=
/^\//
.
match
(
t
)
?
t
:
Rails
.
root
.
join
(
t
)
t
t
end
end
...
...
db/fixtures/test/001_repo.rb
View file @
afc4a754
...
@@ -3,13 +3,13 @@ require 'fileutils'
...
@@ -3,13 +3,13 @@ require 'fileutils'
print
"Unpacking seed repository..."
print
"Unpacking seed repository..."
SEED_REPO
=
'seed_project.tar.gz'
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
# Make whatever directories we need to make
FileUtils
.
mkdir_p
(
REPO_PATH
)
FileUtils
.
mkdir_p
(
REPO_PATH
)
# Copy the archive to the 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
# chdir to the repo path
FileUtils
.
cd
(
REPO_PATH
)
do
FileUtils
.
cd
(
REPO_PATH
)
do
...
...
lib/gitlab/backend/gitolite_config.rb
View file @
afc4a754
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
attr_reader
:config_tmp_dir
,
:ga_repo
,
:conf
attr_reader
:config_tmp_dir
,
:ga_repo
,
:conf
def
config_tmp_dir
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
end
def
ga_repo
def
ga_repo
...
@@ -19,7 +19,7 @@ module Gitlab
...
@@ -19,7 +19,7 @@ module Gitlab
def
apply
def
apply
Timeout
::
timeout
(
30
)
do
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
begin
# Set exclusive lock
# Set exclusive lock
# to prevent race condition
# to prevent race condition
...
...
lib/gitlab/logger.rb
View file @
afc4a754
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
self
.
build
def
self
.
build
new
(
File
.
join
(
Rails
.
root
,
"log"
,
file_name
))
new
(
Rails
.
root
.
join
(
"log"
,
file_name
))
end
end
end
end
end
end
lib/gitlab/merge.rb
View file @
afc4a754
...
@@ -28,7 +28,7 @@ module Gitlab
...
@@ -28,7 +28,7 @@ module Gitlab
def
process
def
process
Grit
::
Git
.
with_timeout
(
30
.
seconds
)
do
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
|
File
.
open
(
lock_file
,
"w+"
)
do
|
f
|
f
.
flock
(
File
::
LOCK_EX
)
f
.
flock
(
File
::
LOCK_EX
)
...
@@ -36,7 +36,7 @@ module Gitlab
...
@@ -36,7 +36,7 @@ module Gitlab
unless
project
.
satellite
.
exists?
unless
project
.
satellite
.
exists?
raise
"You should run: rake gitlab:app:enable_automerge"
raise
"You should run: rake gitlab:app:enable_automerge"
end
end
project
.
satellite
.
clear
project
.
satellite
.
clear
Dir
.
chdir
(
project
.
satellite
.
path
)
do
Dir
.
chdir
(
project
.
satellite
.
path
)
do
...
...
lib/gitlab/satellite.rb
View file @
afc4a754
module
Gitlab
module
Gitlab
class
Satellite
class
Satellite
PARKING_BRANCH
=
"__parking_branch"
PARKING_BRANCH
=
"__parking_branch"
attr_accessor
:project
attr_accessor
:project
...
@@ -14,7 +14,7 @@ module Gitlab
...
@@ -14,7 +14,7 @@ module Gitlab
end
end
def
path
def
path
File
.
join
(
Rails
.
root
,
"tmp"
,
"repo_satellites"
,
project
.
path
)
Rails
.
root
.
join
(
"tmp"
,
"repo_satellites"
,
project
.
path
)
end
end
def
exists?
def
exists?
...
@@ -36,6 +36,6 @@ module Gitlab
...
@@ -36,6 +36,6 @@ module Gitlab
end
end
end
end
end
end
end
end
end
end
spec/models/project_spec.rb
View file @
afc4a754
...
@@ -125,7 +125,7 @@ describe Project do
...
@@ -125,7 +125,7 @@ describe Project do
it
"should return path to repo"
do
it
"should return path to repo"
do
project
=
Project
.
new
(
path:
"somewhere"
)
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
end
it
"returns the full web URL for this repo"
do
it
"returns the full web URL for this repo"
do
...
...
spec/support/stubbed_repository.rb
View file @
afc4a754
...
@@ -5,11 +5,11 @@ module StubbedRepository
...
@@ -5,11 +5,11 @@ module StubbedRepository
if
new_record?
||
path
==
'newproject'
if
new_record?
||
path
==
'newproject'
# There are a couple Project specs and features that expect the Project's
# 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.
# 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
else
# For everything else, just give it the path to one of our real seeded
# For everything else, just give it the path to one of our real seeded
# repos.
# repos.
File
.
join
(
Rails
.
root
,
'tmp'
,
'repositories'
,
'gitlabhq'
)
Rails
.
root
.
join
(
'tmp'
,
'repositories'
,
'gitlabhq'
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
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