History

Improve version check methods documentation

Break up documentation of scraper version checking utility methods into different sections based on purpose. Also add missing documentation for get_latest_github_commit_date() method.

Phil Scherer committed 5 years ago

Commit 5840d8d1 parent 792183e1 file · +11 −0Browse files

Unified · Split

docs/scraper-reference.md+11−0
@@ -190,6 +190,8 @@ More information about how filters work is available on the [Filter Reference](. · 189 unmodified lines
190In order to keep scrapers up-to-date the `get_latest_version(opts)` method should be overridden. If `self.release` is defined, this should return the latest version of the documentation. If `self.release` is not defined, it should return the Epoch time when the documentation was last modified. If the documentation will never change, simply return `1.0.0`. The result of this method is periodically reported in a "Documentation versions report" issue which helps maintainers keep track of outdated documentations.190In order to keep scrapers up-to-date the `get_latest_version(opts)` method should be overridden. If `self.release` is defined, this should return the latest version of the documentation. If `self.release` is not defined, it should return the Epoch time when the documentation was last modified. If the documentation will never change, simply return `1.0.0`. The result of this method is periodically reported in a "Documentation versions report" issue which helps maintainers keep track of outdated documentations.
191 191
192To make life easier, there are a few utility methods that you can use in `get_latest_version`:192To make life easier, there are a few utility methods that you can use in `get_latest_version`:
193
194### General HTTP methods
193* `fetch(url, opts)`195* `fetch(url, opts)`
194 196
195 Makes a GET request to the url and returns the response body.197 Makes a GET request to the url and returns the response body.
@@ -205,11 +207,15 @@ To make life easier, there are a few utility methods that you can use in `get_la · 9 unmodified lines
205 Makes a GET request to the url and returns the JSON body converted to a dictionary.207 Makes a GET request to the url and returns the JSON body converted to a dictionary.
206 208
207 Example: [lib/docs/scrapers/mdn/mdn.rb](../lib/docs/scrapers/mdn/mdn.rb)209 Example: [lib/docs/scrapers/mdn/mdn.rb](../lib/docs/scrapers/mdn/mdn.rb)
210
211### Package repository methods
208* `get_npm_version(package, opts)`212* `get_npm_version(package, opts)`
209 213
210 Returns the latest version of the given npm package.214 Returns the latest version of the given npm package.
211 215
212 Example: [lib/docs/scrapers/bower.rb](../lib/docs/scrapers/bower.rb)216 Example: [lib/docs/scrapers/bower.rb](../lib/docs/scrapers/bower.rb)
217
218### GitHub methods
213* `get_latest_github_release(owner, repo, opts)`219* `get_latest_github_release(owner, repo, opts)`
214 220
215 Returns the tag name of the latest GitHub release of the given repository. If the tag name is preceded by a "v", the "v" will be removed.221 Returns the tag name of the latest GitHub release of the given repository. If the tag name is preceded by a "v", the "v" will be removed.
@@ -225,3 +231,8 @@ To make life easier, there are a few utility methods that you can use in `get_la · 9 unmodified lines
225 Returns the contents of the requested file in the default branch of the given repository.231 Returns the contents of the requested file in the default branch of the given repository.
226 232
227 Example: [lib/docs/scrapers/minitest.rb](../lib/docs/scrapers/minitest.rb)233 Example: [lib/docs/scrapers/minitest.rb](../lib/docs/scrapers/minitest.rb)
234* `get_latest_github_commit_date(owner, repo, opts)`
235
236 Returns the date of the most recent commit in the default branch of the given repository.
237
238 Example: [lib/docs/scrapers/reactivex.rb](../lib/docs/scrapers/reactivex.rb)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t