webpack.rb 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. module Docs
  2. class Webpack < UrlScraper
  3. self.name = 'webpack'
  4. self.type = 'webpack'
  5. version do
  6. self.release = '4.2.0'
  7. self.base_url = 'https://webpack.js.org/'
  8. self.root_path = 'guides/'
  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] = false
  24. options[:only_patterns] = [
  25. /\Aconcepts\//,
  26. /\Aguides\//,
  27. /\Aapi\//,
  28. /\Aconfiguration\//,
  29. /\Aloaders\//,
  30. /\Aplugins\//
  31. ]
  32. options[:attribution] = <<-HTML
  33. &copy; JS Foundation and other contributors<br>
  34. Licensed under the Creative Commons Attribution License 4.0.
  35. HTML
  36. ([self.root_path] + self.initial_paths).each do |path|
  37. stub(path) do
  38. capybara = load_capybara_selenium
  39. capybara.app_host = self.base_url.origin
  40. capybara.visit("#{self.base_url}#{path}")
  41. capybara.execute_script('return document.body.innerHTML')
  42. end
  43. end
  44. end
  45. version '1' do
  46. self.release = '1.15.0'
  47. self.base_url = 'https://webpack.github.io/docs/'
  48. self.links = {
  49. home: 'https://webpack.github.io/',
  50. code: 'https://github.com/webpack/webpack/tree/webpack-1'
  51. }
  52. html_filters.push 'webpack/entries_old', 'webpack/clean_html_old', 'title'
  53. options[:title] = false
  54. options[:root_title] = 'webpack'
  55. options[:skip] = %w(list-of-tutorials.html examples.html changelog.html ideas.html roadmap.html)
  56. options[:attribution] = <<-HTML
  57. &copy; 2012&ndash;2015 Tobias Koppers<br>
  58. Licensed under the MIT License.
  59. HTML
  60. end
  61. end
  62. end