chrono_trigger 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbca0c2caa1b69582cd2e5e35bb6df578b9ae913d2da07f8e3b84d76c812ade7
4
- data.tar.gz: 02c0808b8df6dc06be2aa7c8812f1cac72bfb53192c97acb0ba9ba6a48f5225e
3
+ metadata.gz: 0dfebcd3579be37cd3046bfff80788f500b959cff02328dc85ca5486f2612e88
4
+ data.tar.gz: bb4372687bd9fae034c998c97cbffb9809aee2cec79efa33b273f4c3bba42af3
5
5
  SHA512:
6
- metadata.gz: 016a3b4aacbf0c960de0c17885287eb4505da012d130eb6c0ea9a96cd4098d1848cc37af9072d4907816e3c25bc6d2f712ef0f449245cff598020cad6bea184d
7
- data.tar.gz: dfb36735721ce71346ac77bbd0a031f91ffa98082850f89fc1d201a5dafe6de0875cfe36fa6c95f6b39b3233593b5e0006c3bc6792eb2d887991fc19806f74c6
6
+ metadata.gz: b9d39623a63a49b23bc57702d9c3ad67f1f392469ea9897861c422042aec240ee02715662e28dc5f0c66366f38a9dd88b6456293dbbfad22a1f840cb0c423e52
7
+ data.tar.gz: f31e4d3de6b275568e6cf1b8618ef0345536d57e6a6db244a15687932a2781bab1723db4caf1f01806d7fa7be1bcac2377fdc6eb558fdf1905548c14a9916af4
data/README.md CHANGED
@@ -1,2 +1,89 @@
1
- # Initial page
1
+ ---
2
+ description: Make Rails apps that feel alive.
3
+ ---
4
+
5
+ # ChronoTrigger
6
+
7
+ [![GitHub stars](https://img.shields.io/github/stars/leastbad/chrono_trigger?style=social)](https://github.com/leastbad/chrono_trigger) [![GitHub forks](https://img.shields.io/github/forks/leastbad/chrono_trigger?style=social)](https://github.com/leastbad/chrono_trigger) [![Twitter follow](https://img.shields.io/twitter/follow/theleastbad?style=social)](https://twitter.com/theleastbad) [![Discord](https://img.shields.io/discord/681373845323513862)](https://discord.gg/GnweR3)
8
+
9
+ ChronoTrigger is a clock-based scheduler that runs inside your Rails app. Use it to run code \(events\) at specific times and intervals.
10
+
11
+ ![](.gitbook/assets/chrono-trigger.jpg)
12
+
13
+ ## Why use ChronoTrigger?
14
+
15
+ Nobody wants to be the first person to arrive at a club, and yet, this is exactly what most app onboarding processes feel like.
16
+
17
+ A typical visitor will spend _7-12 seconds_ evaluating your hard work before deciding if they will engage. You must convey that _exciting things are happening_, or they will close the tab and forget you exist.
18
+
19
+ **ChronoTrigger is a tool designed to breathe life into otherwise static user interfaces and onboarding experiences.**
20
+
21
+ It allows you to subtly expose users to a crafted narrative that nudges them forward, without feeling like a canned theme park ride. The story is advanced by their actions and their engagement is rewarded with simulated interaction, even if they are user number one.
22
+
23
+ ## Is ChronoTrigger for you?
24
+
25
+ If you spend months building something cool, and then hustle to get people to check it out, you get exactly one chance to make your first and only impression. It's up to you to do everything you can to make sure that your app is special enough to love. To succeed long-term, you need these first users to become cheerleaders and evangelize to their friends.
26
+
27
+ If you think about the stand-out [onboarding success stories](https://www.useronboard.com/user-onboarding-teardowns/) like Slack, they all prioritize anticipating what the user will be thinking, feeling and wondering during each _moment_ of the first minutes the user spends on the site.
28
+
29
+ ChronoTrigger is for developers who are proud of what they have created; tech founders looking for a way to give new users an aspirational story to tell themselves. This converging path leads to feelings of ownership and drives conversion without a hard sell.
30
+
31
+ You will use ChronoTrigger to orchestrate the onboarding experience your app deserves:
32
+
33
+ * interactive demos, charts and UI elements
34
+ * automation / wizards that feel personal
35
+ * placeholder content that changes to help tell a story
36
+ * a path through features instead of just clicking everything
37
+ * simulated human responses and exchanges
38
+
39
+ ### Why not ActiveJob?
40
+
41
+ ActiveJob is amazing, but creating Jobs for typical ChronoTrigger use cases feels like taking a taxi to the next house.
42
+
43
+ Jobs are not designed to run immediately, and priority should be given to important things like mail delivery. There's also functionality in the Event class that would be hard to retrofit to Job classes.
44
+
45
+ It's also worth mentioning that requiring Sidekiq would require Heroku users to set up a worker dyno, even if you're not using ActiveJob. Finally, Sidekiq sometimes runs jobs multiple times!
46
+
47
+ ## How does ChronoTrigger work?
48
+
49
+ ChronoTrigger runs on real world time, like trains. Every second, on the second, ChronoTrigger decides whether there are new events to run. If so, there's a thread-safe and highly-optimized pool of workers waiting.
50
+
51
+ {% hint style="info" %}
52
+ Other event scheduling libraries tend to be either `cron` wrappers or use timing offsets \(think: `sleep 1`\) from whenever they are called and don't factor in their own timing footprint. In other words, 1000 loops later, more than 1000 seconds have passed. No good!
53
+ {% endhint %}
54
+
55
+ You start the ChronoTrigger Clock after your web server, and it runs inside your Rails app process.
56
+
57
+ ChronoTrigger Events live in `app/events` and follow a structure that will be familiar to ActiveJob users.
58
+
59
+ You can schedule Events from anywhere in your application that it makes sense to do so, such as:
60
+
61
+ * Controller actions and webhook callbacks
62
+ * ActiveRecord model callbacks
63
+ * Devise session/registration callbacks
64
+ * Reflex action methods
65
+ * ActionCable Connection/Channel subscription callbacks
66
+
67
+ ## Design concepts and goals
68
+
69
+ * Not a replacement for ActiveJob \(or cron!\)
70
+ * Events are ephemeral and disposable; failure should be fine 🤷
71
+ * Borrow the best ideas from the ActiveJob and CableReady APIs
72
+ * ActiveSupport::TimeWithZone all the way down
73
+ * All times are today, rounded to 1s for easy comparison
74
+ * Times are memoized to avoid side effects
75
+ * Events should be short term and soon; _there is no tomorrow_
76
+ * Run in-process with no additional infrastructure dependencies
77
+
78
+ ## Key features and advantages
79
+
80
+ * A natural fit with [CableReady](https://cableready.stimulusreflex.com/)
81
+ * Easy to learn, quick to implement
82
+ * Plays well with tools such as [StimulusReflex](https://docs.stimulusreflex.com/) and [Turbo Drive](https://turbo.hotwire.dev/handbook/drive)
83
+ * Configurable via an optional initializer file
84
+ * Worker pool provided by the excellent [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby) library
85
+
86
+ ## Try it now
87
+
88
+ ![](.gitbook/assets/soon.jpg)
2
89
 
data/SUMMARY.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Table of contents
2
2
 
3
- * [Initial page](README.md)
3
+ * [ChronoTrigger](README.md)
4
+ * [Setup](setup.md)
4
5
 
@@ -15,7 +15,6 @@ module ChronoTrigger
15
15
  after: @after
16
16
  )
17
17
  new(options, args)
18
- id
19
18
  end
20
19
 
21
20
  def scope(value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChronoTrigger
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
@@ -4,7 +4,7 @@ module ChronoTrigger
4
4
  class Worker < Concurrent::Actor::RestartingContext
5
5
  def on_message(event)
6
6
  Rails.logger.debug "ChronoTrigger: #{event.inspect}"
7
- event.perform(*event.args) if event.at.nil? || (event.before && event.at < event.before)
7
+ event.perform(*event.args) if event.at.nil? || (event.before && event.at < event.before) || event.repeats == :forever
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chrono_trigger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - leastbad
@@ -165,10 +165,12 @@ files:
165
165
  - lib/chrono_trigger/timeline.rb
166
166
  - lib/chrono_trigger/version.rb
167
167
  - lib/chrono_trigger/worker.rb
168
- homepage: https://github.com/leastbad/chrono_trigger
168
+ homepage: https://chronotrigger.leastbad.com/
169
169
  licenses:
170
170
  - MIT
171
- metadata: {}
171
+ metadata:
172
+ source_code_uri: https://github.com/leastbad/chrono_trigger
173
+ documentation_uri: https://chronotrigger.leastbad.com/
172
174
  post_install_message:
173
175
  rdoc_options: []
174
176
  require_paths: