[devdocsgjs/main: 632/1867] Remove hardcoded username and fix broken methods




commit 4ce7dbcfd58873857fc4c613d4c6b4bbb9d90f12
Author: Jasper van Merle <jaspervmerle gmail com>
Date:   Tue Jun 11 23:01:37 2019 +0200

    Remove hardcoded username and fix broken methods

 .github/CONTRIBUTING.md          | 2 +-
 lib/docs/scrapers/async.rb       | 2 +-
 lib/docs/scrapers/drupal.rb      | 9 ++-------
 lib/docs/scrapers/perl.rb        | 5 +++--
 lib/docs/scrapers/phalcon.rb     | 2 +-
 lib/docs/scrapers/sass.rb        | 2 +-
 lib/docs/scrapers/statsmodels.rb | 2 +-
 lib/tasks/updates.thor           | 2 +-
 8 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 06558d36..d0fccff5 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -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.
 
-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
 
diff --git a/lib/docs/scrapers/async.rb b/lib/docs/scrapers/async.rb
index 67498eed..61615b54 100644
--- a/lib/docs/scrapers/async.rb
+++ b/lib/docs/scrapers/async.rb
@@ -19,7 +19,7 @@ module Docs
     HTML
 
     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]
     end
   end
diff --git a/lib/docs/scrapers/drupal.rb b/lib/docs/scrapers/drupal.rb
index f29b585b..3798caec 100644
--- a/lib/docs/scrapers/drupal.rb
+++ b/lib/docs/scrapers/drupal.rb
@@ -100,13 +100,8 @@ module Docs
     end
 
     def get_latest_version(opts)
-      doc = fetch_doc('http://cgit.drupalcode.org/drupal', opts)
-
-      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
+      json = fetch_json('https://packagist.org/packages/drupal/drupal.json', opts)
+      json['package']['versions'].keys.find {|version| !version.end_with?('-dev')}
     end
   end
 end
diff --git a/lib/docs/scrapers/perl.rb b/lib/docs/scrapers/perl.rb
index 7e5ed8f8..ebf0a653 100644
--- a/lib/docs/scrapers/perl.rb
+++ b/lib/docs/scrapers/perl.rb
@@ -45,8 +45,9 @@ module Docs
     end
 
     def get_latest_version(opts)
-      body = fetch('https://perldoc.perl.org/static/perlversion.js', opts)
-      body.scan(/>Perl ([0-9.]+)/)[0][0]
+      doc = fetch_doc('https://perldoc.perl.org/', opts)
+      header = doc.at_css('h2.h1').content
+      header.scan(/Perl ([0-9.]+)/)[0][0]
     end
   end
 end
diff --git a/lib/docs/scrapers/phalcon.rb b/lib/docs/scrapers/phalcon.rb
index dd476329..c6ca63f2 100644
--- a/lib/docs/scrapers/phalcon.rb
+++ b/lib/docs/scrapers/phalcon.rb
@@ -32,7 +32,7 @@ module Docs
 
     def get_latest_version(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
diff --git a/lib/docs/scrapers/sass.rb b/lib/docs/scrapers/sass.rb
index 228a5337..c81753d2 100644
--- a/lib/docs/scrapers/sass.rb
+++ b/lib/docs/scrapers/sass.rb
@@ -25,7 +25,7 @@ module Docs
     HTML
 
     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
diff --git a/lib/docs/scrapers/statsmodels.rb b/lib/docs/scrapers/statsmodels.rb
index db2eacb2..3e8a357c 100644
--- a/lib/docs/scrapers/statsmodels.rb
+++ b/lib/docs/scrapers/statsmodels.rb
@@ -23,7 +23,7 @@ module Docs
 
     def get_latest_version(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
diff --git a/lib/tasks/updates.thor b/lib/tasks/updates.thor
index 20ef20b2..c715f752 100644
--- a/lib/tasks/updates.thor
+++ b/lib/tasks/updates.thor
@@ -139,7 +139,7 @@ class UpdatesCLI < Thor
   def upload_results(outdated_results, up_to_date_results, failed_results)
     # We can't create issues without a 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
     end
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]