diff --git a/apkbuild-gem-resolver.in b/apkbuild-gem-resolver.in index 69f4049..f19b18f 100644 --- a/apkbuild-gem-resolver.in +++ b/apkbuild-gem-resolver.in @@ -1,7 +1,7 @@ #!/usr/bin/ruby # APKBUILD dependency resolver for RubyGems -# Copyright (C) 2014 Kaarle Ritvanen +# Copyright (C) 2014-2015 Kaarle Ritvanen require 'augeas' require 'optparse' @@ -201,12 +201,8 @@ class Update def each @gems.each_value do |gem| - obs = gem.obsolete_deps - obs = obs.length == 0 ? nil : " (obsolete dependencies: #{obs.join ', '})" - - if gem.updated? || obs - yield "#{gem.aport.name}-#{gem.version}#{obs}" - end + update = gem.update + yield update if update end end @@ -233,7 +229,7 @@ class Update @aport = aport end - attr_reader :aport, :obsolete_deps + attr_reader :aport def require_version version if @version @@ -278,6 +274,16 @@ class Update } end end + + def update + updated? || @obsolete_deps.length > 0 ? ( + { + :name => @aport.name, + :version => version, + :obsolete_deps => @obsolete_deps.clone + } + ) : nil + end end end @@ -306,6 +312,9 @@ end update.resolve -for aport in update - puts aport +for pkg in update + obs = pkg[:obsolete_deps] + obs = obs.length == 0 ? nil : " (obsolete dependencies: #{obs.join ', '})" + + puts "#{pkg[:name]}-#{pkg[:version]}#{obs}" end