Permalink
Browse files

fix rake task for downloads

  • Loading branch information...
bry4n committed Sep 20, 2012
1 parent 25563fc commit 5439bebe9dc89c3f24a6ed8076e18e0f8870f335
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/tasks/downloads.rake
View
@@ -10,10 +10,12 @@ task :downloads => :environment do
puts version = version
puts url = down.html_url
v = Version.where(:name => version).first
- d = v.downloads.where(:url => url).first_or_create
- d.filename = down.name
- d.platform = 'windows'
- d.save
+ if v
+ d = v.downloads.where(:url => url).first_or_create
+ d.filename = down.name
+ d.platform = 'windows'
+ d.save
+ end
end
end
@@ -25,10 +27,12 @@ task :downloads => :environment do
puts version = version
puts url = down.html_url
v = Version.where(:name => version).first
- d = v.downloads.where(:url => url).first_or_create
- d.filename = down.name
- d.platform = 'mac'
- d.save
+ if v
+ d = v.downloads.where(:url => url).first_or_create
+ d.filename = down.name
+ d.platform = 'mac'
+ d.save
+ end
end
end
end

0 comments on commit 5439beb

Please sign in to comment.