algoliasearch-jekyll 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/algoliasearch-jekyll.gemspec +3 -2
- data/lib/push.rb +7 -0
- data/scripts/git_hooks/pre-push +0 -5
- data/spec/push_spec.rb +24 -0
- data/todo +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 958dac73432790cf98b7d3e94fcbedc3be399b5e
|
4
|
+
data.tar.gz: 0d31b043d45af8e0a6760c51832bf7c2a77a3c58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c8b32b5c817cb4c40c731442fb26dda3beec23e51ac95d4c745d8445bbb70ffef2215873404d739a705267dfb5e47fecd7a65104a617132b3b1577a8fcb3c62
|
7
|
+
data.tar.gz: 3952045733b2e53c41a3321f2a4bf7332e9d6eed481a2073854c254f54df0bb0f11fc92c5c50d51a05ad59412cc38fe55087bab3043475f8f526688156faadc1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
@@ -2,11 +2,11 @@
|
|
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.4.
|
5
|
+
# stub: algoliasearch-jekyll 0.4.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "algoliasearch-jekyll"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.2"
|
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"]
|
@@ -70,6 +70,7 @@ Gem::Specification.new do |s|
|
|
70
70
|
"spec/spec_helper.rb",
|
71
71
|
"spec/spec_helper_jekyll.rb",
|
72
72
|
"spec/spec_helper_simplecov.rb",
|
73
|
+
"todo",
|
73
74
|
"txt/api_key_missing",
|
74
75
|
"txt/application_id_missing",
|
75
76
|
"txt/index_name_missing"
|
data/lib/push.rb
CHANGED
@@ -124,8 +124,15 @@ class AlgoliaSearchJekyllPush < Jekyll::Command
|
|
124
124
|
index.set_settings(settings)
|
125
125
|
end
|
126
126
|
|
127
|
+
# Change the User-Agent header to isolate calls from this plugin
|
128
|
+
def set_user_agent_header
|
129
|
+
version = Gem::Specification.load('algoliasearch-jekyll.gemspec').version
|
130
|
+
Algolia.set_extra_header('User-Agent', "Algolia for Jekyll #{version}")
|
131
|
+
end
|
132
|
+
|
127
133
|
# Create an index to push our data
|
128
134
|
def create_index(index_name)
|
135
|
+
set_user_agent_header
|
129
136
|
index = Algolia::Index.new(index_name)
|
130
137
|
configure_index(index) unless @is_dry_run
|
131
138
|
index
|
data/scripts/git_hooks/pre-push
CHANGED
data/spec/push_spec.rb
CHANGED
@@ -184,6 +184,29 @@ describe(AlgoliaSearchJekyllPush) do
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
+
describe 'set_user_agent_header' do
|
188
|
+
it 'should set a User-Agent with the plugin name and version' do
|
189
|
+
# Given
|
190
|
+
expected = '48.1516.2342'
|
191
|
+
spec = Gem::Specification.load('algoliasearch-jekyll.gemspec')
|
192
|
+
spec.version = expected
|
193
|
+
allow(Algolia).to receive(:set_extra_header)
|
194
|
+
|
195
|
+
# When
|
196
|
+
push.set_user_agent_header
|
197
|
+
|
198
|
+
# Then
|
199
|
+
expect(Algolia).to have_received(:set_extra_header).with(
|
200
|
+
'User-Agent',
|
201
|
+
/Jekyll/
|
202
|
+
)
|
203
|
+
expect(Algolia).to have_received(:set_extra_header).with(
|
204
|
+
'User-Agent',
|
205
|
+
/#{expected}/
|
206
|
+
)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
187
210
|
describe 'push' do
|
188
211
|
let(:index_double) { double('Algolia Index').as_null_object }
|
189
212
|
let(:config) do
|
@@ -199,6 +222,7 @@ describe(AlgoliaSearchJekyllPush) do
|
|
199
222
|
# Mock all calls to not send anything
|
200
223
|
allow_any_instance_of(AlgoliaSearchCredentialChecker)
|
201
224
|
.to receive(:assert_valid)
|
225
|
+
allow(Algolia).to receive(:set_extra_header)
|
202
226
|
allow(Algolia).to receive(:init)
|
203
227
|
allow(Algolia).to receive(:move_index)
|
204
228
|
allow(Algolia::Index).to receive(:new).and_return(index_double)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Carry
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- spec/spec_helper.rb
|
253
253
|
- spec/spec_helper_jekyll.rb
|
254
254
|
- spec/spec_helper_simplecov.rb
|
255
|
+
- todo
|
255
256
|
- txt/api_key_missing
|
256
257
|
- txt/application_id_missing
|
257
258
|
- txt/index_name_missing
|