webpack.rb 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. module Docs
  2. class Webpack < UrlScraper
  3. self.name = 'webpack'
  4. self.type = 'webpack'
  5. version '2' do
  6. self.release = '2.2.0'
  7. self.base_url = 'https://webpack.js.org/'
  8. self.root_path = 'get-started/'
  9. self.initial_paths = %w(
  10. concepts/
  11. guides/
  12. api/
  13. configuration/
  14. loaders/
  15. plugins/
  16. )
  17. self.links = {
  18. home: 'https://webpack.js.org/',
  19. code: 'https://github.com/webpack/webpack'
  20. }
  21. html_filters.push 'webpack/clean_html', 'webpack/entries'
  22. options[:container] = '.page'
  23. options[:trailing_slash] = true
  24. options[:only_patterns] = [
  25. /\Aget-started\//,
  26. /\Aconcepts\//,
  27. /\Aguides\//,
  28. /\Aapi\//,
  29. /\Aconfiguration\//,
  30. /\Aloaders\//,
  31. /\Aplugins\//
  32. ]
  33. options[:attribution] = <<-HTML
  34. &copy; 2012&ndash;2016 Tobias Koppers<br>
  35. Licensed under the Creative Commons Attribution License 4.0.
  36. HTML
  37. ([self.root_path] + self.initial_paths).each do |path|
  38. stub(path) do
  39. capybara = load_capybara_selenium
  40. capybara.app_host = self.base_url.origin
  41. capybara.visit("#{self.base_url}#{path}")
  42. capybara.execute_script('return document.body.innerHTML')
  43. end
  44. end
  45. end
  46. version '1' do
  47. self.release = '1.13.2'
  48. self.base_url = 'https://webpack.github.io/docs/'
  49. self.links = {
  50. home: 'https://webpack.github.io/',
  51. code: 'https://github.com/webpack/webpack'
  52. }
  53. html_filters.push 'webpack/entries_old', 'webpack/clean_html_old', 'title'
  54. options[:title] = false
  55. options[:root_title] = 'webpack'
  56. options[:skip] = %w(list-of-tutorials.html examples.html changelog.html ideas.html roadmap.html)
  57. options[:attribution] = <<-HTML
  58. &copy; 2012&ndash;2016 Tobias Koppers<br>
  59. Licensed under the MIT License.
  60. HTML
  61. end
  62. end
  63. end