Skip to content

Commit

Permalink
Merge pull request #4 from basecamp/initial-spike
Browse files Browse the repository at this point in the history
Initial version
  • Loading branch information
jorgemanrubia authored Dec 18, 2024
2 parents 0e6f0eb + 356047e commit e3b498d
Show file tree
Hide file tree
Showing 75 changed files with 6,202 additions and 162 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ jobs:
- name: Run tests
env:
RAILS_ENV: test
# REDIS_URL: redis://localhost:6379/0
run: bin/rails db:test:prepare test
run: bin/rails db:test:prepare && bin/rails test

- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
/test/dummy/log/*.log
/test/dummy/storage/
/test/dummy/tmp/
/node_modules/

8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
source "https://rubygems.org"

# Specify your gem's dependencies in pulse_wire.gemspec.
# Specify your gem's dependencies in hotwire_spark.gemspec.
gemspec

gem "puma"

gem "sqlite3"

gem "propshaft"

# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false

# Start debugger with binding.b [https://github.com/ruby/debug]
# gem "debug", ">= 1.0.0"

gem "propshaft"
gem "importmap-rails"
gem "stimulus-rails"
94 changes: 70 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
PATH
remote: .
specs:
pulse_wire (0.1.0)
hotwire-spark (0.1.0)
listen
rails (>= 8.0.0)
zeitwerk

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -78,28 +80,55 @@ GEM
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
builder (3.3.0)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
cuprite (0.15.1)
capybara (~> 3.0)
ferrum (~> 0.15.0)
date (3.4.0)
drb (2.2.1)
erubi (1.13.0)
ferrum (0.15)
addressable (~> 2.5)
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (~> 0.7)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
importmap-rails (2.0.3)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.8.0)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.8.2)
language_server-protocol (3.17.0.3)
logger (1.6.1)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.2)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -109,9 +138,10 @@ GEM
net-pop
net-smtp
marcel (1.0.4)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.25.1)
net-imap (0.5.1)
minitest (5.25.4)
net-imap (0.5.2)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -121,9 +151,9 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.4)
nokogiri (1.16.7-arm64-darwin)
nokogiri (1.17.0-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.17.0-x86_64-linux)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.6.0)
Expand All @@ -134,8 +164,10 @@ GEM
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
psych (5.2.0)
psych (5.2.1)
date
stringio
public_suffix (6.0.1)
puma (6.4.3)
nio4r (~> 2.0)
racc (1.8.1)
Expand Down Expand Up @@ -164,9 +196,9 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.1)
loofah (~> 2.21)
nokogiri (~> 1.14)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (8.0.0)
actionpack (= 8.0.0)
activesupport (= 8.0.0)
Expand All @@ -177,26 +209,30 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.8.1)
psych (>= 4.0.0)
regexp_parser (2.9.2)
reline (0.5.11)
reline (0.5.12)
io-console (~> 0.5)
rubocop (1.68.0)
rexml (3.3.9)
rubocop (1.52.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.36.1)
parser (>= 3.3.1.0)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-minitest (0.34.5)
rubocop (>= 1.39, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-performance (1.23.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
Expand All @@ -211,32 +247,42 @@ GEM
rubocop-performance
rubocop-rails
ruby-progressbar (1.13.0)
securerandom (0.3.2)
securerandom (0.4.0)
sqlite3 (2.2.0-arm64-darwin)
sqlite3 (2.2.0-x86_64-linux-gnu)
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.2)
thor (1.3.2)
timeout (0.4.2)
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
uri (1.0.2)
useragent (0.16.10)
useragent (0.16.11)
webrick (1.9.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.7.1)

PLATFORMS
arm64-darwin
x86_64-linux

DEPENDENCIES
capybara
cuprite
hotwire-spark!
importmap-rails
propshaft
pulse_wire!
puma
rubocop
rubocop-rails-omakase
sqlite3
stimulus-rails

BUNDLED WITH
2.5.23
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
# PulseWire
Short description and motivation.
# Hotwire Spark

## Usage
How to use my plugin.
**Hotwire Spark** is a live-reloading system for Hotwire applications. It enhances your development feedback loop by detecting source code changes and updating the page *smoothly* without requiring a manual reload.

## Installation
Add this line to your application's Gemfile:

Add the gem to the group `development`:

```ruby
gem "pulse_wire"
group :development do
gem "hotwire_spark"
end
```

And then execute:

```bash
$ bundle
```

Or install it yourself as:
```bash
$ gem install pulse_wire
That's it!

## Hot it works

The system will listen for three kinds of changes and will take action depending on each:

* **HTML change:** it fetches the new document body and updates the current body with morphing. It uses [`idiomorph`](https://github.com/bigskysoftware/idiomorph) under the hood.
* **CSS change:** it fetches and reloads the stylesheet that changed.
* **Stimulus controller change:** it fetches the Stimulus controller that changed and reloads all the controllers in the page.

## Configuration

You can set configuration options on your `development.rb`. For example:

```ruby
config.hotwire.spark.html_paths += %w[ lib ]
```

## Contributing
Contribution directions go here.
| Name | Description |
|------------------|------------------------------------------------------------------------------------------------------------------------------|
| `html_paths` | Paths where file changes trigger a content refresh. By default: `app/controllers`, `app/helpers`, `app/models`, `app/views`. |
| `css_paths` | Paths where file changes trigger a CSS refresh. By default: `app/assets/stylesheets`. |
| `stimulus_paths` | Paths where file changes trigger a Stimulus controller refresh. By default: `app/javascript/controllers`. |
| `enabled` | Enable or disable live reloading. By default, it's only enabled in `development`. |
| `logging` | Show logs in the browser console when reloading happens. It's false by default. |

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
File renamed without changes.
Loading

0 comments on commit e3b498d

Please sign in to comment.