lib/reap/task/release.rb in reap-4.3.3 vs lib/reap/task/release.rb in reap-4.3.4

- old
+ new

@@ -156,43 +156,61 @@ dir = File.join( rel.dir, "#{rel.name}-#{rel.version}" ) files = Dir.entries(dir).select { |f| f =~ re_rtypes or f == 'PKGBUILD' } - files = files.collect { |f| File.join( rel.dir, f ) } + files = files.collect { |f| File.join( dir, f ) } if files.empty? puts "No files to release at #{dir}." exit -1 end # ask for password - print "Password for #{rel.username}: " - until passwd = $stdin.gets.strip ; sleep 1 ; end - @password = passwd + unless $PASSWORD + print "Password for #{rel.username}: " + until passwd = $stdin.gets.strip ; sleep 1 ; end + @password = passwd + else + @password = $PASSWORD + end login { unless package? -exit 0 + puts "Package (#{rel.package}) does not exist." + puts "Use -f option to force package creation." + exit 0 unless $FORCE create_package + puts "Created package -- #{rel.package}" end if release? -exit 0 + puts "Release (#{rel.release}) already exists." + puts "Use -f option to force re-release." + exit 0 unless $FORCE files.each do |f| remove_file( f ) if file?( f ) add_file( f ) end else -exit 0 - add_release( files.unshift ) - files.each { |f| add_file( f ) } + add_release( files.first ) + unless release? + puts "Release creation failed -- #{rel.release}" + exit -1 + end + puts "Added release -- #{ rel.release }" + puts "Added file -- #{ files.first }" + files[1..-1].each do |f| + add_file( f ) + puts "Added file -- #{ f }" + end end } + puts "Release complete!" end private FILETYPES = { @@ -252,11 +270,11 @@ # do whatever block.call # logout page = "/account/logout.php" - method = "" #"post_content" + method = "post_content" form = {} http_transaction( page, method, form ) end # Package exists? @@ -335,18 +353,18 @@ # how to use these? notes = rel.notes ? rel.notes : ( rel.notelog ? open(rel.notelog) : nil ) changes = rel.changes ? rel.changes : ( rel.changelog ? open(rel.changelog) : nil ) - userfile = open(rel.userfile) + userfile = open(userfile) preformatted = '1' form = { "group_id" => rel.groupid, "package_id" => rel.packageid, - "release_name" => rel.name, + "release_name" => rel.release, "release_date" => rel.date, "type_id" => type_id, "processor_id" => proc_id, "preformatted" => preformatted, "userfile" => userfile, @@ -427,10 +445,13 @@ "type_id" => type_id, "processor_id" => proc_id, "submit" => "Add This File" } - http_transaction( page, method, form ) #, extheader ) + boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__') + extheader = { 'content-type'=>"multipart/form-data; boundary=___#{ boundary }___" } + + http_transaction( page, method, form, extheader ) end # http transaction def http_transaction( page, method, form, extheader={} )