Remove hardcoded username and fix broken methods

pull/986/head
Jasper van Merle 6 years ago
parent 16061956ce
commit 4ce7dbcfd5

@ -61,7 +61,7 @@ In addition to the [guidelines for contributing code](#contributing-code-and-fea
Please don't submit a pull request updating the version number of a documentation, unless a change is required in the scraper and you've verified that it works. Please don't submit a pull request updating the version number of a documentation, unless a change is required in the scraper and you've verified that it works.
To ask that an existing documentation be updated, first check the last two [Documentation versions reports](https://github.com/freeCodeCamp/devdocs/issues?utf8=%E2%9C%93&q=Documentation+versions+report+is%3Aissue+author%3Adevdocs-bot+sort%3Aupdated-desc). Only create an issue if the documentation has been wrongly marked as up-to-date for at least 2 reports (a new report is automatically created every month). To ask that an existing documentation be updated, first check the last two [Documentation versions reports](https://github.com/freeCodeCamp/devdocs/issues?utf8=%E2%9C%93&q=Documentation+versions+report+is%3Aissue+author%3Adevdocs-bot+sort%3Aupdated-desc). Only create an issue if the documentation has been wrongly marked as up-to-date.
## Coding conventions ## Coding conventions

@ -19,7 +19,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://caolan.github.io/async/', opts) doc = fetch_doc('https://caolan.github.io/async/v3/', opts)
doc.at_css('#version-dropdown > a').content.strip[1..-1] doc.at_css('#version-dropdown > a').content.strip[1..-1]
end end
end end

@ -100,13 +100,8 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('http://cgit.drupalcode.org/drupal', opts) json = fetch_json('https://packagist.org/packages/drupal/drupal.json', opts)
json['package']['versions'].keys.find {|version| !version.end_with?('-dev')}
version = doc.at_css('td.form > form > select > option[selected]').content
version = version.scan(/([0-9.]+)/)[0][0]
version = version[0...-1] if version.end_with?('.')
version
end end
end end
end end

@ -45,8 +45,9 @@ module Docs
end end
def get_latest_version(opts) def get_latest_version(opts)
body = fetch('https://perldoc.perl.org/static/perlversion.js', opts) doc = fetch_doc('https://perldoc.perl.org/', opts)
body.scan(/>Perl ([0-9.]+)/)[0][0] header = doc.at_css('h2.h1').content
header.scan(/Perl ([0-9.]+)/)[0][0]
end end
end end
end end

@ -32,7 +32,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('https://docs.phalconphp.com/', opts) doc = fetch_doc('https://docs.phalconphp.com/', opts)
doc.at_css('.custom-select__version').content.strip.sub(/Version /, '') doc.at_css('.header__lang.expand > div > ul > li > a').content
end end
end end
end end

@ -25,7 +25,7 @@ module Docs
HTML HTML
def get_latest_version(opts) def get_latest_version(opts)
get_github_file_contents('sass', 'sass', 'VERSION', opts).strip get_latest_github_release('sass', 'libsass', opts)['tag_name']
end end
end end
end end

@ -23,7 +23,7 @@ module Docs
def get_latest_version(opts) def get_latest_version(opts)
doc = fetch_doc('http://www.statsmodels.org/stable/', opts) doc = fetch_doc('http://www.statsmodels.org/stable/', opts)
doc.at_css('.sphinxsidebarwrapper h3 + p > b').content doc.at_css('.sphinxsidebarwrapper h3 + p > b').content[1..-1]
end end
end end
end end

@ -139,7 +139,7 @@ class UpdatesCLI < Thor
def upload_results(outdated_results, up_to_date_results, failed_results) def upload_results(outdated_results, up_to_date_results, failed_results)
# We can't create issues without a GitHub token # We can't create issues without a GitHub token
unless options.key?(:github_token) unless options.key?(:github_token)
logger.error('Please specify a GitHub token with the public_repo permission for devdocs-bot with the --github-token parameter') logger.error("Please specify a GitHub token with the public_repo permission for #{UPLOAD_USER} with the --github-token parameter")
return return
end end

Loading…
Cancel
Save