guard-jekyll-plus 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -6
- data/lib/guard/jekyll/version.rb +1 -1
- data/lib/guard/jekyll.rb +46 -18
- data/test/Gemfile.lock +1 -1
- data/test/images/app.net.png +0 -0
- data/test/images/facebook.png +0 -0
- data/test/images/logo.png +0 -0
- data/test/images/twitter.png +0 -0
- metadata +6 -2
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Features:
|
|
12
12
|
|
13
13
|
Here's a look
|
14
14
|
|
15
|
-
![Colorized output](http://cl.ly/
|
15
|
+
![Colorized output](http://cl.ly/Q9qK/content.png)
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
@@ -71,11 +71,15 @@ For the most part that's all you'll ever need to do. There are some things you c
|
|
71
71
|
|
72
72
|
This guard has two configurations.
|
73
73
|
|
74
|
-
| Config
|
75
|
-
|
76
|
-
| `extensions`
|
77
|
-
| `config`
|
78
|
-
| `serve`
|
74
|
+
| Config | Description | Default
|
75
|
+
|:--------------|:-------------------------------------------------|:-----------------------------------------------------------------------------------|
|
76
|
+
| `extensions` | Array of file extensions to trigger Jekyll build | ['md', 'mkd', 'mkdn', 'markdown', 'textile', 'html', 'haml', 'slim', 'xml', 'yml'] |
|
77
|
+
| `config` | Array of configuration files | ['_config.yml'] |
|
78
|
+
| `serve` | Use Jekyll's build in WEBrick server | false |
|
79
|
+
| `drafts` | Build your site with draft posts | false |
|
80
|
+
| `future` | Build your site with future dated posts | false |
|
81
|
+
| `config_hash` | Use a config hash instead of an array of files | nil |
|
82
|
+
| `silent` | Slience all output other than exception message | false |
|
79
83
|
|
80
84
|
**Note:** customizations to the `extensions` configuration are additive.
|
81
85
|
|
data/lib/guard/jekyll/version.rb
CHANGED
data/lib/guard/jekyll.rb
CHANGED
@@ -11,24 +11,54 @@ module Guard
|
|
11
11
|
def initialize (watchers=[], options={})
|
12
12
|
super
|
13
13
|
|
14
|
-
default_extensions = ['md','mkd','markdown','textile','html','haml','slim','xml','yml']
|
14
|
+
default_extensions = ['md','mkd','mkdn','markdown','textile','html','haml','slim','xml','yml']
|
15
15
|
|
16
16
|
@options = {
|
17
17
|
:extensions => [],
|
18
18
|
:config => ['_config.yml'],
|
19
|
-
:serve => false
|
19
|
+
:serve => false,
|
20
|
+
:drafts => false,
|
21
|
+
:future => false,
|
22
|
+
:config_hash => nil,
|
23
|
+
:silent => false
|
20
24
|
}.merge(options)
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
@
|
26
|
+
# The config_hash option should be a hash ready to be consumed by Jekyll's Site class.
|
27
|
+
#
|
28
|
+
@config = @options[:config_hash] || jekyll_config(@options)
|
29
|
+
|
30
|
+
# Override configuration with passed values
|
31
|
+
#
|
32
|
+
@config['show_drafts'] ||= @options[:drafts]
|
33
|
+
@config['future'] ||= @options[:future]
|
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
|
+
# Store vars for easy internal access
|
44
|
+
#
|
25
45
|
@source = local_path @config['source']
|
26
46
|
@destination = local_path @config['destination']
|
27
|
-
|
28
|
-
|
47
|
+
@label = "Guard::Jekyll"
|
48
|
+
|
29
49
|
# Convert array of extensions into a regex for matching file extensions eg, /\.md$|\.markdown$|\.html$/i
|
50
|
+
#
|
51
|
+
extensions = @options[:extensions].concat(default_extensions).flatten.uniq
|
30
52
|
@extensions = Regexp.new extensions.map { |e| (e << '$').gsub('\.', '\\.') }.join('|'), true
|
31
53
|
|
54
|
+
# set Jekyll server process id to nil
|
55
|
+
#
|
56
|
+
@pid = nil
|
57
|
+
|
58
|
+
# Create a Jekyll site
|
59
|
+
#
|
60
|
+
@site = ::Jekyll::Site.new @config
|
61
|
+
|
32
62
|
end
|
33
63
|
|
34
64
|
def start
|
@@ -36,10 +66,10 @@ module Guard
|
|
36
66
|
if @options[:serve]
|
37
67
|
start_server
|
38
68
|
|
39
|
-
UI.info "
|
69
|
+
UI.info "#{@label} " + "watching and serving at #{@config['host']}:#{@config['port']}#{@config['baseurl']}" unless @config[:silent]
|
40
70
|
else
|
41
71
|
build
|
42
|
-
UI.info "
|
72
|
+
UI.info "#{@label} " + "watching" unless @config[:silent]
|
43
73
|
end
|
44
74
|
end
|
45
75
|
|
@@ -74,17 +104,17 @@ module Guard
|
|
74
104
|
|
75
105
|
def build(changes=nil)
|
76
106
|
begin
|
77
|
-
UI.info "
|
107
|
+
UI.info "#{@label} " + "building...".yellow unless @config[:silent]
|
78
108
|
if changes
|
79
109
|
puts '| ' # spacing
|
80
110
|
changes.each { |file| puts '|' + " ~ ".yellow + file }
|
81
111
|
puts '| ' # spacing
|
82
112
|
end
|
83
113
|
@site.process
|
84
|
-
UI.info "
|
114
|
+
UI.info "#{@label} " + "build complete ".green + "#{@source} → #{@destination}" unless @config[:silent]
|
85
115
|
|
86
116
|
rescue Exception => e
|
87
|
-
UI.error "
|
117
|
+
UI.error "#{@label} build has failed" unless @config[:silent]
|
88
118
|
stop_server
|
89
119
|
throw :task_has_failed
|
90
120
|
end
|
@@ -96,7 +126,7 @@ module Guard
|
|
96
126
|
begin
|
97
127
|
message = 'copied file'
|
98
128
|
message += 's' if files.size > 1
|
99
|
-
UI.info "
|
129
|
+
UI.info "#{@label} #{message.green}" unless @config[:silent]
|
100
130
|
puts '| ' #spacing
|
101
131
|
files.each do |file|
|
102
132
|
path = destination_path file
|
@@ -107,7 +137,7 @@ module Guard
|
|
107
137
|
puts '| ' #spacing
|
108
138
|
|
109
139
|
rescue Exception => e
|
110
|
-
UI.error "
|
140
|
+
UI.error "#{@label} copy has failed" unless @config[:silent]
|
111
141
|
UI.error e
|
112
142
|
stop_server
|
113
143
|
throw :task_has_failed
|
@@ -121,7 +151,7 @@ module Guard
|
|
121
151
|
begin
|
122
152
|
message = 'removed file'
|
123
153
|
message += 's' if files.size > 1
|
124
|
-
UI.info "
|
154
|
+
UI.info "#{@label} #{message.red}" unless @config[:silent]
|
125
155
|
puts '| ' #spacing
|
126
156
|
|
127
157
|
files.each do |file|
|
@@ -140,7 +170,7 @@ module Guard
|
|
140
170
|
puts '| ' #spacing
|
141
171
|
|
142
172
|
rescue Exception => e
|
143
|
-
UI.error "
|
173
|
+
UI.error "#{@label} remove has failed" unless @config[:silent]
|
144
174
|
UI.error e
|
145
175
|
stop_server
|
146
176
|
throw :task_has_failed
|
@@ -226,8 +256,6 @@ module Guard
|
|
226
256
|
false
|
227
257
|
end
|
228
258
|
end
|
229
|
-
|
230
|
-
|
231
259
|
end
|
232
260
|
end
|
233
261
|
|
data/test/Gemfile.lock
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.
|
4
|
+
version: 1.1.2
|
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-
|
12
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -72,6 +72,10 @@ files:
|
|
72
72
|
- test/_posts/2013-07-08-welcome-to-jekyll.markdown
|
73
73
|
- test/css/main.css
|
74
74
|
- test/css/syntax.css
|
75
|
+
- test/images/app.net.png
|
76
|
+
- test/images/facebook.png
|
77
|
+
- test/images/logo.png
|
78
|
+
- test/images/twitter.png
|
75
79
|
- test/index.html
|
76
80
|
homepage: http://github.com/imathis/guard-jekyll-plus
|
77
81
|
licenses: []
|