cable_ready 5.0.0.pre6 → 5.0.0.pre9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,8 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cable_ready (5.0.0.pre6)
5
- rails (>= 5.2)
4
+ cable_ready (5.0.0.pre8)
5
+ actioncable (>= 5.2)
6
+ actionpack (>= 5.2)
7
+ actionview (>= 5.2)
8
+ activerecord (>= 5.2)
9
+ activesupport (>= 5.2)
10
+ railties (>= 5.2)
6
11
  thread-local (>= 1.1.0)
7
12
 
8
13
  GEM
@@ -67,107 +72,41 @@ GEM
67
72
  minitest (>= 5.1)
68
73
  tzinfo (~> 2.0)
69
74
  zeitwerk (~> 2.3)
70
- addressable (2.8.0)
71
- public_suffix (>= 2.0.2, < 5.0)
72
75
  ast (2.4.2)
73
- async (1.30.1)
74
- console (~> 1.10)
75
- nio4r (~> 2.3)
76
- timers (~> 4.1)
77
- async-http (0.56.5)
78
- async (>= 1.25)
79
- async-io (>= 1.28)
80
- async-pool (>= 0.2)
81
- protocol-http (~> 0.22.0)
82
- protocol-http1 (~> 0.14.0)
83
- protocol-http2 (~> 0.14.0)
84
- async-http-faraday (0.11.0)
85
- async-http (~> 0.42)
86
- faraday
87
- async-io (1.32.2)
88
- async
89
- async-pool (0.3.8)
90
- async (>= 1.25)
91
76
  builder (3.2.4)
92
77
  coderay (1.1.3)
93
78
  concurrent-ruby (1.1.9)
94
- console (1.13.1)
95
- fiber-local
96
79
  crass (1.0.6)
97
80
  erubi (1.10.0)
98
- faraday (1.7.0)
99
- faraday-em_http (~> 1.0)
100
- faraday-em_synchrony (~> 1.0)
101
- faraday-excon (~> 1.1)
102
- faraday-httpclient (~> 1.0.1)
103
- faraday-net_http (~> 1.0)
104
- faraday-net_http_persistent (~> 1.1)
105
- faraday-patron (~> 1.0)
106
- faraday-rack (~> 1.0)
107
- multipart-post (>= 1.2, < 3)
108
- ruby2_keywords (>= 0.0.4)
109
- faraday-em_http (1.0.0)
110
- faraday-em_synchrony (1.0.0)
111
- faraday-excon (1.1.0)
112
- faraday-http-cache (2.2.0)
113
- faraday (>= 0.8)
114
- faraday-httpclient (1.0.1)
115
- faraday-net_http (1.0.1)
116
- faraday-net_http_persistent (1.2.0)
117
- faraday-patron (1.0.0)
118
- faraday-rack (1.0.0)
119
- fiber-local (1.0.0)
120
- github_changelog_generator (1.16.4)
121
- activesupport
122
- async (>= 1.25.0)
123
- async-http-faraday
124
- faraday-http-cache
125
- multi_json
126
- octokit (~> 4.6)
127
- rainbow (>= 2.2.1)
128
- rake (>= 10.0)
129
- globalid (0.5.2)
81
+ globalid (1.0.0)
130
82
  activesupport (>= 5.0)
131
- i18n (1.8.10)
83
+ i18n (1.8.11)
132
84
  concurrent-ruby (~> 1.0)
133
- loofah (2.12.0)
85
+ loofah (2.13.0)
134
86
  crass (~> 1.0.2)
135
87
  nokogiri (>= 1.5.9)
136
88
  magic_frozen_string_literal (1.2.0)
137
89
  mail (2.7.1)
138
90
  mini_mime (>= 0.1.1)
139
91
  marcel (1.0.2)
140
- method_source (0.9.2)
92
+ method_source (1.0.0)
141
93
  mini_mime (1.1.2)
142
- mini_portile2 (2.6.1)
143
94
  minitest (5.14.4)
144
95
  mocha (1.13.0)
145
- multi_json (1.15.0)
146
- multipart-post (2.1.1)
147
96
  nio4r (2.5.8)
148
- nokogiri (1.12.5)
149
- mini_portile2 (~> 2.6.1)
97
+ nokogiri (1.13.3-x86_64-darwin)
150
98
  racc (~> 1.4)
151
- octokit (4.21.0)
152
- faraday (>= 0.9)
153
- sawyer (~> 0.8.0, >= 0.5.3)
154
- parallel (1.20.1)
99
+ nokogiri (1.13.3-x86_64-linux)
100
+ racc (~> 1.4)
101
+ parallel (1.21.0)
155
102
  parser (3.0.2.0)
156
103
  ast (~> 2.4.1)
157
- protocol-hpack (1.4.2)
158
- protocol-http (0.22.5)
159
- protocol-http1 (0.14.1)
160
- protocol-http (~> 0.22)
161
- protocol-http2 (0.14.2)
162
- protocol-hpack (~> 1.4)
163
- protocol-http (~> 0.18)
164
- pry (0.12.2)
165
- coderay (~> 1.1.0)
166
- method_source (~> 0.9.0)
167
- pry-nav (0.3.0)
168
- pry (>= 0.9.10, < 0.13.0)
169
- public_suffix (4.0.6)
170
- racc (1.5.2)
104
+ pry (0.14.1)
105
+ coderay (~> 1.1)
106
+ method_source (~> 1.0)
107
+ pry-nav (1.0.0)
108
+ pry (>= 0.9.10, < 0.15)
109
+ racc (1.6.0)
171
110
  rack (2.2.3)
172
111
  rack-test (1.1.0)
173
112
  rack (>= 1.0, < 3)
@@ -201,62 +140,59 @@ GEM
201
140
  rake (13.0.6)
202
141
  regexp_parser (2.1.1)
203
142
  rexml (3.2.5)
204
- rubocop (1.18.4)
143
+ rubocop (1.22.3)
205
144
  parallel (~> 1.10)
206
145
  parser (>= 3.0.0.0)
207
146
  rainbow (>= 2.2.2, < 4.0)
208
147
  regexp_parser (>= 1.8, < 3.0)
209
148
  rexml
210
- rubocop-ast (>= 1.8.0, < 2.0)
149
+ rubocop-ast (>= 1.12.0, < 2.0)
211
150
  ruby-progressbar (~> 1.7)
212
151
  unicode-display_width (>= 1.4.0, < 3.0)
213
- rubocop-ast (1.10.0)
152
+ rubocop-ast (1.13.0)
214
153
  parser (>= 3.0.1.1)
215
- rubocop-performance (1.11.4)
154
+ rubocop-performance (1.11.5)
216
155
  rubocop (>= 1.7.0, < 2.0)
217
156
  rubocop-ast (>= 0.4.0)
218
157
  ruby-progressbar (1.11.0)
219
- ruby2_keywords (0.0.5)
220
- sawyer (0.8.2)
221
- addressable (>= 2.3.5)
222
- faraday (> 0.8, < 2.0)
223
158
  sprockets (4.0.2)
224
159
  concurrent-ruby (~> 1.0)
225
160
  rack (> 1, < 3)
226
- sprockets-rails (3.2.2)
227
- actionpack (>= 4.0)
228
- activesupport (>= 4.0)
161
+ sprockets-rails (3.4.2)
162
+ actionpack (>= 5.2)
163
+ activesupport (>= 5.2)
229
164
  sprockets (>= 3.0.0)
230
165
  sqlite3 (1.4.2)
231
- standard (1.1.7)
232
- rubocop (= 1.18.4)
233
- rubocop-performance (= 1.11.4)
166
+ standard (1.4.0)
167
+ rubocop (= 1.22.3)
168
+ rubocop-performance (= 1.11.5)
234
169
  standardrb (1.0.0)
235
170
  standard
236
171
  thor (1.1.0)
237
172
  thread-local (1.1.0)
238
- timers (4.3.3)
239
173
  tzinfo (2.0.4)
240
174
  concurrent-ruby (~> 1.0)
241
- unicode-display_width (2.0.0)
175
+ unicode-display_width (2.1.0)
242
176
  websocket-driver (0.7.5)
243
177
  websocket-extensions (>= 0.1.0)
244
178
  websocket-extensions (0.1.5)
245
- zeitwerk (2.4.2)
179
+ zeitwerk (2.5.1)
246
180
 
247
181
  PLATFORMS
248
- ruby
182
+ x86_64-darwin-18
183
+ x86_64-darwin-19
184
+ x86_64-linux
249
185
 
250
186
  DEPENDENCIES
251
187
  cable_ready!
252
- github_changelog_generator
253
188
  magic_frozen_string_literal
254
189
  mocha
255
190
  pry
256
191
  pry-nav
192
+ rails (>= 5.2)
257
193
  rake
258
194
  sqlite3
259
195
  standardrb
260
196
 
261
197
  BUNDLED WITH
262
- 2.2.19
198
+ 2.2.33
data/IMPLEMENTATION.md ADDED
@@ -0,0 +1,93 @@
1
+ # CableReady Language Implementation Project
2
+
3
+ We believe that CableReady can become the universal standard tool for developers to dynamically control client browsers from the server. While the project has roots in the Ruby on Rails community, the JS client is unopinionated about how the simple JSON structure that it consumes was created.
4
+
5
+ We would like to announce support for Python, Go, C#, Java, PHP and NodeJS server libraries in early 2022. While there's a broad set of features a server library could implement, there's a baseline that we'd like to make sure all implementations can offer.
6
+
7
+ ## Background
8
+
9
+ CableReady was started in 2017 by Nate Hopkins. It predates LiveView and the HTML-on-the-wire trend by 18 months. It sees roughly 15,000 downloads per week and offers 36 different [operations](https://cableready.stimulusreflex.com/v/v5/reference/operations).
10
+
11
+ CableReady is currently a client-side JS module and a server-side Ruby module.
12
+
13
+ ## Key concepts
14
+
15
+ - available everywhere
16
+ - multiple operations per payload
17
+ - schemaless
18
+ - simple JSON wire format
19
+ - method chaining
20
+ - transport agnostic
21
+ - extensible via custom operations
22
+
23
+ ### Available everywhere
24
+
25
+ Rails developers can access a `cable_ready` singleton from just about anywhere in their application, and we believe it's a big part of the secret sauce. While every language and framework has their own idioms, we encourage implementors to remove barriers and make it easy to call CableReady anywhere it could be useful.
26
+
27
+ https://cableready.stimulusreflex.com/v/v5/cableready-everywhere
28
+
29
+ ### Operations and their options
30
+
31
+ Operations are the basic atomic unit of activity in CableReady. Each operation typically has a very specific focus and often mimics the DOM JS spec for the activity in question. Operations have options passed to them which specify their exact behavior.
32
+
33
+ Multiple operations can be prepared together. They will be executed in the order that they were created. Different operation types can be mixed together in one payload.
34
+
35
+ The Ruby implementation offers two interfaces; the (original) primary mechanism delivers the operations to a WebSocket channel in what we refer to as a "broadcast". The other - known as "cable car" - returns a JSON string that can be sent, persisted or displayed for any purpose.
36
+
37
+ ### Schemaless
38
+
39
+ CableReady operations each have their own mandatory and optional options, along with options that are provided to every operation by the library. However, arbitrary additional options can be passed to an operation and they will be passed to the client. This makes it easy for CableReady to form the basis of much larger projects, such as StimulusReflex.
40
+
41
+ ### JSON wire format
42
+
43
+ As of v5.0, the CableReady JSON wire format is an array of objects, where each object represents one operation. It's intentionally very simple.
44
+
45
+ ```json
46
+ [{\"message\":\"Hello!\",\"operation\":\"consoleLog\"}]
47
+ ```
48
+
49
+ Each operation has **camelCased** key/value pairs that convey options. Every operation must have an `operation` value, or the client will raise an exception.
50
+
51
+ ### Method chaining
52
+
53
+ Developer experience is a high priority. We take pride in the readability and expressiveness offered by our server API. The basic pseudocode structure we provide looks like:
54
+
55
+ ```rb
56
+ cable_ready[:foo].operation(options).broadcast
57
+ ```
58
+
59
+ In other words, the first method `cable_ready` starts a method chain by returning `self`, and then each operation is a method that also returns the chain started by the initial method. In this way, you can chain together as many operations as you like. Finally, we have a `broadcast` method which takes the current chain and broadcasts it via WebSockets to the `:foo` channel.
60
+
61
+ We also have our "cable car" interface which emits JSON when `to_json` is called. This makes it perfect for responding to Ajax fetch requests:
62
+
63
+ ```rb
64
+ cable_car.operation(options).to_json
65
+ ```
66
+
67
+ The `cable_car` might be assembled in steps, perhaps via a control loop:
68
+
69
+ ```rb
70
+ inspiration = cable_car.console_log(message: "Hello there!").dispatch_event(name: "fred", detail: {inspiring: true})
71
+ 3.times do |i|
72
+ inspiration.console_log(message: "Still here: #{i}")
73
+ end
74
+ inspiration.to_json
75
+ ```
76
+
77
+ The main expectation that should hold between languages is that you will start the chain with a command, add one or many operation methods, and then execute the chain.
78
+
79
+ ### Transport agnostic
80
+
81
+ CableReady started its life as a WebSocket library, but the neutral JSON format has potential far beyond just WebSocket usage. We now frequently return CableReady JSON payloads via Ajax as well. There's nothing stopping you from embedding payloads into a DOM element attribute, for example.
82
+
83
+ We believe that a minimally viable CableReady server library must be able to produce compatible JSON. There's no hard requirement that it interface with WebSockets, although we do find this to be a major sweet spot and will do our best to provide support.
84
+
85
+ ### Custom operations
86
+
87
+ While CableReady ships with an impressive number of operations out of the box, users should be able to add their own operations. Admittedly, the method used to dynamically create all of the methods for each operation is the [most sophisticated](https://github.com/stimulusreflex/cable_ready/blob/master/lib/cable_ready/operation_builder.rb) one in our framework, but again, we're here to help.
88
+
89
+ https://cableready.stimulusreflex.com/v/v5/customization#custom-operations
90
+
91
+ # Get involved!
92
+
93
+ We have a wonderful community with over 1600 folks on our Discord server, helping people get started. Come join https://discord.gg/stimulus-reflex and drop by the #cable_ready channel with any questions.
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  <p align="center">
2
- <img src="https://gitcdn.link/repo/stimulusreflex/cable_ready/master/assets/cable-ready-logo-with-copy.svg" width="360" />
2
+ <img src="https://raw.githubusercontent.com/stimulusreflex/cable_ready/master/assets/cable-ready-logo-with-copy.svg" width="360" />
3
3
  <h1 align="center">Welcome to CableReady 👋</h1>
4
4
  <p align="center">
5
- <a href="https://rubygems.org/gems/cable_ready">
5
+ <a href="https://rubygems.org/gems/cable_ready">
6
6
  <img src="https://img.shields.io/gem/v/cable_ready.svg?color=red" />
7
- </a>
8
- <a href="https://www.npmjs.com/package/cable_ready">
7
+ </a>
8
+ <a href="https://www.npmjs.com/package/cable_ready">
9
9
  <img src="https://img.shields.io/npm/v/cable_ready.svg?color=blue" />
10
10
  </a>
11
11
  <a href="https://www.npmjs.com/package/cable_ready">
@@ -60,12 +60,41 @@ to learn more about ActionCable before proceeding.
60
60
 
61
61
  ## 🚀 Install
62
62
 
63
+ ### Rubygem
64
+
63
65
  ```sh
64
- bundle add cable_ready && yarn add cable_ready
66
+ bundle add cable_ready
65
67
  ```
66
68
 
67
- Checkout the [documentation](https://cableready.stimulusreflex.com) to continue!
69
+ ### JavaScript
70
+
71
+ There are a few ways to install the CableReady JavaScript client, depending on your application setup.
72
+
73
+ #### ESBuild / Webpacker
74
+
75
+ ```sh
76
+ yarn add cable_ready
77
+ ```
78
+
79
+ #### Import maps:
68
80
 
81
+ ```ruby
82
+ # config/importmap.rb
83
+
84
+ # ...
85
+
86
+ pin 'cable_ready', to: 'cable_ready.min.js', preload: true
87
+ ```
88
+
89
+ #### Rails Asset pipeline (Sprockets):
90
+
91
+ ```html+erb
92
+ <!-- app/views/layouts/application.html.erb -->
93
+
94
+ <%= javascript_include_tag "cable_ready.umd.min.js", "data-turbo-track": "reload" %>
95
+ ```
96
+
97
+ Checkout the [documentation](https://cableready.stimulusreflex.com) to continue!
69
98
 
70
99
  ## 🙏 Contributing
71
100
 
@@ -82,11 +111,15 @@ Please run `./bin/standardize` prior submitting pull requests.
82
111
 
83
112
  ### 📦 Releasing
84
113
 
85
- 1. Bump version number at `lib/cable_ready/version.rb`
86
- 2. Run `rake build`
87
- 3. Run `rake release`
88
- 4. Run `yarn publish --no-git-tag-version`
89
- 5. Commit and push changes to the `package.json` file
114
+ 1. Make sure that you run `yarn` and `bundle` to pick up the latest.
115
+ 1. Bump version number at `lib/cable_ready/version.rb`. Pre-release versions use `.preN`
116
+ 1. Run `rake build` and `yarn build`
117
+ 1. Commit and push changes to github
118
+ 1. Run `rake release`
119
+ 1. Run `yarn publish --no-git-tag-version`
120
+ 1. Yarn will prompt you for the new version. Pre-release versions use `-preN`
121
+ 1. Commit and push changes to GitHub
122
+ 1. Create a new release on GitHub ([here](https://github.com/stimulusreflex/stimulus_reflex/releases)) and generate the changelog for the stable release for it
90
123
 
91
124
  ## 📝 License
92
125
 
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "github_changelog_generator/task"
5
4
  require "rake/testtask"
6
5
  require "pry"
7
6
 
@@ -14,8 +13,3 @@ Rake::TestTask.new(:test) do |t|
14
13
  t.verbose = true
15
14
  t.warning = false
16
15
  end
17
-
18
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
19
- config.user = "hopsoft"
20
- config.project = "cable_ready"
21
- end