guard-jekyll-plus 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -9,3 +9,19 @@
9
9
  ### 1.1.1
10
10
  - Improved colorized output.
11
11
  - Rescued errors kill the Jekyll WEBrick server.
12
+
13
+ ## 1.1.2
14
+
15
+ New config options
16
+
17
+ - `config_hash` allows passing a config hash instead of an array of config files.
18
+ - `silent` allows you to prevent all output other than exception errors.
19
+
20
+ ### 1.2.0
21
+
22
+ **Changed** Now you must use jekyllplus in your guard file. Check the readme for updates.
23
+
24
+ - Changed guard name to jekyllplus to avoid issues with Guard Jekyll.
25
+ - Fixed installation of template guardfile
26
+ - Improved handling of Jekyll WEBrick server
27
+
data/README.md CHANGED
@@ -38,7 +38,7 @@ Navigate to your Jekyll project directory and create a Guardfile using:
38
38
  Or if you already have a Guardfile, add a Jekyll guard.
39
39
 
40
40
  ```ruby
41
- guard :jekyll do
41
+ guard :jekyllplus do
42
42
  watch /.*/
43
43
  ignore /^_site/
44
44
  end
@@ -59,7 +59,7 @@ If your Jekyll project has a non-standard directory stucture like this:
59
59
  You would do this instead:
60
60
 
61
61
  ```ruby
62
- guard :jekyll do
62
+ guard :jekyllplus do
63
63
  watch /^source/
64
64
  watch /_config.yml/
65
65
  end
@@ -88,7 +88,7 @@ This guard has two configurations.
88
88
  Here's how you would add `txt` to the list of file extensions which triggers a Jekyll build.
89
89
 
90
90
  ```ruby
91
- guard :jekyll, :extensions => ['txt'] do
91
+ guard :jekyllplus, :extensions => ['txt'] do
92
92
  watch /.*/
93
93
  ignore /^_site/
94
94
  end
@@ -102,7 +102,7 @@ which don't match these extensions will be simply copied over to the destination
102
102
  Here's how you might tell Jekyll to read from multiple configuration files.
103
103
 
104
104
  ```ruby
105
- guard :jekyll, :config => ['settings.yml', 'override.yml'] do
105
+ guard :jekyllplus, :config => ['settings.yml', 'override.yml'] do
106
106
  watch /.*/
107
107
  ignore /^_site/
108
108
  end
@@ -1,11 +1,11 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'guard/jekyll/version'
4
+ require 'guard/jekyll-plus/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "guard-jekyll-plus"
8
- gem.version = Guard::JekyllVersion::VERSION
8
+ gem.version = Guard::JekyllPlusVersion::VERSION
9
9
  gem.authors = ["Brandon Mathis"]
10
10
  gem.email = ["brandon@imathis.com"]
11
11
  gem.description = %q{A Guard plugin for smarter Jekyll watching}
@@ -1,4 +1,4 @@
1
- guard :jekyll do
1
+ guard :jekyllplus do
2
2
  watch /.*/
3
3
  ignore /^_site/
4
4
  end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ class JekyllPlusVersion
3
+ VERSION = "1.2.0"
4
+ end
5
+ end
@@ -6,7 +6,7 @@ require 'guard/guard'
6
6
  require 'jekyll'
7
7
 
8
8
  module Guard
9
- class Jekyll < Guard
9
+ class Jekyllplus < Guard
10
10
 
11
11
  def initialize (watchers=[], options={})
12
12
  super
@@ -25,21 +25,13 @@ module Guard
25
25
 
26
26
  # The config_hash option should be a hash ready to be consumed by Jekyll's Site class.
27
27
  #
28
- @config = @options[:config_hash] || jekyll_config(@options)
28
+ @config = jekyll_config(@options)
29
29
 
30
- # Override configuration with passed values
30
+ # Override configuration with guard option values
31
31
  #
32
32
  @config['show_drafts'] ||= @options[:drafts]
33
33
  @config['future'] ||= @options[:future]
34
34
 
35
- # Ensure required configurations are set
36
- # This ensures that config_hash option will succeed if set
37
- #
38
- @config['source'] ||= Dir.pwd
39
- @config['desitnation'] ||= File.join(Dir.pwd, '_site')
40
- @config['permalink'] ||= 'date'
41
- @config['limit_posts'] ||= 0
42
-
43
35
  # Store vars for easy internal access
44
36
  #
45
37
  @source = local_path @config['source']
@@ -65,7 +57,7 @@ module Guard
65
57
 
66
58
  if @options[:serve]
67
59
  start_server
68
-
60
+ build
69
61
  UI.info "#{@label} " + "watching and serving at #{@config['host']}:#{@config['port']}#{@config['baseurl']}" unless @config[:silent]
70
62
  else
71
63
  build
@@ -200,9 +192,15 @@ module Guard
200
192
  end
201
193
 
202
194
  def jekyll_config(options)
203
- config_files = options[:config]
204
- config_files = [config_files] unless config_files.is_a? Array
205
- ::Jekyll.configuration({ "config" => config_files })
195
+ puts options
196
+ if options[:config_hash]
197
+ config = options[:config_hash]
198
+ elsif options[:config]
199
+ config_files = options[:config]
200
+ config_files = [config_files] unless config_files.is_a? Array
201
+ config = { "config" => config_files}
202
+ end
203
+ ::Jekyll.configuration(config)
206
204
  end
207
205
 
208
206
  def local_path(path)
@@ -224,8 +222,8 @@ module Guard
224
222
  end
225
223
  end
226
224
 
227
- def server
228
- proc{ Process.spawn "jekyll server --config #{@options[:config].join(',')}" }
225
+ def server(config)
226
+ proc{ Process.fork { ::Jekyll::Commands::Serve.process(config) } }
229
227
  end
230
228
 
231
229
  def kill
@@ -234,7 +232,7 @@ module Guard
234
232
 
235
233
  def start_server
236
234
  return @pid if alive?
237
- @pid = instance_eval &server
235
+ @pid = instance_eval &server(@config)
238
236
  end
239
237
 
240
238
  def stop_server
data/test/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- guard-jekyll-plus (1.1.2)
4
+ guard-jekyll-plus (1.2.0)
5
5
  guard (>= 1.1.0)
6
6
  jekyll (>= 1.0.0)
7
7
 
@@ -25,7 +25,7 @@ GEM
25
25
  pry (>= 0.9.10)
26
26
  thor (>= 0.14.6)
27
27
  highline (1.6.19)
28
- jekyll (1.0.3)
28
+ jekyll (1.1.0)
29
29
  classifier (~> 1.3)
30
30
  colorator (~> 0.1)
31
31
  commander (~> 4.1.3)
@@ -34,6 +34,7 @@ GEM
34
34
  liquid (~> 2.3)
35
35
  maruku (~> 0.5)
36
36
  pygments.rb (~> 0.5.0)
37
+ redcarpet (~> 2.2.2)
37
38
  safe_yaml (~> 0.7.0)
38
39
  kramdown (1.0.2)
39
40
  liquid (2.5.0)
@@ -50,7 +51,7 @@ GEM
50
51
  coderay (~> 1.0.5)
51
52
  method_source (~> 0.8)
52
53
  slop (~> 3.4)
53
- pygments.rb (0.5.1)
54
+ pygments.rb (0.5.2)
54
55
  posix-spawn (~> 0.3.6)
55
56
  yajl-ruby (~> 1.1.0)
56
57
  rb-fsevent (0.9.3)
@@ -58,6 +59,7 @@ GEM
58
59
  ffi (>= 0.5.0)
59
60
  rb-kqueue (0.2.0)
60
61
  ffi (>= 0.5.0)
62
+ redcarpet (2.2.2)
61
63
  safe_yaml (0.7.1)
62
64
  slop (3.4.5)
63
65
  syntax (1.0.0)
data/test/Guardfile CHANGED
@@ -1,10 +1,8 @@
1
1
  # A sample Guardfile
2
2
  # More info at https://github.com/guard/guard#readme
3
3
  #
4
- require 'guard/guard'
5
- require 'jekyll'
6
4
 
7
- guard :jekyll, :config => ['_config.yml', '_override.yml'], :serve => true do
5
+ guard :jekyllplus, :config => ['_config.yml', '_override.yml'], :serve => true do
8
6
  watch /.*/
9
7
  ignore /^_site/
10
8
  end
data/test/_config.yml CHANGED
@@ -1,3 +0,0 @@
1
- name: Your New Jekyll Site
2
- pygments: true
3
- port: 4567
data/test/index.html CHANGED
@@ -10,4 +10,4 @@ title: Your New Jekyll Site
10
10
  <li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ post.url }}">{{ post.title }}</a></li>
11
11
  {% endfor %}
12
12
  </ul>
13
- </div>
13
+ </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-jekyll-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2013-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -58,9 +58,9 @@ files:
58
58
  - README.md
59
59
  - Rakefile
60
60
  - guard-jekyll-plus.gemspec
61
- - lib/guard/jekyll.rb
62
- - lib/guard/jekyll/templates/Guardfile
63
- - lib/guard/jekyll/version.rb
61
+ - lib/guard/jekyll-plus/templates/Guardfile
62
+ - lib/guard/jekyll-plus/version.rb
63
+ - lib/guard/jekyllplus.rb
64
64
  - test/.gitignore
65
65
  - test/Gemfile
66
66
  - test/Gemfile.lock
@@ -1,5 +0,0 @@
1
- module Guard
2
- class JekyllVersion
3
- VERSION = "1.1.2"
4
- end
5
- end