simple-feed 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +5 -5
- data/.github/workflows/ruby.yml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.adoc +37 -28
- data/README.pdf +25720 -12
- data/lib/simplefeed/providers/redis/driver.rb +1 -3
- data/lib/simplefeed/version.rb +1 -1
- data/lib/simplefeed.rb +1 -1
- data/simple-feed.gemspec +0 -1
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9463006c8c234e72c14d26c56c144cc6cc0a2e38a9061a1c98369c30568820ef
|
4
|
+
data.tar.gz: e85378ed78e2ebe0a78a2b74e51f3b5c5dab953b205e738216ccdaebaf6bff0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd55bf28d6aaacccbd88f27535ca4cee49a425b8a469b01f14fbcd549b928ecd1c97b4dcbdf0bdc88d9ea800c03184163c7008cf654254246f2f64e8936673f
|
7
|
+
data.tar.gz: b7a34d5a6630f4142e79af74847f18e7bbc34251062664b7f7b427a641943d153cb182de4dc0b340deadc2ede93fded703709bf3c6a3710e5e0356862bfc3bdd
|
@@ -3,9 +3,9 @@ name: Rubocop
|
|
3
3
|
|
4
4
|
on:
|
5
5
|
push:
|
6
|
-
branches: [
|
6
|
+
branches: [ main ]
|
7
7
|
pull_request:
|
8
|
-
branches: [
|
8
|
+
branches: [ main ]
|
9
9
|
|
10
10
|
jobs:
|
11
11
|
test:
|
@@ -21,11 +21,11 @@ jobs:
|
|
21
21
|
REDIS_HOST: redis
|
22
22
|
REDIS_PORT: 6379
|
23
23
|
steps:
|
24
|
-
- uses: actions/checkout@
|
24
|
+
- uses: actions/checkout@v4
|
25
25
|
- uses: ruby/setup-ruby@v1
|
26
26
|
with:
|
27
|
-
ruby-version: 3.
|
28
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
27
|
+
ruby-version: 3.3 # Not needed with a .ruby-version file
|
28
|
+
bundler-cache: true # # runs 'bundle install' and caches installed gems automatically
|
29
29
|
- run: |
|
30
30
|
gem update --system
|
31
31
|
gem install bundler
|
data/.github/workflows/ruby.yml
CHANGED
@@ -3,9 +3,9 @@ name: RSpec
|
|
3
3
|
|
4
4
|
on:
|
5
5
|
push:
|
6
|
-
branches: [
|
6
|
+
branches: [ main ]
|
7
7
|
pull_request:
|
8
|
-
branches: [
|
8
|
+
branches: [ main ]
|
9
9
|
|
10
10
|
jobs:
|
11
11
|
test:
|
@@ -22,10 +22,10 @@ jobs:
|
|
22
22
|
REDIS_HOST: redis
|
23
23
|
REDIS_PORT: 6379
|
24
24
|
steps:
|
25
|
-
- uses: actions/checkout@
|
25
|
+
- uses: actions/checkout@v4
|
26
26
|
- uses: ruby/setup-ruby@v1
|
27
27
|
with:
|
28
|
-
ruby-version: 3.
|
28
|
+
ruby-version: 3.3 # Not needed with a .ruby-version file
|
29
29
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
30
30
|
- run: |
|
31
31
|
gem update --system
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.1.2](https://github.com/kigster/simple-feed/tree/v3.1.2) (2022-02-23)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/kigster/simple-feed/compare/v3.1.1...v3.1.2)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Awesome print should be a regular dependency if it will be required [\#31](https://github.com/kigster/simple-feed/pull/31) ([danigirl329](https://github.com/danigirl329))
|
10
|
+
|
3
11
|
## [v3.1.1](https://github.com/kigster/simple-feed/tree/v3.1.1) (2022-02-22)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/kigster/simple-feed/compare/v3.1.0...v3.1.1)
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2016 Konstantin Gredeskoul
|
3
|
+
Copyright (c) 2016-2022 Konstantin Gredeskoul
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.adoc
CHANGED
@@ -3,25 +3,33 @@
|
|
3
3
|
:toc:
|
4
4
|
:toclevels: 5
|
5
5
|
:sectnums:
|
6
|
+
:icons: font
|
6
7
|
|
7
|
-
|
8
|
+
====
|
8
9
|
|
9
|
-
|
10
|
+
https://liberapay.com/kigster/donate[image:https://liberapay.com/assets/widgets/donate.svg[Donate using Liberapay,height=30]]
|
10
11
|
|
11
|
-
image:https://img.shields.io/
|
12
|
-
|
12
|
+
https://liberapay.com/kigster/donate[image:https://img.shields.io/liberapay/goal/kigster.svg?logo=liberapay[https://img.shields.io/liberapay/goal/kigster,height=50]]
|
13
|
+
====
|
13
14
|
|
14
|
-
|
15
|
-
image:https://github.com/kigster/simple-feed/workflows/Rubocop/badge.svg?branch=master[Rubocop,link=https://github.com/kigster/simple-feed/actions?query=workflow%3ARubocop]
|
15
|
+
== Scalable, Easy to Use Activity (aka "News") Feed
|
16
16
|
|
17
|
-
|
18
|
-
image:http://inch-ci.org/github/kigster/simple-feed.svg?branch=master[Inline docs,link=http://inch-ci.org/github/kigster/simple-feed]
|
17
|
+
=== What is this gem? — A Quick Summary
|
19
18
|
|
20
|
-
|
19
|
+
NOTE: This gem is the Redis-backed backend implementation for a reverse chronological order news feed for a typical social network similar in some ways to Twitter: where users have followers, but also topics or a categories can have followers. When an event is posted by a user, it is also pushed to various individual feeds, and the gem then offers `O(1)` speed pagination for reading any page of the feed. The limitation is that the number of feed items must be capped (the default is 4000 items). The implementation can be scaled horizontally by sharding Redis backend, which can be implemented using a Redis Proxy layer such as https://github.com/twitter/twemproxy[Twemproxy] or https://github.com/envoyproxy/envoy/issues/19436[Envoy]).
|
20
|
+
|
21
|
+
=== Build & Gem Status
|
22
|
+
|
23
|
+
image:https://img.shields.io/badge/license-MIT-blue.svg[MIT licensed,link=https://github.com/kigster/simple-feed/main/LICENSE.txt]
|
24
|
+
image:https://github.com/kigster/simple-feed/actions/workflows/ruby.yml/badge.svg[RSpec,link=https://github.com/kigster/simple-feed/actions/workflows/ruby.yml]
|
25
|
+
image:https://github.com/kigster/simple-feed/actions/workflows/rubocop.yml/badge.svg[Rubocop,link=https://github.com/kigster/simple-feed/actions/workflows/rubocop.yml]
|
26
|
+
|
27
|
+
image:https://img.shields.io/gem/v/simple-feed.svg[Gem Version,link=https://rubygems.org/gems/simple-feed]
|
28
|
+
image:https://codecov.io/gh/kigster/simple-feed/branch/master/graph/badge.svg?token=RvDkGqoahz[Coverage,link=https://codecov.io/gh/kigster/simple-feed]
|
21
29
|
|
22
30
|
=== Test Coverage Map
|
23
31
|
|
24
|
-
image:https://codecov.io/gh/kigster/simple-feed/
|
32
|
+
image:https://codecov.io/gh/kigster/simple-feed/graphs/sunburst.svg?token=RvDkGqoahz[Coverage Map,link=https://codecov.io/gh/kigster/simple-feed/branch/master]
|
25
33
|
|
26
34
|
IMPORTANT: Please read the (somewhat outdated) blog post http://kig.re/2017/02/19/feeding-frenzy-with-simple-feed-activity-feed-ruby-gem.html[Feeding Frenzy with SimpleFeed] launching this library. Please leave comments or questions in the discussion thread at the bottom of that post. Thanks!
|
27
35
|
|
@@ -36,25 +44,26 @@ This is a fast, pure-ruby implementation of an activity feed concept commonly us
|
|
36
44
|
* SimpleFeed _does not depend on Ruby on Rails_ and is a *pure-ruby* implementation
|
37
45
|
* SimpleFeed requires MRI Ruby 2.3 or later
|
38
46
|
* SimpleFeed is currently live in production
|
47
|
+
* SimpleFeed can use https://github.com/redis/hiredis[hiredis] if you install it separately and load it before loading the gem.
|
39
48
|
* SimpleFeed is open source thanks to the generosity of *http://simbi.com[Simbi, Inc]*.
|
40
49
|
|
41
50
|
== Features
|
42
51
|
|
43
52
|
SimpleFeed is a Ruby Library that can be plugged into any application to power a fast, Redis-based activity feed implementation so common on social networking sites. SimpleFeed offers the following features:
|
44
53
|
|
45
|
-
*
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
*
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
* Modelled after graph-relationships similar to those on Twitter (bi-directional independent follow relationships):
|
55
|
+
** Feed maintains a reverse-chronological order for heterogeneous events for each user.
|
56
|
+
** It offers a constant time lookup for user's feed, avoiding complex SQL joins to render it.
|
57
|
+
** An API to read/paginate the feed for a given user
|
58
|
+
** As well as to *query the total unread items in the feed* since it was last read by the user (typically shown on App icons).
|
59
|
+
* Scalable and well performing Redis-based activity feed —
|
60
|
+
** Scales to millions of users (will need to use Twemproxy to shard across several Redis instances)
|
61
|
+
** Stores a fixed number of events for each unique "user" — the default is 1000. When the feed reaches 1001 events, the oldest event is offloaded from the activity.
|
62
|
+
* Implementation properties:
|
63
|
+
** Fully thread-safe implementation, writing events can be done in eg. Sidekiq.
|
64
|
+
** Zero assumptions about what you are storing: the "data" is just a string. Serialize it with JSON, Marshall, YAML, or whatever.
|
65
|
+
** You can create as many different types of feeds per application as you like (no Ruby Singletons used).
|
66
|
+
** Customize mapping from `user_id` to the activity id based on your business logic (more on this later).
|
58
67
|
|
59
68
|
=== Publishing Events
|
60
69
|
|
@@ -111,7 +120,7 @@ Please read the additional documentation, including the examples, on the https:/
|
|
111
120
|
|
112
121
|
Below is a screen shot of an actual activity feed powered by this library.
|
113
122
|
|
114
|
-
image::https://raw.githubusercontent.com/kigster/simple-feed/
|
123
|
+
image::https://raw.githubusercontent.com/kigster/simple-feed/main/man/activity-feed-action.png[usage]
|
115
124
|
|
116
125
|
=== Providers
|
117
126
|
|
@@ -430,7 +439,7 @@ The DSL context has access to two additional methods:
|
|
430
439
|
|
431
440
|
Below is an example output of `color_dump` method, which is intended for the debugging purposes.
|
432
441
|
|
433
|
-
image::https://raw.githubusercontent.com/kigster/simple-feed/
|
442
|
+
image::https://raw.githubusercontent.com/kigster/simple-feed/main/man/sf-color-dump.png[title=#color_dump method output, width=659, link=https://raw.githubusercontent.com/kigster/simple-feed/main/man/sf-color-dump.png]
|
434
443
|
|
435
444
|
+++<a name="api">++++++</a>+++
|
436
445
|
|
@@ -521,7 +530,7 @@ If you set environment variable `REDIS_DEBUG` to `true` and run the example (see
|
|
521
530
|
|
522
531
|
Source code for the gem contains the `examples` folder with an example file that can be used to test out the providers, and see what they do under the hood.
|
523
532
|
|
524
|
-
Both the specs and the example requires a local redis instance to be available.
|
533
|
+
Both the specs and the example requires a local redis instance to be available.
|
525
534
|
|
526
535
|
To run it, checkout the source of the library, and then:
|
527
536
|
|
@@ -547,11 +556,11 @@ ruby examples/redis_provider_example.rb
|
|
547
556
|
|
548
557
|
The above command will help you download, setup all dependencies, and run the examples for a single user:
|
549
558
|
|
550
|
-
image::https://raw.githubusercontent.com/kigster/simple-feed/
|
559
|
+
image::https://raw.githubusercontent.com/kigster/simple-feed/main/man/running-example.png[title=Running Redis Example in a Terminal, width=663, link=https://raw.githubusercontent.com/kigster/simple-feed/main/man/running-example.png]
|
551
560
|
|
552
561
|
If you set `REDIS_DEBUG` variable prior to running the example, you will be able to see every single Redis command executed as the example works its way through. Below is a sample output:
|
553
562
|
|
554
|
-
image::https://raw.githubusercontent.com/kigster/simple-feed/
|
563
|
+
image::https://raw.githubusercontent.com/kigster/simple-feed/main/man/running-example-redis-debug.png[title=Running Redis Example with REDIS_DEBUG set, width=918, link=https://raw.githubusercontent.com/kigster/simple-feed/main/man/running-example-redis-debug.png]
|
555
564
|
|
556
565
|
=== Generating Ruby API Documentation
|
557
566
|
|