bin/git_gem_updater.rb in polisher-0.9.1 vs bin/git_gem_updater.rb in polisher-0.10.1

- old
+ new

@@ -9,17 +9,15 @@ # # Licensed under the MIT License # Copyright (C) 2013-2014 Red Hat, Inc. require 'colored' -require 'curb' -require 'json' require 'optparse' -require 'nokogiri' require 'polisher/git' require 'polisher/gem' +require 'polisher/core' ORIG_DIR = Dir.pwd # read various options from the command line conf = { :dir => ORIG_DIR, @@ -43,14 +41,23 @@ puts opts exit end end - optparse.parse! +optparse.parse! -conf[:gems] += Polisher::Fedora.gems_owned_by(conf[:user]) unless conf[:user].nil? +Polisher::Config.set +unless conf[:user].nil? + begin + conf[:gems] += Polisher::Fedora.gems_owned_by(conf[:user]) + rescue + puts "Could not retrieve gems owned by #{conf[:user]}".red + exit 1 + end +end + if conf[:gems].empty? puts "must specify a gem name or user name!".red exit 1 end @@ -59,20 +66,24 @@ # iterate over gems conf[:gems].each do |gem_name| pkg = begin - Polisher::Git::Pkg.new(:name => gem_name).clone + Polisher::Git::Pkg.new(:name => gem_name).fetch rescue => e puts "Problem Cloning Package, Skipping: #{e}" next end gem = Polisher::Gem.retrieve gem_name pkg.update_to(gem) # TODO append gem dependencies to conf[:gems] list - pkg.build + begin + pkg.build + rescue => e + puts "Warning: scratch build failed: #{e}".bold.red + end unless pkg.spec.has_check? puts "Warning: no %check section in spec, "\ "manually verify functionality!".bold.red end