From e6c90931d57c79420b825c09054ea4a5c57a783f Mon Sep 17 00:00:00 2001 From: Lyubomir Popov Date: Fri, 30 Oct 2015 22:25:50 +0200 Subject: [PATCH] Add Vagrant documentation --- lib/docs/filters/vagrant/clean_html.rb | 20 ++++++++ lib/docs/filters/vagrant/entries.rb | 63 +++++++++++++++++++++++++ lib/docs/scrapers/vagrant.rb | 19 ++++++++ public/icons/docs/vagrant/16.png | Bin 0 -> 863 bytes public/icons/docs/vagrant/16@2x.png | Bin 0 -> 1914 bytes public/icons/docs/vagrant/SOURCE | 1 + 6 files changed, 103 insertions(+) create mode 100644 lib/docs/filters/vagrant/clean_html.rb create mode 100644 lib/docs/filters/vagrant/entries.rb create mode 100644 lib/docs/scrapers/vagrant.rb create mode 100644 public/icons/docs/vagrant/16.png create mode 100644 public/icons/docs/vagrant/16@2x.png create mode 100644 public/icons/docs/vagrant/SOURCE diff --git a/lib/docs/filters/vagrant/clean_html.rb b/lib/docs/filters/vagrant/clean_html.rb new file mode 100644 index 00000000..30516650 --- /dev/null +++ b/lib/docs/filters/vagrant/clean_html.rb @@ -0,0 +1,20 @@ +module Docs + class Vagrant + class CleanHtmlFilter < Filter + def call + if root_page? + doc.children = css('h1, .category') + return doc + end + + css('nav', '.sidebar', 'footer').remove + + css('.wrapper', '.page', '.container', '.row', '.page-contents', '.span8').each do |node| + node.before(node.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/vagrant/entries.rb b/lib/docs/filters/vagrant/entries.rb new file mode 100644 index 00000000..6ff89757 --- /dev/null +++ b/lib/docs/filters/vagrant/entries.rb @@ -0,0 +1,63 @@ +module Docs + class Vagrant + class EntriesFilter < Docs::EntriesFilter + def get_name + if slug.start_with?('push/') + if at_css('h2') + name = at_css('h2').content.strip + else + name = at_css('h1').content.strip + end + name + else + name = at_css('h1').content.strip + name + end + end + + def get_type + if slug.start_with?('why-vagrant') + 'Why Vagrant?' + elsif slug.start_with?('installation') + 'Installation' + elsif slug.start_with?('getting-started') + 'Getting Started' + elsif slug.start_with?('cli') + 'Command-Line Interface' + elsif slug.start_with?('share') + 'Vagrant Share' + elsif slug.start_with?('vagrantfile') + 'Vagrantfile' + elsif slug.start_with?('boxes') + 'Boxes' + elsif slug.start_with?('provisioning') + 'Provisioning' + elsif slug.start_with?('networking') + 'Networking' + elsif slug.start_with?('synced-folders') + 'Synced Folders' + elsif slug.start_with?('multi-machine') + 'Multi-Machine' + elsif slug.start_with?('providers') + 'Providers' + elsif slug.start_with?('plugins') + 'Plugins' + elsif slug.start_with?('push') + 'Push' + elsif slug.start_with?('other') + 'Other' + elsif slug.start_with?('vmware') + 'VMware' + elsif slug.start_with?('docker') + 'Docker' + elsif slug.start_with?('virtualbox') + 'VirtualBox' + elsif slug.start_with?('hyperv') + 'Hyper-V' + else + 'Overview' + end + end + end + end +end diff --git a/lib/docs/scrapers/vagrant.rb b/lib/docs/scrapers/vagrant.rb new file mode 100644 index 00000000..c0fc8010 --- /dev/null +++ b/lib/docs/scrapers/vagrant.rb @@ -0,0 +1,19 @@ +module Docs + class Vagrant < UrlScraper + self.name = 'Vagrant' + self.slug = 'vagrant' + self.type = 'vagrant' + self.version = '1.7.4' + self.base_url = 'http://docs.vagrantup.com/v2/' + self.links = { + home: 'http://www.vagrantup.com/' + } + + html_filters.push 'vagrant/clean_html', 'vagrant/entries' + + options[:attribution] = <<-HTML + © 2010–2015 Mitchell Hashimoto
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/vagrant/16.png b/public/icons/docs/vagrant/16.png new file mode 100644 index 0000000000000000000000000000000000000000..9c111f32f59cb707b54fe75ffd0c9320523fea38 GIT binary patch literal 863 zcmV-l1EBngP)nQz)}hCXJPK1LvB1|%R!6IxwJ!h#?w1|)_J?nuxL36z9r zgk4=3LW+_QqEe#^6Uu@OpwXBZOs#D~qF@V>fznRDnQ3X~(V6)k_a0X@WGdeE@Ao@r zaSs82lP~nMl6!+7xRgqz3izKlKR=%!qGJ%^Rx*(ohgVt{WOuPrEEa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qErB=%+f31RZ6|CimK;Mmg=E?4x|s=8olNRP z0ZoCQH3p31SbTrnsA@6`D-Yao^R}>g#&4xOu(V)X>sK_fro$s+3n1Fu+!~083!tiG zyzKbmj%Cl6ljJE6-ZKC_o4Zm(x`ERTF|Aq{Sbk-)EHbAGpA%%&bn`v4|MFDz`per~ zv+=4TKmKexSG0LxOjIl`a#Yi4M^!yhXli=K|Jt?Rz8&srh^#)sFB-)tjzY^XkK1sz z3PN3lmI2q__-f=#+47)mB(wd5&l7(i<y#D z(*$}pb=6RLsWDAewS&O7Yhkr2VjvCiC(jT@A&A`VTJ}XBd*ZJpfm;E`5@FZ-6(0TD zFnb4TQERa+n)2maJpg)j_E#hM1Km6BaKZ%%^la{mfj5ALV^{<*t|)tk z9J+^c1gSxQBuQ>CMwY`&sc_v)HJdGDRCTIvQ~?G>cwvrs&3+*;1al2VpppntI>Sk( z4z?M6L#fnW1F>D#BbRHU-o*R2uXB1nlEBf;U1ea~T#*xu$ZS=db2M9)?Kd^G3o94R{o2E*aj_T`0<#Pj?_?0K>o$ffol z&IMr3Io%eEJ-};oSR0`hr}EBllpgbqRY{C(i7-$3U;O>;qW>|0zAvv-U_Wqjt}qEA zV2NNEVSId~QS$*(qcdlW3noxkns@5kFxOdxAn@t!J;vZ*FKIeM6nDS2!TI37CU9(X z*Qg@T0)L)I9ZjWDCJ4%;>5S~V6&^UB8QW0Yaz%eI~19dH?_b07*qoM6N<$f|Vtd AxBvhE literal 0 HcmV?d00001 diff --git a/public/icons/docs/vagrant/SOURCE b/public/icons/docs/vagrant/SOURCE new file mode 100644 index 00000000..7c6a05ed --- /dev/null +++ b/public/icons/docs/vagrant/SOURCE @@ -0,0 +1 @@ +http://www.vagrantup.com