guard-jekyll 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -2
- data/README.markdown +31 -16
- data/lib/guard/jekyll.rb +17 -38
- data/lib/guard/jekyll/templates/Guardfile +1 -0
- data/lib/guard/jekyll/version.rb +1 -1
- metadata +2 -3
- data/.gitignore +0 -1
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -1,26 +1,41 @@
|
|
1
|
-
|
2
|
-
Run jekyll for you.
|
1
|
+
# Guard::Jekyll
|
3
2
|
|
4
|
-
|
5
|
-
if you haven't already `gem install jekyll`
|
6
|
-
then `gem install guard-jekyll`
|
7
|
-
in your project's directory root
|
8
|
-
`guard init`
|
9
|
-
`guard init jekyll`
|
3
|
+
This is a guard for [jekyll](http://jekyllrb.com/).
|
10
4
|
|
11
|
-
|
5
|
+
## Installation
|
12
6
|
|
13
|
-
|
14
|
-
watch /.*/
|
15
|
-
end
|
7
|
+
Add this line to your application's Gemfile:
|
16
8
|
|
17
|
-
|
18
|
-
|
9
|
+
gem 'guard-jekyll'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install guard-jekyll
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Enter the jekyll site directory for which you want to use Guard::Jekyll. Create a Guardfile using `guard init`:
|
22
|
+
|
23
|
+
$ guard init jekyll
|
24
|
+
|
25
|
+
Execute guard:
|
26
|
+
|
27
|
+
$ guard
|
28
|
+
|
29
|
+
Whenever you change a file in the jekyll site directory now, the site will be rebuilt!
|
30
|
+
|
31
|
+
## Options
|
32
|
+
* `:source` the source directory which jekyll reads files from (default `'./'`)
|
33
|
+
* `:destination` the directory where Jekyll will write files to (default is `'./_site'`)
|
34
|
+
* `:config` array of configuration files which jekyll will read (default `['./_config.yml']`)
|
19
35
|
|
20
36
|
## License
|
21
|
-
(The MIT License)
|
22
37
|
|
23
|
-
|
38
|
+
(MIT License)
|
24
39
|
|
25
40
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
26
41
|
|
data/lib/guard/jekyll.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'guard'
|
4
2
|
require 'guard/guard'
|
5
3
|
|
@@ -7,62 +5,43 @@ require 'jekyll'
|
|
7
5
|
|
8
6
|
module Guard
|
9
7
|
class Jekyll < Guard
|
10
|
-
|
11
8
|
def initialize(watchers = [], options = {})
|
12
|
-
|
13
|
-
|
9
|
+
defaults = {
|
10
|
+
:source => './',
|
11
|
+
:destination => './_site',
|
12
|
+
:config => ['_config.yml'],
|
13
|
+
}
|
14
|
+
|
15
|
+
super(watchers, options.merge(defaults))
|
14
16
|
end
|
15
17
|
|
16
18
|
def start
|
17
19
|
UI.info 'Guard::Jekyll is watching for file changes'
|
18
|
-
|
20
|
+
rebuild
|
19
21
|
end
|
20
22
|
|
21
23
|
def run_all
|
22
|
-
|
24
|
+
rebuild
|
23
25
|
end
|
24
26
|
|
25
27
|
def run_on_changes(paths)
|
26
|
-
|
27
|
-
end
|
28
|
-
|
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)
|
38
|
-
jekyll!
|
28
|
+
rebuild
|
39
29
|
end
|
40
30
|
|
41
31
|
private
|
42
32
|
|
43
|
-
|
44
|
-
|
33
|
+
# rebuilds the entire jekyll site
|
34
|
+
#
|
35
|
+
def rebuild
|
36
|
+
UI.info 'Guard::Jekyll regenerating'
|
45
37
|
|
46
|
-
|
38
|
+
site = ::Jekyll::Site.new(::Jekyll.configuration(options))
|
39
|
+
site.process
|
47
40
|
|
48
|
-
UI.info 'Guard::Jekyll
|
41
|
+
UI.info 'Guard::Jekyll done.'
|
49
42
|
rescue Exception => e
|
50
43
|
UI.error "Guard::Jekyll failed: #{e}"
|
51
44
|
throw :task_has_failed
|
52
45
|
end
|
53
|
-
|
54
|
-
def create_site(source)
|
55
|
-
working_path = File.expand_path(source)
|
56
|
-
|
57
|
-
options = {'source' => working_path}
|
58
|
-
|
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')
|
62
|
-
end
|
63
|
-
|
64
|
-
config = ::Jekyll.configuration(options)
|
65
|
-
@jekyll_site = ::Jekyll::Site.new(config)
|
66
|
-
end
|
67
46
|
end
|
68
47
|
end
|
data/lib/guard/jekyll/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -50,7 +50,6 @@ executables: []
|
|
50
50
|
extensions: []
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
|
-
- .gitignore
|
54
53
|
- Gemfile
|
55
54
|
- README.markdown
|
56
55
|
- Rakefile
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
*.un~
|