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
iv
gitlab-ce
Commits
c50ec72b
Commit
c50ec72b
authored
Nov 23, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate code for Project. Use title and path
parent
ab9d0236
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
79 additions
and
83 deletions
+79
-83
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+1
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/models/namespace.rb
app/models/namespace.rb
+8
-6
app/models/project.rb
app/models/project.rb
+18
-15
app/models/user.rb
app/models/user.rb
+3
-2
app/observers/project_observer.rb
app/observers/project_observer.rb
+5
-7
app/roles/push_observer.rb
app/roles/push_observer.rb
+1
-1
app/roles/repository.rb
app/roles/repository.rb
+4
-4
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+1
-1
app/views/admin/groups/_form.html.haml
app/views/admin/groups/_form.html.haml
+2
-2
app/views/admin/projects/_form.html.haml
app/views/admin/projects/_form.html.haml
+0
-7
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+0
-7
db/fixtures/development/001_admin.rb
db/fixtures/development/001_admin.rb
+5
-4
db/fixtures/development/003_users.rb
db/fixtures/development/003_users.rb
+8
-8
db/fixtures/production/001_admin.rb
db/fixtures/production/001_admin.rb
+5
-4
db/migrate/20121123164910_rename_code_to_path.rb
db/migrate/20121123164910_rename_code_to_path.rb
+11
-0
db/schema.rb
db/schema.rb
+2
-3
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+1
-0
spec/factories.rb
spec/factories.rb
+1
-0
spec/observers/user_observer_spec.rb
spec/observers/user_observer_spec.rb
+1
-1
spec/routing/admin_routing_spec.rb
spec/routing/admin_routing_spec.rb
+0
-8
No files found.
app/controllers/admin/projects_controller.rb
View file @
c50ec72b
...
@@ -5,7 +5,7 @@ class Admin::ProjectsController < AdminController
...
@@ -5,7 +5,7 @@ class Admin::ProjectsController < AdminController
@projects
=
Project
.
scoped
@projects
=
Project
.
scoped
@projects
=
@projects
.
where
(
namespace_id:
params
[
:namespace_id
])
if
params
[
:namespace_id
].
present?
@projects
=
@projects
.
where
(
namespace_id:
params
[
:namespace_id
])
if
params
[
:namespace_id
].
present?
@projects
=
@projects
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@projects
=
@projects
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.
code
, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.
path
, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
end
end
def
show
def
show
...
...
app/controllers/application_controller.rb
View file @
c50ec72b
...
@@ -66,7 +66,7 @@ class ApplicationController < ActionController::Base
...
@@ -66,7 +66,7 @@ class ApplicationController < ActionController::Base
id
=
params
[
:project_id
]
||
params
[
:id
]
id
=
params
[
:project_id
]
||
params
[
:id
]
id
=
id
.
split
(
"/"
)
if
id
.
include?
(
"/"
)
id
=
id
.
split
(
"/"
)
if
id
.
include?
(
"/"
)
@project
||=
current_user
.
projects
.
find_by_
code
(
id
)
@project
||=
current_user
.
projects
.
find_by_
path
(
id
)
@project
||
render_404
@project
||
render_404
end
end
...
...
app/models/namespace.rb
View file @
c50ec72b
class
Namespace
<
ActiveRecord
::
Base
class
Namespace
<
ActiveRecord
::
Base
attr_accessible
:
code
,
:name
,
:owner_id
attr_accessible
:
name
,
:path
has_many
:projects
has_many
:projects
,
dependent: :destroy
belongs_to
:owner
,
class_name:
"User"
belongs_to
:owner
,
class_name:
"User"
validates
:name
,
presence:
true
,
uniqueness:
true
validates
:name
,
presence:
true
,
uniqueness:
true
validates
:code
,
presence:
true
,
uniqueness:
true
validates
:path
,
uniqueness:
true
,
presence:
true
,
length:
{
within:
1
..
255
},
format:
{
with:
/\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/
,
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
validates
:owner
,
presence:
true
validates
:owner
,
presence:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
...
@@ -15,11 +17,11 @@ class Namespace < ActiveRecord::Base
...
@@ -15,11 +17,11 @@ class Namespace < ActiveRecord::Base
scope
:root
,
where
(
'type IS NULL'
)
scope
:root
,
where
(
'type IS NULL'
)
def
self
.
search
query
def
self
.
search
query
where
(
"name LIKE :query OR
code
LIKE :query"
,
query:
"%
#{
query
}
%"
)
where
(
"name LIKE :query OR
path
LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
end
def
to_param
def
to_param
code
path
end
end
def
human_name
def
human_name
...
@@ -27,7 +29,7 @@ class Namespace < ActiveRecord::Base
...
@@ -27,7 +29,7 @@ class Namespace < ActiveRecord::Base
end
end
def
ensure_dir_exist
def
ensure_dir_exist
namespace_dir_path
=
File
.
join
(
Gitlab
.
config
.
git_base_path
,
code
)
namespace_dir_path
=
File
.
join
(
Gitlab
.
config
.
git_base_path
,
path
)
Dir
.
mkdir
(
namespace_dir_path
)
unless
File
.
exists?
(
namespace_dir_path
)
Dir
.
mkdir
(
namespace_dir_path
)
unless
File
.
exists?
(
namespace_dir_path
)
end
end
end
end
app/models/project.rb
View file @
c50ec72b
...
@@ -27,7 +27,7 @@ class Project < ActiveRecord::Base
...
@@ -27,7 +27,7 @@ class Project < ActiveRecord::Base
include
Authority
include
Authority
include
Team
include
Team
attr_accessible
:name
,
:path
,
:description
,
:
code
,
:
default_branch
,
:issues_enabled
,
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
as:
[
:default
,
:admin
]
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
as:
[
:default
,
:admin
]
attr_accessible
:namespace_id
,
as: :admin
attr_accessible
:namespace_id
,
as: :admin
...
@@ -58,16 +58,16 @@ class Project < ActiveRecord::Base
...
@@ -58,16 +58,16 @@ class Project < ActiveRecord::Base
# Validations
# Validations
validates
:owner
,
presence:
true
validates
:owner
,
presence:
true
validates
:description
,
length:
{
within:
0
..
2000
}
validates
:description
,
length:
{
within:
0
..
2000
}
validates
:name
,
uniqueness:
true
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:path
,
uniqueness:
true
,
presence:
true
,
length:
{
within:
0
..
255
},
validates
:path
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
/\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/
,
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
validates
:code
,
presence:
true
,
uniqueness:
true
,
length:
{
within:
1
..
255
},
format:
{
with:
/\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/
,
format:
{
with:
/\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/
,
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
validates
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
validates
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
validate
:check_limit
,
:repo_name
validate
:check_limit
,
:repo_name
# Scopes
# Scopes
...
@@ -81,20 +81,23 @@ class Project < ActiveRecord::Base
...
@@ -81,20 +81,23 @@ class Project < ActiveRecord::Base
end
end
def
search
query
def
search
query
where
(
"projects.name LIKE :query OR projects.
code LIKE :query OR projects.
path LIKE :query"
,
query:
"%
#{
query
}
%"
)
where
(
"projects.name LIKE :query OR projects.path LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
end
def
create_by_user
(
params
,
user
)
def
create_by_user
(
params
,
user
)
namespace_id
=
params
.
delete
(
:namespace_id
)
||
namespace
.
try
(
:id
)
namespace_id
=
params
.
delete
(
:namespace_id
)
namespace_id
||=
current_user
.
namespace_id
project
=
Project
.
new
params
project
=
Project
.
new
params
Project
.
transaction
do
Project
.
transaction
do
#
Build gitlab-hq code from GitLab HQ name
#
Parametrize path for project
#
#
slug
=
project
.
name
.
dup
.
parameterize
# Ex.
project
.
code
=
project
.
path
=
slug
# 'GitLab HQ'.parameterize => "gitlab-hq"
#
project
.
path
=
project
.
name
.
dup
.
parameterize
project
.
owner
=
user
project
.
owner
=
user
project
.
namespace_id
=
namespace_id
project
.
namespace_id
=
namespace_id
...
@@ -149,14 +152,14 @@ class Project < ActiveRecord::Base
...
@@ -149,14 +152,14 @@ class Project < ActiveRecord::Base
def
to_param
def
to_param
if
namespace
if
namespace
namespace
.
code
+
"/"
+
code
namespace
.
path
+
"/"
+
path
else
else
code
path
end
end
end
end
def
web_url
def
web_url
[
Gitlab
.
config
.
url
,
code
].
join
(
"/"
)
[
Gitlab
.
config
.
url
,
path
].
join
(
"/"
)
end
end
def
common_notes
def
common_notes
...
@@ -213,7 +216,7 @@ class Project < ActiveRecord::Base
...
@@ -213,7 +216,7 @@ class Project < ActiveRecord::Base
def
path_with_namespace
def
path_with_namespace
if
namespace
if
namespace
namespace
.
code
+
'/'
+
path
namespace
.
path
+
'/'
+
path
else
else
path
path
end
end
...
...
app/models/user.rb
View file @
c50ec72b
...
@@ -69,7 +69,8 @@ class User < ActiveRecord::Base
...
@@ -69,7 +69,8 @@ class User < ActiveRecord::Base
before_save
:ensure_authentication_token
before_save
:ensure_authentication_token
alias_attribute
:private_token
,
:authentication_token
alias_attribute
:private_token
,
:authentication_token
delegate
:code
,
to: :namespace
,
allow_nil:
true
,
prefix:
true
delegate
:path
,
to: :namespace
,
allow_nil:
true
,
prefix:
true
delegate
:id
,
to: :namespace
,
allow_nil:
true
,
prefix:
true
# Scopes
# Scopes
scope
:not_in_project
,
->
(
project
)
{
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
}
scope
:not_in_project
,
->
(
project
)
{
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
}
...
@@ -121,7 +122,7 @@ class User < ActiveRecord::Base
...
@@ -121,7 +122,7 @@ class User < ActiveRecord::Base
def
namespaces
def
namespaces
namespaces
=
[]
namespaces
=
[]
namespaces
<<
self
.
namespace
namespaces
<<
self
.
namespace
if
self
.
namespace
namespaces
=
namespaces
+
Group
.
all
if
admin
namespaces
=
namespaces
+
Group
.
all
if
admin
namespaces
namespaces
end
end
...
...
app/observers/project_observer.rb
View file @
c50ec72b
class
ProjectObserver
<
ActiveRecord
::
Observer
class
ProjectObserver
<
ActiveRecord
::
Observer
def
before_save
(
project
)
def
after_save
(
project
)
project
.
update_repository
# Move repository if namespace changed
# Move repository if namespace changed
if
project
.
namespace_id_changed?
and
not
project
.
new_record?
if
project
.
namespace_id_changed?
and
not
project
.
new_record?
move_project
(
project
)
move_project
(
project
)
end
end
end
end
def
after_save
(
project
)
project
.
update_repository
end
def
after_destroy
(
project
)
def
after_destroy
(
project
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
...
@@ -27,8 +25,8 @@ class ProjectObserver < ActiveRecord::Observer
...
@@ -27,8 +25,8 @@ class ProjectObserver < ActiveRecord::Observer
end
end
def
move_project
(
project
)
def
move_project
(
project
)
old_dir
=
Namespace
.
find_by_id
(
project
.
namespace_id_was
).
try
(
:
code
)
||
''
old_dir
=
Namespace
.
find_by_id
(
project
.
namespace_id_was
).
try
(
:
path
)
||
''
new_dir
=
Namespace
.
find_by_id
(
project
.
namespace_id
).
try
(
:
code
)
||
''
new_dir
=
Namespace
.
find_by_id
(
project
.
namespace_id
).
try
(
:
path
)
||
''
# Create new dir if missing
# Create new dir if missing
new_dir_path
=
File
.
join
(
Gitlab
.
config
.
git_base_path
,
new_dir
)
new_dir_path
=
File
.
join
(
Gitlab
.
config
.
git_base_path
,
new_dir
)
...
...
app/roles/push_observer.rb
View file @
c50ec72b
...
@@ -114,7 +114,7 @@ module PushObserver
...
@@ -114,7 +114,7 @@ module PushObserver
id:
commit
.
id
,
id:
commit
.
id
,
message:
commit
.
safe_message
,
message:
commit
.
safe_message
,
timestamp:
commit
.
date
.
xmlschema
,
timestamp:
commit
.
date
.
xmlschema
,
url:
"
#{
Gitlab
.
config
.
url
}
/
#{
code
}
/commits/
#{
commit
.
id
}
"
,
url:
"
#{
Gitlab
.
config
.
url
}
/
#{
path
}
/commits/
#{
commit
.
id
}
"
,
author:
{
author:
{
name:
commit
.
author_name
,
name:
commit
.
author_name
,
email:
commit
.
author_email
email:
commit
.
author_email
...
...
app/roles/repository.rb
View file @
c50ec72b
...
@@ -87,7 +87,7 @@ module Repository
...
@@ -87,7 +87,7 @@ module Repository
end
end
def
namespace_dir
def
namespace_dir
namespace
.
try
(
:
code
)
||
''
namespace
.
try
(
:
path
)
||
''
end
end
def
update_repository
def
update_repository
...
@@ -164,12 +164,12 @@ module Repository
...
@@ -164,12 +164,12 @@ module Repository
return
nil
unless
commit
return
nil
unless
commit
# Build file path
# Build file path
file_name
=
self
.
code
+
"-"
+
commit
.
id
.
to_s
+
".tar.gz"
file_name
=
self
.
path
+
"-"
+
commit
.
id
.
to_s
+
".tar.gz"
storage_path
=
Rails
.
root
.
join
(
"tmp"
,
"repositories"
,
self
.
code
)
storage_path
=
Rails
.
root
.
join
(
"tmp"
,
"repositories"
,
self
.
path
)
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
prefix
=
self
.
code
+
"/"
prefix
=
self
.
path
+
"/"
# Create file if not exists
# Create file if not exists
unless
File
.
exists?
(
file_path
)
unless
File
.
exists?
(
file_path
)
...
...
app/views/admin/dashboard/index.html.haml
View file @
c50ec72b
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
=
link_to
admin_projects_path
do
=
link_to
admin_projects_path
do
%h1
=
Project
.
count
%h1
=
Project
.
count
%hr
%hr
=
link_to
'New Project'
,
new_
admin_
project_path
,
class:
"btn small"
=
link_to
'New Project'
,
new_project_path
,
class:
"btn small"
.span4
.span4
.ui-box
.ui-box
%h5
Users
%h5
Users
...
...
app/views/admin/groups/_form.html.haml
View file @
c50ec72b
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
.input
.input
=
f
.
text_field
:name
,
placeholder:
"Example Group"
,
class:
"xxlarge"
=
f
.
text_field
:name
,
placeholder:
"Example Group"
,
class:
"xxlarge"
.clearfix
.clearfix
=
f
.
label
:
code
do
=
f
.
label
:
path
do
URL
URL
.input
.input
.input-prepend
.input-prepend
%span
.add-on
=
web_app_url
+
'groups/'
%span
.add-on
=
web_app_url
+
'groups/'
=
f
.
text_field
:
code
,
placeholder:
"example"
=
f
.
text_field
:
path
,
placeholder:
"example"
.form-actions
.form-actions
=
f
.
submit
'Save group'
,
class:
"btn save-btn"
=
f
.
submit
'Save group'
,
class:
"btn save-btn"
app/views/admin/projects/_form.html.haml
View file @
c50ec72b
...
@@ -18,13 +18,6 @@
...
@@ -18,13 +18,6 @@
Path
Path
.input
.input
=
text_field_tag
:ppath
,
@project
.
path_to_repo
,
class:
"xlarge"
,
disabled:
true
=
text_field_tag
:ppath
,
@project
.
path_to_repo
,
class:
"xlarge"
,
disabled:
true
.clearfix
=
f
.
label
:code
do
URL
.input
.input-prepend
%span
.add-on
=
web_app_url
=
f
.
text_field
:code
,
placeholder:
"example"
-
unless
project
.
new_record?
-
unless
project
.
new_record?
.clearfix
.clearfix
...
...
app/views/projects/_form.html.haml
View file @
c50ec72b
...
@@ -19,13 +19,6 @@
...
@@ -19,13 +19,6 @@
.input-prepend
.input-prepend
%strong
%strong
=
text_field_tag
:ppath
,
@project
.
path_to_repo
,
class:
"xlarge"
,
disabled:
true
=
text_field_tag
:ppath
,
@project
.
path_to_repo
,
class:
"xlarge"
,
disabled:
true
.clearfix
=
f
.
label
:code
do
URL
.input
.input-prepend
%span
.add-on
=
web_app_url
=
f
.
text_field
:code
,
placeholder:
"example"
-
unless
@project
.
new_record?
||
@project
.
heads
.
empty?
-
unless
@project
.
new_record?
||
@project
.
heads
.
empty?
.clearfix
.clearfix
...
...
db/fixtures/development/001_admin.rb
View file @
c50ec72b
unless
User
.
count
>
0
unless
User
.
count
>
0
admin
=
User
.
create
(
admin
=
User
.
create
(
:email
=>
"admin@local.host"
,
email:
"admin@local.host"
,
:name
=>
"Administrator"
,
name:
"Administrator"
,
:password
=>
"5iveL!fe"
,
username:
'root'
,
:password_confirmation
=>
"5iveL!fe"
password:
"5iveL!fe"
,
password_confirmation:
"5iveL!fe"
)
)
admin
.
projects_limit
=
10000
admin
.
projects_limit
=
10000
...
...
db/fixtures/development/003_users.rb
View file @
c50ec72b
User
.
seed
(
:id
,
[
User
.
seed
(
:id
,
[
{
:id
=>
2
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
2
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
3
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
3
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
4
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
4
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
5
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
5
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
6
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
6
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
7
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
7
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
8
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
},
{
id:
8
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
},
{
:id
=>
9
,
:name
=>
Faker
::
Internet
.
user_name
,
:email
=>
Faker
::
Internet
.
email
}
{
id:
9
,
username:
Faker
::
Internet
.
user_name
,
name:
Faker
::
Name
.
name
,
email:
Faker
::
Internet
.
email
}
])
])
db/fixtures/production/001_admin.rb
View file @
c50ec72b
admin
=
User
.
create
(
admin
=
User
.
create
(
:email
=>
"admin@local.host"
,
email:
"admin@local.host"
,
:name
=>
"Administrator"
,
name:
"Administrator"
,
:password
=>
"5iveL!fe"
,
username:
'root'
,
:password_confirmation
=>
"5iveL!fe"
password:
"5iveL!fe"
,
password_confirmation:
"5iveL!fe"
)
)
admin
.
projects_limit
=
10000
admin
.
projects_limit
=
10000
...
...
db/migrate/20121123164910_rename_code_to_path.rb
0 → 100644
View file @
c50ec72b
class
RenameCodeToPath
<
ActiveRecord
::
Migration
def
up
remove_column
:projects
,
:code
rename_column
:namespaces
,
:code
,
:path
end
def
down
add_column
:projects
,
:code
,
:string
rename_column
:namespaces
,
:path
,
:code
end
end
db/schema.rb
View file @
c50ec72b
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended to check this file into your version control system.
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
201211231
04937
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
201211231
64910
)
do
create_table
"events"
,
:force
=>
true
do
|
t
|
create_table
"events"
,
:force
=>
true
do
|
t
|
t
.
string
"target_type"
t
.
string
"target_type"
...
@@ -82,7 +82,7 @@ ActiveRecord::Schema.define(:version => 20121123104937) do
...
@@ -82,7 +82,7 @@ ActiveRecord::Schema.define(:version => 20121123104937) do
create_table
"namespaces"
,
:force
=>
true
do
|
t
|
create_table
"namespaces"
,
:force
=>
true
do
|
t
|
t
.
string
"name"
,
:null
=>
false
t
.
string
"name"
,
:null
=>
false
t
.
string
"
code
"
,
:null
=>
false
t
.
string
"
path
"
,
:null
=>
false
t
.
integer
"owner_id"
,
:null
=>
false
t
.
integer
"owner_id"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
...
@@ -111,7 +111,6 @@ ActiveRecord::Schema.define(:version => 20121123104937) do
...
@@ -111,7 +111,6 @@ ActiveRecord::Schema.define(:version => 20121123104937) do
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
boolean
"private_flag"
,
:default
=>
true
,
:null
=>
false
t
.
boolean
"private_flag"
,
:default
=>
true
,
:null
=>
false
t
.
string
"code"
t
.
integer
"owner_id"
t
.
integer
"owner_id"
t
.
string
"default_branch"
t
.
string
"default_branch"
t
.
boolean
"issues_enabled"
,
:default
=>
true
,
:null
=>
false
t
.
boolean
"issues_enabled"
,
:default
=>
true
,
:null
=>
false
...
...
lib/api/helpers.rb
View file @
c50ec72b
...
@@ -6,7 +6,7 @@ module Gitlab
...
@@ -6,7 +6,7 @@ module Gitlab
def
user_project
def
user_project
if
@project
||=
current_user
.
projects
.
find_by_id
(
params
[
:id
])
||
if
@project
||=
current_user
.
projects
.
find_by_id
(
params
[
:id
])
||
current_user
.
projects
.
find_by_
code
(
params
[
:id
])
current_user
.
projects
.
find_by_
path
(
params
[
:id
])
else
else
not_found!
not_found!
end
end
...
...
lib/gitlab/auth.rb
View file @
c50ec72b
...
@@ -34,6 +34,7 @@ module Gitlab
...
@@ -34,6 +34,7 @@ module Gitlab
extern_uid:
uid
,
extern_uid:
uid
,
provider:
provider
,
provider:
provider
,
name:
name
,
name:
name
,
username:
email
.
match
(
/^[^@]*/
)[
0
],
email:
email
,
email:
email
,
password:
password
,
password:
password
,
password_confirmation:
password
,
password_confirmation:
password
,
...
...
spec/factories.rb
View file @
c50ec72b
...
@@ -12,6 +12,7 @@ FactoryGirl.define do
...
@@ -12,6 +12,7 @@ FactoryGirl.define do
factory
:user
,
aliases:
[
:author
,
:assignee
,
:owner
]
do
factory
:user
,
aliases:
[
:author
,
:assignee
,
:owner
]
do
email
{
Faker
::
Internet
.
email
}
email
{
Faker
::
Internet
.
email
}
name
name
username
'john'
password
"123456"
password
"123456"
password_confirmation
{
password
}
password_confirmation
{
password
}
...
...
spec/observers/user_observer_spec.rb
View file @
c50ec72b
...
@@ -13,7 +13,7 @@ describe UserObserver do
...
@@ -13,7 +13,7 @@ describe UserObserver do
end
end
context
'when a new user is created'
do
context
'when a new user is created'
do
let
(
:user
)
{
double
(
:user
,
id:
42
,
password:
'P@ssword!'
,
name:
'John'
,
email:
'u@mail.local'
)
}
let
(
:user
)
{
double
(
:user
,
id:
42
,
password:
'P@ssword!'
,
name:
'John'
,
email:
'u@mail.local'
,
username:
'root'
)
}
let
(
:notification
)
{
double
:notification
}
let
(
:notification
)
{
double
:notification
}
it
'sends an email'
do
it
'sends an email'
do
...
...
spec/routing/admin_routing_spec.rb
View file @
c50ec72b
...
@@ -78,14 +78,6 @@ describe Admin::ProjectsController, "routing" do
...
@@ -78,14 +78,6 @@ describe Admin::ProjectsController, "routing" do
get
(
"/admin/projects"
).
should
route_to
(
'admin/projects#index'
)
get
(
"/admin/projects"
).
should
route_to
(
'admin/projects#index'
)
end
end
it
"to #create"
do
post
(
"/admin/projects"
).
should
route_to
(
'admin/projects#create'
)
end
it
"to #new"
do
get
(
"/admin/projects/new"
).
should
route_to
(
'admin/projects#new'
)
end
it
"to #edit"
do
it
"to #edit"
do
get
(
"/admin/projects/gitlab/edit"
).
should
route_to
(
'admin/projects#edit'
,
id:
'gitlab'
)
get
(
"/admin/projects/gitlab/edit"
).
should
route_to
(
'admin/projects#edit'
,
id:
'gitlab'
)
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