guard-jekyll-plus 1.1.0 → 1.1.1
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.
- data/CHANGELOG.md +11 -0
- data/README.md +5 -0
- data/lib/guard/jekyll/version.rb +1 -1
- data/lib/guard/jekyll.rb +51 -26
- data/test/Gemfile.lock +1 -1
- data/test/_override.yml +0 -1
- metadata +3 -2
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -8,6 +8,11 @@ Features:
|
|
8
8
|
- Batched processing! (Adding a directory of `n` files triggers a single build)
|
9
9
|
- Reads options from your YAML config file(s)
|
10
10
|
- Supports multiple config files (Jekyll 1.0)
|
11
|
+
- Clear and colorized output
|
12
|
+
|
13
|
+
Here's a look
|
14
|
+
|
15
|
+

|
11
16
|
|
12
17
|
## Installation
|
13
18
|
|
data/lib/guard/jekyll/version.rb
CHANGED
data/lib/guard/jekyll.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require 'guard'
|
2
4
|
require 'guard/guard'
|
3
5
|
|
@@ -34,10 +36,10 @@ module Guard
|
|
34
36
|
if @options[:serve]
|
35
37
|
start_server
|
36
38
|
|
37
|
-
UI.info "Guard::Jekyll
|
39
|
+
UI.info "Guard::Jekyll " + "watching and serving at #{@config['host']}:#{@config['port']}#{@config['baseurl']}"
|
38
40
|
else
|
39
41
|
build
|
40
|
-
UI.info "Guard::Jekyll
|
42
|
+
UI.info "Guard::Jekyll " + "watching"
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -64,61 +66,84 @@ module Guard
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def run_on_removals(paths)
|
67
|
-
|
69
|
+
remove paths
|
68
70
|
end
|
69
71
|
|
70
72
|
|
71
73
|
private
|
72
74
|
|
73
|
-
def build
|
75
|
+
def build(changes=nil)
|
74
76
|
begin
|
75
|
-
UI.info "Guard::Jekyll "+"
|
77
|
+
UI.info "Guard::Jekyll " + "building...".yellow
|
78
|
+
if changes
|
79
|
+
puts '| ' # spacing
|
80
|
+
changes.each { |file| puts '|' + " ~ ".yellow + file }
|
81
|
+
puts '| ' # spacing
|
82
|
+
end
|
76
83
|
@site.process
|
77
|
-
UI.info "Guard::Jekyll "+" complete".green + "
|
84
|
+
UI.info "Guard::Jekyll " + "build complete ".green + "#{@source} → #{@destination}"
|
78
85
|
|
79
86
|
rescue Exception => e
|
80
87
|
UI.error "Guard::Jekyll build has failed"
|
88
|
+
stop_server
|
81
89
|
throw :task_has_failed
|
82
90
|
end
|
83
91
|
end
|
84
92
|
|
85
93
|
# Copy static files to destination directory
|
86
94
|
#
|
87
|
-
def copy(
|
95
|
+
def copy(files=[])
|
88
96
|
begin
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
97
|
+
message = 'copied file'
|
98
|
+
message += 's' if files.size > 1
|
99
|
+
UI.info "Guard::Jekyll #{message.green}"
|
100
|
+
puts '| ' #spacing
|
101
|
+
files.each do |file|
|
102
|
+
path = destination_path file
|
103
|
+
FileUtils.mkdir_p File.dirname(path)
|
104
|
+
FileUtils.cp file, path
|
105
|
+
puts '|' + " → ".green + path
|
106
|
+
end
|
107
|
+
puts '| ' #spacing
|
108
|
+
|
93
109
|
rescue Exception => e
|
94
110
|
UI.error "Guard::Jekyll copy has failed"
|
95
111
|
UI.error e
|
112
|
+
stop_server
|
96
113
|
throw :task_has_failed
|
97
114
|
end
|
115
|
+
true
|
98
116
|
end
|
99
117
|
|
100
118
|
# Remove deleted source file/directories from destination
|
101
119
|
#
|
102
|
-
def remove(
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
120
|
+
def remove(files=[])
|
121
|
+
begin
|
122
|
+
message = 'removed file'
|
123
|
+
message += 's' if files.size > 1
|
124
|
+
UI.info "Guard::Jekyll #{message.red}"
|
125
|
+
puts '| ' #spacing
|
126
|
+
|
127
|
+
files.each do |file|
|
128
|
+
path = destination_path file
|
129
|
+
if File.exist? path
|
130
|
+
FileUtils.rm path
|
131
|
+
puts '|' + " x ".red + path
|
132
|
+
end
|
109
133
|
|
110
134
|
dir = File.dirname path
|
111
135
|
if Dir[dir+'/*'].empty?
|
112
136
|
FileUtils.rm_r(dir)
|
113
|
-
|
137
|
+
puts '|' + " x ".red + dir
|
114
138
|
end
|
115
|
-
|
116
|
-
rescue Exception => e
|
117
|
-
UI.error "Guard::Jekyll remove has failed"
|
118
|
-
UI.error e
|
119
|
-
throw :task_has_failed
|
120
139
|
end
|
140
|
+
puts '| ' #spacing
|
121
141
|
|
142
|
+
rescue Exception => e
|
143
|
+
UI.error "Guard::Jekyll remove has failed"
|
144
|
+
UI.error e
|
145
|
+
stop_server
|
146
|
+
throw :task_has_failed
|
122
147
|
end
|
123
148
|
true
|
124
149
|
end
|
@@ -138,9 +163,9 @@ module Guard
|
|
138
163
|
# If changes match Jekyll extensions, trigger a build else, copy files manually
|
139
164
|
#
|
140
165
|
if matches.length > 0
|
141
|
-
build
|
166
|
+
build(matches)
|
142
167
|
else
|
143
|
-
copy_files
|
168
|
+
copy(copy_files)
|
144
169
|
end
|
145
170
|
end
|
146
171
|
|
data/test/Gemfile.lock
CHANGED
data/test/_override.yml
CHANGED
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.1
|
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-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -51,6 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
53
|
- .gitignore
|
54
|
+
- CHANGELOG.md
|
54
55
|
- Gemfile
|
55
56
|
- Gemfile.lock
|
56
57
|
- LICENSE.txt
|