middleman-blog 0.1.5 → 3.0.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +5 -0
- data/.travis.yml +9 -0
- data/.yardopts +3 -0
- data/Gemfile +19 -0
- data/LICENSE +20 -0
- data/README.md +62 -0
- data/Rakefile +15 -0
- data/features/article_cli.feature +7 -0
- data/features/blog_sources.feature +9 -0
- data/features/calendar.feature +30 -0
- data/features/directory_indexes.feature +6 -0
- data/features/encoding.feature +0 -0
- data/features/filename_date.feature +9 -0
- data/features/next_previous.feature +8 -0
- data/features/preview.feature +29 -0
- data/features/support/env.rb +4 -0
- data/features/tags.feature +50 -0
- data/fixtures/blog-sources-app/config.rb +3 -0
- data/fixtures/blog-sources-app/source/_article_template.erb +1 -0
- data/fixtures/blog-sources-app/source/blog/2011-01-01-new-article.html.markdown +6 -0
- data/fixtures/blog-sources-app/source/index.html.erb +9 -0
- data/fixtures/blog-sources-app/source/layout.erb +13 -0
- data/fixtures/calendar-app/config.rb +5 -0
- data/fixtures/calendar-app/source/blog/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/calendar-app/source/blog/2011-01-02-another-article.html.markdown +8 -0
- data/fixtures/calendar-app/source/calendar.html.erb +13 -0
- data/fixtures/calendar-app/source/index.html.erb +3 -0
- data/fixtures/calendar-app/source/layout.erb +15 -0
- data/fixtures/filename-date-app/config.rb +1 -0
- data/fixtures/filename-date-app/source/2011-01-01-new-article.html.markdown +5 -0
- data/fixtures/filename-date-app/source/2011-01-03-filename-and-frontmatter.html.markdown +6 -0
- data/fixtures/filename-date-app/source/layout.erb +14 -0
- data/fixtures/indexes-app/config.rb +5 -0
- data/fixtures/indexes-app/source/2011/01/01/new-article.html.markdown +6 -0
- data/fixtures/indexes-app/source/_article_template.erb +1 -0
- data/fixtures/indexes-app/source/index.html.erb +9 -0
- data/fixtures/indexes-app/source/layout.erb +13 -0
- data/fixtures/preview-app/config.rb +3 -0
- data/fixtures/preview-app/source/2011/01/01/new-article.html.markdown +6 -0
- data/fixtures/preview-app/source/_article_template.erb +10 -0
- data/fixtures/preview-app/source/index.html.erb +9 -0
- data/fixtures/preview-app/source/layout.erb +22 -0
- data/fixtures/tags-app/config.rb +6 -0
- data/fixtures/tags-app/source/blog/2011-01-01-new-article.html.markdown +7 -0
- data/fixtures/tags-app/source/blog/2011-01-02-another-article.html.markdown +8 -0
- data/fixtures/tags-app/source/index.html.erb +3 -0
- data/fixtures/tags-app/source/layout.erb +13 -0
- data/fixtures/tags-app/source/tag.html.erb +7 -0
- data/fixtures/utf8ouch/config.rb +17 -0
- data/fixtures/utf8ouch/source/2010/11/13/telling-time.html.markdown +73 -0
- data/fixtures/utf8ouch/source/2011/01/01/new-article.html.markdown +6 -0
- data/{lib/middleman-blog/template → fixtures/utf8ouch}/source/_article_template.erb +0 -0
- data/{lib/middleman-blog/template → fixtures/utf8ouch}/source/archives/index.html.erb +0 -0
- data/fixtures/utf8ouch/source/feed.xml.builder +23 -0
- data/fixtures/utf8ouch/source/index.html.erb +9 -0
- data/fixtures/utf8ouch/source/layout.erb +30 -0
- data/lib/middleman-blog.rb +10 -2
- data/lib/middleman-blog/blog_article.rb +123 -0
- data/lib/middleman-blog/blog_data.rb +94 -0
- data/lib/middleman-blog/calendar_pages.rb +85 -0
- data/lib/middleman-blog/commands/article.rb +52 -0
- data/lib/middleman-blog/commands/article.tt +6 -0
- data/lib/middleman-blog/extension.rb +170 -0
- data/lib/middleman-blog/tag_pages.rb +33 -0
- data/lib/middleman-blog/template.rb +19 -8
- data/lib/middleman-blog/template/config.tt +101 -5
- data/lib/middleman-blog/template/shared/Gemfile.tt +4 -0
- data/lib/middleman-blog/template/source/2012-01-01-example-article.html.markdown +7 -0
- data/lib/middleman-blog/template/source/calendar.html.erb +15 -0
- data/lib/middleman-blog/template/source/feed.xml.builder +2 -2
- data/lib/middleman-blog/template/source/index.html.erb +8 -9
- data/lib/middleman-blog/template/source/layout.erb +18 -12
- data/lib/middleman-blog/template/source/tag.html.erb +7 -0
- data/lib/middleman-blog/version.rb +1 -1
- data/lib/{middleman_init.rb → middleman_extension.rb} +0 -0
- data/middleman-blog.gemspec +1 -2
- metadata +110 -63
- data/lib/middleman-blog/feature.rb +0 -162
- data/lib/middleman-blog/template/config.ru +0 -9
- data/lib/middleman-blog/template/source/2011/01/01/new-article.html.markdown +0 -6
data/.gemtest
ADDED
File without changes
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,23 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
+
git "git://github.com/middleman/middleman.git" do
|
4
|
+
# gem "middleman"
|
5
|
+
gem "middleman-core"
|
6
|
+
# gem "middleman-more"
|
7
|
+
end
|
8
|
+
|
3
9
|
# Specify your gem's dependencies in middleman-blog.gemspec
|
4
10
|
gemspec
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem "cucumber", "~> 1.1.0"
|
14
|
+
gem "aruba", "~> 0.4.11"
|
15
|
+
gem "rake", "~> 0.9.2"
|
16
|
+
gem "rspec", "~> 2.7"
|
17
|
+
# gem "rdoc", "~> 3.9"
|
18
|
+
# gem "yard"
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem "rdiscount"
|
23
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Thomas Reynolds
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# middleman-blog
|
2
|
+
|
3
|
+
middleman-blog is an extension for the [Middleman](http://middlemanapp.com) static site generator that adds blog-specific functionality. This includes handling blog articles, helpers for listing articles, and tagging support.
|
4
|
+
|
5
|
+
# Install
|
6
|
+
If you're just getting started, install the `middleman` and `middleman-blog` gems and generate a new project:
|
7
|
+
|
8
|
+
```
|
9
|
+
gem install middleman
|
10
|
+
gem install middleman-blog
|
11
|
+
middleman init MY_BLOG_PROJECT --template=blog
|
12
|
+
```
|
13
|
+
|
14
|
+
If you already have a Middleman project:
|
15
|
+
Add `middleman-blog` to your `Gemfile`, and open your `config.rb` and add:
|
16
|
+
|
17
|
+
```
|
18
|
+
activate :blog
|
19
|
+
```
|
20
|
+
|
21
|
+
# Learn More
|
22
|
+
|
23
|
+
See [the blog extension guide](http://beta.middlemanapp.com/extensions/blog/) for detailed information on configuring and using the blog extension.
|
24
|
+
|
25
|
+
Up-to-date generated code documentation is available on RubyDoc:
|
26
|
+
http://rubydoc.info/github/middleman/middleman-blog
|
27
|
+
|
28
|
+
# Community
|
29
|
+
|
30
|
+
The official community forum is available at:
|
31
|
+
|
32
|
+
http://forum.middlemanapp.com/
|
33
|
+
|
34
|
+
# Bug Reports
|
35
|
+
|
36
|
+
GitHub Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems:
|
37
|
+
|
38
|
+
https://github.com/middleman/middleman-blog/issues
|
39
|
+
|
40
|
+
The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit Pull Requests containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.
|
41
|
+
|
42
|
+
# Build & Dependency Status
|
43
|
+
|
44
|
+
[![Build Status](http://travis-ci.org/middleman/middleman-blog.png)](http://travis-ci.org/middleman/middleman-blog)
|
45
|
+
[![Dependency Status](https://gemnasium.com/middleman/middleman-blog.png?travis)](https://gemnasium.com/middleman/middleman-blog)
|
46
|
+
|
47
|
+
# How to Run Cucumber Tests
|
48
|
+
|
49
|
+
1. Checkout Repository: `git clone https://github.com/middleman/middleman-blog.git`
|
50
|
+
2. Install Bundler: `gem install bundler`
|
51
|
+
3. Run `bundle install` inside the project root to install the gem dependencies.
|
52
|
+
4. Run test cases: `bundle exec rake test`
|
53
|
+
|
54
|
+
# Donate
|
55
|
+
|
56
|
+
[![Click here to lend your support to Middleman](https://www.pledgie.com/campaigns/15807.png)](http://www.pledgie.com/campaigns/15807)
|
57
|
+
|
58
|
+
# License
|
59
|
+
|
60
|
+
Copyright (c) 2010 Thomas Reynolds. MIT Licensed, see [LICENSE] for details.
|
61
|
+
|
62
|
+
[LICENSE]: https://github.com/middleman/middleman-blog/blob/master/LICENSE
|
data/Rakefile
CHANGED
@@ -1,2 +1,17 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
|
6
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rake/clean'
|
11
|
+
|
12
|
+
task :test => ["cucumber"]
|
13
|
+
|
14
|
+
desc "Build HTML documentation"
|
15
|
+
task :doc do
|
16
|
+
sh 'bundle exec yard'
|
17
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Feature: New article CLI command
|
2
|
+
Scenario: Create a new blog article with the CLI
|
3
|
+
Given a fixture app "blog-sources-app"
|
4
|
+
And I run `middleman article "My New Article" --date 2012-03-17`
|
5
|
+
Then the exit status should be 0
|
6
|
+
Then the following files should exist:
|
7
|
+
| source/blog/2012-03-17-my-new-article.html.markdown |
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Flexible article sources
|
2
|
+
Scenario: Blog articles can live under a different structure than their permalink
|
3
|
+
Given the Server is running at "blog-sources-app"
|
4
|
+
When I go to "/2011/01/01/new-article.html"
|
5
|
+
Then I should see "/2011/01/01/new-article.html"
|
6
|
+
When I go to "/blog/2001-01-01-new-article.html"
|
7
|
+
Then I should see "Not Found"
|
8
|
+
When I go to "/"
|
9
|
+
Then I should see "/2011/01/01/new-article.html"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Calendar pages
|
2
|
+
Scenario: Calendar pages are accessible from preview server
|
3
|
+
Given the Server is running at "calendar-app"
|
4
|
+
When I go to "/2011.html"
|
5
|
+
Then I should see "/2011-01-01-new-article.html"
|
6
|
+
Then I should see "/2011-01-02-another-article.html"
|
7
|
+
Then I should see "Year: '2011'"
|
8
|
+
Then I should see "Month: ''"
|
9
|
+
Then I should see "Day: ''"
|
10
|
+
|
11
|
+
When I go to "/2011/01.html"
|
12
|
+
Then I should see "/2011-01-01-new-article.html"
|
13
|
+
Then I should see "/2011-01-02-another-article.html"
|
14
|
+
Then I should see "Year: '2011'"
|
15
|
+
Then I should see "Month: '1'"
|
16
|
+
Then I should see "Day: ''"
|
17
|
+
|
18
|
+
When I go to "/2011/01/01.html"
|
19
|
+
Then I should see "/2011-01-01-new-article.html"
|
20
|
+
Then I should not see "/2011-01-02-another-article.html"
|
21
|
+
Then I should see "Year: '2011'"
|
22
|
+
Then I should see "Month: '1'"
|
23
|
+
Then I should see "Day: '1'"
|
24
|
+
|
25
|
+
When I go to "/2011/01/02.html"
|
26
|
+
Then I should not see "/2011-01-01-new-article.html"
|
27
|
+
Then I should see "/2011-01-02-another-article.html"
|
28
|
+
Then I should see "Year: '2011'"
|
29
|
+
Then I should see "Month: '1'"
|
30
|
+
Then I should see "Day: '2'"
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Feature: Directory Indexes
|
2
|
+
Scenario: A template changes contents during preview
|
3
|
+
Given the Server is running at "indexes-app"
|
4
|
+
When I go to "/2011/01/01/new-article"
|
5
|
+
Then I should see "/2011/01/01/new-article/"
|
6
|
+
And I should not see "/2011/01/01/new-article.html"
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Derive article date from its source filename
|
2
|
+
Scenario: Posts with dates in filenames and optionally frontmatter
|
3
|
+
Given the Server is running at "filename-date-app"
|
4
|
+
When I go to "/2011/01/01/new-article.html"
|
5
|
+
Then I should see "Date: 2011-01-01T00:00:00"
|
6
|
+
When I go to "/2011/01/03/filename-and-frontmatter.html"
|
7
|
+
Then I should see "Date: 2011-01-03T10:15:00"
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: Next and previous article
|
2
|
+
|
3
|
+
Scenario: Articles know their next and previous article
|
4
|
+
Given the Server is running at "calendar-app"
|
5
|
+
When I go to "/blog/2011-01-01-new-article.html"
|
6
|
+
Then I should see "Next: /blog/2011-01-02-another-article.html"
|
7
|
+
When I go to "/blog/2011-01-02-another-article.html"
|
8
|
+
Then I should see "Previous: /blog/2011-01-01-new-article.html"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Preview Changes
|
2
|
+
In order to run quickly, we should update internal caches on file changes
|
3
|
+
|
4
|
+
Scenario: A template changes contents during preview
|
5
|
+
Given the Server is running at "preview-app"
|
6
|
+
And the file "source/2011/01/01/new-article.html.markdown" has the contents
|
7
|
+
"""
|
8
|
+
---
|
9
|
+
title: "New Article"
|
10
|
+
date: 01/01/2011
|
11
|
+
---
|
12
|
+
|
13
|
+
New Article Content
|
14
|
+
"""
|
15
|
+
When I go to "/2011/01/01/new-article.html"
|
16
|
+
Then I should see "New Article Content"
|
17
|
+
And I should see "New Article</title>"
|
18
|
+
And the file "source/2011/01/01/new-article.html.markdown" has the contents
|
19
|
+
"""
|
20
|
+
---
|
21
|
+
title: "Newer Article"
|
22
|
+
date: 01/01/2011
|
23
|
+
---
|
24
|
+
|
25
|
+
Newer Article Content
|
26
|
+
"""
|
27
|
+
When I go to "/2011/01/01/new-article.html"
|
28
|
+
Then I should see "Newer Article Content"
|
29
|
+
And I should see "Newer Article</title>"
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Feature: Tag pages
|
2
|
+
Scenario: Tag pages are accessible from preview server
|
3
|
+
Given the Server is running at "tags-app"
|
4
|
+
When I go to "/tags/foo.html"
|
5
|
+
Then I should see "/2011-01-01-new-article.html"
|
6
|
+
Then I should see "/2011-01-02-another-article.html"
|
7
|
+
Then I should see "Tag: foo"
|
8
|
+
When I go to "/tags/bar.html"
|
9
|
+
Then I should see "/2011-01-01-new-article.html"
|
10
|
+
Then I should not see "/2011-01-02-another-article.html"
|
11
|
+
Then I should see "Tag: bar"
|
12
|
+
|
13
|
+
Scenario: Tag pages also get built
|
14
|
+
Given a successfully built app at "tags-app"
|
15
|
+
When I cd to "build"
|
16
|
+
Then the following files should exist:
|
17
|
+
| tags/foo.html |
|
18
|
+
| tags/bar.html |
|
19
|
+
Then the following files should not exist:
|
20
|
+
| tags.html |
|
21
|
+
|
22
|
+
And the file "tags/foo.html" should contain "Tag: foo"
|
23
|
+
And the file "tags/foo.html" should contain "/2011-01-01-new-article.html"
|
24
|
+
And the file "tags/foo.html" should contain "/2011-01-02-another-article.html"
|
25
|
+
|
26
|
+
And the file "tags/bar.html" should contain "Tag: bar"
|
27
|
+
And the file "tags/bar.html" should contain "/2011-01-01-new-article.html"
|
28
|
+
And the file "tags/bar.html" should not contain "/2011-01-02-another-article.html"
|
29
|
+
|
30
|
+
Scenario: Adding a tag to a post in preview adds a tag page
|
31
|
+
Given the Server is running at "tags-app"
|
32
|
+
When I go to "/tags/bar.html"
|
33
|
+
Then I should see "/2011-01-01-new-article.html"
|
34
|
+
When I go to "/tags/newtag.html"
|
35
|
+
Then I should see "Not Found"
|
36
|
+
And the file "source/blog/2011-01-01-new-article.html.markdown" has the contents
|
37
|
+
"""
|
38
|
+
---
|
39
|
+
title: "Newest Article"
|
40
|
+
date: 2011-01-01
|
41
|
+
tags: newtag
|
42
|
+
---
|
43
|
+
|
44
|
+
Newer Article Content
|
45
|
+
"""
|
46
|
+
When I go to "/tags/bar.html"
|
47
|
+
Then I should see "Not Found"
|
48
|
+
When I go to "/tags/newtag.html"
|
49
|
+
Then I should see "/2011-01-01-new-article.html"
|
50
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= current_article.url %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% blog.articles[0...5].each_with_index do |article, i| %>
|
2
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
3
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
4
|
+
|
5
|
+
<%= article.summary %>
|
6
|
+
|
7
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
8
|
+
</article>
|
9
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Year: '<%= @year %>'
|
2
|
+
Month: '<%= @month %>'
|
3
|
+
Day: '<%= @day %>'
|
4
|
+
|
5
|
+
<% @articles[0...5].each_with_index do |article, i| %>
|
6
|
+
<article class="<%= (i == 0) ? 'first' : '' %>">
|
7
|
+
<h1><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e %Y') %></span></h1>
|
8
|
+
|
9
|
+
<%= article.summary %>
|
10
|
+
|
11
|
+
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
12
|
+
</article>
|
13
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<% if is_blog_article? %>
|
7
|
+
<%= yield %>
|
8
|
+
Url: <%= current_article.url %>
|
9
|
+
Previous: <%= current_article.previous_article.try(:url) %>
|
10
|
+
Next: <%= current_article.next_article.try(:url) %>
|
11
|
+
<% else %>
|
12
|
+
<%= yield %>
|
13
|
+
<% end %>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
activate :blog
|