2014-02-18 23:09:16 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: services
|
|
|
|
#
|
2014-10-09 15:22:20 +00:00
|
|
|
# id :integer not null, primary key
|
|
|
|
# type :string(255)
|
|
|
|
# title :string(255)
|
2015-02-12 02:08:53 +00:00
|
|
|
# project_id :integer
|
2014-10-09 15:22:20 +00:00
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
# active :boolean default(FALSE), not null
|
|
|
|
# properties :text
|
2015-02-12 02:08:53 +00:00
|
|
|
# template :boolean default(FALSE)
|
2015-02-19 05:02:57 +00:00
|
|
|
# push_events :boolean
|
|
|
|
# issues_events :boolean
|
|
|
|
# merge_requests_events :boolean
|
|
|
|
# tag_push_events :boolean
|
2014-02-18 23:09:16 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
require "gemnasium/gitlab_service"
|
|
|
|
|
|
|
|
class GemnasiumService < Service
|
2014-09-08 00:54:18 +00:00
|
|
|
prop_accessor :token, :api_key
|
2014-02-18 23:09:16 +00:00
|
|
|
validates :token, :api_key, presence: true, if: :activated?
|
|
|
|
|
|
|
|
def title
|
|
|
|
'Gemnasium'
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
|
|
|
'Gemnasium monitors your project dependencies and alerts you about updates and security vulnerabilities.'
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_param
|
|
|
|
'gemnasium'
|
|
|
|
end
|
|
|
|
|
|
|
|
def fields
|
|
|
|
[
|
|
|
|
{ type: 'text', name: 'api_key', placeholder: 'Your personal API KEY on gemnasium.com ' },
|
|
|
|
{ type: 'text', name: 'token', placeholder: 'The project\'s slug on gemnasium.com' }
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2015-02-20 13:49:26 +00:00
|
|
|
def execute(data)
|
|
|
|
object_kind = data[:object_kind]
|
2015-02-19 05:02:57 +00:00
|
|
|
return unless object_kind == "push"
|
|
|
|
|
2014-02-18 23:09:16 +00:00
|
|
|
Gemnasium::GitlabService.execute(
|
2015-02-20 13:49:26 +00:00
|
|
|
ref: data[:ref],
|
|
|
|
before: data[:before],
|
|
|
|
after: data[:after],
|
2014-02-18 23:09:16 +00:00
|
|
|
token: token,
|
|
|
|
api_key: api_key,
|
2014-11-05 16:51:08 +00:00
|
|
|
repo: project.repository.path_to_repo
|
2014-02-18 23:09:16 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|