mata 0.6.0 → 0.7.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 +13 -42
- data/lib/mata/railtie.rb +27 -0
- data/lib/mata/version.rb +1 -1
- data/lib/mata/watch_tower.rb +2 -2
- data/lib/mata.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 959629ea5fdd32e3175367b7ddf0ceed61679a9652349f2cd130b4ee4eb70ff4
|
|
4
|
+
data.tar.gz: 7113f529003ecc704a8f66056a32c036da85a6e05d47c9622ac4eb9545f737c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0eb68cc7feb9071eecdc8d528be0713a680caeae621dd5bf1d45d766efc16222f42d7c71c6e4eb3b21b50d0034c6812b71a46be9ad83d4f0a971ecb8d743280d
|
|
7
|
+
data.tar.gz: f15cf5f31841fecc076ed8cbd36d3d6e3775e6e7d74232475eb96947237650a0530af18bcab5abde6c4236ddef54b75110752dab561872f3a116128787cc9d95
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mata
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Live Reload with DOM Morphing for Rack applications using Server-Sent Events.
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
**Sponsored By [Rails Designer](https://railsdesigner.com/)**
|
|
@@ -17,75 +17,46 @@ Hot module reloading for Rack applications using Server-Sent Events and DOM morp
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
|
|
20
|
+
bundle add mata --group=development
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
## Usage
|
|
25
24
|
|
|
26
25
|
### Rails
|
|
27
26
|
|
|
27
|
+
Mata automatically sets up middleware in development with sensible defaults. You can optionally configure:
|
|
28
28
|
```ruby
|
|
29
|
-
# config/
|
|
30
|
-
|
|
31
|
-
config.
|
|
32
|
-
|
|
33
|
-
Mata,
|
|
34
|
-
watch: %w[app/views app/assets],
|
|
35
|
-
skip: %w[tmp log node_modules]
|
|
36
|
-
)
|
|
29
|
+
# config/initializers/mata.rb
|
|
30
|
+
Mata::Railtie.configure do |config|
|
|
31
|
+
config.watch_paths = %w[app]
|
|
32
|
+
config.skip_paths = %w[app/assets/builds app/assets/cache]
|
|
37
33
|
end
|
|
38
34
|
```
|
|
39
35
|
|
|
40
|
-
### Sinatra
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
require "sinatra"
|
|
44
|
-
require "mata"
|
|
45
|
-
|
|
46
|
-
configure :development do
|
|
47
|
-
use Mata, watch: %w[views public]
|
|
48
|
-
end
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Hanami
|
|
37
|
+
### Other rack-based apps
|
|
52
38
|
|
|
53
39
|
```ruby
|
|
54
40
|
# config.ru
|
|
55
|
-
require "hanami/boot"
|
|
56
41
|
require "mata"
|
|
57
42
|
|
|
58
|
-
use Mata, watch: %w[
|
|
59
|
-
|
|
60
|
-
run Hanami.app
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Basic Rack app
|
|
64
|
-
|
|
65
|
-
```ruby
|
|
66
|
-
# config.ru
|
|
67
|
-
require "mata"
|
|
68
|
-
|
|
69
|
-
use Mata, watch: %w[views assets], skip: %w[tmp log]
|
|
43
|
+
use Mata, watch: %w[views assets], skip: %w[views/tmp]
|
|
70
44
|
|
|
71
45
|
run YourApp
|
|
72
46
|
```
|
|
73
47
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- **watch**; array of paths to monitor (default: `%w[app views assets]`)
|
|
78
|
-
- **skip**; array of paths to ignore (default: `%w[tmp log]`)
|
|
48
|
+
> [!NOTE]
|
|
49
|
+
> Do share your snippets on how to add Mata into your specific Rack-based apps 💙
|
|
79
50
|
|
|
80
51
|
|
|
81
52
|
## Used in
|
|
82
53
|
|
|
83
|
-
This gem powers
|
|
54
|
+
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.
|
|
84
55
|
|
|
85
56
|
|
|
86
57
|
## Why this gem?
|
|
87
58
|
|
|
88
|
-
I needed
|
|
59
|
+
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.
|
|
89
60
|
|
|
90
61
|
|
|
91
62
|
## Who is Mata?
|
data/lib/mata/railtie.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "rails/railtie"
|
|
2
|
+
|
|
3
|
+
class Mata
|
|
4
|
+
class Railtie < Rails::Railtie
|
|
5
|
+
class << self
|
|
6
|
+
attr_accessor :watch_paths, :skip_paths
|
|
7
|
+
|
|
8
|
+
def configure
|
|
9
|
+
yield(self)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
self.watch_paths = %w[app/views app/assets]
|
|
14
|
+
self.skip_paths = %w[tmp log node_modules]
|
|
15
|
+
|
|
16
|
+
config.before_configuration do |app|
|
|
17
|
+
if Rails.env.development?
|
|
18
|
+
app.config.middleware.insert_before(
|
|
19
|
+
ActionDispatch::Static,
|
|
20
|
+
Mata,
|
|
21
|
+
watch: watch_paths,
|
|
22
|
+
skip: skip_paths
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/mata/version.rb
CHANGED
data/lib/mata/watch_tower.rb
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
class Mata
|
|
4
4
|
class WatchTower
|
|
5
5
|
def initialize(options)
|
|
6
|
-
@watch_paths = Array(options[:watch] ||
|
|
7
|
-
@skip_paths = skipped_patterns(options[:skip] || options[:ignore] ||
|
|
6
|
+
@watch_paths = Array(options[:watch] || [])
|
|
7
|
+
@skip_paths = skipped_patterns(options[:skip] || options[:ignore] || [])
|
|
8
8
|
@on_change = nil
|
|
9
9
|
@listener = nil
|
|
10
10
|
|
data/lib/mata.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.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rails Designer
|
|
@@ -50,6 +50,7 @@ files:
|
|
|
50
50
|
- lib/mata/broadcaster.rb
|
|
51
51
|
- lib/mata/client.js
|
|
52
52
|
- lib/mata/idiomorph.min.js
|
|
53
|
+
- lib/mata/railtie.rb
|
|
53
54
|
- lib/mata/version.rb
|
|
54
55
|
- lib/mata/watch_tower.rb
|
|
55
56
|
homepage: https://railsdesigner.com/mata/
|
|
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
73
|
- !ruby/object:Gem::Version
|
|
73
74
|
version: '0'
|
|
74
75
|
requirements: []
|
|
75
|
-
rubygems_version: 4.0.
|
|
76
|
+
rubygems_version: 4.0.6
|
|
76
77
|
specification_version: 4
|
|
77
78
|
summary: Hot module reloading for Rack applications
|
|
78
79
|
test_files: []
|