mata 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +40 -3
- data/lib/mata/broadcaster.rb +5 -5
- data/lib/mata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e57a04054693fd5c3b092f6c028d8cac79e9c374c043a6c29c34bda658836060
|
|
4
|
+
data.tar.gz: fb9c2cdb01e636273c4e13a5e55321dd5da252bda4a0cd3ed1942565336c2814
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5736a691cd06abf3ec90a561f3ebe5f88c5e88d5445b67ae21a32ff3f39757f49e0a88f3171dbed10afb587018ffc43980a110cf861541a660662d3222a05fe
|
|
7
|
+
data.tar.gz: b5ab2d3ebb6496ffee7f113d2f143b91170ec9f7baa9f4b1257090fe3bc20f1ed4ef2d9858df6164a35dd3eca3f19d0f69791b563acbe2109d841cd67d923243
|
data/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Mata
|
|
2
2
|
|
|
3
|
-
Live Reload with DOM Morphing for Rack applications using Server-Sent Events.
|
|
3
|
+
Live Reload with DOM Morphing for Rack applications using Server-Sent Events (SSE).
|
|
4
4
|
|
|
5
|
+
<img src="https://raw.githubusercontent.com/Rails-Designer/mata/HEAD/.github/mata-preview.gif">
|
|
5
6
|
|
|
6
7
|
**Sponsored By [Rails Designer](https://railsdesigner.com/)**
|
|
7
8
|
|
|
@@ -36,7 +37,6 @@ config.middleware.insert_before(
|
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
### Other rack-based apps
|
|
39
|
-
|
|
40
40
|
```ruby
|
|
41
41
|
# config.ru
|
|
42
42
|
require "mata"
|
|
@@ -50,6 +50,43 @@ run YourApp
|
|
|
50
50
|
> Do share your snippets on how to add Mata into your specific Rack-based apps 💙
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
### Hanami
|
|
54
|
+
```ruby
|
|
55
|
+
# config.ru
|
|
56
|
+
require "mata"
|
|
57
|
+
|
|
58
|
+
require_relative "config/app"
|
|
59
|
+
require_relative "config/routes"
|
|
60
|
+
|
|
61
|
+
use Mata, watch: %w[app/templates app/views app/actions], skip: %w[tmp logs node_modules]
|
|
62
|
+
|
|
63
|
+
run Hanami.app
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Sinatra
|
|
67
|
+
```ruby
|
|
68
|
+
# config.ru
|
|
69
|
+
require "mata"
|
|
70
|
+
require "./app"
|
|
71
|
+
|
|
72
|
+
use Mata, watch: %w[views templates assets], skip: %w[tmp vendor]
|
|
73
|
+
|
|
74
|
+
run Sinatra::Application
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Roda
|
|
78
|
+
```ruby
|
|
79
|
+
# config.ru
|
|
80
|
+
require "mata"
|
|
81
|
+
require "./app"
|
|
82
|
+
|
|
83
|
+
use Mata, watch: %w[templates assets], skip: %w[tmp]
|
|
84
|
+
|
|
85
|
+
route do |r|
|
|
86
|
+
r.on { r.root { view("index") } }
|
|
87
|
+
end
|
|
88
|
+
```
|
|
89
|
+
|
|
53
90
|
## Used in
|
|
54
91
|
|
|
55
92
|
This gem powers live reloading in [Perron](https://github.com/rails-designer/perron), a Rails-based static site generator. It can be enabled with `config.live_reload = true` in your Perron initializer.
|
|
@@ -57,7 +94,7 @@ This gem powers live reloading in [Perron](https://github.com/rails-designer/per
|
|
|
57
94
|
|
|
58
95
|
## Why this gem?
|
|
59
96
|
|
|
60
|
-
I needed a way to reload pages for Perron-powered Rails applications. These are minimal Rails apps typically without Hotwire or ActionCable dependencies. Existing solutions either required ActionCable or provided only basic full-page reloads without state preservation.
|
|
97
|
+
I needed a way to reload pages for Perron-powered Rails applications. These are minimal Rails apps typically without Hotwire or ActionCable dependencies. Existing solutions either required ActionCable or provided only basic full-page reloads without state preservation. So I built a light-weight gem that uses SSE and idiomorph for a smooth developer experience. Not just specific for Perron but for any Rack-based Ruby app. ❤️
|
|
61
98
|
|
|
62
99
|
|
|
63
100
|
## Who is Mata?
|
data/lib/mata/broadcaster.rb
CHANGED
|
@@ -14,10 +14,10 @@ class Mata
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
headers = {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
17
|
+
"content-type" => "text/event-stream",
|
|
18
|
+
"cache-control" => "no-cache",
|
|
19
|
+
"connection" => "keep-alive",
|
|
20
|
+
"access-control-allow-origin" => "*"
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
[200, headers, proc { |stream|
|
|
@@ -45,7 +45,7 @@ class Mata
|
|
|
45
45
|
|
|
46
46
|
script = "#{idiomorph_js}\n\n#{client_js}"
|
|
47
47
|
|
|
48
|
-
[200, {"
|
|
48
|
+
[200, {"content-type" => "application/javascript"}, [script]]
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def broadcast_to_all(files)
|
data/lib/mata/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mata
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rails Designer
|
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: '0'
|
|
74
74
|
requirements: []
|
|
75
|
-
rubygems_version: 4.0.
|
|
75
|
+
rubygems_version: 4.0.10
|
|
76
76
|
specification_version: 4
|
|
77
77
|
summary: Hot module reloading for Rack applications
|
|
78
78
|
test_files: []
|