jekyll-watch 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8769b07f61da530d62944f469f8e3f8439e3e8c075ad70e3916d4af04974ddc
4
- data.tar.gz: 6ca091b888b1aa7198d3464eec8af308b2c8ebb1fcf3b8dfbcdb446f883aab6a
3
+ metadata.gz: 5b995f8f1937dd0830a8347c44a27f87b28325c7614854f93337583423107256
4
+ data.tar.gz: 2a275f462b1112f9993181dc1d7014b86d729fc73a092cbb99cdc71a071c11f7
5
5
  SHA512:
6
- metadata.gz: 0fa54e4e9b1ef2c9f9f57c047aa4124de778a26c315e816adc0757c9bb9c10bbe46d8c25babaf0bed8c89ac6a3b8b61479a694c978cb0cbaa496903b04dbaea1
7
- data.tar.gz: e65f4b7ddf6d557b0d7d4f5ad8ef2c984ddb96da193c77492ab1bc563923f611d86633fcfaa9d3322727d5570ed9b37aa0240a6dd29108e0f2d5b280aa9c5139
6
+ metadata.gz: 21004c7e9c97022dbcdb58c4d10d2236c7e8f2592e60bb1539bd91645a10e8f0dbd4d926243439849e0004aa2ecb123ffda0abf81fe4abb11fa0bb268c8a0eb0
7
+ data.tar.gz: '08b6ff0a2bb1c8016f96f71d0e91ed52250ef67177a660081cc4c72b54104ad965775aef247e329fdc8e46cb3f449cc8956a59dd8dd9cd8da22e753290e6b3c9'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Watch
5
- VERSION = "1.5.1".freeze
5
+ VERSION = "2.0.0".freeze
6
6
  end
7
7
  end
@@ -11,17 +11,7 @@ module Jekyll
11
11
  # Continuously watch if `watch` is set to true in the config.
12
12
  def process(options)
13
13
  Jekyll.logger.log_level = :error if options["quiet"]
14
- watch(site, options) if options["watch"]
15
- end
16
-
17
- # Watch for file changes and rebuild the site.
18
- #
19
- # site - A Jekyll::Site instance
20
- # options - A Hash of options passed to the command
21
- #
22
- # Returns nothing.
23
- def watch(_site, options)
24
- Jekyll::Watcher.watch(options)
14
+ Jekyll::Watcher.watch(options) if options["watch"]
25
15
  end
26
16
 
27
17
  end
@@ -40,7 +40,7 @@ module Jekyll
40
40
  # You pressed Ctrl-C, oh my!
41
41
  end
42
42
 
43
- # TODO: shouldn't be public API
43
+ private
44
44
  def build_listener(site, options)
45
45
  Listen.to(
46
46
  options["source"],
@@ -50,34 +50,36 @@ module Jekyll
50
50
  )
51
51
  end
52
52
 
53
+ private
53
54
  def listen_handler(site)
54
55
  proc do |modified, added, removed|
55
56
  t = Time.now
56
57
  c = modified + added + removed
57
58
  n = c.length
58
- print Jekyll.logger.message("Regenerating:",
59
- "#{n} file(s) changed at #{t.strftime("%Y-%m-%d %H:%M:%S")} ")
60
- begin
61
- site.process
62
- puts "...done in #{Time.now - t} seconds."
63
- rescue => e
64
- puts "...error:"
65
- Jekyll.logger.warn "Error:", e.message
66
- Jekyll.logger.warn "Error:", "Run jekyll build --trace for more information."
59
+ Jekyll.logger.info "Regenerating:",
60
+ "#{n} file(s) changed at #{t.strftime("%Y-%m-%d %H:%M:%S")}"
61
+
62
+ c.map { |path| path.sub("#{site.source}/", "") }.each do |file|
63
+ Jekyll.logger.info "", file
67
64
  end
65
+
66
+ process(site, t)
68
67
  end
69
68
  end
70
69
 
70
+ private
71
71
  def custom_excludes(options)
72
72
  Array(options["exclude"]).map { |e| Jekyll.sanitized_path(options["source"], e) }
73
73
  end
74
74
 
75
+ private
75
76
  def config_files(options)
76
77
  %w(yml yaml toml).map do |ext|
77
78
  Jekyll.sanitized_path(options["source"], "_config.#{ext}")
78
79
  end
79
80
  end
80
81
 
82
+ private
81
83
  def to_exclude(options)
82
84
  [
83
85
  config_files(options),
@@ -91,6 +93,7 @@ module Jekyll
91
93
  # options - A Hash of options passed to the command
92
94
  #
93
95
  # Returns a list of relative paths from source that should be ignored
96
+ private
94
97
  def listen_ignore_paths(options)
95
98
  source = Pathname.new(options["source"]).expand_path
96
99
  paths = to_exclude(options)
@@ -111,8 +114,21 @@ module Jekyll
111
114
  end.compact + [%r!\.jekyll\-metadata!]
112
115
  end
113
116
 
117
+ private
114
118
  def sleep_forever
115
119
  loop { sleep 1000 }
116
120
  end
121
+
122
+ private
123
+ def process(site, time)
124
+ begin
125
+ site.process
126
+ Jekyll.logger.info "", "...done in #{Time.now - time} seconds."
127
+ rescue => e
128
+ Jekyll.logger.warn "Error:", e.message
129
+ Jekyll.logger.warn "Error:", "Run jekyll build --trace for more information."
130
+ end
131
+ puts ""
132
+ end
117
133
  end
118
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore