Add source as input param. Refs #1
This commit is contained in:
parent
27668c7546
commit
aceccae830
|
@ -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}'..."
|
||||
|
|
Loading…
Reference in New Issue