Giter Club home page Giter Club logo

feedjira-redis's Introduction

feedjira-redis

Build Status Gem Version

FeedjiraRedis uses Datamapper's dm-redis-adapter to provide a persistance layer for the feedjira RSS/Atom feed consumption library.

Example Usage

FeedjiraRedis can be used in much the same fashion as feedjira itself. One common use for FeedjiraRedis is to avoid updating the feed with every page hit, so you could update the feed from a Rakefile on a cron job instead.

Shared

DataMapper.setup(:default, { :adapter  => 'redis' })
FEED_URL = 'https://github.com/logankoester/feedjira-redis/commits/master.atom'

Rakefile

namespace :blog do
  desc 'Grab the latest blog posts'
  task :update do
    FeedjiraRedis::Feed.fetch_and_parse(FEED_URL)
  end
end

FeedjiraRedis::Feed is actually a Datamapper model that wraps the interface to Feedjira::Feed with some code to add persistence. Feeds are uniquely identified by their feed_url property, so when you call fetch_and_parse or update a second time the new entries are associated with the original feed.

Run rake blog:update to grab some entries.

Action

Now you just need to fetch the object your Rakefile created.

@feed = FeedjiraRedis::Feed.first(:feed_url => FEED_URL)

View

FeedjiraRedis::Entry is also a Datamapper model, but it shares the same properties as Feedjira::Entry.

%h1= @feed.title
  - @feed.entries.each do |e|
    %h2= e.title
    %p= e.content

See the Feedjira documentation or read the code (it's short!) for further details.

Contributing to feedjira-redis

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2011-2014 Logan Koester. See LICENSE.txt for further details.

feedjira-redis's People

Contributors

logankoester avatar scicco avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

scicco

feedjira-redis's Issues

migration error from a rails project

Hi again @logankoester ,

i tried the new version using it against a migration on my rails project. When you launch it you get this error:

LoadError: cannot load such file -- dm-aggregates

If you add data_mapper dependency on Gemfile of my project everything works as expected.

I think data_mapper gem should be added as dependency on this project. In my case i used data_mapper (1.2.0) as version

see #3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.