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 CHANGED
@@ -1,3 +1,4 @@
1
1
  # Ignore bundler lock file
2
2
  Gemfile.lock
3
3
  /tmp
4
+ /pkg
@@ -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
@@ -1,5 +1,5 @@
1
1
  Feature: Building the site
2
2
  Scenario: Unpublished articles don't get built
3
- Given a fixture app "draft-date-app"
3
+ Given a fixture app "drafts-app"
4
4
  When I run `middleman build`
5
5
  Then the build directory should be empty
@@ -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 "draft-date-app"
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 "draft-date-app"
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
@@ -0,0 +1,7 @@
1
+ Feature: Listing drafts
2
+ Scenario: Draft articles can be listed
3
+ Given the Server is running at "drafts-app"
4
+ When I go to "/drafts/listing_drafts.html"
5
+ Then I should see "New Draft Title"
6
+ And I should see "Other Draft Title"
7
+ And I should see "Drafts List"
@@ -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 "draft-date-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 "draft-date-app"
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'
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: "Drafts List"
3
+ ---
4
+
5
+ <% unless settings.build? %>
6
+ <ul>
7
+ <% drafts.each do |draft| %>
8
+ <li><%= draft.title %></li>
9
+ <% end %>
10
+ </ul>
11
+ <% end %>
@@ -1,2 +1,5 @@
1
+ ---
2
+ title: "New Draft Title"
3
+ ---
1
4
  <h1>New Draft Title</h1>
2
5
  <p>Date: <%= current_article.date.iso8601 %></p>
@@ -1,2 +1,5 @@
1
+ ---
2
+ title: "Other Draft Title"
3
+ ---
1
4
  <h1>Other Draft Title</h1>
2
5
  <p>Date: <%= current_article.data.date.iso8601 %></p>
@@ -78,6 +78,12 @@ module Middleman
78
78
 
79
79
  used_resources
80
80
  end
81
+
82
+ # A list of all draft articles.
83
+ # @return [Array<Middleman::Sitemap::Resource>]
84
+ def articles
85
+ @_drafts
86
+ end
81
87
  end
82
88
  end
83
89
  end
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Middleman
2
2
  module Blog
3
3
  module Drafts
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  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.1
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: -3659966068752668471
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: -3659966068752668471
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
@@ -1,3 +0,0 @@
1
- require 'middleman-blog'
2
- activate :blog
3
- activate :drafts