diff --git a/apkbuild-gem-resolver.in b/apkbuild-gem-resolver.in index 821ba30..dbe55f0 100644 --- a/apkbuild-gem-resolver.in +++ b/apkbuild-gem-resolver.in @@ -4,6 +4,7 @@ # Copyright (C) 2014 Kaarle Ritvanen require 'augeas' +require 'optparse' require 'rubygems/dependency' require 'rubygems/resolver' require 'rubygems/spec_fetcher' @@ -31,7 +32,7 @@ class Aport @@aports = {} @@subpackages = [] - def self.initialize + def self.initialize testing Augeas::open(nil, nil, Augeas::NO_MODL_AUTOLOAD) do |aug| dir = Dir.pwd aug.transform(:lens => 'Shellvars.lns', :incl => dir + '/*/ruby*/APKBUILD') @@ -40,7 +41,9 @@ class Aport apath = '/files' + dir fail if aug.match("/augeas#{apath}//error").length > 0 - for repo in ['main', 'testing'] + repos = ['main'] + repos.push 'testing' if testing + for repo in repos for aport in aug.match "#{apath}/#{repo}/*" FileAport.new(aug, aport) unless aport.end_with? '/ruby' end @@ -130,9 +133,6 @@ class FileAport < Aport end -Aport.initialize - - class Update def initialize @gems = {} @@ -264,6 +264,14 @@ class Update end +testing = false +OptionParser.new do |opts| + opts.on('-t', '--testing') do |t| + testing = t + end +end.parse! ARGV +Aport.initialize testing + latest = {} for source, gems in Gem::SpecFetcher::fetcher.available_specs(:latest)[0] for gem in gems