diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 1c24e8e1e..d3c5cce79 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -4,12 +4,13 @@ require 'open-uri' namespace :import do desc "Load projects" task :projects => :environment do + source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/package_list.txt' owner = User.find_by_uname(ENV['OWNER_UNAME']) || Group.find_by_uname(ENV['OWNER_UNAME']) || User.first platform = Platform.find_by_name(ENV['PLATFORM_NAME']) # 'mandriva2011' repo = platform.repositories.first rescue nil - say "START import projects for '#{owner.uname}'.#{repo ? " To repo '#{platform.name}/#{repo.name}'." : ''}" + say "START import projects from '#{source}' for '#{owner.uname}'.#{repo ? " To repo '#{platform.name}/#{repo.name}'." : ''}" ask 'Press enter to continue' - open('http://dl.dropbox.com/u/984976/package_list.txt').readlines.each do |name| + open(source).readlines.each do |name| name.chomp!; name.strip! #; name.downcase! # name = name.match(/^([a-z\d_\-\+\.]+?)-(\d[a-z\d\-\.]+)\.src\.rpm$/)[1] # parse print "Import '#{name}'..."