middleman-blog-drafts 0.0.1 → 0.0.2
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/.gitignore +1 -0
- data/README.md +61 -0
- data/features/build.feature +1 -1
- data/features/draft_date.feature +2 -2
- data/features/drafts_list.feature +7 -0
- data/features/publish_cli.feature +3 -3
- data/fixtures/drafts-app/source/drafts/listing_drafts.html.erb +11 -0
- data/fixtures/{draft-date-app → drafts-app}/source/drafts/new-draft.html.erb +3 -0
- data/fixtures/{draft-date-app → drafts-app}/source/drafts/other-draft.html.erb +3 -0
- data/fixtures/{draft-date-app → drafts-app}/source/layout.erb +0 -0
- data/lib/middleman-blog-drafts/blog_data_extensions.rb +6 -0
- data/lib/middleman-blog-drafts/extension.rb +7 -0
- data/lib/middleman-blog-drafts/version.rb +1 -1
- metadata +10 -7
- data/fixtures/draft-date-app/config.rb +0 -3
data/.gitignore
CHANGED
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# middleman-blog-drafts
|
2
|
+
|
3
|
+
middleman-blog-drafts is an addon for [middleman-blog](https://github.com/middleman/middleman-blog)
|
4
|
+
that simplifies draft posts creation and publishing.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
If you're just getting started, install the required gems and generate a new blog project:
|
9
|
+
|
10
|
+
```terminal
|
11
|
+
gem install middleman middleman-blog-drafts
|
12
|
+
middleman init MY_BLOG_PROJECT --template=blog
|
13
|
+
```
|
14
|
+
|
15
|
+
Then add `middleman-blog-drafts` to your `Gemfile` and activate the extension in your `config.rb`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
activate :drafts
|
19
|
+
```
|
20
|
+
|
21
|
+
## Generating drafts
|
22
|
+
|
23
|
+
```terminal
|
24
|
+
middleman draft 'My awesome new blog post'
|
25
|
+
```
|
26
|
+
|
27
|
+
## Publishing drafts
|
28
|
+
|
29
|
+
```terminal
|
30
|
+
middleman publish source/drafts/my-awesome-new-blog-post.markdown
|
31
|
+
```
|
32
|
+
|
33
|
+
## Listing drafts on a page
|
34
|
+
|
35
|
+
```erb
|
36
|
+
<% unless settings.build? %>
|
37
|
+
<ul>
|
38
|
+
<%= drafts.each do |draft| %>
|
39
|
+
<li><%= link_to draft.title, draft.path %></li>
|
40
|
+
<% end %>
|
41
|
+
</ul>
|
42
|
+
<% end %>
|
43
|
+
```
|
44
|
+
|
45
|
+
## Learn More
|
46
|
+
|
47
|
+
See the [blog extension guide](http://middlemanapp.com/blogging/) for detailed
|
48
|
+
information on configuring and using the blog extension.
|
49
|
+
|
50
|
+
## Credits
|
51
|
+
|
52
|
+
Most of the code was based on the [middleman-blog](https://github.com/middleman/middleman-blog)
|
53
|
+
gem itself, so many thanks to everyone that helped out with it.
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
1. Fork it
|
58
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
61
|
+
5. Create new Pull Request
|
data/features/build.feature
CHANGED
data/features/draft_date.feature
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Feature: Derive draft date from today
|
2
2
|
Scenario: Drafts without dates
|
3
|
-
Given the Server is running at "
|
3
|
+
Given the Server is running at "drafts-app"
|
4
4
|
When I go to "/drafts/new-draft.html"
|
5
5
|
Then I should see the current date
|
6
6
|
|
7
7
|
Scenario: Drafts without dates and using data store
|
8
|
-
Given the Server is running at "
|
8
|
+
Given the Server is running at "drafts-app"
|
9
9
|
When I go to "/drafts/other-draft.html"
|
10
10
|
Then I should see the current date
|
@@ -10,8 +10,8 @@ Feature: Publish draft CLI command
|
|
10
10
|
| source/drafts/my-new-article.html.markdown |
|
11
11
|
|
12
12
|
Scenario: Viewing a published article
|
13
|
-
Given a fixture app "
|
13
|
+
Given a fixture app "drafts-app"
|
14
14
|
And I run `middleman publish source/drafts/new-draft.html.erb --date 2012-03-07`
|
15
|
-
When the Server is running at "
|
16
|
-
And I go to "/2012/03/07/new-draft.html"
|
15
|
+
When the Server is running at "drafts-app"
|
16
|
+
And I go to "/blog/2012/03/07/new-draft.html"
|
17
17
|
Then I should see '2012-03-07'
|
File without changes
|
@@ -48,6 +48,13 @@ module Middleman
|
|
48
48
|
def current_article
|
49
49
|
super || blog.draft(current_resource.path)
|
50
50
|
end
|
51
|
+
|
52
|
+
|
53
|
+
# Returns the list of drafts on the site.
|
54
|
+
# @return [Array<Middleman::Sitemap::Resource>]
|
55
|
+
def drafts
|
56
|
+
blog.drafts.articles
|
57
|
+
end
|
51
58
|
end
|
52
59
|
end
|
53
60
|
end
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -53,18 +53,20 @@ files:
|
|
53
53
|
- .gitignore
|
54
54
|
- Gemfile
|
55
55
|
- Guardfile
|
56
|
+
- README.md
|
56
57
|
- Rakefile
|
57
58
|
- features/build.feature
|
58
59
|
- features/draft_cli.feature
|
59
60
|
- features/draft_date.feature
|
61
|
+
- features/drafts_list.feature
|
60
62
|
- features/publish_cli.feature
|
61
63
|
- features/step_definitions/drafts_steps.rb
|
62
64
|
- features/support/env.rb
|
63
|
-
- fixtures/draft-date-app/config.rb
|
64
|
-
- fixtures/draft-date-app/source/drafts/new-draft.html.erb
|
65
|
-
- fixtures/draft-date-app/source/drafts/other-draft.html.erb
|
66
|
-
- fixtures/draft-date-app/source/layout.erb
|
67
65
|
- fixtures/drafts-app/config.rb
|
66
|
+
- fixtures/drafts-app/source/drafts/listing_drafts.html.erb
|
67
|
+
- fixtures/drafts-app/source/drafts/new-draft.html.erb
|
68
|
+
- fixtures/drafts-app/source/drafts/other-draft.html.erb
|
69
|
+
- fixtures/drafts-app/source/layout.erb
|
68
70
|
- lib/middleman-blog-drafts.rb
|
69
71
|
- lib/middleman-blog-drafts/blog_data_extensions.rb
|
70
72
|
- lib/middleman-blog-drafts/commands/draft.rb
|
@@ -88,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
90
|
version: '0'
|
89
91
|
segments:
|
90
92
|
- 0
|
91
|
-
hash:
|
93
|
+
hash: 1502395184488581113
|
92
94
|
none: false
|
93
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
96
|
requirements:
|
@@ -97,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
99
|
version: '0'
|
98
100
|
segments:
|
99
101
|
- 0
|
100
|
-
hash:
|
102
|
+
hash: 1502395184488581113
|
101
103
|
none: false
|
102
104
|
requirements: []
|
103
105
|
rubyforge_project:
|
@@ -109,6 +111,7 @@ test_files:
|
|
109
111
|
- features/build.feature
|
110
112
|
- features/draft_cli.feature
|
111
113
|
- features/draft_date.feature
|
114
|
+
- features/drafts_list.feature
|
112
115
|
- features/publish_cli.feature
|
113
116
|
- features/step_definitions/drafts_steps.rb
|
114
117
|
- features/support/env.rb
|