Sha256: 2a196dfb2bf950e8d48601374d380ad725bd603f4dbeacde40eeffdb528ee129
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
module Tentacle VERSION = '0.1' def validate_url(url) RestClient.get(url + '/repodata/repomd.xml') rescue return false YumRepo::Repomd.new(url) rescue return false true end class RepoFeed attr_reader :url, :repo_id, :distro_class def initialize(feed) @url, @repo_id, @distro_class = feed.split(',').map { |f| f.strip.chomp } end def to_s "URL: #{url.red} REPO_ID: #{repo_id} CLASS: #{distro_class}" end end class FeedCollection def self.all(validate = false) Git.clone "git://gist.github.com/1139245.git", TEMP_DIR feeds = [] urls = [] File.readlines(File.join(TEMP_DIR, "repo_feeds.txt")).each do |line| next if (line.strip.chomp.empty? or line =~ /^\s*#/) urls << line end urls.sort! { |a,b| a.split(',')[1] <=> b.split(',')[1] } urls.each do |u| f = RepoFeed.new(u) if validate and validate_url(f.url) feeds << f else feeds << f end end feeds end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tentacle-0.1 | lib/tentacle.rb |