Permalink
Browse files

mention how to set logo/url

  • Loading branch information...
1 parent 58035e5 commit 1f7f12c234646add53dcc1587fec4cc3c8774e35 @technoweenie technoweenie committed Nov 1, 2012
Showing with 46 additions and 16 deletions.
  1. +3 −0 CONTRIBUTING.md
  2. +32 −16 lib/service.rb
  3. +11 −0 test/schema_test.rb
View
@@ -37,6 +37,9 @@ class Service::MyService < Service
default_events :push, :issues, :pull_request
+ url "http://myservice.com"
+ logo_url "http://myservice.com/logo.png"
+
# Technoweenie on GitHub is pinged for any bugs with the Hook code.
maintained_by :github => 'technoweenie'
View
@@ -318,13 +318,13 @@ def add_to_schema(type, attrs)
# Returns a String.
def title(value = nil)
if value
- return self.title = value
- end
-
- @title ||= begin
- hook = name.dup
- hook.sub! /.*:/, ''
- hook
+ @title = value
+ else
+ @title ||= begin
+ hook = name.dup
+ hook.sub! /.*:/, ''
+ hook
+ end
end
end
@@ -341,14 +341,14 @@ def title(value = nil)
# Returns a String.
def hook_name(value = nil)
if value
- return self.hook_name = value
- end
-
- @hook_name ||= begin
- hook = name.dup
- hook.downcase!
- hook.sub! /.*:/, ''
- hook
+ @hook_name = value
+ else
+ @hook_name ||= begin
+ hook = name.dup
+ hook.downcase!
+ hook.sub! /.*:/, ''
+ hook
+ end
end
end
@@ -359,7 +359,23 @@ def hook_name(value = nil)
# Returns a String.
attr_writer :hook_name
- attr_accessor :url, :logo_url
+ attr_reader :url, :logo_url
+
+ def url(value = nil)
+ if value
+ @url = value
+ else
+ @url
+ end
+ end
+
+ def logo_url(value = nil)
+ if value
+ @logo_url = value
+ else
+ @logo_url
+ end
+ end
def supporters
@supporters ||= []
View
@@ -99,6 +99,9 @@ class SchemaService < Service
white_list :abc, :ghi
+ url 'url'
+ logo_url 'logo'
+
maintained_by :email => 'abc@def.com',
:web => 'http://def.com/support',
:github => 'abc',
@@ -152,6 +155,14 @@ def test_supporters
assert_equal 5, supporters.size
end
+ def test_url
+ assert_equal 'url', @svc.url
+ end
+
+ def test_logo_url
+ assert_equal 'logo', @svc.logo_url
+ end
+
def assert_contributor(contributor_type, value, contributors)
assert contributors.detect { |c| c.class.contributor_type == contributor_type &&
c.value == value }

1 comment on commit 1f7f12c

xu3re commented on 1f7f12c Nov 7, 2012

commit

Please sign in to comment.