jekyll-feed-0.3.1/ 0000755 0001750 0001750 00000000000 12540452645 013551 5 ustar uwabami uwabami jekyll-feed-0.3.1/.rspec 0000644 0001750 0001750 00000000032 12540452645 014661 0 ustar uwabami uwabami --color
--format progress
jekyll-feed-0.3.1/script/ 0000755 0001750 0001750 00000000000 12540452645 015055 5 ustar uwabami uwabami jekyll-feed-0.3.1/script/bootstrap 0000755 0001750 0001750 00000000035 12540452645 017016 0 ustar uwabami uwabami #! /bin/bash
bundle install
jekyll-feed-0.3.1/script/release 0000755 0001750 0001750 00000000125 12540452645 016421 0 ustar uwabami uwabami #!/bin/sh
# Tag and push a release.
set -e
script/cibuild
bundle exec rake release
jekyll-feed-0.3.1/script/cibuild 0000755 0001750 0001750 00000000106 12540452645 016413 0 ustar uwabami uwabami #! /bin/bash
set -e
bundle exec rspec
gem build jekyll-feed.gemspec
jekyll-feed-0.3.1/.gitignore 0000644 0001750 0001750 00000000302 12540452645 015534 0 ustar uwabami uwabami /vendor
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log
*.gem
Gemfile.lock
spec/dest
.bundle
spec/fixtures/.jekyll-metadata
jekyll-feed-0.3.1/LICENSE.txt 0000644 0001750 0001750 00000002053 12540452645 015374 0 ustar uwabami uwabami Copyright (c) 2015 Ben Balter
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
jekyll-feed-0.3.1/jekyll-feed.gemspec 0000644 0001750 0001750 00000001774 12540452645 017322 0 ustar uwabami uwabami # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "jekyll-feed"
spec.version = "0.3.1"
spec.authors = ["Ben Balter"]
spec.email = ["ben.balter@github.com"]
spec.summary = "A Jekyll plugin to generate an Atom feed of your Jekyll posts"
spec.homepage = "https://github.com/jekyll/jekyll-feed"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "jekyll", ">= 2.4.0", "< 3.1.0"
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "typhoeus", "~> 0.7"
spec.add_development_dependency "nokogiri", "~> 1.6"
spec.add_development_dependency "jekyll-last-modified-at", "0.3.4"
end
jekyll-feed-0.3.1/lib/ 0000755 0001750 0001750 00000000000 12540452645 014317 5 ustar uwabami uwabami jekyll-feed-0.3.1/lib/jekyll-feed.rb 0000644 0001750 0001750 00000004637 12540452645 017051 0 ustar uwabami uwabami require 'fileutils'
module Jekyll
class PageWithoutAFile < Page
def read_yaml(*)
@data ||= {}
end
end
class FeedMetaTag < Liquid::Tag
def config
@context.registers[:site].config
end
def path
if config["feed"] && config["feed"]["path"]
config["feed"]["path"]
else
"feed.xml"
end
end
def url
if config["url"]
config["url"]
elsif config["github"] && config["github"]["url"]
config["github"]["url"]
end
end
def render(context)
@context = context
""
end
end
class JekyllFeed < Jekyll::Generator
safe true
priority :lowest
# Path to feed from config, or feed.xml for default
def path
if @site.config["feed"] && @site.config["feed"]["path"]
@site.config["feed"]["path"]
else
"feed.xml"
end
end
# Main plugin action, called by Jekyll-core
def generate(site)
@site = site
@site.config["time"] = Time.new
unless feed_exists?
write
@site.keep_files ||= []
@site.keep_files << path
end
end
# Path to feed.xml template file
def source_path
File.expand_path "feed.xml", File.dirname(__FILE__)
end
# Destination for feed.xml file within the site source directory
def destination_path
if @site.respond_to?(:in_dest_dir)
@site.in_dest_dir(path)
else
Jekyll.sanitized_path(@site.dest, path)
end
end
# copy feed template from source to destination
def write
FileUtils.mkdir_p File.dirname(destination_path)
File.open(destination_path, 'w') { |f| f.write(feed_content) }
end
def feed_content
site_map = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", path)
site_map.content = File.read(source_path).gsub(/\s*\n\s*/, "\n").gsub(/\n{%/, "{%")
site_map.data["layout"] = nil
site_map.render(Hash.new, @site.site_payload)
site_map.output
end
# Checks if a feed already exists in the site source
def feed_exists?
if @site.respond_to?(:in_source_dir)
File.exists? @site.in_source_dir(path)
else
File.exists? Jekyll.sanitized_path(@site.source, path)
end
end
end
end
Liquid::Template.register_tag('feed_meta', Jekyll::FeedMetaTag)
jekyll-feed-0.3.1/lib/feed.xml 0000644 0001750 0001750 00000005534 12540452645 015753 0 ustar uwabami uwabami
{% if site.url %}
{% assign url_base = site.url | append: site.baseurl %}
{% else %}
{% assign url_base = site.github.url %}
{% endif %}
Line 1 Line 2 Line 3jekyll-feed-0.3.1/spec/fixtures/_posts/2014-03-04-march-the-fourth.md 0000644 0001750 0001750 00000000061 12540452645 024404 0 ustar uwabami uwabami --- tags: - '"/>