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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c3b074ac
Commit
c3b074ac
authored
Nov 19, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Service model and service hook
parent
be1dc554
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
0 deletions
+97
-0
app/assets/images/service-gitlab-ci.png
app/assets/images/service-gitlab-ci.png
+0
-0
app/models/service.rb
app/models/service.rb
+21
-0
app/models/service_hook.rb
app/models/service_hook.rb
+15
-0
db/migrate/20121119170638_create_services.rb
db/migrate/20121119170638_create_services.rb
+12
-0
db/migrate/20121120051432_add_service_id_to_web_hook.rb
db/migrate/20121120051432_add_service_id_to_web_hook.rb
+5
-0
spec/models/service_hook_spec.rb
spec/models/service_hook_spec.rb
+19
-0
spec/models/service_spec.rb
spec/models/service_spec.rb
+25
-0
No files found.
app/assets/images/service-gitlab-ci.png
0 → 100644
View file @
c3b074ac
2.69 KB
app/models/service.rb
0 → 100644
View file @
c3b074ac
# == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# token :string(255)
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class
Service
<
ActiveRecord
::
Base
attr_accessible
:title
,
:token
,
:type
belongs_to
:project
has_one
:service_hook
validates
:project_id
,
presence:
true
end
app/models/service_hook.rb
0 → 100644
View file @
c3b074ac
# == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# type :string(255) default("ProjectHook")
#
class
ServiceHook
<
WebHook
belongs_to
:service
end
db/migrate/20121119170638_create_services.rb
0 → 100644
View file @
c3b074ac
class
CreateServices
<
ActiveRecord
::
Migration
def
change
create_table
:services
do
|
t
|
t
.
string
:type
t
.
string
:title
t
.
string
:token
t
.
integer
:project_id
,
null:
false
t
.
timestamps
end
end
end
db/migrate/20121120051432_add_service_id_to_web_hook.rb
0 → 100644
View file @
c3b074ac
class
AddServiceIdToWebHook
<
ActiveRecord
::
Migration
def
change
add_column
:web_hooks
,
:service_id
,
:integer
,
null:
true
end
end
spec/models/service_hook_spec.rb
0 → 100644
View file @
c3b074ac
# == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# type :string(255) default("ProjectHook")
#
require
"spec_helper"
describe
ServiceHook
do
describe
"Associations"
do
it
{
should
belong_to
:service
}
end
end
spec/models/service_spec.rb
0 → 100644
View file @
c3b074ac
# == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# token :string(255)
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
require
'spec_helper'
describe
Service
do
describe
"Associations"
do
it
{
should
belong_to
:project
}
it
{
should
have_one
:service_hook
}
end
describe
"Mass assignment"
do
it
{
should_not
allow_mass_assignment_of
(
:project_id
)
}
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