Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for CoffeeDoc.info

  • Loading branch information...
commit 5eb64d662209259e1b61c874ac2e111ec0df4040 1 parent 1f7f12c
@pwnall pwnall authored
View
2  docs/coffeedocinfo
@@ -0,0 +1,2 @@
+This service allows you to auto-publish documentation for your CoffeeScript library.
+The resulting documentation will be hosted for you at http://coffeedoc.info/github/your-name/your-project
View
16 services/coffeedocinfo.rb
@@ -0,0 +1,16 @@
+class Service::CoffeeDocInfo < Service
+ self.title = 'CoffeeDoc.info'
+
+ default_events :push
+
+ url "http://coffeedoc.info/"
+
+ maintained_by :github => 'pwnall'
+
+ supported_by :web => 'https://github.com/netzpirat/coffeedoc.info',
+ :twitter => 'netzpirat', :github => 'netzpirat'
+
+ def receive_push
+ http_post 'http://coffeedoc.info/checkout', :payload => payload.to_json
+ end
+end
View
24 test/coffeedocinfo_test.rb
@@ -0,0 +1,24 @@
+require File.expand_path('../helper', __FILE__)
+
+class CoffeeDocInfoTest < Service::TestCase
+ def setup
+ @stubs = Faraday::Adapter::Test::Stubs.new
+ end
+
+ def test_push
+ @stubs.post "/checkout" do |env|
+ assert_equal 'coffeedoc.info', env[:url].host
+ data = Rack::Utils.parse_query(env[:body])
+ assert_equal 1, JSON.parse(data['payload'])['a']
+ [200, {}, '']
+ end
+
+ svc = service({}, :a => 1)
+ svc.receive_push
+ end
+
+ def service(*args)
+ super Service::CoffeeDocInfo, *args
+ end
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.