elastics-rails 1.1.11 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b3557c34db875d8814339ecce273fe7fbffe921c
4
+ data.tar.gz: 775c3e630785a14eba4ee13996146374a7999ae5
5
+ SHA512:
6
+ metadata.gz: 8f6005025b0ab4565a00d15c872aee74ebe5d593b9507c5e636691bed85bb1adecbe6e705004b6776918ecf1c7a3a98e4d6c60711cb53a56658f1f208464af06
7
+ data.tar.gz: 40be010e82cdf499deef25fc0d3b8441316c1b1895dfa1f8b163fc2658de1147054bfcfffaa82371b438b6dbadbf27d1691d3eb0186f56633bb9b1de97ba3268
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.11
1
+ 1.2.0
@@ -1,6 +1,9 @@
1
1
  require 'date'
2
- version_path = %w[../VERSION ../../VERSION].detect{|v| File.exist?(File.expand_path(v, __FILE__))}
3
- version = File.read(File.expand_path(version_path, __FILE__)).strip
2
+ version_path = %w[VERSION ../VERSION].detect{|v| File.exist?(v)}
3
+ version = File.read(version_path).strip
4
+ extra_files = []
5
+ extra_files << 'VERSION' if File.exist?('VERSION')
6
+ extra_files << 'LICENSE' if File.exist?('LICENSE')
4
7
 
5
8
  Gem::Specification.new do |s|
6
9
  s.name = 'elastics-rails'
@@ -9,7 +12,7 @@ Gem::Specification.new do |s|
9
12
  s.homepage = 'http://elastics.github.io/elastics'
10
13
  s.authors = ["Domizio Demichelis"]
11
14
  s.email = 'dd.nexus@gmail.com'
12
- s.files = `git ls-files -z`.split("\0") + %w[VERSION LICENSE]
15
+ s.files = `git ls-files -z`.split("\0") + extra_files
13
16
  s.version = version
14
17
  s.date = Date.today.to_s
15
18
  s.required_rubygems_version = ">= 1.3.6"
@@ -6,7 +6,7 @@ module Elastics
6
6
  config.elastics = Conf
7
7
  config.elastics.variables[:index] = [self.class.name.split('::').first.underscore, ::Rails.env].join('_')
8
8
  config.elastics.config_file = ::Rails.root.join('config', 'elastics.yml').to_s
9
- config.elastics.elastics_dir = ::Rails.root.join('app', 'elastics').to_s
9
+ config.elastics.elastics_dir = ::Rails.root.join('app', 'elastics').to_s
10
10
  config.elastics.logger = Logger.new(STDOUT)
11
11
  config.elastics.logger.level = ::Logger::DEBUG if ::Rails.env.development?
12
12
  config.elastics.result_extenders |= [ Elastics::Result::RailsHelper ]
@@ -14,25 +14,26 @@ module Elastics
14
14
  def method_missing(meth, *args, &block)
15
15
  meth.to_s =~ RE
16
16
  attribute = $1
17
- if attribute
18
- opts = {:fragment_separator => ' ... '}.merge(args.first||{})
19
- if self['highlight']
20
- key, high = self['highlight'].find { |k,v| k.gsub('.','_') == attribute }
21
- high = Array.wrap(high) if high
22
- end
23
- if high.blank?
24
- respond_to?(attribute.to_sym) ? send(attribute.to_sym) : ''
25
- else
26
- high.join(opts[:fragment_separator]).html_safe
27
- end
17
+ attribute ? higlighted(attribute, args.first || {}) : super
18
+ end
19
+
20
+ # TODO: add the doc for this method
21
+ def higlighted(attribute, opts={})
22
+ opts = { :fragment_separator => ' ... ' }.merge(opts)
23
+ if self['highlight']
24
+ # works also with nested attributes
25
+ key, high = self['highlight'].find { |k, v| k.gsub('.', '_') == attribute }
26
+ high = Array.wrap(high) if high
27
+ end
28
+ if high.blank?
29
+ respond_to?(attribute.to_sym) ? send(attribute.to_sym) : ''
28
30
  else
29
- super
31
+ high.join(opts[:fragment_separator]).html_safe
30
32
  end
31
33
  end
32
34
 
33
35
  end
34
36
 
35
-
36
37
  # extend if result is a Search or MultiGet
37
38
  def self.should_extend?(result)
38
39
  result.is_a?(Search) || result.is_a?(MultiGet)
metadata CHANGED
@@ -1,64 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastics-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Domizio Demichelis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '2.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: elastics-client
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
37
- version: 1.1.11
33
+ version: 1.2.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
45
- version: 1.1.11
40
+ version: 1.2.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: elastics-models
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - '='
52
46
  - !ruby/object:Gem::Version
53
- version: 1.1.11
47
+ version: 1.2.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - '='
60
53
  - !ruby/object:Gem::Version
61
- version: 1.1.11
54
+ version: 1.2.0
62
55
  description: Provides the engine, generators and helpers to integrate Elastics with
63
56
  Rails
64
57
  email: dd.nexus@gmail.com
@@ -66,7 +59,9 @@ executables: []
66
59
  extensions: []
67
60
  extra_rdoc_files: []
68
61
  files:
62
+ - LICENSE
69
63
  - README.md
64
+ - VERSION
70
65
  - elastics-rails.gemspec
71
66
  - lib/elastics-rails.rb
72
67
  - lib/elastics/rails/engine.rb
@@ -79,33 +74,29 @@ files:
79
74
  - lib/generators/elastics/setup/templates/elastics_dir/elastics.yml.erb
80
75
  - lib/generators/elastics/setup/templates/elastics_dir/elastics_extender.rb.erb
81
76
  - lib/generators/elastics/setup/templates/elastics_initializer.rb.erb
82
- - VERSION
83
- - LICENSE
84
77
  homepage: http://elastics.github.io/elastics
85
78
  licenses:
86
79
  - MIT
80
+ metadata: {}
87
81
  post_install_message:
88
82
  rdoc_options:
89
- - --charset=UTF-8
83
+ - "--charset=UTF-8"
90
84
  require_paths:
91
85
  - lib
92
86
  required_ruby_version: !ruby/object:Gem::Requirement
93
- none: false
94
87
  requirements:
95
- - - ! '>='
88
+ - - ">="
96
89
  - !ruby/object:Gem::Version
97
90
  version: '0'
98
91
  required_rubygems_version: !ruby/object:Gem::Requirement
99
- none: false
100
92
  requirements:
101
- - - ! '>='
93
+ - - ">="
102
94
  - !ruby/object:Gem::Version
103
95
  version: 1.3.6
104
96
  requirements: []
105
97
  rubyforge_project:
106
- rubygems_version: 1.8.25
98
+ rubygems_version: 2.4.5.1
107
99
  signing_key:
108
- specification_version: 3
100
+ specification_version: 4
109
101
  summary: Rails integration for Elastics
110
102
  test_files: []
111
- has_rdoc: