Преглед на файлове

Add mocha documentation

Thibaut преди 10 години
родител
ревизия
76412b3fba

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


+ 3 - 0
assets/javascripts/news.json

@@ -1,5 +1,8 @@
 [
   [
+    "2015-03-22",
+    "New <a href=\"/mocha/\">mocha</a> documentation"
+  ], [
     "2015-02-22",
     "Improved <a href=\"/http/\">HTTP</a> documentation",
     "New <a href=\"/minitest/\">Minitest</a> documentation"

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -225,6 +225,11 @@ credits = [
     'Ryan Davis, seattle.rb',
     'MIT',
     'https://raw.githubusercontent.com/seattlerb/minitest/master/README.txt'
+  ], [
+    'Mocha',
+    '2011-2015 TJ Holowaychuk',
+    'MIT',
+    'https://raw.githubusercontent.com/mochajs/mocha/master/LICENSE'
   ], [
     'Modernizr',
     '2009-2014 Modernizr',

+ 1 - 0
assets/javascripts/views/pages/javascript.coffee

@@ -20,6 +20,7 @@ app.views.ExpressPage =
 app.views.GruntPage =
 app.views.LodashPage =
 app.views.MarionettePage =
+app.views.MochaPage =
 app.views.ModernizrPage =
 app.views.MomentPage =
 app.views.MongoosePage =

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -97,3 +97,4 @@
 ._icon-lua:before           { background-position: -3rem -7rem; @extend %darkIconFix !optional; }
 ._icon-clojure:before       { background-position: -4rem -7rem; }
 ._icon-symfony:before       { background-position: -5rem -7rem; }
+._icon-mocha:before         { background-position: -6rem -7rem; }

+ 2 - 1
assets/stylesheets/pages/_base.scss

@@ -19,6 +19,7 @@
 }
 
 ._lodash,
-._sinon {
+._sinon,
+._mocha {
   @extend %simple;
 }

+ 15 - 0
lib/docs/filters/mocha/clean_html.rb

@@ -0,0 +1,15 @@
+module Docs
+  class Mocha
+    class CleanHtmlFilter < Filter
+      def call
+        doc.child.remove until doc.child['id'] == 'installation'
+
+        css('pre').each do |node|
+          node.content = node.content
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 34 - 0
lib/docs/filters/mocha/entries.rb

@@ -0,0 +1,34 @@
+module Docs
+  class Mocha
+    class EntriesFilter < Docs::EntriesFilter
+      ENTRIES = {
+        'asynchronous-code' => ['done()'],
+        'hooks' => ['before()', 'after()', 'beforeEach()', 'afterEach()', 'suiteSetup()', 'suiteTeardown()', 'setup()', 'teardown()'],
+        'exclusive-tests' => ['only()'],
+        'inclusive-tests' => ['skip()'],
+        'usage' => ['mocha'],
+        'bdd-interface' => ['describe()', 'context()', 'it()'],
+        'tdd-interface' => ['suite()', 'test()'],
+        'exports-interface' => ['exports'],
+        'qunit-interface' => ['QUnit'],
+        'require-interface' => ['require'],
+        'browser-setup' => ['setup()'],
+        'mocha.opts' => ['mocha.opts'],
+        'suite-specific-timeouts' => ['timeout()']
+      }
+
+      def additional_entries
+        ENTRIES.each_with_object [] do |(id, names), entries|
+          type = case id
+            when 'hooks' then 'Hooks'
+            when /interface/ then 'Interfaces'
+            else 'Miscellaneous' end
+
+          names.each do |name|
+            entries << [name, id, type]
+          end
+        end
+      end
+    end
+  end
+end

+ 23 - 0
lib/docs/scrapers/mocha.rb

@@ -0,0 +1,23 @@
+module Docs
+  class Mocha < UrlScraper
+    self.name = 'mocha'
+    self.type = 'mocha'
+    self.version = '2.2.1'
+    self.base_url = 'http://mochajs.org/'
+    self.links = {
+      home: 'http://mochajs.org/',
+      code: 'https://github.com/mochajs/mocha'
+    }
+
+    html_filters.push 'mocha/entries', 'mocha/clean_html', 'title'
+
+    options[:container] = '#content'
+    options[:title] = 'mocha'
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; 2011&ndash;2015 TJ Holowaychuk<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

BIN
public/icons/docs/mocha/16.png


BIN
public/icons/docs/mocha/16@2x.png