jekyll_pages_api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4485de15e66a09dedf59a42575b00ae341f442e9
4
- data.tar.gz: f1063959c1529374a696d1be62521fa451de8b71
3
+ metadata.gz: 811fc43f57f4e801222cf78914842d6809c5b1d0
4
+ data.tar.gz: 9dacb9aa3c7a60a1ecc07f6ab7b0f381003929e9
5
5
  SHA512:
6
- metadata.gz: a589f6459b68d956a086a1c81a0cc6736115d6e403c38733626d6e90cc5ff601a42fb751031d3d017b62b9dad17038fced9ce7c1bcf46113510e03baff01f3b7
7
- data.tar.gz: 0f791a9cfe8bf63305e66d0248fba0372ce911425edbbc35ab357497b7143413807ece67b91ebb1821dfc46ac39090b9d95102e0d1a322dce7fd074d021a9f5c
6
+ metadata.gz: b7d6f06549f8ae61acef268bceadfc80b632ec1d6d63d5b3f1df4d20e04a6724745ccaf72eccf58cfa429d0b3eaa30949e0051100f71a97e3c244d67f7e108af
7
+ data.tar.gz: af0004b3e2a43dedc840eb2d5c687d3355c914008cdf64f3b45cf49042b59e8f82422825431fd37b353fefd80287fb5ffa08f4586ad304f2a0cdc5d979eb6997
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
+ /gemfiles/*.lock
3
4
  /Gemfile.lock
4
5
  /_yardoc/
5
6
  /coverage/
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
+ gemfile:
5
+ - gemfiles/jekyll_2.gemfile
6
+ - gemfiles/jekyll_3.gemfile
4
7
  script: bundle exec rspec
data/CONTRIBUTING.md CHANGED
@@ -11,6 +11,12 @@ bundle
11
11
  bundle exec rspec
12
12
  ```
13
13
 
14
+ ### Running against Jekyll 3
15
+
16
+ ```bash
17
+ BUNDLE_GEMFILE=gemfiles/jekyll_3.gemfile bundle exec rspec
18
+ ```
19
+
14
20
  ## Public domain
15
21
 
16
22
  This project is in the public domain within the United States, and
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Jekyll Pages API [![Build Status](https://travis-ci.org/18F/jekyll_pages_api.svg?branch=master)](https://travis-ci.org/18F/jekyll_pages_api)
1
+ # Jekyll Pages API [![Build Status](https://travis-ci.org/18F/jekyll_pages_api.svg?branch=master)](https://travis-ci.org/18F/jekyll_pages_api) [![Code Climate](https://codeclimate.com/github/18F/jekyll_pages_api/badges/gpa.svg)](https://codeclimate.com/github/18F/jekyll_pages_api)
2
2
 
3
3
  Jekyll Pages API is a [Jekyll Plugin](http://jekyllrb.com/docs/plugins/) gem that generates a JSON file with data for all the Pages in your Site. [Jekyll](http://jekyllrb.com), if you're not familiar, is a static website generator written in Ruby.
4
4
 
@@ -19,19 +19,32 @@ bundle
19
19
  bundle exec jekyll serve
20
20
  ```
21
21
 
22
- You can then see the generated JSON file at http://localhost:4000/api/v1/pages.json, which will look something like this:
22
+ You can then see the generated JSON file at http://localhost:4000/api/v1/pages.json, which will look like this:
23
23
 
24
- ```json
24
+ ```javascript
25
25
  {
26
26
  "entries": [
27
27
  {
28
28
  "title": "18F Hub",
29
+ // the page path
29
30
  "url": "/",
31
+ // the content of the page, with the HTML tags stripped and the whitespace condensed
30
32
  "body": "18F is a digital services team within GSA..."
31
33
  },
32
- ...
34
+ // ...
33
35
  ]
34
36
  }
35
37
  ```
36
38
 
37
- This endpoint will be re-generated any time your site it rebuilt.
39
+ This endpoint will be re-generated any time your site is rebuilt.
40
+
41
+ ## See also
42
+
43
+ Additional means of turning your site content into data:
44
+
45
+ * [Jekyll's `jsonify` filter](http://jekyllrb.com/docs/templates/)
46
+ * [jekyll-git_metadata](https://github.com/ivantsepp/jekyll-git_metadata)
47
+ * [jekyll-rss](https://github.com/agelber/jekyll-rss)
48
+ * [jekyll-sitemap](https://github.com/jekyll/jekyll-sitemap)
49
+ * Reading the YAML frontmatter of the source files
50
+ * Scraping the HTML pages themselves
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'jekyll', '~> 2.0'
4
+
5
+ gemspec path: '../'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'jekyll', '3.0.0.beta2'
4
+
5
+ gemspec path: '../'
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "htmlentities", "~> 4.3"
21
- spec.add_dependency "jekyll", "~> 2.0"
21
+ spec.add_dependency "jekyll", [">= 2.0", "< 4.0"]
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.7"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,3 +1,3 @@
1
1
  module JekyllPagesApi
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'json'
2
4
  require_relative 'support/shell'
3
5
 
@@ -15,16 +17,20 @@ describe "integration" do
15
17
  json['entries']
16
18
  end
17
19
 
20
+ def page_data(url)
21
+ entries_data.find{|page| page['url'] == url }
22
+ end
23
+
18
24
  def homepage_data
19
- entries_data.find{|page| page['url'] == '/' }
25
+ page_data('/')
20
26
  end
21
27
 
22
28
  before(:context) do
23
29
  # http://bundler.io/man/bundle-exec.1.html#Shelling-out
24
30
  Bundler.with_clean_env do
25
31
  Dir.chdir(BUILD_DIR) do
26
- run_cmd('bundle')
27
- run_cmd('bundle exec jekyll build')
32
+ run_cmd("JEKYLL_VERSION=#{Jekyll::VERSION} bundle update")
33
+ run_cmd("JEKYLL_VERSION=#{Jekyll::VERSION} bundle exec jekyll build")
28
34
  end
29
35
  end
30
36
  end
@@ -35,10 +41,21 @@ describe "integration" do
35
41
 
36
42
  it "includes an entry for every page" do
37
43
  urls = entries_data.map{|page| page['url'] }
38
- expect(urls).to eq(%w(
39
- /about/
40
- /index.html
41
- ))
44
+
45
+ # not sure why this discrepancy exists...
46
+ if Jekyll::VERSION.start_with?('3.')
47
+ expect(urls).to eq(%w(
48
+ /about/
49
+ /
50
+ /unicode.html
51
+ ))
52
+ else
53
+ expect(urls).to eq(%w(
54
+ /about/
55
+ /index.html
56
+ /unicode.html
57
+ ))
58
+ end
42
59
  end
43
60
 
44
61
  it "removes liquid tags" do
@@ -59,4 +76,9 @@ describe "integration" do
59
76
  expect(page['body']).to_not match(/\s{2,}/m)
60
77
  end
61
78
  end
79
+
80
+ it "handles unicode" do
81
+ page = page_data('/unicode.html')
82
+ expect(page['body']).to eq("”Handle the curly quotes!” they said.")
83
+ end
62
84
  end
data/spec/site/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  _site
2
2
  .sass-cache
3
3
  Gemfile.lock
4
+ .jekyll-metadata
data/spec/site/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'jekyll'
3
+ gem 'jekyll', ENV['JEKYLL_VERSION']
4
4
 
5
5
  group :jekyll_plugins do
6
6
  gem 'jekyll_pages_api', path: '../..'
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ ”Handle the curly quotes!” they said.
data/spec/spec_helper.rb CHANGED
@@ -17,6 +17,8 @@
17
17
 
18
18
  require_relative '../lib/jekyll_pages_api'
19
19
 
20
+ puts "Using Jekyll v#{Jekyll::VERSION}"
21
+
20
22
  RSpec.configure do |config|
21
23
  # rspec-expectations config goes here. You can use an alternate
22
24
  # assertion/expectation library such as wrong or the stdlib/minitest
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_pages_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aidan Feldman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '4.0'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '2.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +101,8 @@ files:
95
101
  - LICENSE.md
96
102
  - README.md
97
103
  - Rakefile
104
+ - gemfiles/jekyll_2.gemfile
105
+ - gemfiles/jekyll_3.gemfile
98
106
  - jekyll_pages_api.gemspec
99
107
  - lib/jekyll/site.rb
100
108
  - lib/jekyll_pages_api.rb
@@ -123,6 +131,7 @@ files:
123
131
  - spec/site/css/main.scss
124
132
  - spec/site/feed.xml
125
133
  - spec/site/index.html
134
+ - spec/site/unicode.html
126
135
  - spec/spec_helper.rb
127
136
  - spec/support/shell.rb
128
137
  homepage: https://github.com/18F/jekyll_pages_api
@@ -145,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
154
  version: '0'
146
155
  requirements: []
147
156
  rubyforge_project:
148
- rubygems_version: 2.4.5
157
+ rubygems_version: 2.4.6
149
158
  signing_key:
150
159
  specification_version: 4
151
160
  summary: A Jekyll Plugin that generates a JSON file with data for all the Pages in
@@ -171,5 +180,6 @@ test_files:
171
180
  - spec/site/css/main.scss
172
181
  - spec/site/feed.xml
173
182
  - spec/site/index.html
183
+ - spec/site/unicode.html
174
184
  - spec/spec_helper.rb
175
185
  - spec/support/shell.rb