rosa-build/lib/modules/models/web_hooks.rb

56 lines
1.0 KiB
Ruby
Raw Normal View History

# -*- encoding : utf-8 -*-
module Modules::Models::WebHooks
class << self
protected
def add_hook(name)
NAMES << name.to_s
@schema = []
yield if block_given?
SCHEMA[name] = @schema
@schema = []
end
def add_to_schema(type, attrs)
attrs.each do |attr|
@schema << [type, attr.to_sym]
end
end
def boolean(*attrs)
add_to_schema :boolean, attrs
end
def string(*attrs)
add_to_schema :string, attrs
end
def password(*attrs)
add_to_schema :password, attrs
end
end
NAMES = []
SCHEMA = {}
add_hook :web do
string :url
end
2013-04-17 13:05:33 +01:00
# temporarily disabled
# add_hook :hipchat do
# string :auth_token, :room, :restrict_to_branch
# boolean :notify
# end
add_hook :irc do
string :server, :port, :room, :nick, :branch_regexes
password :password
boolean :ssl, :message_without_join, :no_colors, :long_url, :notice
end
2013-05-16 09:45:27 +01:00
add_hook :jabber do
string :user
end
SCHEMA.freeze
NAMES.freeze
end