| @@ -13,14 +13,18 @@ module Docs · 12 unmodified lines |
| 13 | html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html' | 13 | html_filters.push 'rethinkdb/entries', 'rethinkdb/clean_html' |
| 14 | | 14 | |
| 15 | options[:trailing_slash] = true | 15 | options[:trailing_slash] = true |
| | 16 | |
| 16 | options[:container] = '.documentation' | 17 | options[:container] = '.documentation' |
| 17 | | 18 | |
| 18 | options[:only_patterns] = [/\Adocs/] | 19 | options[:only_patterns] = [/\Adocs/] |
| | 20 | |
| 19 | options[:skip_patterns] = [/docs\/install(\-drivers)?\/./] | 21 | options[:skip_patterns] = [/docs\/install(\-drivers)?\/./] |
| | 22 | |
| 20 | options[:skip] = %w( | 23 | options[:skip] = %w( |
| 21 | docs/build/ | 24 | docs/build/ |
| 22 | docs/tutorials/elections/ | 25 | docs/tutorials/elections/ |
| 23 | docs/tutorials/superheroes/) | 26 | docs/tutorials/superheroes/ |
| | 27 | ) |
| 24 | | 28 | |
| 25 | MULTILANG_DOCS = %w( | 29 | MULTILANG_DOCS = %w( |
| 26 | changefeeds | 30 | changefeeds |
| @@ -33,31 +37,66 @@ module Docs · 6 unmodified lines |
| 33 | rabbitmq | 37 | rabbitmq |
| 34 | secondary-indexes | 38 | secondary-indexes |
| 35 | sql-to-reql | 39 | sql-to-reql |
| 36 | storing-binary) | 40 | storing-binary |
| | 41 | ) |
| 37 | | 42 | |
| 38 | options[:attribution] = <<-HTML | 43 | options[:attribution] = <<-HTML |
| 39 | © RethinkDB contributors<br> | 44 | © RethinkDB contributors<br> |
| 40 | Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. | 45 | Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. |
| 41 | HTML | 46 | HTML |
| 42 | | 47 | |
| 43 | %w(JavaScript Ruby Python Java).each do |name| | 48 | version 'javascript' do |
| 44 | path = name.downcase | 49 | self.initial_paths = %w(api/javascript/) |
| 45 | instance_eval <<-CODE | | |
| 46 | version '#{name}' do | | |
| 47 | self.initial_paths = %w(api/#{path}/) | | |
| 48 | | 50 | |
| 49 | options[:only_patterns] += [/\\Aapi\\/#{path}\\//] | 51 | options[:only_patterns] += [/\Aapi\/javascript\//] |
| 50 | | 52 | |
| 51 | options[:fix_urls] = ->(url) do | 53 | options[:fix_urls] = ->(url) do |
| 52 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/#{path}/' | 54 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/javascript/' |
| 53 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!#{path}/).*}, 'rethinkdb.com/docs/\\1/#{path}/' | 55 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!javascript/).*}, 'rethinkdb.com/docs/\\1/javascript/' |
| 54 | url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/#{path}/' | 56 | url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/javascript/' |
| 55 | url | 57 | url |
| 56 | end | 58 | end |
| 57 | end | | |
| 58 | CODE | | |
| 59 | end | 59 | end |
| 60 | | 60 | |
| | 61 | version 'ruby' do |
| | 62 | self.initial_paths = %w(api/ruby/) |
| | 63 | |
| | 64 | options[:only_patterns] += [/\Aapi\/ruby\//] |
| | 65 | |
| | 66 | options[:fix_urls] = ->(url) do |
| | 67 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/ruby/' |
| | 68 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!ruby/).*}, 'rethinkdb.com/docs/\\1/ruby/' |
| | 69 | url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/ruby/' |
| | 70 | url |
| | 71 | end |
| | 72 | end |
| | 73 | |
| | 74 | version 'python' do |
| | 75 | self.initial_paths = %w(api/python/) |
| | 76 | |
| | 77 | options[:only_patterns] += [/\Aapi\/python\//] |
| | 78 | |
| | 79 | options[:fix_urls] = ->(url) do |
| | 80 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/python/' |
| | 81 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!python/).*}, 'rethinkdb.com/docs/\\1/python/' |
| | 82 | url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/python/' |
| | 83 | url |
| | 84 | end |
| | 85 | end |
| | 86 | |
| | 87 | version 'java' do |
| | 88 | self.initial_paths = %w(api/java/) |
| | 89 | |
| | 90 | options[:only_patterns] += [/\Aapi\/java\//] |
| | 91 | |
| | 92 | options[:fix_urls] = ->(url) do |
| | 93 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})\\z}, 'rethinkdb.com/docs/\\1/java/' |
| | 94 | url.sub! %r{rethinkdb.com/docs/(#{MULTILANG_DOCS.join('|')})/(?!java/).*}, 'rethinkdb.com/docs/\\1/java/' |
| | 95 | url.sub! %r{rethinkdb.com/api/(?!javascript|ruby|python|java)}, 'rethinkdb.com/api/java/' |
| | 96 | url |
| | 97 | end |
| | 98 | end |
| | 99 | |
| 61 | def get_latest_version(opts) | 100 | def get_latest_version(opts) |
| 62 | get_latest_github_release('rethinkdb', 'rethinkdb', opts) | 101 | get_latest_github_release('rethinkdb', 'rethinkdb', opts) |
| 63 | end | 102 | end |
| @@ -68,5 +107,6 @@ module Docs · 4 unmodified lines |
| 68 | return false unless super | 107 | return false unless super |
| 69 | response.body !~ /http-equiv="refresh"/i | 108 | response.body !~ /http-equiv="refresh"/i |
| 70 | end | 109 | end |
| | 110 | |
| 71 | end | 111 | end |
| 72 | end | 112 | end |