algoliasearch-jekyll 0.5.3 → 0.6.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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -0
  3. data/Appraisals +8 -0
  4. data/CONTRIBUTING.md +15 -7
  5. data/Gemfile +1 -1
  6. data/Guardfile +14 -4
  7. data/README.md +1 -1
  8. data/algoliasearch-jekyll.gemspec +46 -33
  9. data/gemfiles/jekyll_v2.gemfile +21 -0
  10. data/gemfiles/jekyll_v3.gemfile +22 -0
  11. data/lib/record_extractor.rb +30 -12
  12. data/lib/version.rb +1 -1
  13. data/scripts/git_hooks/pre-push +1 -1
  14. data/scripts/test +4 -0
  15. data/scripts/test_ci +7 -0
  16. data/scripts/test_v2 +5 -0
  17. data/scripts/test_v3 +6 -0
  18. data/scripts/watch +4 -0
  19. data/scripts/watch_v2 +4 -0
  20. data/scripts/watch_v3 +4 -0
  21. data/spec/credential_checker_spec.rb +1 -1
  22. data/spec/fixtures/{_config.yml → jekyll_version_2/_config.yml} +4 -0
  23. data/spec/fixtures/{_layouts → jekyll_version_2/_layouts}/default.html +0 -0
  24. data/spec/fixtures/{_my-collection → jekyll_version_2/_my-collection}/collection-item.html +0 -0
  25. data/spec/fixtures/{_my-collection → jekyll_version_2/_my-collection}/collection-item.md +0 -0
  26. data/spec/fixtures/{_posts → jekyll_version_2/_posts}/2015-07-02-test-post.md +0 -0
  27. data/spec/fixtures/{_posts → jekyll_version_2/_posts}/2015-07-03-test-post-again.md +0 -0
  28. data/spec/fixtures/{about.md → jekyll_version_2/about.md} +0 -0
  29. data/spec/fixtures/{api_key_dir → jekyll_version_2/api_key_dir}/_algolia_api_key +0 -0
  30. data/spec/fixtures/{_site → jekyll_version_2}/assets/ring.png +0 -0
  31. data/spec/fixtures/{authors.html → jekyll_version_2/authors.html} +0 -0
  32. data/spec/fixtures/{excluded.html → jekyll_version_2/excluded.html} +0 -0
  33. data/spec/fixtures/{hierarchy.md → jekyll_version_2/hierarchy.md} +0 -0
  34. data/spec/fixtures/{index.html → jekyll_version_2/index.html} +0 -0
  35. data/spec/fixtures/{page2 → jekyll_version_2/page2}/index.html +0 -0
  36. data/spec/fixtures/{weight.md → jekyll_version_2/weight.md} +0 -0
  37. data/spec/fixtures/jekyll_version_3/_config.yml +17 -0
  38. data/spec/fixtures/jekyll_version_3/_layouts/default.html +6 -0
  39. data/spec/fixtures/{_site/my-collection → jekyll_version_3/_my-collection}/collection-item.html +5 -1
  40. data/spec/fixtures/jekyll_version_3/_my-collection/collection-item.md +7 -0
  41. data/spec/fixtures/jekyll_version_3/_posts/2015-07-02-test-post.md +32 -0
  42. data/spec/fixtures/jekyll_version_3/_posts/2015-07-03-test-post-again.md +7 -0
  43. data/spec/fixtures/jekyll_version_3/about.md +34 -0
  44. data/spec/fixtures/jekyll_version_3/api_key_dir/_algolia_api_key +1 -0
  45. data/spec/fixtures/{assets → jekyll_version_3/assets}/ring.png +0 -0
  46. data/spec/fixtures/{_site → jekyll_version_3}/authors.html +4 -0
  47. data/spec/fixtures/{_site → jekyll_version_3}/excluded.html +4 -0
  48. data/spec/fixtures/jekyll_version_3/hierarchy.md +35 -0
  49. data/spec/fixtures/jekyll_version_3/index.html +13 -0
  50. data/spec/fixtures/jekyll_version_3/page2/index.html +6 -0
  51. data/spec/fixtures/jekyll_version_3/weight.md +19 -0
  52. data/spec/record_extractor_spec.rb +131 -5
  53. data/spec/spec_helper.rb +47 -26
  54. metadata +56 -43
  55. data/spec/fixtures/_site/2015/07/02/test-post.html +0 -26
  56. data/spec/fixtures/_site/2015/07/03/test-post-again.html +0 -3
  57. data/spec/fixtures/_site/about.html +0 -31
  58. data/spec/fixtures/_site/hierarchy.html +0 -31
  59. data/spec/fixtures/_site/index.html +0 -17
  60. data/spec/fixtures/_site/page2/index.html +0 -40
  61. data/spec/fixtures/_site/weight.html +0 -15
  62. data/spec/spec_helper_jekyll.rb +0 -4
data/spec/spec_helper.rb CHANGED
@@ -4,40 +4,61 @@ if ENV['TRAVIS']
4
4
  end
5
5
 
6
6
  require 'awesome_print'
7
- require_relative './spec_helper_jekyll.rb'
7
+ require 'jekyll'
8
8
  require_relative './spec_helper_simplecov.rb'
9
9
  require './lib/push.rb'
10
10
 
11
11
  RSpec.configure do |config|
12
12
  config.filter_run(focus: true)
13
13
  config.run_all_when_everything_filtered = true
14
+ end
14
15
 
15
- # Create a Jekyll::Site instance, patched with a `file_by_name` method
16
- def get_site(config = {}, options = {})
17
- default_options = {
18
- mock_write_method: true,
19
- process: true
20
- }
21
- options = default_options.merge(options)
22
-
23
- config = config.merge(
24
- source: File.expand_path('./spec/fixtures')
25
- )
26
- config = Jekyll.configuration(config)
27
-
28
- site = AlgoliaSearchJekyllPush.init_options({}, options, config)
29
- .jekyll_new(config)
30
-
31
- def site.file_by_name(file_name)
32
- each_site_file do |file|
33
- return file if file.path =~ /#{file_name}$/
34
- end
35
- nil
36
- end
16
+ # Disabling the logs
17
+ Jekyll.logger.log_level = :error
18
+
19
+ # Create a Jekyll::Site instance, patched with a `file_by_name` method
20
+ def get_site(config = {}, options = {})
21
+ default_options = {
22
+ mock_write_method: true,
23
+ process: true
24
+ }
25
+ options = default_options.merge(options)
37
26
 
38
- allow(site).to receive(:write) if options[:mock_write_method]
27
+ config = config.merge(
28
+ source: fixture_path
29
+ )
30
+ config = Jekyll.configuration(config)
39
31
 
40
- site.process if options[:process]
41
- site
32
+ site = AlgoliaSearchJekyllPush.init_options({}, options, config)
33
+ .jekyll_new(config)
34
+
35
+ def site.file_by_name(file_name)
36
+ each_site_file do |file|
37
+ return file if file.path =~ /#{file_name}$/
38
+ end
39
+ nil
42
40
  end
41
+
42
+ allow(site).to receive(:write) if options[:mock_write_method]
43
+
44
+ site.process if options[:process]
45
+ site
46
+ end
47
+
48
+ # Return the fixture path, according to the current Jekyll version being tested
49
+ def fixture_path
50
+ jekyll_version = Jekyll::VERSION[0]
51
+ fixture_path = "./spec/fixtures/jekyll_version_#{jekyll_version}"
52
+ File.expand_path(fixture_path)
53
+ end
54
+
55
+ # Check the current Jekyll version
56
+ def restrict_jekyll_version(more_than: nil, less_than: nil)
57
+ jekyll_version = Gem::Version.new(Jekyll::VERSION)
58
+ minimum_version = Gem::Version.new(more_than)
59
+ maximum_version = Gem::Version.new(less_than)
60
+
61
+ return false if !more_than.nil? && jekyll_version < minimum_version
62
+ return false if !less_than.nil? && jekyll_version > maximum_version
63
+ true
43
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Carry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: algoliasearch
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: appraisal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.1.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: awesome_print
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +136,6 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '4.6'
125
- - !ruby/object:Gem::Dependency
126
- name: jekyll
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '2.5'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '2.5'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: jeweler
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,7 @@ files:
205
205
  - ".rspec"
206
206
  - ".rubocop.yml"
207
207
  - ".travis.yml"
208
+ - Appraisals
208
209
  - CONTRIBUTING.md
209
210
  - Gemfile
210
211
  - Guardfile
@@ -213,6 +214,8 @@ files:
213
214
  - Rakefile
214
215
  - algoliasearch-jekyll.gemspec
215
216
  - docs/travis-settings.png
217
+ - gemfiles/jekyll_v2.gemfile
218
+ - gemfiles/jekyll_v3.gemfile
216
219
  - lib/algoliasearch-jekyll.rb
217
220
  - lib/credential_checker.rb
218
221
  - lib/push.rb
@@ -224,37 +227,47 @@ files:
224
227
  - scripts/git_hooks/pre-commit
225
228
  - scripts/git_hooks/pre-push
226
229
  - scripts/release
230
+ - scripts/test
231
+ - scripts/test_ci
232
+ - scripts/test_v2
233
+ - scripts/test_v3
234
+ - scripts/watch
235
+ - scripts/watch_v2
236
+ - scripts/watch_v3
227
237
  - spec/credential_checker_spec.rb
228
- - spec/fixtures/_config.yml
229
- - spec/fixtures/_layouts/default.html
230
- - spec/fixtures/_my-collection/collection-item.html
231
- - spec/fixtures/_my-collection/collection-item.md
232
- - spec/fixtures/_posts/2015-07-02-test-post.md
233
- - spec/fixtures/_posts/2015-07-03-test-post-again.md
234
- - spec/fixtures/_site/2015/07/02/test-post.html
235
- - spec/fixtures/_site/2015/07/03/test-post-again.html
236
- - spec/fixtures/_site/about.html
237
- - spec/fixtures/_site/assets/ring.png
238
- - spec/fixtures/_site/authors.html
239
- - spec/fixtures/_site/excluded.html
240
- - spec/fixtures/_site/hierarchy.html
241
- - spec/fixtures/_site/index.html
242
- - spec/fixtures/_site/my-collection/collection-item.html
243
- - spec/fixtures/_site/page2/index.html
244
- - spec/fixtures/_site/weight.html
245
- - spec/fixtures/about.md
246
- - spec/fixtures/api_key_dir/_algolia_api_key
247
- - spec/fixtures/assets/ring.png
248
- - spec/fixtures/authors.html
249
- - spec/fixtures/excluded.html
250
- - spec/fixtures/hierarchy.md
251
- - spec/fixtures/index.html
252
- - spec/fixtures/page2/index.html
253
- - spec/fixtures/weight.md
238
+ - spec/fixtures/jekyll_version_2/_config.yml
239
+ - spec/fixtures/jekyll_version_2/_layouts/default.html
240
+ - spec/fixtures/jekyll_version_2/_my-collection/collection-item.html
241
+ - spec/fixtures/jekyll_version_2/_my-collection/collection-item.md
242
+ - spec/fixtures/jekyll_version_2/_posts/2015-07-02-test-post.md
243
+ - spec/fixtures/jekyll_version_2/_posts/2015-07-03-test-post-again.md
244
+ - spec/fixtures/jekyll_version_2/about.md
245
+ - spec/fixtures/jekyll_version_2/api_key_dir/_algolia_api_key
246
+ - spec/fixtures/jekyll_version_2/assets/ring.png
247
+ - spec/fixtures/jekyll_version_2/authors.html
248
+ - spec/fixtures/jekyll_version_2/excluded.html
249
+ - spec/fixtures/jekyll_version_2/hierarchy.md
250
+ - spec/fixtures/jekyll_version_2/index.html
251
+ - spec/fixtures/jekyll_version_2/page2/index.html
252
+ - spec/fixtures/jekyll_version_2/weight.md
253
+ - spec/fixtures/jekyll_version_3/_config.yml
254
+ - spec/fixtures/jekyll_version_3/_layouts/default.html
255
+ - spec/fixtures/jekyll_version_3/_my-collection/collection-item.html
256
+ - spec/fixtures/jekyll_version_3/_my-collection/collection-item.md
257
+ - spec/fixtures/jekyll_version_3/_posts/2015-07-02-test-post.md
258
+ - spec/fixtures/jekyll_version_3/_posts/2015-07-03-test-post-again.md
259
+ - spec/fixtures/jekyll_version_3/about.md
260
+ - spec/fixtures/jekyll_version_3/api_key_dir/_algolia_api_key
261
+ - spec/fixtures/jekyll_version_3/assets/ring.png
262
+ - spec/fixtures/jekyll_version_3/authors.html
263
+ - spec/fixtures/jekyll_version_3/excluded.html
264
+ - spec/fixtures/jekyll_version_3/hierarchy.md
265
+ - spec/fixtures/jekyll_version_3/index.html
266
+ - spec/fixtures/jekyll_version_3/page2/index.html
267
+ - spec/fixtures/jekyll_version_3/weight.md
254
268
  - spec/push_spec.rb
255
269
  - spec/record_extractor_spec.rb
256
270
  - spec/spec_helper.rb
257
- - spec/spec_helper_jekyll.rb
258
271
  - spec/spec_helper_simplecov.rb
259
272
  - txt/api_key_missing
260
273
  - txt/application_id_missing
@@ -1,26 +0,0 @@
1
- <p>Introduction text that also includes <a href="https://www.algolia.com">some link</a>. To
2
- add a bit of fancy, we will also <strong>bold</strong> and <em>italicize</em> some text.</p>
3
-
4
- <h1 id="main-title">Main title</h1>
5
-
6
- <p>We like writing stuff and then indexing it in a very fast engine. Here is why
7
- a fast engine is good for you:</p>
8
-
9
- <ul>
10
- <li>fast</li>
11
- <li>fast</li>
12
- <li>fast</li>
13
- <li>and fast</li>
14
- </ul>
15
-
16
- <h2 id="built-with-hands">Built with hands</h2>
17
-
18
- <p>All this text was typed with my own hands, on my own keyboard. I also did use
19
- a Chair© and a Table™.</p>
20
-
21
- <h2 id="features">Features</h2>
22
-
23
- <p>The whole plugin is composed of parts of <code>code</code>, and sometime even
24
- <code>&lt;code&gt;</code>.</p>
25
-
26
- <p>Code is <strong>✔ checked</strong> and errors are <strong>✘ deleted</strong>.</p>
@@ -1,3 +0,0 @@
1
- <p>The goal of this post is simply to trigger pagination, and see that we do not
2
- index the pagination results.</p>
3
-
@@ -1,31 +0,0 @@
1
- <h1 id="heading-1">Heading 1</h1>
2
-
3
- <p>Text 1</p>
4
-
5
- <h2 id="heading-2">Heading 2</h2>
6
-
7
- <p>Text 2</p>
8
-
9
- <h3 id="heading-3">Heading 3</h3>
10
-
11
- <p>Text 3</p>
12
-
13
- <ul>
14
- <li>item 1</li>
15
- <li>item 2</li>
16
- <li>item 3</li>
17
- </ul>
18
-
19
- <h3 id="another-heading-3">Another Heading 3</h3>
20
-
21
- <p id="text4">Another text 4</p>
22
-
23
- <h2 id="heading2b">Another Heading 2</h2>
24
-
25
- <p>Another <code>&lt;text&gt;</code> 5</p>
26
-
27
- <h3 id="last-heading-3">Last Heading 3</h3>
28
-
29
- <div>Just a div</div>
30
-
31
- <div><p>Last text 6 </p></div>
@@ -1,31 +0,0 @@
1
- <h1 id="h1">H1</h1>
2
-
3
- <p>TEXT1-H1</p>
4
-
5
- <h2 id="h2a">H2A</h2>
6
-
7
- <p>TEXT2-H2A-H1</p>
8
-
9
- <p>TEXT3-H2A-H1</p>
10
-
11
- <h2 id="h2b">H2B</h2>
12
-
13
- <p>TEXT4-H2B-H1</p>
14
-
15
- <h3 id="h3a">H3A</h3>
16
-
17
- <p>TEXT5-H3-H2B-H1</p>
18
-
19
- <div>
20
- <h4>H4</h4>
21
- <p>TEXT7-H4-H3-H2B-H1</p>
22
- </div>
23
-
24
- <h2 id="h2c">H2C</h2>
25
-
26
- <p>TEXT8-H2C-H1</p>
27
-
28
- <h3 id="h3b-code">H3B <code>&lt;code&gt;</code></h3>
29
-
30
- <p>TEXT9-H3B-H2C-H1</p>
31
-
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en-us">
3
- <body>
4
- This default index page is used to display the paginated posts
5
-
6
-
7
- <a href="/2015/07/03/test-post-again.html">
8
- Test post again
9
- </a>
10
- <p>The goal of this post is simply to trigger pagination, and see that we do not
11
- index the pagination results.</p>
12
-
13
-
14
-
15
-
16
- </body>
17
- </html>
@@ -1,40 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en-us">
3
- <body>
4
- This default index page is used to display the paginated posts
5
-
6
-
7
- <a href="/2015/07/02/test-post.html">
8
- Test post
9
- </a>
10
- <p>Introduction text that also includes <a href="https://www.algolia.com">some link</a>. To
11
- add a bit of fancy, we will also <strong>bold</strong> and <em>italicize</em> some text.</p>
12
-
13
- <h1 id="main-title">Main title</h1>
14
-
15
- <p>We like writing stuff and then indexing it in a very fast engine. Here is why
16
- a fast engine is good for you:</p>
17
-
18
- <ul>
19
- <li>fast</li>
20
- <li>fast</li>
21
- <li>fast</li>
22
- <li>and fast</li>
23
- </ul>
24
-
25
- <h2 id="built-with-hands">Built with hands</h2>
26
-
27
- <p>All this text was typed with my own hands, on my own keyboard. I also did use
28
- a Chair© and a Table™.</p>
29
-
30
- <h2 id="features">Features</h2>
31
-
32
- <p>The whole plugin is composed of parts of <code>code</code>, and sometime even
33
- <code>&lt;code&gt;</code>.</p>
34
-
35
- <p>Code is <strong>✔ checked</strong> and errors are <strong>✘ deleted</strong>.</p>
36
-
37
-
38
-
39
- </body>
40
- </html>
@@ -1,15 +0,0 @@
1
- <h1 id="aaa-bbb-ccc-ddd">AAA BBB CCC DDD</h1>
2
-
3
- <p>aaa xxx aaa xxx aaa</p>
4
-
5
- <h2 id="aaa-bbb">AAA BBB</h2>
6
-
7
- <p>aaa bbb</p>
8
-
9
- <h2 id="ccc-ddd">CCC DDD</h2>
10
-
11
- <p>ccc ddd</p>
12
-
13
- <h3 id="ddd">DDD</h3>
14
-
15
- <p>aaa bbb ccc dddd</p>
@@ -1,4 +0,0 @@
1
- require 'jekyll'
2
-
3
- # Prevent Jekyll from displaying the "Configuration file:..." on every test
4
- Jekyll.logger.log_level = :error