Skip to content

Commit 44cc1da

Browse files
committed
renamed HotLoader to Hotloader, made sure it is disabled in prerendering
1 parent 0289982 commit 44cc1da

File tree

12 files changed

+30
-26
lines changed

12 files changed

+30
-26
lines changed

ruby/hyper-component/lib/hyperstack/internal/component/callbacks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def define_callback(callback_name, &after_define_hook)
2727
define_singleton_method(callback_name) do |*args, &block|
2828
send(wrapper_name).concat(args)
2929
send(wrapper_name).push(block) if block_given?
30-
HotLoader.record(self, "@#{wrapper_name}", 4, *args, block)
30+
Hotloader.record(self, "@#{wrapper_name}", 4, *args, block)
3131
after_define_hook.call(*args, &block) if after_define_hook
3232
end
3333
end

ruby/hyperstack-config/bin/hyperstack-hotloader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env ruby
22

33
require 'bundler/setup'
4-
require "hyperstack/hot_loader/server"
4+
require "hyperstack/hotloader/server"
55

66
options = {:port => 25222, :directories => []}
77
OptionParser.new do |opts|
@@ -17,6 +17,6 @@ OptionParser.new do |opts|
1717

1818
end.parse!
1919

20-
server = Hyperstack::HotLoader::Server.new(options)
20+
server = Hyperstack::Hotloader::Server.new(options)
2121
puts "Listening on port #{options[:port]}, watching for changes in #{options[:directories].join(', ')}"
2222
server.loop

ruby/hyperstack-config/lib/hyperstack-config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
require 'hyperstack/on_client'
99
require 'hyperstack/active_support_string_inquirer.rb'
1010
require 'hyperstack_env'
11-
require 'hyperstack/hot_loader/stub'
11+
require 'hyperstack/hotloader/stub'
1212
else
1313
require 'opal'
1414
require 'opal-browser'

ruby/hyperstack-config/lib/hyperstack/hot_loader/short_cut.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

ruby/hyperstack-config/lib/hyperstack/hot_loader.rb renamed to ruby/hyperstack-config/lib/hyperstack/hotloader.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
require 'hyperstack/hot_loader/add_error_boundry'
2-
require 'hyperstack/hot_loader/stack-trace.js'
3-
require 'hyperstack/hot_loader/css_reloader'
1+
require 'hyperstack/hotloader/add_error_boundry'
2+
require 'hyperstack/hotloader/stack-trace.js'
3+
require 'hyperstack/hotloader/css_reloader'
44
require 'opal-parser' # gives me 'eval', for hot-loading code
55

66
require 'json'
7-
require 'hyperstack/hot_loader/short_cut.js'
7+
require 'hyperstack/hotloader/short_cut.js'
88

99
# Opal client to support hot reloading
1010
$eval_proc = proc do |file_name, s|
@@ -14,7 +14,7 @@
1414

1515
module Hyperstack
1616

17-
class HotLoader
17+
class Hotloader
1818
def self.callbackmaps
1919
@@callbackmaps ||= Hash.new { |h, k| h[k] = Hash.new { |h1, k1| h1[k1] = Hash.new { |h2, k2| h2[k2] = Array.new }}}
2020
end
@@ -58,7 +58,7 @@ def connect_to_websocket(port)
5858
end
5959

6060
def notify_error(reload_request)
61-
msg = "HotLoader #{reload_request[:filename]} RELOAD ERROR:\n\n#{$!}"
61+
msg = "Hotloader #{reload_request[:filename]} RELOAD ERROR:\n\n#{$!}"
6262
puts msg
6363
alert msg if use_alert?
6464
end
@@ -83,7 +83,7 @@ def reload(e)
8383
begin
8484
#Hyperstack::Context.reset! false
8585
file_name = reload_request[:asset_path] #.gsub(/.+hyperstack\//, '')
86-
HotLoader.remove(file_name)
86+
Hotloader.remove(file_name)
8787
$eval_proc.call file_name, reload_request[:source_code]
8888
rescue
8989
notify_error(reload_request)
@@ -114,7 +114,7 @@ def listen
114114

115115
def self.listen(port=25222, ping=nil)
116116
::Hyperstack::Internal::Component::TopLevelRailsComponent.include AddErrorBoundry
117-
@server = HotLoader.new(port, ping) do
117+
@server = Hotloader.new(port, ping) do
118118
# TODO: check this out when Operations are integrated
119119
# if defined?(Hyperloop::Internal::Operation::ClientDrivers) &&
120120
# Hyperloop::ClientDrivers.respond_to?(:initialize_client_drivers_on_boot)

ruby/hyperstack-config/lib/hyperstack/hot_loader/add_error_boundry.rb renamed to ruby/hyperstack-config/lib/hyperstack/hotloader/add_error_boundry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Hyperstack
2-
class HotLoader
2+
class Hotloader
33
module AddErrorBoundry
44
def self.included(base)
55
base.after_error do |*err|

ruby/hyperstack-config/lib/hyperstack/hot_loader/css_reloader.rb renamed to ruby/hyperstack-config/lib/hyperstack/hotloader/css_reloader.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'native'
22
module Hyperstack
3-
class HotLoader
3+
class Hotloader
44
class CssReloader
55

66
def reload(reload_request, document)
@@ -34,7 +34,7 @@ def is_matching_stylesheet?(href, url)
3434
href_base = File.basename(href).sub(/\.self-?.*.css.+/, '')
3535
url_base == href_base
3636
end
37-
37+
3838
end
3939
end
4040
end

ruby/hyperstack-config/lib/hyperstack/hot_loader/server.rb renamed to ruby/hyperstack-config/lib/hyperstack/hotloader/server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require 'pry'
88

99
module Hyperstack
10-
class HotLoader
10+
class Hotloader
1111
# Most of this lifted from https://github.com/saward/Rubame
1212
class Server
1313

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if (typeof window !== 'undefined') {
2+
window.Hyperstack = {
3+
hotloader: function(port, ping) {
4+
Opal.Hyperstack.$const_get('Hotloader').$listen(port || 25222, ping || Opal.nil)
5+
}
6+
}
7+
} else {
8+
throw 'Attempt to run hotloader during prerendering - make sure you import with the `client_only: true` option'
9+
}

ruby/hyperstack-config/lib/hyperstack/hot_loader/socket.rb renamed to ruby/hyperstack-config/lib/hyperstack/hotloader/socket.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module Hyperstack
55

6-
class HotLoader
6+
class Hotloader
77

88
# Code taken from opal browser, did not want to force an opal-browser dependency
99
#

0 commit comments

Comments
 (0)