tire-contrib 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +16 -0
- data/README.markdown +4 -0
- data/Rakefile +2 -0
- data/lib/tire-contrib/version.rb +1 -1
- data/lib/tire/http/clients/pooled_curb.rb +124 -0
- data/lib/tire/model/dynamic_persistence.rb +33 -0
- data/lib/tire/model/dynamic_persistence/README.markdown +26 -0
- data/lib/tire/model/dynamic_persistence/dynamic_persistence.rb +22 -0
- data/lib/tire/new_relic/instrumentation.rb +146 -0
- data/lib/tire/new_relic/model.rb +23 -0
- data/test/dynamic_persistence/dynamic_persistence_test.rb +49 -0
- data/test/new_relic/config/newrelic.yml +1 -0
- data/test/new_relic/instrumentation_test.rb +112 -0
- data/test/new_relic/model.rb +8 -0
- data/test/test_helper.rb +1 -3
- data/tire-contrib.gemspec +6 -3
- metadata +93 -20
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -----------------------------------------------------------------
|
2
|
+
# Configuration file for http://travis-ci.org/#!/karmi/tire-contrib
|
3
|
+
# -----------------------------------------------------------------
|
4
|
+
|
5
|
+
language: ruby
|
6
|
+
|
7
|
+
rvm:
|
8
|
+
- 1.9.3
|
9
|
+
|
10
|
+
script: "bundle exec rake test"
|
11
|
+
|
12
|
+
before_install:
|
13
|
+
- sudo service elasticsearch start
|
14
|
+
|
15
|
+
notifications:
|
16
|
+
disable: true
|
data/README.markdown
CHANGED
@@ -15,6 +15,10 @@ Then require the component you want to use in your application initializer. For
|
|
15
15
|
See specific files and folders inside the `lib/tire` folder for instructions and documentation.
|
16
16
|
|
17
17
|
|
18
|
+
### Dynamic Persistence ###
|
19
|
+
|
20
|
+
Adds support for dynamic attributes when using Tire::Model::Persistence so that model properties no longer need to be declared explicitly. [More info](lib/tire/model/dynamic_persistence).
|
21
|
+
|
18
22
|
### More Like This Queries ###
|
19
23
|
|
20
24
|
Adds support for [“more like this”](http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html) queries.
|
data/Rakefile
CHANGED
data/lib/tire-contrib/version.rb
CHANGED
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'common_pool'
|
2
|
+
require 'curb'
|
3
|
+
|
4
|
+
# A Curb-based client which uses the "common-pool" gem to allow high-performance
|
5
|
+
# HTTP requests in a multi-threaded environment.
|
6
|
+
#
|
7
|
+
# See <https://github.com/jugend/common-pool>
|
8
|
+
#
|
9
|
+
# Make sure to include the "common-pool" gem in your Gemfile.
|
10
|
+
#
|
11
|
+
# Example:
|
12
|
+
# --------
|
13
|
+
#
|
14
|
+
# require 'curb'
|
15
|
+
# require 'tire/http/clients/pooled_curb'
|
16
|
+
#
|
17
|
+
# Tire.configure do
|
18
|
+
# client Tire::HTTP::Client::PooledCurb
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
module Tire
|
22
|
+
module HTTP
|
23
|
+
module Client
|
24
|
+
|
25
|
+
class PooledCurbDataSource < CommonPool::PoolDataSource
|
26
|
+
def create_object
|
27
|
+
Curl::Easy.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class PooledCurb
|
32
|
+
HTTP_CLIENT_POOL = CommonPool::ObjectPool.new(PooledCurbDataSource.new) { |config| config.max_active = 200 }
|
33
|
+
|
34
|
+
def self.with_client
|
35
|
+
curl = HTTP_CLIENT_POOL.borrow_object
|
36
|
+
begin
|
37
|
+
yield curl
|
38
|
+
rescue Curl::Err::MultiBadEasyHandle
|
39
|
+
curl = HTTP_CLIENT_POOL.borrow_object
|
40
|
+
retry
|
41
|
+
ensure
|
42
|
+
HTTP_CLIENT_POOL.return_object(curl)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get(url, data=nil)
|
47
|
+
response = nil
|
48
|
+
|
49
|
+
3.times do |tries|
|
50
|
+
# Sleep for 0.2 seconds after the second failure
|
51
|
+
Kernel.sleep(0.2) if tries > 1
|
52
|
+
|
53
|
+
begin
|
54
|
+
response = get_once(url, data)
|
55
|
+
if block_given?
|
56
|
+
next unless yield response.body, response.code
|
57
|
+
else
|
58
|
+
next unless response.code == 200 && response.present?
|
59
|
+
end
|
60
|
+
|
61
|
+
return response
|
62
|
+
rescue Curl::Err::CurlError
|
63
|
+
# will retry
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
response
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.get_once(url, data=nil)
|
71
|
+
with_client do |curl|
|
72
|
+
curl.timeout = 15
|
73
|
+
curl.url = url
|
74
|
+
if data
|
75
|
+
curl.post_body = data
|
76
|
+
curl.http_post
|
77
|
+
else
|
78
|
+
curl.http_get
|
79
|
+
end
|
80
|
+
Response.new curl.body_str, curl.response_code
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.post(url, data)
|
85
|
+
with_client do |curl|
|
86
|
+
curl.timeout = 15
|
87
|
+
curl.url = url
|
88
|
+
curl.post_body = data
|
89
|
+
curl.http_post
|
90
|
+
Response.new curl.body_str, curl.response_code
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.put(url, data)
|
95
|
+
with_client do |curl|
|
96
|
+
curl.timeout = 15
|
97
|
+
curl.url = url
|
98
|
+
curl.http_put data
|
99
|
+
Response.new curl.body_str, curl.response_code
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.delete(url)
|
104
|
+
with_client do |curl|
|
105
|
+
curl.timeout = 15
|
106
|
+
curl.url = url
|
107
|
+
curl.http_delete
|
108
|
+
Response.new curl.body_str, curl.response_code
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.head(url)
|
113
|
+
with_client do |curl|
|
114
|
+
curl.timeout = 15
|
115
|
+
curl.url = url
|
116
|
+
curl.http_head
|
117
|
+
Response.new curl.body_str, curl.response_code
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Dynamic Persistence
|
2
|
+
# ===================
|
3
|
+
#
|
4
|
+
# Author: Dave Kinkead <dave@kinkead.com.au>
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Adds support for dynamic persistence to Tire::Model::Persistence,
|
8
|
+
# so explicit declarations of `property :attr_name` are not required.
|
9
|
+
#
|
10
|
+
#
|
11
|
+
# Usage:
|
12
|
+
# ------
|
13
|
+
#
|
14
|
+
# Require the component:
|
15
|
+
#
|
16
|
+
# require 'tire/model/dynamic_persistence'
|
17
|
+
#
|
18
|
+
# Example:
|
19
|
+
# -------
|
20
|
+
#
|
21
|
+
# class Author
|
22
|
+
# include Tire::Model::Persistence
|
23
|
+
# include Tire::Model::DynamicPersistence
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# author = Author.new :name => 'Inigo Montoya',
|
27
|
+
# :books => ['The Pragmatic Swordfighter', 'Revenge: Best Served Cold']
|
28
|
+
#
|
29
|
+
# author.name
|
30
|
+
# # => 'Inigo Montoya'
|
31
|
+
#
|
32
|
+
#
|
33
|
+
require 'tire/model/dynamic_persistence/dynamic_persistence'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Dynamic Persistence
|
2
|
+
|
3
|
+
Adds support for truly dynamic persistence models so that you no longer have to explicitly declare properties.
|
4
|
+
|
5
|
+
Very useful if you want to create models on the fly.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Require the module in your model file
|
10
|
+
|
11
|
+
require 'tire/model/dynamic_persistence'
|
12
|
+
|
13
|
+
Include Persistence and DynamicPersistence
|
14
|
+
|
15
|
+
class Author
|
16
|
+
include Tire::Model::Persistence
|
17
|
+
include Tire::Model::DynamicPersistence
|
18
|
+
end
|
19
|
+
|
20
|
+
Then create your model by passing it a hash of key:value pairs
|
21
|
+
|
22
|
+
author = Author.new :name => 'Inigo Montoya',
|
23
|
+
:books => ['The Pragmatic Swordfighter', 'Revenge: Best Served Cold']
|
24
|
+
|
25
|
+
author.name
|
26
|
+
# => 'Inigo Montoya'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'tire'
|
2
|
+
|
3
|
+
module Tire
|
4
|
+
module Model
|
5
|
+
module DynamicPersistence
|
6
|
+
|
7
|
+
# Overrides the initializer in Tire::Model::Persistence to allow
|
8
|
+
# dynamic creation of attributes without the need to
|
9
|
+
# declare them with `property :name`
|
10
|
+
#
|
11
|
+
def initialize(attrs={})
|
12
|
+
attrs.each do |attr, value|
|
13
|
+
# => call Tire's property method if it's declared for this attribute
|
14
|
+
self.class.property attr unless self.class.property_types.keys.include? attr
|
15
|
+
# => set instance variable for this attribute
|
16
|
+
instance_variable_set("@#{attr}", value)
|
17
|
+
end
|
18
|
+
super attrs
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# NewRelic Instrumentation
|
2
|
+
# ========================
|
3
|
+
#
|
4
|
+
# Author: Karel Minarik <karmi@karmi.cz>
|
5
|
+
#
|
6
|
+
# Adds instrumentation support for the [NewRelic](http://newrelic.com) application performance management tool.
|
7
|
+
#
|
8
|
+
# Usage:
|
9
|
+
# ------
|
10
|
+
#
|
11
|
+
# For tracing Tire::Index and Tire::DSL method calls, just require the component
|
12
|
+
# (eg. in a Ruby On Rails initializer):
|
13
|
+
#
|
14
|
+
# require 'tire/new_relic/instrumentation'
|
15
|
+
#
|
16
|
+
# For tracing search calls in the ActiveModel model integration, in addition
|
17
|
+
# to requiring the component, include the tracing module in your model:
|
18
|
+
#
|
19
|
+
# class MyModel
|
20
|
+
# include Tire::Model::Search
|
21
|
+
# include Tire::Model::NewRelic unless Rails.env.test?
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# You'll find the statistics in the "Diagnostics > Transaction Traces" page at NewRelic.
|
25
|
+
# See an example image here: <https://img.skitch.com/20120713-t5knmkxnu8r9n6iu156phitdfp.png>
|
26
|
+
#
|
27
|
+
# Often, you perform multiple search requests in your application, eg. within a Rails controller action.
|
28
|
+
# Currently, all these search requests are bundled into one metric.
|
29
|
+
# To measure individual search requests, you have to use the custom NewRelic instrumentation:
|
30
|
+
#
|
31
|
+
# class ArticlesController < ApplicationController
|
32
|
+
# extend NewRelic::Agent::MethodTracer
|
33
|
+
# # ...
|
34
|
+
# def index
|
35
|
+
# self.class.trace_execution_scoped(['ArticlesController/Index/main_search']) do
|
36
|
+
# @articles = Article.search do |search|
|
37
|
+
# # ...
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# self.class.trace_execution_scoped(['ArticlesController/Index/category_facets']) do
|
42
|
+
# # ...
|
43
|
+
# end
|
44
|
+
# # ...
|
45
|
+
#
|
46
|
+
# respond_with(@articles)
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# See <https://newrelic.com/docs/ruby/ruby-custom-metric-collection#example_blocks> for more information.
|
51
|
+
#
|
52
|
+
# TODO
|
53
|
+
# ----
|
54
|
+
#
|
55
|
+
# * Implement tracing for searches via the proxy object (`MyModel.tire.search ...`)
|
56
|
+
# * Implement tracing for `update_index` via `after_save` callbacks (again, proxied)
|
57
|
+
# * Implement tracing for different search queries, if possible
|
58
|
+
#
|
59
|
+
# More Information:
|
60
|
+
# -----------------
|
61
|
+
#
|
62
|
+
# * https://newrelic.com/docs/ruby/ruby-custom-metric-collection
|
63
|
+
# * https://github.com/newrelic/rpm/tree/master/lib/new_relic/agent/instrumentation
|
64
|
+
# * https://github.com/newrelic/rpm_contrib/tree/master/lib/rpm_contrib/instrumentation
|
65
|
+
#
|
66
|
+
require 'new_relic/agent/method_tracer'
|
67
|
+
require 'tire/new_relic/model'
|
68
|
+
|
69
|
+
module Tire
|
70
|
+
module NewRelic
|
71
|
+
|
72
|
+
module Helpers
|
73
|
+
extend ::NewRelic::Agent::MethodTracer
|
74
|
+
|
75
|
+
# Helper method to add multiple methods in a certain scope
|
76
|
+
#
|
77
|
+
def add_method_tracers methods, metric_name_code
|
78
|
+
methods.each do |method_name|
|
79
|
+
add_method_tracer method_name.to_sym, "#{metric_name_code}#{method_name}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
DependencyDetection.defer do
|
88
|
+
@name = :tire
|
89
|
+
|
90
|
+
depends_on do
|
91
|
+
defined?(::Tire) and not NewRelic::Control.instance['disable_tire_instrumentation']
|
92
|
+
end
|
93
|
+
|
94
|
+
executes do
|
95
|
+
NewRelic::Agent.logger.debug 'Installing Tire instrumentation...'
|
96
|
+
end
|
97
|
+
|
98
|
+
executes do
|
99
|
+
|
100
|
+
::Tire::Index.class_eval do
|
101
|
+
include ::NewRelic::Agent::MethodTracer
|
102
|
+
extend ::Tire::NewRelic::Helpers
|
103
|
+
|
104
|
+
add_method_tracers %w|
|
105
|
+
exists?
|
106
|
+
delete
|
107
|
+
create
|
108
|
+
add_alias
|
109
|
+
remove_alias
|
110
|
+
aliases
|
111
|
+
mapping
|
112
|
+
settings
|
113
|
+
store
|
114
|
+
bulk_store
|
115
|
+
import
|
116
|
+
reindex
|
117
|
+
remove
|
118
|
+
retrieve
|
119
|
+
update
|
120
|
+
refresh
|
121
|
+
open
|
122
|
+
close
|
123
|
+
analyze
|
124
|
+
register_percolator_query
|
125
|
+
unregister_percolator_query
|
126
|
+
percolate
|
127
|
+
|,
|
128
|
+
'Search/Tire/index_'
|
129
|
+
end
|
130
|
+
|
131
|
+
::Tire::DSL.class_eval do
|
132
|
+
include ::NewRelic::Agent::MethodTracer
|
133
|
+
extend ::Tire::NewRelic::Helpers
|
134
|
+
|
135
|
+
add_method_tracers %w| search index scan aliases |, 'Search/Tire/'
|
136
|
+
end
|
137
|
+
|
138
|
+
# ::Tire::Search::Search.class_eval do
|
139
|
+
# include ::NewRelic::Agent::MethodTracer
|
140
|
+
# extend ::Tire::NewRelic::Helpers
|
141
|
+
#
|
142
|
+
# add_method_tracers %w| perform |, 'Search/Tire/'
|
143
|
+
# end
|
144
|
+
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Tire
|
2
|
+
module Model
|
3
|
+
|
4
|
+
module NewRelic
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.class_eval do
|
8
|
+
::NewRelic::Agent.logger.debug "Installing NewRelic instrumentation for #{self}"
|
9
|
+
|
10
|
+
include ::NewRelic::Agent::MethodTracer
|
11
|
+
add_method_tracer :update_index, 'Search/#{self.class.name}/update_index'
|
12
|
+
|
13
|
+
class << self
|
14
|
+
include ::NewRelic::Agent::MethodTracer
|
15
|
+
add_method_tracer :search, 'Search/#{self}/search'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'tire/model/dynamic_persistence'
|
4
|
+
|
5
|
+
class DynamicAuthor
|
6
|
+
include Tire::Model::Persistence
|
7
|
+
include Tire::Model::DynamicPersistence
|
8
|
+
end
|
9
|
+
|
10
|
+
class PersistentArticleWithDynamicCreation
|
11
|
+
|
12
|
+
include Tire::Model::Persistence
|
13
|
+
include Tire::Model::DynamicPersistence
|
14
|
+
|
15
|
+
property :author, :class => DynamicAuthor
|
16
|
+
property :tags, :default => []
|
17
|
+
end
|
18
|
+
|
19
|
+
module Tire
|
20
|
+
module Model
|
21
|
+
|
22
|
+
class DynamicPersistenceTest < Test::Unit::TestCase
|
23
|
+
|
24
|
+
context "Persistent model with dynamic creation" do
|
25
|
+
|
26
|
+
should "allow accessing attributes not explicitely defined" do
|
27
|
+
@article = PersistentArticleWithDynamicCreation.new :name => 'Elasticsearch',
|
28
|
+
:title => 'You know, for Search!'
|
29
|
+
assert_nothing_raised do
|
30
|
+
assert_equal 'Elasticsearch', @article.name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
should "not override explicitely defined properties" do
|
35
|
+
@article = PersistentArticleWithDynamicCreation.new :name => 'Elasticsearch',
|
36
|
+
:author => { :name => 'Inigo Montoya' }
|
37
|
+
|
38
|
+
assert_instance_of DynamicAuthor, @article.author
|
39
|
+
assert_equal 'Inigo Montoya', @article.author.name
|
40
|
+
|
41
|
+
assert_instance_of Array, @article.tags
|
42
|
+
assert_equal [], @article.tags
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
monitor_mode: true
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Based on test suite from @evanphx:
|
2
|
+
#
|
3
|
+
# <https://github.com/evanphx/newrelic-redis>
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'test_helper'
|
7
|
+
|
8
|
+
require 'tire/new_relic/instrumentation'
|
9
|
+
require 'tire/new_relic/model'
|
10
|
+
require File.expand_path('../model', __FILE__)
|
11
|
+
|
12
|
+
module Tire
|
13
|
+
module NewRelic
|
14
|
+
|
15
|
+
class InstrumentationTest < Test::Unit::TestCase
|
16
|
+
|
17
|
+
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
18
|
+
|
19
|
+
def setup
|
20
|
+
::NewRelic::Agent.manual_start
|
21
|
+
|
22
|
+
@engine = ::NewRelic::Agent.instance.stats_engine
|
23
|
+
@engine.clear_stats
|
24
|
+
|
25
|
+
DependencyDetection.detect!
|
26
|
+
end
|
27
|
+
|
28
|
+
def assert_metrics(*m)
|
29
|
+
m.each { |x| assert_contains @engine.metrics, x }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "NewRelic instrumentation for" do
|
33
|
+
|
34
|
+
context "Tire::Index" do
|
35
|
+
|
36
|
+
should "trace the class" do
|
37
|
+
assert Tire.index('foo').traced?
|
38
|
+
end
|
39
|
+
|
40
|
+
should "trace the method calls" do
|
41
|
+
Tire.index('foo').exists?
|
42
|
+
assert_metrics "Search/Tire/index_exists?"
|
43
|
+
end
|
44
|
+
|
45
|
+
should "trace delete/create" do
|
46
|
+
Tire.index('foo').delete
|
47
|
+
Tire.index('foo').create
|
48
|
+
assert_metrics "Search/Tire/index_delete", "Search/Tire/index_create"
|
49
|
+
end
|
50
|
+
|
51
|
+
should "trace percolate" do
|
52
|
+
Tire.index('foo').percolate foo: 'bar'
|
53
|
+
assert_metrics "Search/Tire/index_percolate"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
context "Tire::DSL" do
|
59
|
+
|
60
|
+
should "trace the method calls" do
|
61
|
+
Tire.search 'foo'
|
62
|
+
assert_metrics "Search/Tire/search"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
# context "Tire::Search::Search" do
|
68
|
+
#
|
69
|
+
# should "trace perform" do
|
70
|
+
# Tire.search('foo').results
|
71
|
+
#
|
72
|
+
# assert_metrics "Search/Tire/perform"
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# end
|
76
|
+
|
77
|
+
context "ActiveModel integration" do
|
78
|
+
|
79
|
+
should "be traced" do
|
80
|
+
assert TestModel.traced?
|
81
|
+
end
|
82
|
+
|
83
|
+
should "trace search" do
|
84
|
+
TestModel.search('foo').results
|
85
|
+
# p @engine.metrics
|
86
|
+
assert_metrics "Search/TestModel/search"
|
87
|
+
end
|
88
|
+
|
89
|
+
should_eventually "trace search via proxy object" do
|
90
|
+
TestModel.tire.search('foo').results
|
91
|
+
assert_metrics "Search/TestModel/search"
|
92
|
+
end
|
93
|
+
|
94
|
+
should "trace index updates" do
|
95
|
+
TestModel.new(title: 'foo').update_index
|
96
|
+
assert_metrics "Search/TestModel/update_index"
|
97
|
+
end
|
98
|
+
|
99
|
+
should_eventually "trace index updates via callbacks" do
|
100
|
+
TestModel.new(title: 'foo').save
|
101
|
+
assert_metrics "Search/TestModel/update_index"
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
2
|
require 'pathname'
|
4
3
|
require 'test/unit'
|
5
|
-
|
6
4
|
require 'shoulda'
|
7
5
|
require 'turn' unless ENV["TM_FILEPATH"] || ENV["CI"]
|
8
6
|
require 'mocha'
|
9
|
-
|
7
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
10
8
|
require 'tire'
|
11
9
|
|
12
10
|
class Test::Unit::TestCase
|
data/tire-contrib.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "tire-contrib"
|
7
7
|
s.version = Tire::Contrib::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Karel Minarik", "Oliver Eilhard"]
|
10
|
-
s.email = ["karmi@karmi.cz", "oliver.eilhard@gmail.com"]
|
9
|
+
s.authors = ["Karel Minarik", "Oliver Eilhard", "Dave Kinkead"]
|
10
|
+
s.email = ["karmi@karmi.cz", "oliver.eilhard@gmail.com", "dave@kinkead.com.au"]
|
11
11
|
s.homepage = ""
|
12
12
|
s.summary = %q{Contributions and additions for the Tire gem}
|
13
13
|
|
@@ -15,7 +15,10 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.add_dependency "tire"
|
17
17
|
|
18
|
-
s.add_development_dependency "bundler", "~> 1.1
|
18
|
+
s.add_development_dependency "bundler", "~> 1.1"
|
19
|
+
|
20
|
+
s.add_development_dependency "newrelic_rpm"
|
21
|
+
|
19
22
|
s.add_development_dependency "turn"
|
20
23
|
s.add_development_dependency "shoulda"
|
21
24
|
s.add_development_dependency "mocha"
|
metadata
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tire-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Karel Minarik
|
9
9
|
- Oliver Eilhard
|
10
|
+
- Dave Kinkead
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: tire
|
17
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
20
|
requirements:
|
20
21
|
- - ! '>='
|
@@ -22,21 +23,47 @@ dependencies:
|
|
22
23
|
version: '0'
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
26
32
|
- !ruby/object:Gem::Dependency
|
27
33
|
name: bundler
|
28
|
-
requirement:
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
29
35
|
none: false
|
30
36
|
requirements:
|
31
37
|
- - ~>
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.1
|
39
|
+
version: '1.1'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: newrelic_rpm
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
34
56
|
type: :development
|
35
57
|
prerelease: false
|
36
|
-
version_requirements:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
37
64
|
- !ruby/object:Gem::Dependency
|
38
65
|
name: turn
|
39
|
-
requirement:
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
40
67
|
none: false
|
41
68
|
requirements:
|
42
69
|
- - ! '>='
|
@@ -44,10 +71,15 @@ dependencies:
|
|
44
71
|
version: '0'
|
45
72
|
type: :development
|
46
73
|
prerelease: false
|
47
|
-
version_requirements:
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
48
80
|
- !ruby/object:Gem::Dependency
|
49
81
|
name: shoulda
|
50
|
-
requirement:
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
51
83
|
none: false
|
52
84
|
requirements:
|
53
85
|
- - ! '>='
|
@@ -55,10 +87,15 @@ dependencies:
|
|
55
87
|
version: '0'
|
56
88
|
type: :development
|
57
89
|
prerelease: false
|
58
|
-
version_requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
59
96
|
- !ruby/object:Gem::Dependency
|
60
97
|
name: mocha
|
61
|
-
requirement:
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
62
99
|
none: false
|
63
100
|
requirements:
|
64
101
|
- - ! '>='
|
@@ -66,10 +103,15 @@ dependencies:
|
|
66
103
|
version: '0'
|
67
104
|
type: :development
|
68
105
|
prerelease: false
|
69
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
70
112
|
- !ruby/object:Gem::Dependency
|
71
113
|
name: activerecord
|
72
|
-
requirement:
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
73
115
|
none: false
|
74
116
|
requirements:
|
75
117
|
- - ! '>='
|
@@ -77,10 +119,15 @@ dependencies:
|
|
77
119
|
version: '0'
|
78
120
|
type: :development
|
79
121
|
prerelease: false
|
80
|
-
version_requirements:
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
81
128
|
- !ruby/object:Gem::Dependency
|
82
129
|
name: activesupport
|
83
|
-
requirement:
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
84
131
|
none: false
|
85
132
|
requirements:
|
86
133
|
- - ! '>='
|
@@ -88,10 +135,15 @@ dependencies:
|
|
88
135
|
version: '0'
|
89
136
|
type: :development
|
90
137
|
prerelease: false
|
91
|
-
version_requirements:
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
92
144
|
- !ruby/object:Gem::Dependency
|
93
145
|
name: sqlite3
|
94
|
-
requirement:
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
95
147
|
none: false
|
96
148
|
requirements:
|
97
149
|
- - ! '>='
|
@@ -99,11 +151,17 @@ dependencies:
|
|
99
151
|
version: '0'
|
100
152
|
type: :development
|
101
153
|
prerelease: false
|
102
|
-
version_requirements:
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
103
160
|
description:
|
104
161
|
email:
|
105
162
|
- karmi@karmi.cz
|
106
163
|
- oliver.eilhard@gmail.com
|
164
|
+
- dave@kinkead.com.au
|
107
165
|
executables: []
|
108
166
|
extensions: []
|
109
167
|
extra_rdoc_files:
|
@@ -111,6 +169,7 @@ extra_rdoc_files:
|
|
111
169
|
- MIT-LICENSE
|
112
170
|
files:
|
113
171
|
- .gitignore
|
172
|
+
- .travis.yml
|
114
173
|
- Gemfile
|
115
174
|
- MIT-LICENSE
|
116
175
|
- README.markdown
|
@@ -119,6 +178,12 @@ files:
|
|
119
178
|
- lib/tire-contrib/README.markdown
|
120
179
|
- lib/tire-contrib/version.rb
|
121
180
|
- lib/tire/README.markdown
|
181
|
+
- lib/tire/http/clients/pooled_curb.rb
|
182
|
+
- lib/tire/model/dynamic_persistence.rb
|
183
|
+
- lib/tire/model/dynamic_persistence/README.markdown
|
184
|
+
- lib/tire/model/dynamic_persistence/dynamic_persistence.rb
|
185
|
+
- lib/tire/new_relic/instrumentation.rb
|
186
|
+
- lib/tire/new_relic/model.rb
|
122
187
|
- lib/tire/queries/custom_filters_score.rb
|
123
188
|
- lib/tire/queries/custom_filters_score/custom_filters_score.rb
|
124
189
|
- lib/tire/queries/more_like_this.rb
|
@@ -128,6 +193,10 @@ files:
|
|
128
193
|
- lib/tire/rails/logger/instrumentation.rb
|
129
194
|
- lib/tire/rails/logger/log_subscriber.rb
|
130
195
|
- lib/tire/rails/logger/railtie.rb
|
196
|
+
- test/dynamic_persistence/dynamic_persistence_test.rb
|
197
|
+
- test/new_relic/config/newrelic.yml
|
198
|
+
- test/new_relic/instrumentation_test.rb
|
199
|
+
- test/new_relic/model.rb
|
131
200
|
- test/queries/custom_filters_score/custom_filters_score_test.rb
|
132
201
|
- test/queries/more_like_this/more_like_this_test.rb
|
133
202
|
- test/rails/logger/active_record_article.rb
|
@@ -155,11 +224,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
224
|
version: '0'
|
156
225
|
requirements: []
|
157
226
|
rubyforge_project: tire-contrib
|
158
|
-
rubygems_version: 1.8.
|
227
|
+
rubygems_version: 1.8.23
|
159
228
|
signing_key:
|
160
229
|
specification_version: 3
|
161
230
|
summary: Contributions and additions for the Tire gem
|
162
231
|
test_files:
|
232
|
+
- test/dynamic_persistence/dynamic_persistence_test.rb
|
233
|
+
- test/new_relic/config/newrelic.yml
|
234
|
+
- test/new_relic/instrumentation_test.rb
|
235
|
+
- test/new_relic/model.rb
|
163
236
|
- test/queries/custom_filters_score/custom_filters_score_test.rb
|
164
237
|
- test/queries/more_like_this/more_like_this_test.rb
|
165
238
|
- test/rails/logger/active_record_article.rb
|