guard-jekyll 1.0.0 → 1.1.0

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.
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'guard'
2
4
  require 'guard/guard'
3
5
 
@@ -6,17 +8,14 @@ require 'jekyll'
6
8
  module Guard
7
9
  class Jekyll < Guard
8
10
 
9
- def initialize(watchers=[], options={})
11
+ def initialize(watchers = [], options = {})
10
12
  super
11
- @working_path = File.expand_path(options[:source] ||
12
- options['source'] ||
13
- File.dirname("."))
13
+ @source = options[:source] || File.dirname('.')
14
14
  end
15
15
 
16
16
  def start
17
- UI.info "Guard::Jekyll is watching for file changes..."
18
- run_all
19
- true
17
+ UI.info 'Guard::Jekyll is watching for file changes'
18
+ create_site(@source)
20
19
  end
21
20
 
22
21
  def run_all
@@ -27,30 +26,39 @@ module Guard
27
26
  jekyll!
28
27
  end
29
28
 
30
- def reload
29
+ def run_on_additions(paths)
30
+ jekyll!
31
+ end
32
+
33
+ def run_on_modifications(paths)
34
+ jekyll!
35
+ end
36
+
37
+ def run_on_removals(paths)
31
38
  jekyll!
32
39
  end
33
40
 
34
41
  private
35
42
 
36
43
  def jekyll!
37
- UI.info "Guard::Jekyll running."
44
+ UI.info 'Guard::Jekyll running'
38
45
 
39
- create_site
40
46
  @jekyll_site.process
41
47
 
42
- UI.info "Guard::Jekyll complete."
48
+ UI.info 'Guard::Jekyll complete'
43
49
  rescue Exception => e
44
50
  UI.error "Guard::Jekyll failed: #{e}"
45
51
  throw :task_has_failed
46
52
  end
47
53
 
48
- def create_site
49
- options = {'source' => @working_path}
54
+ def create_site(source)
55
+ working_path = File.expand_path(source)
56
+
57
+ options = {'source' => working_path}
50
58
 
51
- unless File.exists? File.join(@working_path, '_config.yml')
52
- options['destination'] = File.join(@working_path, '_site')
53
- options['plugins'] = File.join(@working_path, '_plugins')
59
+ unless File.exists? File.join(working_path, '_config.yml')
60
+ options['destination'] = File.join(working_path, '_site')
61
+ options['plugins'] = File.join(working_path, '_plugins')
54
62
  end
55
63
 
56
64
  config = ::Jekyll.configuration(options)
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module JekyllVersion
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: