Skip to content

Commit 4cb41b8

Browse files
committed
Pointing Mac downloads to Sourceforge instead of Google Code
The downloads for the Mac installers moved to Sourceforge, so I've updated the downloads.rake and the downloads controller and haml file to point to the new location. Note that SF doesn't allow deep linking, so the iframe trick doesn't work here (you'll always need to manually download it, the browser won't force a download).
1 parent f6ee598 commit 4cb41b8

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

app/controllers/downloads_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def download
3030
@project_url = "http://msysgit.github.com/"
3131
@source_url = "https://github.com/msysgit/git/"
3232
else
33-
@project_url = "http://code.google.com/p/git-osx-installer/"
33+
@project_url = "http://sourceforge.net/projects/git-osx-installer/"
3434
@source_url = "https://github.com/git/git/"
3535
end
3636

app/views/downloads/installers/index.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
%td
3434
%strong Mac
3535
%td
36-
=link_to "Stable", "http://code.google.com/p/git-osx-installer/downloads/list?can=3"
36+
=link_to "Stable", "http://sourceforge.net/projects/git-osx-installer/files/"
3737
%tr
3838
%td
3939
%strong Solaris

lib/tasks/downloads.rake

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
require 'octokit'
22
require 'feedzirra'
33

4-
def gcode_downloads(project)
4+
# [OvD] note that Google uses Atom & Sourceforge uses RSS
5+
# however this isn't relevant when parsing the feeds for
6+
# name, version, url & date with Feedzirra
7+
GOOGLE_CODE_URL = "http://code.google.com/feeds/p/msysgit/downloads/basic"
8+
SOURCEFORGE_URL = "http://sourceforge.net/api/file/index/project-id/2063428/mtime/desc/limit/20/rss"
9+
10+
def file_downloads(repository)
511
downloads = []
6-
atom_url = "http://code.google.com/feeds/p/#{project}/downloads/basic"
7-
feed = Feedzirra::Feed.fetch_and_parse(atom_url)
12+
feed = Feedzirra::Feed.fetch_and_parse(repository)
813
feed.entries.each do |entry|
914
downloads << [entry.entry_id, entry.published]
1015
end
1116
downloads
1217
end
1318

14-
def file_url(project, filename)
19+
def googlecode_url(project, filename)
1520
"https://#{project}.googlecode.com/files/#{filename}"
1621
end
1722

23+
def sourceforge_url(project, filename)
24+
"http://sourceforge.net/projects/#{project}/files/#{filename}/download?use_mirror=autoselect"
25+
end
26+
1827
# find newest mac and windows binary downloads
1928
task :downloads => :environment do
2029
# find latest windows version
2130
project = "msysgit"
22-
win_downloads = gcode_downloads(project)
31+
win_downloads = file_downloads(GOOGLE_CODE_URL)
2332
win_downloads.each do |url, date|
2433
name = url.split('/').last
2534
if m = /^Git-(.*?)-(.*?)(\d{4})(\d{2})(\d{2})\.exe/.match(name)
26-
url = file_url(project, name)
35+
url = googlecode_url(project, name)
2736
version = m[1]
2837
puts version = version
2938
puts name
@@ -43,11 +52,11 @@ task :downloads => :environment do
4352

4453
# find latest mac version
4554
project = "git-osx-installer"
46-
mac_downloads = gcode_downloads(project)
55+
mac_downloads = file_downloads(SOURCEFORGE_URL)
4756
mac_downloads.each do |url, date|
48-
name = url.split('/').last
57+
name = url.split('/')[-2]
4958
if m = /git-(.*?)-/.match(name)
50-
url = file_url(project, name)
59+
url = sourceforge_url(project, name)
5160
version = m[1]
5261
puts version = version
5362
puts name

0 commit comments

Comments
 (0)