You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
1.2 KiB

  1. $:.unshift File.join(File.dirname(__FILE__),'lib')
  2. BIOGEMS = './data/biogems.yaml'
  3. RUBYGEMS = './data/rubygems.yaml'
  4. GENERATE_DATA_FILES = [
  5. BIOGEMS,
  6. RUBYGEMS,
  7. './data/news.yaml'
  8. ]
  9. file BIOGEMS => [ :biogems ]
  10. file RUBYGEMS => [ :biogems ]
  11. file "./source/rss.xml" => ["./data/biogems.yaml", "./etc/blogs.yaml"] do |t|
  12. require 'biogems/rss'
  13. projects, blogs = t.prerequisite_tasks.map(&:name)
  14. File.open(t.name,'w') do |f|
  15. f.print generate_biogems_rss_feed(projects, blogs, 50).to_s
  16. end
  17. end
  18. file "./data/news.yaml" =>"./source/rss.xml" do |t|
  19. require 'yaml'
  20. require 'rss'
  21. feed = RSS::Parser.parse File.read(t.prerequisite_tasks[0].name), false
  22. site_news = feed.items.inject(Array.new) do |news, item|
  23. if item.date.to_i > Time.now.to_i - 356*24*3600
  24. entry = { :title => item.title, :date => item.date, :link => item.link }
  25. news << entry
  26. end
  27. news
  28. end
  29. File.open(t.name,'w'){|f| YAML.dump(site_news,f) }
  30. end
  31. task :rss => [ "./source/rss.xml" ]
  32. desc "Fetch gem info and write to data directory (optionally use -- --test)"
  33. task :biogems do |t|
  34. %x{./bin/fetch-geminfo.rb #{ARGV.join(' ')} 1>&2}
  35. end
  36. task :default => [ :biogems ] do
  37. `middleman build`
  38. end