Class: Tentacle::FeedCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/tentacle.rb

Class Method Summary collapse

Class Method Details

.all(validate = false) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tentacle.rb', line 24

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