breakfast 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/breakfast/capistrano.rb +8 -0
- data/lib/breakfast/capistrano/tasks/breakfast.rake +20 -0
- data/lib/breakfast/railtie.rb +8 -6
- data/lib/breakfast/version.rb +1 -1
- data/lib/breakfast/view_helper.rb +0 -2
- data/node_package/package.json +1 -1
- data/node_package/src/live-reload.js +9 -10
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1921d73960db6220372261094df549425a17f87
|
4
|
+
data.tar.gz: e98eb67524ab7eef41caf5651b394191cc356e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f46f6998d520f4cfa0dedb651e98900dc24a6e0975c58c5f2375d04a2d86068769366a809d42c0d1a6ef4ad088b01eb1b74bbf65b5c1f446ec368721dc3510
|
7
|
+
data.tar.gz: 49da1174fb90a1f7303a1fee22156874b99f3ee6eeba8b92e4aa23bc72e47c449fb3ac8235dfe915be2c67b6a87636a2eddbeeedf534b888f4cce18b1b2b9418
|
@@ -0,0 +1,20 @@
|
|
1
|
+
namespace :breakfast do
|
2
|
+
desc "Compile assets for production use"
|
3
|
+
task :compile do
|
4
|
+
on roles fetch(:breakfast_roles) do |host|
|
5
|
+
within release_path do
|
6
|
+
execute :npm, "install"
|
7
|
+
execute "node_modules/brunch/bin/brunch", "build --production"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
after "deploy:updated", "breakfast:compile"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
namespace :load do
|
17
|
+
task :defaults do
|
18
|
+
set :breakfast_roles, -> { :web }
|
19
|
+
end
|
20
|
+
end
|
data/lib/breakfast/railtie.rb
CHANGED
@@ -6,7 +6,6 @@ module BrunchRails
|
|
6
6
|
config.breakfast = ActiveSupport::OrderedOptions.new
|
7
7
|
|
8
8
|
config.before_configuration do |app|
|
9
|
-
config.breakfast.live_reload = true
|
10
9
|
config.breakfast.html_reload_strategy = :turbolinks
|
11
10
|
config.breakfast.js_reload_strategy = :page
|
12
11
|
config.breakfast.css_reload_strategy = :hot
|
@@ -17,16 +16,15 @@ module BrunchRails
|
|
17
16
|
end
|
18
17
|
|
19
18
|
initializer "breakfast.setup_view_helpers" do |app|
|
20
|
-
|
21
|
-
|
22
|
-
include ::Breakfast::ViewHelper
|
23
|
-
end
|
19
|
+
ActiveSupport.on_load(:action_view) do
|
20
|
+
include ::Breakfast::ViewHelper
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
27
24
|
config.after_initialize do |app|
|
28
25
|
if config.breakfast.environments.include?(Rails.env) && defined?(Rails::Server)
|
29
|
-
Process.spawn("brunch watch")
|
26
|
+
@brunch_pid = Process.spawn("brunch watch")
|
27
|
+
Process.detach(@brunch_pid)
|
30
28
|
|
31
29
|
listen_to_paths = Array.wrap(config.breakfast.asset_output_folders) +
|
32
30
|
Array.wrap(config.breakfast.view_folders)
|
@@ -45,5 +43,9 @@ module BrunchRails
|
|
45
43
|
listener.start
|
46
44
|
end
|
47
45
|
end
|
46
|
+
|
47
|
+
ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES[:javascript] = "/assets"
|
48
|
+
ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES[:image] = "/assets"
|
49
|
+
ActionView::Helpers::AssetUrlHelper::ASSET_PUBLIC_DIRECTORIES[:stylesheet] = "/assets"
|
48
50
|
end
|
49
51
|
end
|
data/lib/breakfast/version.rb
CHANGED
@@ -4,8 +4,6 @@ module Breakfast
|
|
4
4
|
if Rails.configuration.breakfast.environments.include?(Rails.env)
|
5
5
|
content_tag :script do
|
6
6
|
<<-SCRIPT.html_safe
|
7
|
-
window.Breakfast = window.Breakfast || {};
|
8
|
-
window.Breakfast.liveReload = #{Rails.configuration.breakfast.live_reload};
|
9
7
|
require("breakfast-rails").init({
|
10
8
|
host: "#{request.host}",
|
11
9
|
port: #{request.port},
|
data/node_package/package.json
CHANGED
@@ -69,18 +69,17 @@ class LiveReloader {
|
|
69
69
|
|
70
70
|
document.addEventListener('DOMContentLoaded', () => {
|
71
71
|
let Breakfast = window.Breakfast || {};
|
72
|
+
Breakfast.options = options
|
72
73
|
|
73
|
-
|
74
|
-
let reloadChannel = 'Breakfast::LiveReloadChannel'
|
74
|
+
let reloadChannel = 'Breakfast::LiveReloadChannel'
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
76
|
+
Breakfast.cable = ActionCable.createConsumer(`ws://${options.host}:${options.port}/cable`);
|
77
|
+
Breakfast.channel = Breakfast.cable.subscriptions.create(reloadChannel, {
|
78
|
+
received: (data) => {
|
79
|
+
let reloader = reloaders[data.extension];
|
80
|
+
reloader(options.reloadStrategies[data.extension]);
|
81
|
+
}
|
82
|
+
})
|
84
83
|
});
|
85
84
|
}
|
86
85
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breakfast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Koperwas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,6 +113,8 @@ files:
|
|
113
113
|
- bin/setup
|
114
114
|
- breakfast.gemspec
|
115
115
|
- lib/breakfast.rb
|
116
|
+
- lib/breakfast/capistrano.rb
|
117
|
+
- lib/breakfast/capistrano/tasks/breakfast.rake
|
116
118
|
- lib/breakfast/live_reload_channel.rb
|
117
119
|
- lib/breakfast/railtie.rb
|
118
120
|
- lib/breakfast/version.rb
|