octopress-hooks 2.5.0 → 2.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +15 -10
- data/lib/octopress-hooks.rb +10 -0
- data/lib/octopress-hooks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec569a69dc73f39cc9ead6b67485a3fba18be51c
|
4
|
+
data.tar.gz: aaed2428cc80be687c0378b0d93bad7686da3d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c70fee3dee75ce2cc45468ba7536c540b2774b8cd9a7415fbf8874fdba9b70bdb192440211249a8393888374e1a1b2ab61f091638de0a5da628f5265c3f32e71
|
7
|
+
data.tar.gz: f4b31162567218a8b9163ffa4d4c33179ee9e2f682e3b421b454b4deafa03350be94c19036be9a84877c643769f15e030b6448f854bc4073dbcbf30a1edc5d22
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 2.6.0 - 2015-02-16
|
4
|
+
- New: Site `reset` hook helps you reset variables before successive builds.
|
5
|
+
|
3
6
|
### 2.5.0 - 2015-02-16
|
4
7
|
- New: `deep_merge_payload` hook allows Posts, Pages, and Documents to have control over the way the payload is merged. (Expert level)
|
5
8
|
|
data/README.md
CHANGED
@@ -24,16 +24,17 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
This is the order in which hooks are triggered.
|
26
26
|
|
27
|
-
1. Site `
|
28
|
-
2. Site `
|
29
|
-
3.
|
30
|
-
4.
|
31
|
-
5. Site `
|
32
|
-
6.
|
33
|
-
5. Post/Page/Document `
|
34
|
-
7. Post/Page/Document `
|
35
|
-
8. Post/Page/Document `
|
36
|
-
9.
|
27
|
+
1. Site `reset`
|
28
|
+
2. Site `pre_read`
|
29
|
+
3. Site `post_read`
|
30
|
+
4. Post/Page/Document `post_init`
|
31
|
+
5. Site `pre_render`
|
32
|
+
6. Site `merge_payload`
|
33
|
+
5. Post/Page/Document `pre_render`
|
34
|
+
7. Post/Page/Document `merge_payload`
|
35
|
+
8. Post/Page/Document `post_render`
|
36
|
+
9. Post/Page/Document `post_write`
|
37
|
+
10. Site `post_write`
|
37
38
|
|
38
39
|
## Usage
|
39
40
|
|
@@ -52,6 +53,8 @@ The Site class has three methods. Here's an example.
|
|
52
53
|
|
53
54
|
```ruby
|
54
55
|
class MySiteHook < Octopress::Hooks::Site
|
56
|
+
def reset(site)
|
57
|
+
end
|
55
58
|
|
56
59
|
def pre_read(site)
|
57
60
|
end
|
@@ -73,6 +76,8 @@ class MySiteHook < Octopress::Hooks::Site
|
|
73
76
|
end
|
74
77
|
```
|
75
78
|
|
79
|
+
Use the `reset` hook to reset variables to before each build. It's mostly useful to support `--watch` builds.
|
80
|
+
|
76
81
|
Use the `pre_read` hook to modify the site instance before posts, pages and static files are read.
|
77
82
|
|
78
83
|
Use the `post_read` hook to modify the site instance after posts, pages and static files are read but before generators are triggered.
|
data/lib/octopress-hooks.rb
CHANGED
@@ -6,6 +6,12 @@ module Octopress
|
|
6
6
|
|
7
7
|
class Site < Jekyll::Plugin
|
8
8
|
|
9
|
+
# Called at the beginning of every build
|
10
|
+
# Returns nothing
|
11
|
+
#
|
12
|
+
def reset(site)
|
13
|
+
end
|
14
|
+
|
9
15
|
# Called before after Jekyll reads in items
|
10
16
|
# Returns nothing
|
11
17
|
#
|
@@ -36,6 +42,7 @@ module Octopress
|
|
36
42
|
#
|
37
43
|
def post_write(site)
|
38
44
|
end
|
45
|
+
|
39
46
|
end
|
40
47
|
|
41
48
|
class Page < Jekyll::Plugin
|
@@ -161,6 +168,9 @@ module Jekyll
|
|
161
168
|
def reset
|
162
169
|
old_reset
|
163
170
|
load_hooks
|
171
|
+
site_hooks.each do |hook|
|
172
|
+
hook.reset(self)
|
173
|
+
end
|
164
174
|
end
|
165
175
|
|
166
176
|
def read
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|