algoliasearch-jekyll 0.6.1 → 0.7.0

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: dc842f3c5823b8a809ffcd12e6d520f15eeefc60
4
- data.tar.gz: 3fbfef0340971043048d1e0d71b439a50727e451
3
+ metadata.gz: 0c1ea0f7d0eecf20f9cb33f30116df426637a9f4
4
+ data.tar.gz: 8ec5644ebbd8c08fcead43c3c6cf64c0bbe82db6
5
5
  SHA512:
6
- metadata.gz: 8b80bcd9875ac15f96fa76a1f2cb676c6b4a38d98be4c30936710f5ffb9e6c9d843ecf9f2af6ee1b2af56cc77afa3c54b9eb8ce0f814ec1392f0df89de5067ae
7
- data.tar.gz: 70dc1b288661933a38f5b4845d073985d74f5e7f6dc947799af2c85f2afbdebbad6c9fa732b0c3f5a7538f6f596c8338368aba55982384cd83a78eec8fcb8385
6
+ metadata.gz: 0dd5939456e660845ec71719c47ea296088284907b8d58b3d7ac08e5b070ac6dc688edcd18030e0bb87efe2b62a655c71ffb393f81e674936235cf16a9a46ccb
7
+ data.tar.gz: d19157c6ba465da2dea75f62e4744d3b55fb170043c7aedd0098f7b37bba2d53bb00b4fc2ade9458a1c716340e103768a16381a44052245400089787a3781853
data/CONTRIBUTING.md CHANGED
@@ -25,8 +25,11 @@ You can then launch:
25
25
  - `./scripts/test_v3` to launch tests on Jekyll v3
26
26
  - `./scripts/test` to launch tests on both
27
27
  - `./scripts/watch` to start a test watcher (for TDD) for Jekyll v2
28
- - `./scripts/watch_v3` to start a test watcher (for TDD) for Jekyll v3 (you
29
- cannot run both at the same time)
28
+ - `./scripts/watch_v3` to start a test watcher (for TDD) for Jekyll v3
29
+
30
+ The watched test will both launch Guard (with `guard-rspec`), but each will use
31
+ its own `Guardfile` version, launching the correct `appraisal` before the
32
+ `rspec` command.
30
33
 
31
34
  If you want to test the plugin on an existing Jekyll website while developping,
32
35
  I suggest updating the website `Gemfile` to point to the correct local directory
@@ -35,8 +38,7 @@ I suggest updating the website `Gemfile` to point to the correct local directory
35
38
  gem "algoliasearch-jekyll", :path => "/path/to/local/gem/folder"
36
39
  ```
37
40
  You should also run `rake gemspec` from the `algoliasearch-jekyll` repository if
38
- you added new files or dependencies.
39
-
41
+ you added/deleted any file or dependency.
40
42
 
41
43
  If you plan on submitting a PR, I suggest you install the git hooks. This will
42
44
  run pre-commit and pre-push checks. Those checks will also be run by TravisCI,
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ source 'http://rubygems.org'
3
3
  gem 'algoliasearch', '~> 1.4'
4
4
  gem 'appraisal', '~> 2.1.0'
5
5
  gem 'awesome_print', '~> 1.6'
6
- gem 'jekyll', '~> 2.5'
7
6
  gem 'json', '~> 1.8'
8
7
  gem 'nokogiri', '~> 1.6'
9
8
  gem 'verbal_expressions', '~> 0.1.5'
@@ -1,4 +1,4 @@
1
- guard :rspec, cmd: 'bundle exec rspec --color --format documentation' do
1
+ guard :rspec, cmd: 'appraisal jekyll-v2 bundle exec rspec --color --format documentation' do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
4
  watch('spec/spec_helper.rb') { 'spec' }
@@ -0,0 +1,7 @@
1
+ guard :rspec, cmd: 'appraisal jekyll-v3 bundle exec rspec --color --format documentation' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { 'spec' }
5
+ end
6
+
7
+ notification :off
data/README.md CHANGED
@@ -64,6 +64,11 @@ You write api key will be read from the `ALGOLIA_API_KEY` environment variable.
64
64
  You can define it on the same line as your command, allowing you to type
65
65
  `ALGOLIA_API_KEY='your_write_api_key' jekyll algolia push`.
66
66
 
67
+ Note that your API key should have write access to both the `index_name` and
68
+ `_tmp` suffixed version of it (eg. `your_index_name` and `your_index_name_tmp`)
69
+ in the previous example). This is due to the way we do atomic pushes by pushing
70
+ to a temporary index and then renaming it.
71
+
67
72
  ### ⚠ Other, unsecure, method ⚠
68
73
 
69
74
  You can also store your write api key in a file named `_algolia_api_key`, in
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: algoliasearch-jekyll 0.6.1 ruby lib
5
+ # stub: algoliasearch-jekyll 0.7.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "algoliasearch-jekyll"
9
- s.version = "0.6.1"
9
+ s.version = "0.7.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Tim Carry"]
14
- s.date = "2016-01-13"
14
+ s.date = "2016-03-08"
15
15
  s.description = "Index all your pages and posts to an Algolia index with `jekyll algolia push`"
16
16
  s.email = "tim@pixelastic.com"
17
17
  s.extra_rdoc_files = [
@@ -26,7 +26,8 @@ Gem::Specification.new do |s|
26
26
  "Appraisals",
27
27
  "CONTRIBUTING.md",
28
28
  "Gemfile",
29
- "Guardfile",
29
+ "Guardfile_jekyllv2",
30
+ "Guardfile_jekyllv3",
30
31
  "LICENSE.txt",
31
32
  "README.md",
32
33
  "Rakefile",
@@ -46,6 +47,7 @@ Gem::Specification.new do |s|
46
47
  "scripts/coverage",
47
48
  "scripts/git_hooks/pre-commit",
48
49
  "scripts/git_hooks/pre-push",
50
+ "scripts/lint",
49
51
  "scripts/release",
50
52
  "scripts/test",
51
53
  "scripts/test_ci",
@@ -108,7 +110,6 @@ Gem::Specification.new do |s|
108
110
  s.add_runtime_dependency(%q<algoliasearch>, ["~> 1.4"])
109
111
  s.add_runtime_dependency(%q<appraisal>, ["~> 2.1.0"])
110
112
  s.add_runtime_dependency(%q<awesome_print>, ["~> 1.6"])
111
- s.add_runtime_dependency(%q<jekyll>, ["~> 2.5"])
112
113
  s.add_runtime_dependency(%q<json>, ["~> 1.8"])
113
114
  s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6"])
114
115
  s.add_runtime_dependency(%q<verbal_expressions>, ["~> 0.1.5"])
@@ -124,7 +125,6 @@ Gem::Specification.new do |s|
124
125
  s.add_dependency(%q<algoliasearch>, ["~> 1.4"])
125
126
  s.add_dependency(%q<appraisal>, ["~> 2.1.0"])
126
127
  s.add_dependency(%q<awesome_print>, ["~> 1.6"])
127
- s.add_dependency(%q<jekyll>, ["~> 2.5"])
128
128
  s.add_dependency(%q<json>, ["~> 1.8"])
129
129
  s.add_dependency(%q<nokogiri>, ["~> 1.6"])
130
130
  s.add_dependency(%q<verbal_expressions>, ["~> 0.1.5"])
@@ -141,7 +141,6 @@ Gem::Specification.new do |s|
141
141
  s.add_dependency(%q<algoliasearch>, ["~> 1.4"])
142
142
  s.add_dependency(%q<appraisal>, ["~> 2.1.0"])
143
143
  s.add_dependency(%q<awesome_print>, ["~> 1.6"])
144
- s.add_dependency(%q<jekyll>, ["~> 2.5"])
145
144
  s.add_dependency(%q<json>, ["~> 1.8"])
146
145
  s.add_dependency(%q<nokogiri>, ["~> 1.6"])
147
146
  s.add_dependency(%q<verbal_expressions>, ["~> 0.1.5"])
@@ -5,10 +5,10 @@ source "http://rubygems.org"
5
5
  gem "algoliasearch", "~> 1.4"
6
6
  gem "appraisal", "~> 2.1.0"
7
7
  gem "awesome_print", "~> 1.6"
8
- gem "jekyll", "~> 2.5"
9
8
  gem "json", "~> 1.8"
10
9
  gem "nokogiri", "~> 1.6"
11
10
  gem "verbal_expressions", "~> 0.1.5"
11
+ gem "jekyll", "~> 2.5"
12
12
 
13
13
  group :development do
14
14
  gem "coveralls", "~> 0.8"
@@ -5,10 +5,10 @@ source "http://rubygems.org"
5
5
  gem "algoliasearch", "~> 1.4"
6
6
  gem "appraisal", "~> 2.1.0"
7
7
  gem "awesome_print", "~> 1.6"
8
- gem "jekyll", "~> 3.0"
9
8
  gem "json", "~> 1.8"
10
9
  gem "nokogiri", "~> 1.6"
11
10
  gem "verbal_expressions", "~> 0.1.5"
11
+ gem "jekyll", "~> 3.0"
12
12
  gem "jekyll-paginate", "~> 1.1.0"
13
13
 
14
14
  group :development do
data/lib/error_handler.rb CHANGED
@@ -50,7 +50,7 @@ class AlgoliaSearchErrorHandler
50
50
  end
51
51
 
52
52
  def parse_algolia_error(error)
53
- error.gsub!("\n", '')
53
+ error.delete!("\n")
54
54
 
55
55
  tester = error_tester
56
56
  matches = tester.match(error)
@@ -107,7 +107,7 @@ class AlgoliaSearchRecordExtractor
107
107
  # If the node itself is a heading, we include it
108
108
  def node_hierarchy(node, state = { level: 7 })
109
109
  tag_name = node.name
110
- level = tag_name.gsub('h', '').to_i
110
+ level = tag_name.delete('h').to_i
111
111
 
112
112
  if node_heading?(node) && level < state[:level]
113
113
  state[tag_name.to_sym] = node_text(node)
@@ -173,9 +173,9 @@ class AlgoliaSearchRecordExtractor
173
173
  def weight_tag_name(item)
174
174
  tag_name = item[:tag_name]
175
175
  # No a heading, no weight
176
- return 0 unless %w(h1 h2 h3 h4 h5 h6).include?(tag_name)
176
+ return 0 unless %w(h1 h2 h3 h4 h5 h6).include?(tag_name)
177
177
  # h1: 100, h2: 90, ..., h6: 50
178
- 100 - (tag_name.gsub('h', '').to_i - 1) * 10
178
+ 100 - (tag_name.delete('h').to_i - 1) * 10
179
179
  end
180
180
 
181
181
  # Returns an object of all weights
@@ -190,7 +190,7 @@ class AlgoliaSearchRecordExtractor
190
190
  def extract
191
191
  items = []
192
192
  html_nodes.each_with_index do |node, index|
193
- next unless node.text.size > 0
193
+ next if node.text.empty?
194
194
 
195
195
  item = metadata.clone
196
196
  item.merge!(node_hierarchy(node))
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # Expose gem version
2
2
  class AlgoliaSearchJekyllVersion
3
3
  def self.to_s
4
- '0.6.1'
4
+ '0.7.0'
5
5
  end
6
6
  end
@@ -12,5 +12,5 @@ if grep --color -r 'spec' -E -e '^( |\t)*(fit|fdescribe|xit|xdescribe)'; then
12
12
  fi
13
13
 
14
14
  # Match style guide
15
- rubocop -F './lib/' './spec' || exit 1
15
+ ./scripts/lint || exit 1
16
16
 
data/scripts/lint ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ rubocop -F './lib/' './spec'
data/scripts/release CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  git checkout master || exit 1
4
4
  git pull || exit 1
5
+ bundle install && appraisal install
6
+
5
7
  git rebase develop || exit 1
8
+ bundle install && appraisal install
6
9
  rake release || exit 1
10
+
7
11
  git checkout develop || exit 1
12
+ bundle install && appraisal install
8
13
  git rebase master || exit 1
14
+ bundle install && appraisal install
data/scripts/watch CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
  cd "$(dirname "$BASH_SOURCE")"/..
3
3
 
4
- appraisal jekyll-v2 guard
4
+ guard --guardfile ./Guardfile_jekyllv2
data/scripts/watch_v2 CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
  cd "$(dirname "$BASH_SOURCE")"/..
3
3
 
4
- appraisal jekyll-v2 guard
4
+ guard --guardfile ./Guardfile_jekyllv2
data/scripts/watch_v3 CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
  cd "$(dirname "$BASH_SOURCE")"/..
3
+ guard --guardfile ./Guardfile_jekyllv3
3
4
 
4
- appraisal jekyll-v3 guard
data/spec/push_spec.rb CHANGED
@@ -318,7 +318,7 @@ describe(AlgoliaSearchJekyllPush) do
318
318
 
319
319
  # Then
320
320
  expect(Algolia).to have_received(:move_index)
321
- .with('INDEXNAME_tmp', 'INDEXNAME')
321
+ .with('INDEXNAME_tmp', 'INDEXNAME')
322
322
  end
323
323
 
324
324
  it 'should display the number of elements indexed' do
@@ -44,7 +44,7 @@ describe(AlgoliaSearchRecordExtractor) do
44
44
  it 'gets posted_at timestamp based on the configured timezone' do
45
45
  # Given
46
46
  site = get_site(timezone: 'America/New_York')
47
- post_file = extractor.new(site.file_by_name('test-post.md'))
47
+ post_file = extractor.new(site.file_by_name('test-post.md'))
48
48
  actual = post_file.metadata
49
49
 
50
50
  # Then
data/spec/spec_helper.rb CHANGED
@@ -31,7 +31,7 @@ def get_site(config = {}, options = {})
31
31
  config = Jekyll.configuration(config)
32
32
 
33
33
  site = AlgoliaSearchJekyllPush.init_options({}, options, config)
34
- .jekyll_new(config)
34
+ .jekyll_new(config)
35
35
 
36
36
  def site.file_by_name(file_name)
37
37
  each_site_file do |file|
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.6.1
4
+ version: 0.7.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: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: algoliasearch
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
- - !ruby/object:Gem::Dependency
56
- name: jekyll
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.5'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.5'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: json
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -236,7 +222,8 @@ files:
236
222
  - Appraisals
237
223
  - CONTRIBUTING.md
238
224
  - Gemfile
239
- - Guardfile
225
+ - Guardfile_jekyllv2
226
+ - Guardfile_jekyllv3
240
227
  - LICENSE.txt
241
228
  - README.md
242
229
  - Rakefile
@@ -256,6 +243,7 @@ files:
256
243
  - scripts/coverage
257
244
  - scripts/git_hooks/pre-commit
258
245
  - scripts/git_hooks/pre-push
246
+ - scripts/lint
259
247
  - scripts/release
260
248
  - scripts/test
261
249
  - scripts/test_ci