octopress-feeds 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +110 -0
- data/Rakefile +2 -0
- data/assets/config.yml +5 -0
- data/assets/includes/entry.xml +30 -0
- data/assets/includes/head.xml +9 -0
- data/assets/pages/article-feed.xml +14 -0
- data/assets/pages/link-feed.xml +14 -0
- data/assets/pages/main-feed.xml +12 -0
- data/lib/octopress-feeds/version.rb +7 -0
- data/lib/octopress-feeds.rb +62 -0
- data/octopress-feeds.gemspec +26 -0
- data/test/Gemfile +8 -0
- data/test/_config.yml +9 -0
- data/test/_expected/2014/05/26/awesome-link.html +3 -0
- data/test/_expected/2014/05/26/some-great-post-idea.html +3 -0
- data/test/_expected/feed/articles/index.xml +36 -0
- data/test/_expected/feed/index.xml +60 -0
- data/test/_expected/feed/links/index.xml +39 -0
- data/test/_includes/head.html +1 -0
- data/test/_layouts/post.html +2 -0
- data/test/_octopress.yml +11 -0
- data/test/_plugins/feeds/config.yml +3 -0
- data/test/_posts/2014-05-26-some-great-post-idea.markdown +6 -0
- data/test/_posts/2014-05-27-awesome-link.markdown +9 -0
- data/test/_templates/page +4 -0
- data/test/_templates/post +5 -0
- data/test/test.rb +8 -0
- data/test/test_suite.rb +182 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c0db3234960909184d71e4d5eb1d63e5059c1625
|
4
|
+
data.tar.gz: 1a62792d466da0391b97962eeb681796e982b8da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e17f533d1c37a0ad2d33b4d9e841999f453bc083f9deec84e2d7d237bdf439cf77430757eb4685784df1ae9f42f29607c3666beb7da1d36c1c6f1c480552fe42
|
7
|
+
data.tar.gz: 7acce84984e6b277a5e23be6d244acbc37718576306f22ef58e4359cd9d1f1e5af403e194853189700c7e66f79632940d91826a23b96080834fb919fd8d45478
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
_site
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Brandon Mathis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# Octopress Feeds
|
2
|
+
|
3
|
+
Add nice RSS feeds to Octopress and Jekyll sites. Supports a standard feed, an articles-only feed and a link-post feed.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'octopress-feed'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install octopress-feed
|
18
|
+
|
19
|
+
### Add gem to Jekyll
|
20
|
+
|
21
|
+
Add the gem to Jekyll's configuration file:
|
22
|
+
|
23
|
+
```yaml
|
24
|
+
gems:
|
25
|
+
- octopress-feed
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Be sure your Jekyll configuration has a `url`, a `title`, and an `author`.
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
url: http://yoursite.com/
|
34
|
+
title: My Awesome Site
|
35
|
+
author: Guy McDude
|
36
|
+
```
|
37
|
+
|
38
|
+
Next generate your site with `jekyll build` and an xml feed will be generated at `/feed/index.xml`.
|
39
|
+
|
40
|
+
To be sure you've installed the plugin correctly, run `octopress ink list feed` which will list detailed information about the plugin.
|
41
|
+
|
42
|
+
```
|
43
|
+
Plugin: Octopress Feed - v1.0.0
|
44
|
+
Slug: feed
|
45
|
+
A nice RSS feed for Octopress and Jekyll sites.
|
46
|
+
https://github.com/octopress/feed
|
47
|
+
=============================================================
|
48
|
+
includes:
|
49
|
+
- entry.xml
|
50
|
+
- head.xml
|
51
|
+
- index.xml
|
52
|
+
|
53
|
+
pages: urls:
|
54
|
+
- article-feed.xml /feed/articles/index.xml
|
55
|
+
- link-feed.xml /feed/links/index.xml
|
56
|
+
- main-feed.xml /feed/index.xml
|
57
|
+
|
58
|
+
default configuration:
|
59
|
+
count: 20
|
60
|
+
excerpts: false # Feed excerpts post content
|
61
|
+
external_links: true # Linkposts should direct visitors to the linked site
|
62
|
+
articles_feed: false # Add a feed with articles only
|
63
|
+
linkposts_feed: false # Add a feed with linkposts only
|
64
|
+
```
|
65
|
+
|
66
|
+
NOTE: Any relative URLs in your posts will be expanded based on your site's `url` configuration.
|
67
|
+
|
68
|
+
## Customization
|
69
|
+
|
70
|
+
Octopress Ink can copy all of the plugin's assets to `_plugins/feed/*` where you can override them with your own modifications. This is
|
71
|
+
only necessary if you want to modify this plugin's behavior.
|
72
|
+
|
73
|
+
```
|
74
|
+
octopress ink copy feed
|
75
|
+
```
|
76
|
+
|
77
|
+
This will copy the plugin's configuration, pages, and includes from the gem, to your local site. If, for example, you want to change the XML for an entry, you can simply edit the `_plugins/feed/includes/entry.xml` file.
|
78
|
+
|
79
|
+
If you want to revert to the defaults, simply delete any file you don't care to override from the `_plugins/feed/` directory.
|
80
|
+
|
81
|
+
## Configuration
|
82
|
+
|
83
|
+
| Option | Description | Default |
|
84
|
+
|:----------------------|:------------------------------------------------------------|:------------|
|
85
|
+
| `count` | How many posts should appear in your feed. | 20 |
|
86
|
+
| `excerpts` | Feed entries will contain excerpts of post content. | false |
|
87
|
+
| `external_linkposts` | Link posts should direct visitors to the linked site. | true |
|
88
|
+
| `articles_feed` | Add an additional articles-only feed. | false |
|
89
|
+
| `linkposts_feed` | Add an additional link-posts-only feed. | false |
|
90
|
+
|
91
|
+
Note: Post excerpts are determined by Jekyll's `excerpt_separator` configuration. It defaults to splitting your
|
92
|
+
post at the first double line-break, `\n\n`. If you want more control over where the excerpt happens on your individual
|
93
|
+
posts, You can change that to something like `<!--more-->` and place that comment wherever you like in your post to
|
94
|
+
split the content there.
|
95
|
+
|
96
|
+
To configure this plugin, first create a configuration file at `_plugins/feed/config.yml`. If you like, you can have Octopress Ink add it for you.
|
97
|
+
|
98
|
+
```
|
99
|
+
octopress ink copy feed --config-file
|
100
|
+
```
|
101
|
+
|
102
|
+
This will create a configuration file populated with the defaults for this plugin. Deleting this file will restore the default configuration.
|
103
|
+
|
104
|
+
## Contributing
|
105
|
+
|
106
|
+
1. Fork it ( https://github.com/octopress/feed/fork )
|
107
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
108
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
109
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
110
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/assets/config.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
<title type="html">{{ post.title_text }}</title>
|
2
|
+
{% if post.linkpost and plugins.feeds.external_links %}
|
3
|
+
<link rel="alternate" type="text/html" href="{{ post.external-url }}"/>
|
4
|
+
<link rel="related" type="text/html" href="{{ post.url | full_url }}"/>
|
5
|
+
{% else %}
|
6
|
+
<link rel="alternate" type="text/html" href="{{ post.url | full_url }}"/>
|
7
|
+
{% endif %}
|
8
|
+
<id>{{ post.id }}</id>
|
9
|
+
<published>{{ post.date_xml }}</published>
|
10
|
+
<updated>{% return post.updated_date_xml || post.date_xml %}</updated>
|
11
|
+
<author>
|
12
|
+
<name>{% return post.author || site.author %}</name>
|
13
|
+
<uri>{% return post.author_site || site.url %}</uri>
|
14
|
+
</author>
|
15
|
+
<content type="html" xml:base="{{ site.url }}" xml:lang="en">
|
16
|
+
<![CDATA[
|
17
|
+
{% if plugins.feeds.excerpts and post.linkpost == false %}
|
18
|
+
{{ post.excerpt | full_urls }}
|
19
|
+
|
20
|
+
{% if post.excerpted %}
|
21
|
+
<p><a href="{{ post.url | full_url }}">Continue reading →</a></p>
|
22
|
+
{% endif %}
|
23
|
+
{% else %}
|
24
|
+
{{ post.content | full_urls }}
|
25
|
+
{% if post.linkpost %}
|
26
|
+
<p><a href="{{ post.url | full_url }}">∞ Permalink</a></p>
|
27
|
+
{% endif %}
|
28
|
+
{% endif %}
|
29
|
+
]]>
|
30
|
+
</content>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
3
|
+
<title>{% return site.name || site.title %}</title>
|
4
|
+
<link rel="alternate" type="text/html" href="{{ site.url }}/"/>
|
5
|
+
<link rel="self" type="application/atom+xml" href="{{ page.url | remove:'index.xml' | full_url }}"/>
|
6
|
+
<id>{{ url }}</id>
|
7
|
+
<updated>{% feed_updated_date %}</updated>
|
8
|
+
<generator uri="http://octopress.org/">Octopress</generator>
|
9
|
+
<rights>Copyright © {{ site.time | date: '%Y' }}, {{ site.author | strip_html }}</rights>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
permalink: /feed/articles/
|
3
|
+
title: Articles-only Feed
|
4
|
+
feed: articles
|
5
|
+
---
|
6
|
+
{% if plugins.feeds.articles_feed %}
|
7
|
+
{% include feeds:head.xml %}
|
8
|
+
{% for post in site.articles limit:plugins.feeds.count %}
|
9
|
+
<entry>
|
10
|
+
{% include feeds:entry.xml %}
|
11
|
+
</entry>
|
12
|
+
{% endfor %}
|
13
|
+
</feed>
|
14
|
+
{% else %}{% abort %}{% endif %}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
permalink: /feed/links/
|
3
|
+
title: Linkpost Feed
|
4
|
+
feed: linkposts
|
5
|
+
---
|
6
|
+
{% if plugins.feeds.linkposts_feed %}
|
7
|
+
{% include feeds:head.xml %}
|
8
|
+
{% for post in site.linkposts limit:plugins.feeds.count %}
|
9
|
+
<entry>
|
10
|
+
{% include feeds:entry.xml %}
|
11
|
+
</entry>
|
12
|
+
{% endfor %}
|
13
|
+
</feed>
|
14
|
+
{% else %}{% abort %}{% endif %}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'octopress-feeds/version'
|
2
|
+
require 'octopress-ink'
|
3
|
+
|
4
|
+
Octopress::Ink.add_plugin({
|
5
|
+
name: "Octopress Feeds",
|
6
|
+
slug: "feeds",
|
7
|
+
assets_path: File.expand_path(File.join(File.dirname(__FILE__), "../assets")),
|
8
|
+
type: "plugin",
|
9
|
+
version: Octopress::Ink::Feeds::VERSION,
|
10
|
+
description: "A nice RSS feed for Octopress and Jekyll sites.",
|
11
|
+
website: "https://github.com/octopress/feeds"
|
12
|
+
})
|
13
|
+
|
14
|
+
module Octopress
|
15
|
+
module Ink
|
16
|
+
module Tags
|
17
|
+
class FeedTag < Liquid::Tag
|
18
|
+
def render(context)
|
19
|
+
tags = []
|
20
|
+
|
21
|
+
Ink.plugin('feeds').pages.dup.map do |p|
|
22
|
+
if p.filename == 'main-feed.xml' && !p.disabled?
|
23
|
+
tag(p.page)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def tag(page)
|
29
|
+
url = page.url.sub(/index\.xml/, '')
|
30
|
+
"<link href='#{url}' rel='alternate' title='#{page.data['title']}: #{Ink.site.config['name']}' type='application/atom+xml'>"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class FeedUpdatedTag < Liquid::Tag
|
35
|
+
def render(context)
|
36
|
+
feed = context.environments.first['page']['feed'] || 'posts'
|
37
|
+
|
38
|
+
case feed
|
39
|
+
when 'articles'
|
40
|
+
post = Ink.articles.last
|
41
|
+
when 'linkposts'
|
42
|
+
post = Ink.linkposts.last
|
43
|
+
else
|
44
|
+
post = Ink.site.posts.last
|
45
|
+
end
|
46
|
+
|
47
|
+
if post.data['updated']
|
48
|
+
post.data['updated_date_xml']
|
49
|
+
else
|
50
|
+
post.data['date_xml']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
Liquid::Template.register_tag('feed_tag', Octopress::Ink::Tags::FeedTag)
|
61
|
+
Liquid::Template.register_tag('feed_updated_date', Octopress::Ink::Tags::FeedUpdatedTag)
|
62
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'octopress-feeds/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "octopress-feeds"
|
8
|
+
spec.version = Octopress::Ink::Feeds::VERSION
|
9
|
+
spec.authors = ["Brandon Mathis"]
|
10
|
+
spec.email = ["brandon@imathis.com"]
|
11
|
+
spec.summary = %q{A nice RSS feeds for Octopress and Jekyll sites.}
|
12
|
+
spec.description = %q{A nice RSS feeds for Octopress and Jekyll sites.}
|
13
|
+
spec.homepage = "https://github.com/octopress/feeds"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "octopress"
|
24
|
+
|
25
|
+
spec.add_runtime_dependency "octopress-ink", ">= 1.0.0.rc.8"
|
26
|
+
end
|
data/test/Gemfile
ADDED
data/test/_config.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="utf-8"?>
|
3
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
4
|
+
<title>Some awesome Jekyll site</title>
|
5
|
+
<link rel="alternate" type="text/html" href="http://octopress.org//"/>
|
6
|
+
<link rel="self" type="application/atom+xml" href="http://octopress.org/feed/articles/"/>
|
7
|
+
<id></id>
|
8
|
+
<updated>2014-05-26T22:29:13-05:00</updated>
|
9
|
+
<generator uri="http://octopress.org/">Octopress</generator>
|
10
|
+
<rights>Copyright © 2014, Bob McDiggity</rights>
|
11
|
+
|
12
|
+
<entry>
|
13
|
+
<title type="html">Some Great Post Idea</title>
|
14
|
+
|
15
|
+
<link rel="alternate" type="text/html" href="http://octopress.org/2014/05/26/some-great-post-idea.html"/>
|
16
|
+
|
17
|
+
<id>/2014/05/26/some-great-post-idea</id>
|
18
|
+
<published>2014-05-26T22:29:13-05:00</published>
|
19
|
+
<updated>2014-05-26T22:29:13-05:00</updated>
|
20
|
+
<author>
|
21
|
+
<name>Bob McDiggity</name>
|
22
|
+
<uri>http://octopress.org/</uri>
|
23
|
+
</author>
|
24
|
+
<content type="html" xml:base="http://octopress.org/" xml:lang="en">
|
25
|
+
<![CDATA[
|
26
|
+
|
27
|
+
<p>totally sweet stuff.</p>
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
]]>
|
32
|
+
</content>
|
33
|
+
</entry>
|
34
|
+
|
35
|
+
</feed>
|
36
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
3
|
+
<title>Some awesome Jekyll site</title>
|
4
|
+
<link rel="alternate" type="text/html" href="http://octopress.org//"/>
|
5
|
+
<link rel="self" type="application/atom+xml" href="http://octopress.org/feed/"/>
|
6
|
+
<id></id>
|
7
|
+
<updated>2014-06-01T22:45:41-05:00</updated>
|
8
|
+
<generator uri="http://octopress.org/">Octopress</generator>
|
9
|
+
<rights>Copyright © 2014, Bob McDiggity</rights>
|
10
|
+
|
11
|
+
<entry>
|
12
|
+
<title type="html">Awesome Link →</title>
|
13
|
+
|
14
|
+
<link rel="alternate" type="text/html" href="http://timecube.com"/>
|
15
|
+
<link rel="related" type="text/html" href="http://octopress.org/2014/05/26/awesome-link.html"/>
|
16
|
+
|
17
|
+
<id>/2014/05/26/awesome-link</id>
|
18
|
+
<published>2014-05-26T22:45:41-05:00</published>
|
19
|
+
<updated>2014-06-01T22:45:41-05:00</updated>
|
20
|
+
<author>
|
21
|
+
<name>Bob McDiggity</name>
|
22
|
+
<uri>http://octopress.org/</uri>
|
23
|
+
</author>
|
24
|
+
<content type="html" xml:base="http://octopress.org/" xml:lang="en">
|
25
|
+
<![CDATA[
|
26
|
+
|
27
|
+
<p>This contains all knowledge.</p>
|
28
|
+
|
29
|
+
|
30
|
+
<p><a href="http://octopress.org/2014/05/26/awesome-link.html">∞ Permalink</a></p>
|
31
|
+
|
32
|
+
|
33
|
+
]]>
|
34
|
+
</content>
|
35
|
+
</entry>
|
36
|
+
|
37
|
+
<entry>
|
38
|
+
<title type="html">Some Great Post Idea</title>
|
39
|
+
|
40
|
+
<link rel="alternate" type="text/html" href="http://octopress.org/2014/05/26/some-great-post-idea.html"/>
|
41
|
+
|
42
|
+
<id>/2014/05/26/some-great-post-idea</id>
|
43
|
+
<published>2014-05-26T22:29:13-05:00</published>
|
44
|
+
<updated>2014-05-26T22:29:13-05:00</updated>
|
45
|
+
<author>
|
46
|
+
<name>Bob McDiggity</name>
|
47
|
+
<uri>http://octopress.org/</uri>
|
48
|
+
</author>
|
49
|
+
<content type="html" xml:base="http://octopress.org/" xml:lang="en">
|
50
|
+
<![CDATA[
|
51
|
+
|
52
|
+
<p>totally sweet stuff.</p>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
]]>
|
57
|
+
</content>
|
58
|
+
</entry>
|
59
|
+
|
60
|
+
</feed>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="utf-8"?>
|
3
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
4
|
+
<title>Some awesome Jekyll site</title>
|
5
|
+
<link rel="alternate" type="text/html" href="http://octopress.org//"/>
|
6
|
+
<link rel="self" type="application/atom+xml" href="http://octopress.org/feed/links/"/>
|
7
|
+
<id></id>
|
8
|
+
<updated>2014-06-01T22:45:41-05:00</updated>
|
9
|
+
<generator uri="http://octopress.org/">Octopress</generator>
|
10
|
+
<rights>Copyright © 2014, Bob McDiggity</rights>
|
11
|
+
|
12
|
+
<entry>
|
13
|
+
<title type="html">Awesome Link →</title>
|
14
|
+
|
15
|
+
<link rel="alternate" type="text/html" href="http://timecube.com"/>
|
16
|
+
<link rel="related" type="text/html" href="http://octopress.org/2014/05/26/awesome-link.html"/>
|
17
|
+
|
18
|
+
<id>/2014/05/26/awesome-link</id>
|
19
|
+
<published>2014-05-26T22:45:41-05:00</published>
|
20
|
+
<updated>2014-06-01T22:45:41-05:00</updated>
|
21
|
+
<author>
|
22
|
+
<name>Bob McDiggity</name>
|
23
|
+
<uri>http://octopress.org/</uri>
|
24
|
+
</author>
|
25
|
+
<content type="html" xml:base="http://octopress.org/" xml:lang="en">
|
26
|
+
<![CDATA[
|
27
|
+
|
28
|
+
<p>This contains all knowledge.</p>
|
29
|
+
|
30
|
+
|
31
|
+
<p><a href="http://octopress.org/2014/05/26/awesome-link.html">∞ Permalink</a></p>
|
32
|
+
|
33
|
+
|
34
|
+
]]>
|
35
|
+
</content>
|
36
|
+
</entry>
|
37
|
+
|
38
|
+
</feed>
|
39
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<head>{% feed_tag %}</head>
|
data/test/_octopress.yml
ADDED
data/test/test.rb
ADDED
data/test/test_suite.rb
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
require 'colorator'
|
2
|
+
require 'find'
|
3
|
+
|
4
|
+
# This is a makeshift integration test-suite.
|
5
|
+
# It is unapologetically pragmatic.
|
6
|
+
|
7
|
+
|
8
|
+
# Build Jekyll
|
9
|
+
#
|
10
|
+
def build(options={})
|
11
|
+
config = ['_config.yml'] << options[:config]
|
12
|
+
|
13
|
+
if options[:config]
|
14
|
+
options[:config].each do |name, file|
|
15
|
+
case name
|
16
|
+
when :jekyll
|
17
|
+
config << "_configs/#{file}"
|
18
|
+
when :octopress
|
19
|
+
FileUtils.cp "_configs/#{file}", "_octopress.yml"
|
20
|
+
else
|
21
|
+
FileUtils.cp "_configs/#{file}", "_plugins/#{name}/config.yml"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
cmd = "rm -rf site && bundle exec jekyll build --config #{config.join(',')}"
|
27
|
+
|
28
|
+
`#{cmd}`
|
29
|
+
|
30
|
+
if options[:config]
|
31
|
+
options[:config].each do |name, file|
|
32
|
+
case name
|
33
|
+
when :jekyll
|
34
|
+
next
|
35
|
+
when :octopress
|
36
|
+
`rm _octopress.yml`
|
37
|
+
else
|
38
|
+
`rm _plugins/#{name}/config.yml`
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
# Find all files in a given directory
|
46
|
+
#
|
47
|
+
def dir_files(dir)
|
48
|
+
Find.find(dir).to_a.reject!{|f| File.directory?(f) }
|
49
|
+
end
|
50
|
+
|
51
|
+
# Recursively diff two directories
|
52
|
+
#
|
53
|
+
# This will walk through dir1 and diff matching paths in dir2
|
54
|
+
#
|
55
|
+
def test_dirs(desc, dir1, dir2)
|
56
|
+
|
57
|
+
test_missing_files(desc, dir1, dir2)
|
58
|
+
|
59
|
+
dir_files(dir1).each do |file|
|
60
|
+
file2 = file.sub(dir1, dir2)
|
61
|
+
if File.exist?(file2)
|
62
|
+
if diff = diff_file(file, file2)
|
63
|
+
@failures << {
|
64
|
+
desc: "#{desc}\nDiff of file: #{file.sub(dir1+'/', '')}\n",
|
65
|
+
result: format_diff(diff)
|
66
|
+
}
|
67
|
+
pout 'F'.red
|
68
|
+
else
|
69
|
+
pout '.'.green
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def format_diff(diff)
|
76
|
+
"#{diff.gsub(/\A.+?\n/,'').gsub(/^[^><].+/,'---').gsub(/^>.+/){|m|
|
77
|
+
m.green
|
78
|
+
}.gsub(/^(<.+?)$/){ |m|
|
79
|
+
m.red
|
80
|
+
}}"
|
81
|
+
end
|
82
|
+
|
83
|
+
# List differences between files in two directories
|
84
|
+
#
|
85
|
+
def test_missing_files(desc, dir1, dir2)
|
86
|
+
files1 = dir_files(dir1).map {|f| f.sub(dir1,'') }
|
87
|
+
files2 = dir_files(dir2).map {|f| f.sub(dir2,'') }
|
88
|
+
|
89
|
+
missing = []
|
90
|
+
|
91
|
+
(files2 - files1).each do |file|
|
92
|
+
missing << File.join(dir1, file)
|
93
|
+
end
|
94
|
+
|
95
|
+
(files1 - files2).each do |file|
|
96
|
+
missing << File.join(dir2, file)
|
97
|
+
end
|
98
|
+
|
99
|
+
if !missing.empty?
|
100
|
+
@failures << {
|
101
|
+
desc: "#{desc}\nMissing files:\n",
|
102
|
+
result: " - " + missing.join("\n - ")
|
103
|
+
}
|
104
|
+
|
105
|
+
pout 'F'.red
|
106
|
+
else
|
107
|
+
pout '.'.green
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Diff two files
|
112
|
+
#
|
113
|
+
def diff_file(file1, file2)
|
114
|
+
diff = `diff #{file1} #{file2}`
|
115
|
+
if diff.size > 0
|
116
|
+
diff
|
117
|
+
else
|
118
|
+
false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Test command output
|
123
|
+
#
|
124
|
+
# Input: options hash, format:
|
125
|
+
# {
|
126
|
+
# desc: description of task
|
127
|
+
# cmd: system command to be run, (String or Array)
|
128
|
+
# expect: expected output from command
|
129
|
+
# }
|
130
|
+
#
|
131
|
+
def test_cmd(options)
|
132
|
+
if cmd = options[:cmd]
|
133
|
+
cmd = [cmd] unless cmd.is_a? Array
|
134
|
+
|
135
|
+
# In debug mode command output is printed
|
136
|
+
#
|
137
|
+
if options[:debug]
|
138
|
+
system cmd.join('; ')
|
139
|
+
else
|
140
|
+
output = `#{cmd.join('; ')}`.gsub(/#{Dir.pwd}\/*/,'').strip
|
141
|
+
|
142
|
+
# Remove character color codes
|
143
|
+
output = output.gsub("\e",'').gsub(/\[\d+m/,'').gsub("\[0m",'')
|
144
|
+
end
|
145
|
+
if options[:expect] && options[:expect].strip == output
|
146
|
+
pout '.'.green
|
147
|
+
elsif options[:expect]
|
148
|
+
pout 'F'.red
|
149
|
+
@failures << {
|
150
|
+
desc: options[:desc]+"\n",
|
151
|
+
result: <<-HERE
|
152
|
+
expected: #{(options[:expect] || '').strip.green}
|
153
|
+
result: #{(output || '').strip.red}
|
154
|
+
HERE
|
155
|
+
}
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
|
161
|
+
# Print a single character without a newline
|
162
|
+
#
|
163
|
+
def pout(str)
|
164
|
+
print str
|
165
|
+
$stdout.flush
|
166
|
+
end
|
167
|
+
|
168
|
+
# Ouptut nicely formatted failure messages
|
169
|
+
#
|
170
|
+
def print_results
|
171
|
+
if !@failures.empty?
|
172
|
+
@failures.each do |test|
|
173
|
+
pout "\nFailed: #{test[:desc]}"
|
174
|
+
puts test[:result]
|
175
|
+
# print a newline for easier reading
|
176
|
+
puts ""
|
177
|
+
end
|
178
|
+
abort
|
179
|
+
else
|
180
|
+
puts "All passed!".green
|
181
|
+
end
|
182
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: octopress-feeds
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Mathis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: octopress
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: octopress-ink
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0.rc.8
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0.rc.8
|
69
|
+
description: A nice RSS feeds for Octopress and Jekyll sites.
|
70
|
+
email:
|
71
|
+
- brandon@imathis.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- assets/config.yml
|
83
|
+
- assets/includes/entry.xml
|
84
|
+
- assets/includes/head.xml
|
85
|
+
- assets/pages/article-feed.xml
|
86
|
+
- assets/pages/link-feed.xml
|
87
|
+
- assets/pages/main-feed.xml
|
88
|
+
- lib/octopress-feeds.rb
|
89
|
+
- lib/octopress-feeds/version.rb
|
90
|
+
- octopress-feeds.gemspec
|
91
|
+
- test/Gemfile
|
92
|
+
- test/_config.yml
|
93
|
+
- test/_expected/2014/05/26/awesome-link.html
|
94
|
+
- test/_expected/2014/05/26/some-great-post-idea.html
|
95
|
+
- test/_expected/feed/articles/index.xml
|
96
|
+
- test/_expected/feed/index.xml
|
97
|
+
- test/_expected/feed/links/index.xml
|
98
|
+
- test/_includes/head.html
|
99
|
+
- test/_layouts/post.html
|
100
|
+
- test/_octopress.yml
|
101
|
+
- test/_plugins/feeds/config.yml
|
102
|
+
- test/_posts/2014-05-26-some-great-post-idea.markdown
|
103
|
+
- test/_posts/2014-05-27-awesome-link.markdown
|
104
|
+
- test/_templates/page
|
105
|
+
- test/_templates/post
|
106
|
+
- test/test.rb
|
107
|
+
- test/test_suite.rb
|
108
|
+
homepage: https://github.com/octopress/feeds
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.2.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: A nice RSS feeds for Octopress and Jekyll sites.
|
132
|
+
test_files:
|
133
|
+
- test/Gemfile
|
134
|
+
- test/_config.yml
|
135
|
+
- test/_expected/2014/05/26/awesome-link.html
|
136
|
+
- test/_expected/2014/05/26/some-great-post-idea.html
|
137
|
+
- test/_expected/feed/articles/index.xml
|
138
|
+
- test/_expected/feed/index.xml
|
139
|
+
- test/_expected/feed/links/index.xml
|
140
|
+
- test/_includes/head.html
|
141
|
+
- test/_layouts/post.html
|
142
|
+
- test/_octopress.yml
|
143
|
+
- test/_plugins/feeds/config.yml
|
144
|
+
- test/_posts/2014-05-26-some-great-post-idea.markdown
|
145
|
+
- test/_posts/2014-05-27-awesome-link.markdown
|
146
|
+
- test/_templates/page
|
147
|
+
- test/_templates/post
|
148
|
+
- test/test.rb
|
149
|
+
- test/test_suite.rb
|