Skip to content

Commit

Permalink
Rename to hotwire-spark
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Dec 16, 2024
1 parent d68597f commit 034072f
Show file tree
Hide file tree
Showing 38 changed files with 51 additions and 84 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
hotwire_spark (0.1.0)
hotwire-spark (0.1.0)
listen
rails (>= 8.0.0)
zeitwerk
Expand Down Expand Up @@ -141,7 +141,7 @@ GEM
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.25.4)
net-imap (0.5.1)
net-imap (0.5.2)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -254,7 +254,7 @@ GEM
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)
Expand All @@ -275,7 +275,7 @@ PLATFORMS
DEPENDENCIES
capybara
cuprite
hotwire_spark!
hotwire-spark!
importmap-rails
propshaft
puma
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HotwireSpark
# Hotwire Spark
Short description and motivation.

## Usage
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/hotwire_spark.js
Original file line number Diff line number Diff line change
Expand Up @@ -3648,7 +3648,7 @@ var HotwireSpark = (function () {
}

consumer.subscriptions.create({
channel: "HotwireSpark::Channel"
channel: "Hotwire::Spark::Channel"
}, {
connected() {
document.body.setAttribute("data-hotwire-spark-ready", "");
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/hotwire_spark.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/javascripts/hotwire_spark.min.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HotwireSpark::Channel < ActionCable::Channel::Base
class Hotwire::Spark::Channel < ActionCable::Channel::Base
def subscribed
stream_from "hotwire_spark"
end
Expand Down
Empty file removed app/controllers/concerns/.keep
Empty file.
4 changes: 0 additions & 4 deletions app/controllers/hotwire_spark/application_controller.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/helpers/hotwire_spark/application_helper.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HtmlReloader } from "../reloaders/html_reloader.js";
import { CssReloader } from "../reloaders/css_reloader.js";
import { StimulusReloader } from "../reloaders/stimulus_reloader.js";

consumer.subscriptions.create({ channel: "HotwireSpark::Channel" }, {
consumer.subscriptions.create({ channel: "Hotwire::Spark::Channel" }, {
connected() {
document.body.setAttribute("data-hotwire-spark-ready", "")
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions app/jobs/hotwire_spark/application_job.rb

This file was deleted.

6 changes: 0 additions & 6 deletions app/mailers/hotwire_spark/application_mailer.rb

This file was deleted.

Empty file removed app/models/concerns/.keep
Empty file.
5 changes: 0 additions & 5 deletions app/models/hotwire_spark/application_record.rb

This file was deleted.

17 changes: 0 additions & 17 deletions app/views/layouts/hotwire_spark/application.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
HotwireSpark::Engine.routes.draw do
Hotwire::Spark::Engine.routes.draw do
end
6 changes: 3 additions & 3 deletions hotwire_spark.gemspec → hotwire-spark.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require_relative "lib/hotwire_spark/version"
require_relative "lib/hotwire/spark/version"

Gem::Specification.new do |spec|
spec.name = "hotwire_spark"
spec.version = HotwireSpark::VERSION
spec.name = "hotwire-spark"
spec.version = Hotwire::Spark::VERSION
spec.authors = [ "Jorge Manrubia" ]
spec.email = [ "[email protected]" ]
spec.homepage = "https://github.com/basecamp/hotwire_spark"
Expand Down
12 changes: 8 additions & 4 deletions lib/hotwire_spark.rb → lib/hotwire-spark.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
require "hotwire_spark/version"
require "hotwire_spark/engine"
require "hotwire/spark/version"
require "hotwire/spark/engine"

require "zeitwerk"
loader = Zeitwerk::Loader.for_gem
loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
loader.ignore("#{__dir__}/hotwire-spark.rb")
loader.setup

module HotwireSpark
module Hotwire::Spark
mattr_accessor :css_paths, default: []
mattr_accessor :html_paths, default: []
mattr_accessor :stimulus_paths, default: []
Expand All @@ -22,3 +23,6 @@ def enabled?
end
end
end

Check failure on line 26 in lib/hotwire-spark.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/TrailingEmptyLines: 3 trailing blank lines detected.


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HotwireSpark::ActionCable::PersistentCableMiddleware
class Hotwire::Spark::ActionCable::PersistentCableMiddleware
def initialize(app)
@app = app
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module HotwireSpark::ActionCable::PersistentCableServer
module Hotwire::Spark::ActionCable::PersistentCableServer
def self.prepended(base)
base.class_eval do
thread_mattr_accessor :suppress_restarts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module HotwireSpark::ActionCable::SolidCableListenerWithSafeReloads
module Hotwire::Spark::ActionCable::SolidCableListenerWithSafeReloads
private
def broadcast_messages
Rails.application.executor.wrap do
Expand Down
15 changes: 8 additions & 7 deletions lib/hotwire_spark/engine.rb → lib/hotwire/spark/engine.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
require "action_cable/server/base"

module HotwireSpark
module Hotwire::Spark
class Engine < ::Rails::Engine
isolate_namespace HotwireSpark
isolate_namespace Hotwire::Spark

config.hotwire_spark = ActiveSupport::OrderedOptions.new
config.hotwire_spark.merge! \
config.hotwire = ActiveSupport::OrderedOptions.new unless config.respond_to?(:hotwire)
config.hotwire.spark = ActiveSupport::OrderedOptions.new
config.hotwire.spark.merge! \
enabled: Rails.env.development?,
css_paths: %w[ app/assets/stylesheets ],
html_paths: %w[ app/controllers app/helpers app/models app/views ],
stimulus_paths: %w[ app/javascript/controllers ]

initializer "hotwire_spark.config" do |app|
config.hotwire_spark.each do |key, value|
HotwireSpark.send("#{key}=", value)
config.hotwire.spark.each do |key, value|
Hotwire::Spark.send("#{key}=", value)
end
end

initializer "hotwire_spark.install" do |application|
HotwireSpark.install_into application if HotwireSpark.enabled?
Hotwire::Spark.install_into application if Hotwire::Spark.enabled?
end
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "listen"

class HotwireSpark::FileWatcher
class Hotwire::Spark::FileWatcher
def initialize
@callbacks_by_path = Hash.new { |hash, key| hash[key] = [] }
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HotwireSpark::Installer
class Hotwire::Spark::Installer
attr_reader :file_watcher

def initialize(application)
Expand All @@ -11,10 +11,10 @@ def install
end

def configure_middleware
::ActionCable::Server::Base.prepend(HotwireSpark::ActionCable::PersistentCableServer)
::ActionCable::Server::Base.prepend(Hotwire::Spark::ActionCable::PersistentCableServer)

middleware.insert_before ActionDispatch::Executor, HotwireSpark::ActionCable::PersistentCableMiddleware
middleware.use HotwireSpark::Middleware
middleware.insert_before ActionDispatch::Executor, Hotwire::Spark::ActionCable::PersistentCableMiddleware
middleware.use Hotwire::Spark::Middleware
end

private
Expand All @@ -33,7 +33,7 @@ def register_monitored_paths
end

def monitor(paths_name, action:)
file_watcher.monitor HotwireSpark.public_send(paths_name) do |file_path|
file_watcher.monitor Hotwire::Spark.public_send(paths_name) do |file_path|
broadcast_reload_action(action, file_path)
end
end
Expand All @@ -47,6 +47,6 @@ def reload_message_for(action, file_path)
end

def file_watcher
@file_watches ||= HotwireSpark::FileWatcher.new
@file_watches ||= Hotwire::Spark::FileWatcher.new
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class HotwireSpark::Middleware
class Hotwire::Spark::Middleware
def initialize(app)
@app = app
end
Expand Down
5 changes: 5 additions & 0 deletions lib/hotwire/spark/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Hotwire
module Spark
VERSION = "0.1.0"
end
end
3 changes: 0 additions & 3 deletions lib/hotwire_spark/version.rb

This file was deleted.

2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import resolve from "@rollup/plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"
import babel from "@rollup/plugin-babel"

const inputFile = "app/javascript/hotwire_spark/index.js"
const inputFile = "app/javascript/hotwire/spark/index.js"
const outputDir = "app/assets/javascripts"

export default {
Expand Down
2 changes: 1 addition & 1 deletion test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :cuprite, screen_size: [ 1440, 900 ], options: { headless: "new" }

include HotwireSpark::Engine.routes.url_helpers
include Hotwire::Spark::Engine.routes.url_helpers

def visit(...)
super.tap do
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true

config.middleware.use HotwireSpark::Middleware
config.hotwire_spark.enabled = true
config.middleware.use Hotwire::Spark::Middleware
config.hotwire.spark.enabled = true
end
2 changes: 1 addition & 1 deletion test/dummy/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
mount HotwireSpark::Engine => "/hotwire_spark"
mount Hotwire::Spark::Engine => "/hotwire_spark"

root to: "home#show"
end

0 comments on commit 034072f

Please sign in to comment.