jekyll-watch 1.1.1 → 1.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll/watcher.rb +29 -21
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19fc2330fdbdf644e689711dbb2bf8f43dd941c4
4
- data.tar.gz: 27208f23e082bb1f42d8a48bfd8857e0f750353c
3
+ metadata.gz: 9855455db8909487179a72ecb00a1f4fe815e37d
4
+ data.tar.gz: 78c2b869b915f9f4d4f82938eb595a782fc77884
5
5
  SHA512:
6
- metadata.gz: e0e826d78bc318b9f68e37bd38007c18367b4e824e3cde0349846ea2737b7ec7b108d0d7c1fce1d2d1e6028bdb5667e2ea1e4de4bb2aee01bca12f88906edc2e
7
- data.tar.gz: e864b8310cf3325b04a2cd34aba6426a9825b5f613e298a3e0e2f581f9e687c00353f72b78770d7fcebe92d7d247b65414c2f50374c1816b9965647ce21266c5
6
+ metadata.gz: c1229d13b045a137e5b7576ad5e691d0ed343ba4dc96555a62f53541ca72250f616812940b78a80e3b3bb030cc6eef5b8443e58605aabb29eb7ad32fcb421f94
7
+ data.tar.gz: 86d75902d758067629d35e0427fef1872176c745f4ff7a5577391f712cbfaea021e569ecf324fab524340e5e77e10a0b2be46598f24be502f64debbd81555d7b
@@ -48,35 +48,43 @@ module Jekyll
48
48
  }
49
49
  end
50
50
 
51
+ def custom_excludes(options)
52
+ Array(options['exclude']).map { |e| Jekyll.sanitized_path(options['source'], e) }
53
+ end
54
+
55
+ def to_exclude(options)
56
+ config_files = [
57
+ "_config.yml",
58
+ "_config.yaml",
59
+ "_config.toml"
60
+ ].map { |config_file| Jekyll.sanitized_path(options['source'], config_file) }
61
+ [config_files, options['destination'], custom_excludes(options)].flatten
62
+ end
63
+
51
64
  # Paths to ignore for the watch option
52
65
  #
53
66
  # options - A Hash of options passed to the command
54
67
  #
55
68
  # Returns a list of relative paths from source that should be ignored
56
69
  def listen_ignore_paths(options)
57
- source = options['source']
58
- destination = options['destination']
59
- config_files = Jekyll.sanitized_path(source, "_config.yml")
60
- paths = (
61
- Array(config_files) \
62
- + Array(destination) \
63
- + Array(options['exclude']).map { |e| Jekyll.sanitized_path(source, e) }
64
- )
65
- ignored = []
70
+ source = Pathname.new(options['source']).expand_path
71
+ paths = to_exclude(options)
66
72
 
67
- source_abs = Pathname.new(source).expand_path
68
- paths.each do |p|
69
- path_abs = Pathname.new(p).expand_path
70
- begin
71
- rel_path = path_abs.relative_path_from(source_abs).to_s
72
- ignored << Regexp.new(Regexp.escape(rel_path)) unless rel_path.start_with?('../')
73
- rescue ArgumentError
74
- # Could not find a relative path
73
+ paths.map do |p|
74
+ absolute_path = Pathname.new(p).expand_path
75
+ if absolute_path.exist?
76
+ begin
77
+ relative_path = absolute_path.relative_path_from(source).to_s
78
+ unless relative_path.start_with?('../')
79
+ path_to_ignore = Regexp.new(Regexp.escape(relative_path))
80
+ Jekyll.logger.debug "Watcher:", "Ignoring #{path_to_ignore}"
81
+ path_to_ignore
82
+ end
83
+ rescue ArgumentError
84
+ # Could not find a relative path
85
+ end
75
86
  end
76
- end
77
-
78
- Jekyll.logger.debug "Watcher:", "Ignoring #{ignored.map(&:inspect).join(', ')}"
79
- ignored
87
+ end.compact
80
88
  end
81
89
 
82
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-watch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen