jekyll-feed 0.2.3 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f496b14be99f01195b0596a64372301542de848c
4
- data.tar.gz: 26508eb2dc912d6f367cf2bb7f3ab2296fd45056
3
+ metadata.gz: 58166be831e447c07a57150717670f140681c3c7
4
+ data.tar.gz: 8ab3a70938b5752de7bb755891228fcfe9e997c9
5
5
  SHA512:
6
- metadata.gz: c42e8457ed717e819805c5a2c51511cbfdf036e67d77f92624c3f124d0fe0c701afa7f8ea1e6c7be8996ea59633542999466815e5dfb5d0bac90b53215ff5dad
7
- data.tar.gz: da425d708cdeb818e099901dee7e8f54af74a53de02c6a05a45ed39ddec44436bd36ad34b8054ee6488844fcefada623b77380f5a42ea59fce64775342545e66
6
+ metadata.gz: 793aed59df2ec15981b5a20c378957ecd756ade0d76725243bf06f8071f4c870c6c432c87e02a226b78bf3a5be185cbab26f3c61ec937e398fb87d7b10e01d7c
7
+ data.tar.gz: fed263171fb20cc8f7015bb00d15778de921556e1c5e38ed4155aa0579d86b5f5789e3d33a84350e193e7915760c6978c6f97dc342c2d9a70acc2a7cf9dfe18b
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ /vendor
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
@@ -16,3 +17,4 @@ mkmf.log
16
17
  Gemfile.lock
17
18
  spec/dest
18
19
  .bundle
20
+ spec/fixtures/.jekyll-metadata
@@ -1,9 +1,25 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1
4
- - 2.0.0
5
- - 1.9.3
6
- before_script: bundle update
4
+ - 2.2
5
+ - 2.0
6
+ - 1.9
7
7
  script: "script/cibuild"
8
- sudo: false
8
+ before_script: bundle update
9
9
  cache: bundler
10
+ sudo: false
11
+
12
+ matrix:
13
+ exclude:
14
+ - rvm: 1.9
15
+ env: JEKYLL_VERSION=3.0.0.beta5
16
+ - env: JEKYLL_VERSION=2.4
17
+ rvm: 2.1
18
+ - rvm: 2.2
19
+ env: JEKYLL_VERSION=2.4
20
+
21
+ env:
22
+ matrix:
23
+ - ""
24
+ - JEKYLL_VERSION=2.4
25
+ - JEKYLL_VERSION=3.0.0.beta5
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source 'https://rubygems.org'
2
-
3
2
  gemspec
3
+
4
+ if ENV["JEKYLL_VERSION"]
5
+ gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}"
6
+ end
data/README.md CHANGED
@@ -35,6 +35,16 @@ The plugin will automatically use any of the following configuration variables,
35
35
  - `email` - Email address of the author
36
36
  - `uri` - Webpage where more information about the author can be found
37
37
 
38
+ ### Already have a feed path?
39
+
40
+ Do you already have an existing feed someplace other than `/feed.xml`, but are on a host like GitHub Pages that doesn't support machine-friendly redirects? If you simply swap out `jekyll-feed` for your existing template, your existing subscribers won't continue to get updates. Instead, you can specify a non-default path via your site's config.
41
+
42
+ ```yml
43
+ feed:
44
+ path: atom.xml
45
+ ```
46
+
47
+ To note, you shouldn't have to do this unless you already have a feed you're using, and you can't or wish not to redirect existing subscribers.
38
48
 
39
49
  ### Optional front matter
40
50
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-feed"
5
- spec.version = "0.2.3"
5
+ spec.version = "0.3.0"
6
6
  spec.authors = ["Ben Balter"]
7
7
  spec.email = ["ben.balter@github.com"]
8
8
  spec.summary = "A Jekyll plugin to generate an Atom feed of your Jekyll posts"
@@ -14,12 +14,11 @@ Gem::Specification.new do |spec|
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
15
  spec.require_paths = ["lib"]
16
16
 
17
- spec.add_development_dependency "jekyll", "~> 2.0"
17
+ spec.add_development_dependency "jekyll", ">= 2.4.0", "< 3.1.0"
18
18
  spec.add_development_dependency "bundler", "~> 1.6"
19
19
  spec.add_development_dependency "rake", "~> 10.0"
20
20
  spec.add_development_dependency "rspec", "~> 3.0"
21
21
  spec.add_development_dependency "typhoeus", "~> 0.7"
22
22
  spec.add_development_dependency "nokogiri", "~> 1.6"
23
23
  spec.add_development_dependency "jekyll-last-modified-at", "0.3.4"
24
-
25
24
  end
@@ -12,6 +12,14 @@ module Jekyll
12
12
  @context.registers[:site].config
13
13
  end
14
14
 
15
+ def path
16
+ if config["feed"] && config["feed"]["path"]
17
+ config["feed"]["path"]
18
+ else
19
+ "feed.xml"
20
+ end
21
+ end
22
+
15
23
  def url
16
24
  if config["url"]
17
25
  config["url"]
@@ -22,7 +30,7 @@ module Jekyll
22
30
 
23
31
  def render(context)
24
32
  @context = context
25
- "<link type=\"application/atom+xml\" rel=\"alternate\" href=\"#{url}/feed.xml\" title=\"#{config["name"]}\" />"
33
+ "<link type=\"application/atom+xml\" rel=\"alternate\" href=\"#{url}/#{path}\" title=\"#{config["name"]}\" />"
26
34
  end
27
35
  end
28
36
 
@@ -30,14 +38,23 @@ module Jekyll
30
38
  safe true
31
39
  priority :lowest
32
40
 
41
+ # Path to feed from config, or feed.xml for default
42
+ def path
43
+ if @site.config["feed"] && @site.config["feed"]["path"]
44
+ @site.config["feed"]["path"]
45
+ else
46
+ "feed.xml"
47
+ end
48
+ end
49
+
33
50
  # Main plugin action, called by Jekyll-core
34
51
  def generate(site)
35
52
  @site = site
36
- @site.config["time"] = Time.new
53
+ @site.config["time"] = Time.new
37
54
  unless feed_exists?
38
55
  write
39
56
  @site.keep_files ||= []
40
- @site.keep_files << "feed.xml"
57
+ @site.keep_files << path
41
58
  end
42
59
  end
43
60
 
@@ -49,9 +66,9 @@ module Jekyll
49
66
  # Destination for feed.xml file within the site source directory
50
67
  def destination_path
51
68
  if @site.respond_to?(:in_dest_dir)
52
- @site.in_dest_dir("feed.xml")
69
+ @site.in_dest_dir(path)
53
70
  else
54
- Jekyll.sanitized_path(@site.dest, "feed.xml")
71
+ Jekyll.sanitized_path(@site.dest, path)
55
72
  end
56
73
  end
57
74
 
@@ -62,7 +79,7 @@ module Jekyll
62
79
  end
63
80
 
64
81
  def feed_content
65
- site_map = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", "feed.xml")
82
+ site_map = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", path)
66
83
  site_map.content = File.read(source_path).gsub(/\s*\n\s*/, "\n").gsub(/\n{%/, "{%")
67
84
  site_map.data["layout"] = nil
68
85
  site_map.render(Hash.new, @site.site_payload)
@@ -72,9 +89,9 @@ module Jekyll
72
89
  # Checks if a feed already exists in the site source
73
90
  def feed_exists?
74
91
  if @site.respond_to?(:in_source_dir)
75
- File.exists? @site.in_source_dir("feed.xml")
92
+ File.exists? @site.in_source_dir(path)
76
93
  else
77
- File.exists? Jekyll.sanitized_path(@site.source, "feed.xml")
94
+ File.exists? Jekyll.sanitized_path(@site.source, path)
78
95
  end
79
96
  end
80
97
  end
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe(Jekyll::JekyllFeed) do
4
4
  let(:overrides) do
5
5
  {
6
+ "full_rebuild" => true,
6
7
  "source" => source_dir,
7
8
  "destination" => dest_dir,
8
9
  "url" => "http://example.org",
@@ -30,7 +31,7 @@ describe(Jekyll::JekyllFeed) do
30
31
  end
31
32
 
32
33
  it "creates a feed.xml file" do
33
- expect(File.exist?(dest_dir("feed.xml"))).to be_truthy
34
+ expect(Pathname.new(dest_dir("feed.xml"))).to exist
34
35
  end
35
36
 
36
37
  it "doesn't have multiple new lines or trailing whitespace" do
@@ -145,4 +146,20 @@ describe(Jekyll::JekyllFeed) do
145
146
  expect(index).to include(expected)
146
147
  end
147
148
  end
149
+
150
+ context "changing the feed path" do
151
+ let(:config) do
152
+ Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"feed" => {"path" => "atom.xml"}}))
153
+ end
154
+
155
+ it "should write to atom.xml" do
156
+ expect(Pathname.new(dest_dir("atom.xml"))).to exist
157
+ end
158
+
159
+ it "renders the feed meta with custom feed path" do
160
+ index = File.read(dest_dir("index.html"))
161
+ expected = '<link type="application/atom+xml" rel="alternate" href="http://example.org/atom.xml" title="My awesome site" />'
162
+ expect(index).to include(expected)
163
+ end
164
+ end
148
165
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-26 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.4.0
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '2.0'
22
+ version: 3.1.0
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.4.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '2.0'
32
+ version: 3.1.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement