@@ -13,16 +13,10 @@ class DownloadData
1313 # [OvD] note that Google uses Atom & Sourceforge uses RSS
1414 # however this isn't relevant when parsing the feeds for
1515 # name, version, url & date with Feedzirra
16- SOURCEFORGE_URL = "https://sourceforge.net/projects/git-osx-installer/rss?limit=20"
17-
1816 GIT_FOR_WINDOWS_REGEX = /^(Portable|)Git-(\d +\. \d +\. \d +(?:\. \d +)?)-(?:.+-)*(64-bit|arm64)(?:\. .*)?\. exe/
1917 GIT_FOR_WINDOWS_NAME_WITH_OWNER = "git-for-windows/git"
2018
2119 class << self
22- def sourceforge_project_download_url ( project , filename )
23- "https://sourceforge.net/projects/#{ project } /files/#{ filename } /download?use_mirror=autoselect"
24- end
25-
2620 def update_download_windows_versions ( config )
2721 files_from_github ( GIT_FOR_WINDOWS_NAME_WITH_OWNER ) . each do |name , date , url |
2822 # Git for Windows uses the following naming system
@@ -61,32 +55,6 @@ def update_download_windows_versions(config)
6155 end
6256 end
6357
64- def update_download_mac_versions ( config )
65- files_from_sourceforge ( SOURCEFORGE_URL ) . each do |url , date |
66- filename = url . split ( "/" ) [ -2 ]
67- match = /git-(.*?)-/ . match ( filename )
68-
69- next unless match
70-
71- url = sourceforge_project_download_url ( "git-osx-installer" , filename )
72- name = match [ 1 ]
73-
74- version = name
75-
76- if version
77- config [ "macos_installer" ] = { } if config [ "macos_installer" ] . nil?
78- mac_config = config [ "macos_installer" ]
79- return if version_compare ( version , mac_config [ "version" ] ) < 0
80- mac_config [ "filename" ] = filename
81- mac_config [ "release_date" ] = Time . parse ( date . iso8601 ) . strftime ( "%Y-%m-%d" )
82- mac_config [ "version" ] = version
83- mac_config [ "url" ] = url
84- else
85- $logger. info ( "Could not find version #{ name } " )
86- end
87- end
88- end
89-
9058 private
9159
9260 def files_from_github ( repository )
@@ -109,18 +77,6 @@ def files_from_github(repository)
10977 downloads
11078 end
11179
112- def files_from_sourceforge ( repository )
113- downloads = [ ]
114- rss = URI . parse ( repository ) . open . read
115- feed = RSS ::Parser . parse ( rss )
116-
117- feed . items . each do |item |
118- downloads << [ item . link , item . pubDate ]
119- end
120-
121- downloads
122- end
123-
12480 def version_compare ( a , b )
12581 a = a . nil? ? [ ] : a . gsub ( /^v/ , "" ) . split ( /[.()]/ )
12682 b = b . nil? ? [ ] : b . gsub ( /^v/ , "" ) . split ( /[.()]/ )
@@ -139,6 +95,5 @@ def version_compare(a, b)
13995config = YAML . load_file ( "hugo.yml" )
14096config [ "params" ] = { } if config [ "params" ] . nil?
14197DownloadData . update_download_windows_versions ( config [ "params" ] )
142- DownloadData . update_download_mac_versions ( config [ "params" ] )
14398yaml = YAML . dump ( config ) . gsub ( / *$/ , "" )
14499File . write ( "hugo.yml" , yaml )
0 commit comments