glim 0.1.3 → 0.1.4
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/bin/glim +13 -4
- data/lib/commands.rb +11 -9
- data/lib/local_server.rb +4 -4
- data/lib/version.rb +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c833f6ae8f777fea4bea3921973658abb6d2047e5c8e392551e95af595e0b94
|
4
|
+
data.tar.gz: 20eed39068fed6280b3711a93db863769d7e2dddd56594a50e6325c253b0ff30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d5900a018a77e3840a89e4a7e552d49565ad5c48b7075ce90f9cd53f5068488b6fee8fbfcc9c5793e847c6c5c05ab6e6fe98485afa5f8b82afe19f8ca5ae5fe
|
7
|
+
data.tar.gz: 6a42db7d9f865b6cf444ab4317db99560631a0ad48829ff208d14e7ac63c95f76490ef6b84b48055f8452c3a34c48e5825f3b2f64234d066a99c72044039f599
|
data/bin/glim
CHANGED
@@ -15,7 +15,14 @@ require 'pathname'
|
|
15
15
|
require 'kramdown'
|
16
16
|
require 'liquid'
|
17
17
|
require 'mercenary'
|
18
|
-
|
18
|
+
|
19
|
+
if File.exists?('Gemfile')
|
20
|
+
begin
|
21
|
+
require 'bundler/setup'
|
22
|
+
rescue LoadError => e
|
23
|
+
$log.warn("Unable to load Bundler but directory contains a Gemfile")
|
24
|
+
end
|
25
|
+
end
|
19
26
|
|
20
27
|
module Util
|
21
28
|
module_function
|
@@ -982,7 +989,7 @@ module Glim
|
|
982
989
|
Sass.load_paths << sass_dir unless Sass.load_paths.include?(sass_dir)
|
983
990
|
end
|
984
991
|
end
|
985
|
-
rescue Gem::
|
992
|
+
rescue Gem::LoadError => e
|
986
993
|
$log.warn("Unable to load the #{theme} theme: #{e}")
|
987
994
|
end
|
988
995
|
end
|
@@ -1463,7 +1470,9 @@ Mercenary.program(:glim) do |p|
|
|
1463
1470
|
c.action do |args, options|
|
1464
1471
|
Profiler.enabled = options['profile']
|
1465
1472
|
|
1466
|
-
Glim::
|
1473
|
+
config = Glim::Config.new(files: options['config'], defaults: { 'environment' => 'production' }, override: options)
|
1474
|
+
config['show_backtrace'] = true if c.trace
|
1475
|
+
Glim::Commands.build(config)
|
1467
1476
|
|
1468
1477
|
Profiler.run("Saving cache") do
|
1469
1478
|
Glim::Cache.save
|
@@ -1510,7 +1519,7 @@ Mercenary.program(:glim) do |p|
|
|
1510
1519
|
end
|
1511
1520
|
end
|
1512
1521
|
|
1513
|
-
Bundler.require(:glim_plugins) if File.exists?('Gemfile')
|
1522
|
+
Bundler.require(:glim_plugins) if defined?(Bundler) && File.exists?('Gemfile')
|
1514
1523
|
|
1515
1524
|
Jekyll::Plugin.plugins_of_type(Jekyll::Command).sort.each do |klass|
|
1516
1525
|
klass.init_with_program(p)
|
data/lib/commands.rb
CHANGED
@@ -10,7 +10,7 @@ module Glim
|
|
10
10
|
|
11
11
|
delete_files, delete_dirs = items_in_directory(output_dir, skip: config['keep_files'])
|
12
12
|
deleted = delete_items(delete_files, delete_dirs, keep: output_paths)
|
13
|
-
created, updated, warnings, errors = *generate(output_dir, config['jobs'] || 7, files)
|
13
|
+
created, updated, warnings, errors = *generate(output_dir, config['jobs'] || 7, files, backtrace: config['show_backtrace'])
|
14
14
|
|
15
15
|
symlinks.each do |dest, path|
|
16
16
|
FileUtils.mkdir_p(File.dirname(dest))
|
@@ -163,17 +163,17 @@ module Glim
|
|
163
163
|
res
|
164
164
|
end
|
165
165
|
|
166
|
-
def self.generate(output_dir, number_of_jobs, files)
|
166
|
+
def self.generate(output_dir, number_of_jobs, files, backtrace: false)
|
167
167
|
Profiler.run("Creating pages") do
|
168
168
|
if number_of_jobs == 1
|
169
|
-
generate_subset(output_dir, files)
|
169
|
+
generate_subset(output_dir, files, backtrace: backtrace)
|
170
170
|
else
|
171
|
-
generate_async(output_dir, files.shuffle, number_of_jobs)
|
171
|
+
generate_async(output_dir, files.shuffle, number_of_jobs, backtrace: backtrace)
|
172
172
|
end
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
def self.generate_async(output_dir, files, number_of_jobs)
|
176
|
+
def self.generate_async(output_dir, files, number_of_jobs, backtrace: false)
|
177
177
|
total = files.size
|
178
178
|
slices = number_of_jobs.times.map do |i|
|
179
179
|
first = (total * i / number_of_jobs).ceil
|
@@ -190,7 +190,7 @@ module Glim
|
|
190
190
|
pid = fork do
|
191
191
|
start = Time.now
|
192
192
|
pipe_rd.close
|
193
|
-
created, updated, warnings, errors = *generate_subset(output_dir, files_slice)
|
193
|
+
created, updated, warnings, errors = *generate_subset(output_dir, files_slice, backtrace: backtrace)
|
194
194
|
pipe_wr << Marshal.dump({
|
195
195
|
'cache_updates' => Glim::Cache.updates,
|
196
196
|
'created' => created,
|
@@ -224,7 +224,7 @@ module Glim
|
|
224
224
|
[ created, updated, warnings, errors ]
|
225
225
|
end
|
226
226
|
|
227
|
-
def self.generate_subset(output_dir, files)
|
227
|
+
def self.generate_subset(output_dir, files, backtrace: false)
|
228
228
|
created, updated, warnings, errors = [], [], [], []
|
229
229
|
|
230
230
|
for file in files do
|
@@ -235,16 +235,18 @@ module Glim
|
|
235
235
|
if file.frontmatter?
|
236
236
|
begin
|
237
237
|
if !file_exists || File.read(dest) != file.output
|
238
|
-
(file_exists ? updated : created) << dest
|
239
238
|
File.unlink(dest) if file_exists
|
240
239
|
File.write(dest, file.output)
|
240
|
+
(file_exists ? updated : created) << dest
|
241
241
|
end
|
242
242
|
warnings.concat(file.warnings.map { |warning| "#{file}: #{warning}" }) unless file.warnings.nil?
|
243
243
|
rescue Glim::Error => e
|
244
244
|
errors << [ "Unable to create output for: #{file}", *e.messages ]
|
245
245
|
break
|
246
246
|
rescue => e
|
247
|
-
|
247
|
+
error = [ "Unable to create output for: #{file}", e.to_s ]
|
248
|
+
error << e.backtrace.join("\n") if backtrace
|
249
|
+
errors << error
|
248
250
|
break
|
249
251
|
end
|
250
252
|
else
|
data/lib/local_server.rb
CHANGED
@@ -233,7 +233,7 @@ module Glim
|
|
233
233
|
def websocket_script
|
234
234
|
<<~JS
|
235
235
|
const glim = {
|
236
|
-
connect: function (host, port,
|
236
|
+
connect: function (host, port, should_retry, should_reload) {
|
237
237
|
const server = host + ":" + port
|
238
238
|
console.log("Connecting to Glim’s live reload server (" + server + ")…");
|
239
239
|
|
@@ -260,14 +260,14 @@ module Glim
|
|
260
260
|
socket.onclose = () => {
|
261
261
|
console.log("Lost connection: Live reload disabled.")
|
262
262
|
|
263
|
-
if(
|
264
|
-
window.setTimeout(() => this.connect(host, port,
|
263
|
+
if(should_retry) {
|
264
|
+
window.setTimeout(() => this.connect(host, port, should_retry, true), 2500);
|
265
265
|
}
|
266
266
|
};
|
267
267
|
},
|
268
268
|
};
|
269
269
|
|
270
|
-
glim.connect('#{@config['host']}', #{@config['livereload_port']}, true /*
|
270
|
+
glim.connect('#{@config['host']}', #{@config['livereload_port']}, true /* should_retry */, false /* should_reload */);
|
271
271
|
JS
|
272
272
|
end
|
273
273
|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allan Odgaard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -136,7 +136,8 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.1'
|
139
|
-
description:
|
139
|
+
description: Generating output is done in parallel using multiple tasks and lazy evaluation
|
140
|
+
is used when serving pages locally for instant reloads when source content changes.
|
140
141
|
email:
|
141
142
|
executables:
|
142
143
|
- glim
|
@@ -151,10 +152,14 @@ files:
|
|
151
152
|
- lib/local_server.rb
|
152
153
|
- lib/log_and_profile.rb
|
153
154
|
- lib/version.rb
|
154
|
-
homepage: https://macromates.com/
|
155
|
+
homepage: https://sigpipe.macromates.com/2018/creating-a-faster-jekyll/
|
155
156
|
licenses:
|
156
157
|
- MIT
|
157
|
-
metadata:
|
158
|
+
metadata:
|
159
|
+
homepage_uri: https://sigpipe.macromates.com/2018/creating-a-faster-jekyll/
|
160
|
+
documentation_uri: https://macromates.com/glim/
|
161
|
+
source_code_uri: https://github.com/sorbits/glim/
|
162
|
+
mailing_list_uri: https://lists.macromates.com/listinfo/glim
|
158
163
|
post_install_message:
|
159
164
|
rdoc_options: []
|
160
165
|
require_paths:
|
@@ -163,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
168
|
requirements:
|
164
169
|
- - ">="
|
165
170
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
171
|
+
version: 2.3.0
|
167
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
173
|
requirements:
|
169
174
|
- - ">="
|