middleman-blog-drafts 0.2.0 → 0.3.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.
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -1
- data/README.md +31 -6
- data/features/build.feature +14 -2
- data/fixtures/drafts-app/source/drafts/draft-build-false.html.erb +6 -0
- data/fixtures/drafts-app/source/drafts/draft-build-true.html.erb +6 -0
- data/fixtures/drafts-build-true-app/config.rb +9 -0
- data/fixtures/drafts-build-true-app/source/drafts/draft-build-false.html.erb +6 -0
- data/fixtures/drafts-build-true-app/source/drafts/draft-build-true.html.erb +6 -0
- data/fixtures/drafts-build-true-app/source/drafts/listing_drafts.html.erb +11 -0
- data/fixtures/drafts-build-true-app/source/drafts/new-draft.html.erb +5 -0
- data/fixtures/drafts-build-true-app/source/layout.erb +8 -0
- data/lib/middleman-blog-drafts/blog_data_extensions.rb +3 -1
- data/lib/middleman-blog-drafts/version.rb +1 -1
- metadata +19 -3
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -17,7 +17,7 @@ GIT
|
|
17
17
|
PATH
|
18
18
|
remote: .
|
19
19
|
specs:
|
20
|
-
middleman-blog-drafts (0.
|
20
|
+
middleman-blog-drafts (0.3.0)
|
21
21
|
middleman-blog (~> 3.5.1)
|
22
22
|
middleman-core (~> 3.2.2)
|
23
23
|
|
@@ -123,6 +123,7 @@ DEPENDENCIES
|
|
123
123
|
kramdown
|
124
124
|
middleman-blog-drafts!
|
125
125
|
middleman-core!
|
126
|
+
pry
|
126
127
|
rake (~> 10.1.0)
|
127
128
|
rdoc (~> 3.9)
|
128
129
|
sass
|
data/README.md
CHANGED
@@ -44,13 +44,18 @@ middleman publish source/drafts/my-awesome-new-blog-post.markdown
|
|
44
44
|
<% end %>
|
45
45
|
```
|
46
46
|
|
47
|
-
As drafts won't be be available in the generated page by default, checking
|
47
|
+
As drafts won't be be available in the generated page by default, checking
|
48
|
+
whether there are any is enough to decide whether to render the listing or not.
|
48
49
|
|
49
50
|
## Configuration options
|
50
51
|
|
51
|
-
`build`: when `true`, the drafts will be available unconditionally. If not
|
52
|
+
`build`: when `true`, the drafts will be available unconditionally. If not
|
53
|
+
given, the drafts will be available in middleman's development mode and
|
54
|
+
unavailable in `middleman build`.
|
52
55
|
|
53
|
-
This allows you to control the behaviour, for example if you have a preview
|
56
|
+
This allows you to control the behaviour, for example if you have a preview
|
57
|
+
instance of your blog. One way to do so would be to set it based on an
|
58
|
+
environment variable:
|
54
59
|
|
55
60
|
```ruby
|
56
61
|
activate :drafts do |drafts|
|
@@ -58,16 +63,36 @@ activate :drafts do |drafts|
|
|
58
63
|
end
|
59
64
|
```
|
60
65
|
|
61
|
-
This activates drafts in any environment where `SHOW_DRAFTS` is given and uses
|
66
|
+
This activates drafts in any environment where `SHOW_DRAFTS` is given and uses
|
67
|
+
the default otherwise.
|
68
|
+
|
69
|
+
## Frontmatter options
|
70
|
+
|
71
|
+
`build` can be overriden on a per-draft basis. For example if you want to make
|
72
|
+
a draft available to a small audience for proofreading, you may force the build
|
73
|
+
of that one draft with the following frontmatter:
|
74
|
+
|
75
|
+
```yaml
|
76
|
+
---
|
77
|
+
title: "Example blog post"
|
78
|
+
build: true
|
79
|
+
---
|
80
|
+
```
|
81
|
+
|
82
|
+
Likewise if you configure `build` to `true` for your entire blog, you may still
|
83
|
+
withhold single drafts from being built by setting `build: false` in the
|
84
|
+
frontmatter.
|
62
85
|
|
63
86
|
## Learn More
|
64
87
|
|
65
|
-
See the [blog extension guide](http://middlemanapp.com/basics/blogging/) for
|
88
|
+
See the [blog extension guide](http://middlemanapp.com/basics/blogging/) for
|
89
|
+
detailed
|
66
90
|
information on configuring and using the blog extension.
|
67
91
|
|
68
92
|
## Credits
|
69
93
|
|
70
|
-
Most of the code was based on the
|
94
|
+
Most of the code was based on the
|
95
|
+
[middleman-blog](https://github.com/middleman/middleman-blog)
|
71
96
|
gem itself, so many thanks to everyone that helped out with it.
|
72
97
|
|
73
98
|
## Contributing
|
data/features/build.feature
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
Feature: Building the site
|
2
|
-
|
2
|
+
|
3
|
+
Scenario: Default config builds only drafts with frontmatter build=true
|
3
4
|
Given a fixture app "drafts-app"
|
4
5
|
When I run `middleman build`
|
5
|
-
Then the
|
6
|
+
Then the following files should not exist:
|
7
|
+
| build/drafts/new-draft.html |
|
8
|
+
And the following files should exist:
|
9
|
+
| build/drafts/draft-build-true.html |
|
10
|
+
|
11
|
+
Scenario: Config build=true does not build drafts with frontmatter build=false
|
12
|
+
Given a fixture app "drafts-build-true-app"
|
13
|
+
When I run `middleman build`
|
14
|
+
Then the following files should exist:
|
15
|
+
| build/drafts/new-draft.html |
|
16
|
+
And the following files should not exist:
|
17
|
+
| build/drafts/draft-build-false.html |
|
@@ -83,7 +83,9 @@ module Middleman
|
|
83
83
|
# @param [DraftArticle] draft A draft article
|
84
84
|
# @return [Boolean] Whether it should be built
|
85
85
|
def build?(draft)
|
86
|
-
|
86
|
+
build = draft.data["build"]
|
87
|
+
build = @options.build if build == nil
|
88
|
+
@app.environment == :development || build
|
87
89
|
end
|
88
90
|
|
89
91
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-blog-drafts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-02-
|
13
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
@@ -69,10 +69,18 @@ files:
|
|
69
69
|
- features/step_definitions/drafts_steps.rb
|
70
70
|
- features/support/env.rb
|
71
71
|
- fixtures/drafts-app/config.rb
|
72
|
+
- fixtures/drafts-app/source/drafts/draft-build-false.html.erb
|
73
|
+
- fixtures/drafts-app/source/drafts/draft-build-true.html.erb
|
72
74
|
- fixtures/drafts-app/source/drafts/listing_drafts.html.erb
|
73
75
|
- fixtures/drafts-app/source/drafts/new-draft.html.erb
|
74
76
|
- fixtures/drafts-app/source/drafts/other-draft.html.erb
|
75
77
|
- fixtures/drafts-app/source/layout.erb
|
78
|
+
- fixtures/drafts-build-true-app/config.rb
|
79
|
+
- fixtures/drafts-build-true-app/source/drafts/draft-build-false.html.erb
|
80
|
+
- fixtures/drafts-build-true-app/source/drafts/draft-build-true.html.erb
|
81
|
+
- fixtures/drafts-build-true-app/source/drafts/listing_drafts.html.erb
|
82
|
+
- fixtures/drafts-build-true-app/source/drafts/new-draft.html.erb
|
83
|
+
- fixtures/drafts-build-true-app/source/layout.erb
|
76
84
|
- lib/middleman-blog-drafts.rb
|
77
85
|
- lib/middleman-blog-drafts/blog_data_extensions.rb
|
78
86
|
- lib/middleman-blog-drafts/commands/draft.rb
|
@@ -105,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
113
|
version: '0'
|
106
114
|
segments:
|
107
115
|
- 0
|
108
|
-
hash:
|
116
|
+
hash: 2863171145305893052
|
109
117
|
requirements: []
|
110
118
|
rubyforge_project:
|
111
119
|
rubygems_version: 1.8.25
|
@@ -121,8 +129,16 @@ test_files:
|
|
121
129
|
- features/step_definitions/drafts_steps.rb
|
122
130
|
- features/support/env.rb
|
123
131
|
- fixtures/drafts-app/config.rb
|
132
|
+
- fixtures/drafts-app/source/drafts/draft-build-false.html.erb
|
133
|
+
- fixtures/drafts-app/source/drafts/draft-build-true.html.erb
|
124
134
|
- fixtures/drafts-app/source/drafts/listing_drafts.html.erb
|
125
135
|
- fixtures/drafts-app/source/drafts/new-draft.html.erb
|
126
136
|
- fixtures/drafts-app/source/drafts/other-draft.html.erb
|
127
137
|
- fixtures/drafts-app/source/layout.erb
|
138
|
+
- fixtures/drafts-build-true-app/config.rb
|
139
|
+
- fixtures/drafts-build-true-app/source/drafts/draft-build-false.html.erb
|
140
|
+
- fixtures/drafts-build-true-app/source/drafts/draft-build-true.html.erb
|
141
|
+
- fixtures/drafts-build-true-app/source/drafts/listing_drafts.html.erb
|
142
|
+
- fixtures/drafts-build-true-app/source/drafts/new-draft.html.erb
|
143
|
+
- fixtures/drafts-build-true-app/source/layout.erb
|
128
144
|
has_rdoc:
|