jekyll_pages_api 0.1.0 → 0.1.1
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -0
- data/CONTRIBUTING.md +6 -0
- data/README.md +18 -5
- data/gemfiles/jekyll_2.gemfile +5 -0
- data/gemfiles/jekyll_3.gemfile +5 -0
- data/jekyll_pages_api.gemspec +1 -1
- data/lib/jekyll_pages_api/version.rb +1 -1
- data/spec/integration_spec.rb +29 -7
- data/spec/site/.gitignore +1 -0
- data/spec/site/Gemfile +1 -1
- data/spec/site/unicode.html +5 -0
- data/spec/spec_helper.rb +2 -0
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811fc43f57f4e801222cf78914842d6809c5b1d0
|
4
|
+
data.tar.gz: 9dacb9aa3c7a60a1ecc07f6ab7b0f381003929e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7d6f06549f8ae61acef268bceadfc80b632ec1d6d63d5b3f1df4d20e04a6724745ccaf72eccf58cfa429d0b3eaa30949e0051100f71a97e3c244d67f7e108af
|
7
|
+
data.tar.gz: af0004b3e2a43dedc840eb2d5c687d3355c914008cdf64f3b45cf49042b59e8f82422825431fd37b353fefd80287fb5ffa08f4586ad304f2a0cdc5d979eb6997
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Jekyll Pages API [](https://travis-ci.org/18F/jekyll_pages_api)
|
1
|
+
# Jekyll Pages API [](https://travis-ci.org/18F/jekyll_pages_api) [](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
|
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
|
-
```
|
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
|
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
|
data/jekyll_pages_api.gemspec
CHANGED
@@ -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", "
|
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"
|
data/spec/integration_spec.rb
CHANGED
@@ -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
|
-
|
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(
|
27
|
-
run_cmd(
|
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
|
-
|
39
|
-
|
40
|
-
|
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
data/spec/site/Gemfile
CHANGED
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.
|
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-
|
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.
|
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
|