Skip to content

Adding feeds

Alex Musayev edited this page May 18, 2024 · 18 revisions

Add new feed:

  • Add new feed to config/feeds.yml

  • Create private group on https://candy.freefeed.net/groups/create

  • Create private group on https://freefeed.net/groups/create

  • Update group description and avatar.

  • Create or reuse processor class.

  • Create or reuse normalizer class.

  • Add new feed test to spec/feeds.

    touch spec/processors/FEEDNAME_processor_spec.rb
    touch spec/normalizers/FEEDNAME_normalizer_spec.rb
  • Create feed fixture:

    mkdir -p spec/fixtures/files/feeds/FEEDNAME
    wget -O spec/fixtures/files/feeds/FEEDNAME/feed.xml https://feeds.feedburner.com/oatmealfeed
  • Create normalized entiry expectation:

    touch spec/fixtures/files/feeds/FEEDNAME/normalized.json
  • Adjust feed normalizer:

    docker-compose run app bundle exec rails c
    FeedsConfiguration.sync
    feed = Feed.find_by(name: 'FEEDNAME')
    
    
    loader = feed.loader_instance
    processor = feed.processor_instance
    normalizer = feed.normalizer_instance
    
    content = loader.call(feed)
    entities = processor.call(content, feed: feed)
    entity = entities.first
    normalized = normalizer.call(entity)
    ap normalized.as_json
  • Test new feed processing on staging.

    docker-compose run sh
    bundle exec rails feeder:pull[einzelganger]
  • Deploy to production.

  • ⚠️ Open public access for the new group.

Clone this wiki locally