瀏覽代碼

composer: finish scraper and filters

Jasper van Merle 6 年之前
父節點
當前提交
ce5f182014

+ 2 - 2
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -188,9 +188,9 @@ credits = [
     'https://raw.githubusercontent.com/jashkenas/coffeescript/master/LICENSE'
   ], [
     'Composer',
-    '2012-2018 Nils Adermann, Jordi Boggiano',
+    'Nils Adermann, Jordi Boggiano',
     'MIT',
-    'https://github.com/composer/composer/blob/master/LICENSE'
+    'https://raw.githubusercontent.com/composer/composer/master/LICENSE'
   ], [
     'Cordova',
     '2012-2018 The Apache Software Foundation',

+ 0 - 3
lib/docs/filters/composer/entries.rb

@@ -3,15 +3,12 @@ module Docs
     class EntriesFilter < Docs::EntriesFilter
       def get_name
         title = at_css('h1').content
-
         title = "#{Integer(subpath[1]) + 1}. #{title}" if type == 'Book'
-
         title
       end
 
       def get_type
         return 'Articles' if subpath.start_with?('articles/')
-
         'Book'
       end
 

+ 6 - 5
lib/docs/scrapers/composer.rb

@@ -1,8 +1,8 @@
 module Docs
   class Composer < UrlScraper
-    self.name = 'Composer'
     self.type = 'simple'
-
+    self.release = '1.9.0'
+    self.base_url = 'https://getcomposer.org/doc/'
     self.links = {
       home: 'https://getcomposer.org',
       code: 'https://github.com/composer/composer'
@@ -10,9 +10,6 @@ module Docs
 
     html_filters.push 'composer/clean_html', 'composer/entries'
 
-    self.release = '1.7.2'
-    self.base_url = 'https://getcomposer.org/doc/'
-
     options[:container] = '#main'
 
     options[:skip_patterns] = [
@@ -23,5 +20,9 @@ module Docs
       &copy; Nils Adermann, Jordi Boggiano<br>
       Licensed under the MIT License.
     HTML
+
+    def get_latest_version(opts)
+      get_latest_github_release('composer', 'composer', opts)
+    end
   end
 end