remnant 0.1.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.
- data/Gemfile +3 -0
- data/Gemfile.lock +43 -0
- data/LICENSE +20 -0
- data/README.md +46 -0
- data/Rakefile +20 -0
- data/lib/remnant/base.rb +50 -0
- data/lib/remnant/configuration.rb +41 -0
- data/lib/remnant/discover.rb +61 -0
- data/lib/remnant/rails.rb +66 -0
- data/lib/remnant/railtie.rb +7 -0
- data/lib/remnant/version.rb +3 -0
- data/lib/remnant.rb +7 -0
- data/remnant.gemspec +29 -0
- data/spec/base_spec.rb +23 -0
- data/spec/spec_helper.rb +124 -0
- data/spec/support/rr.rb +42 -0
- metadata +177 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
flail (0.1.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionpack (2.3.14)
|
10
|
+
activesupport (= 2.3.14)
|
11
|
+
rack (~> 1.1.0)
|
12
|
+
activerecord (2.3.14)
|
13
|
+
activesupport (= 2.3.14)
|
14
|
+
activesupport (2.3.14)
|
15
|
+
diff-lcs (1.1.3)
|
16
|
+
fakeweb (1.3.0)
|
17
|
+
rack (1.1.3)
|
18
|
+
rake (0.9.2.2)
|
19
|
+
rr (1.0.4)
|
20
|
+
rspec (2.11.0)
|
21
|
+
rspec-core (~> 2.11.0)
|
22
|
+
rspec-expectations (~> 2.11.0)
|
23
|
+
rspec-mocks (~> 2.11.0)
|
24
|
+
rspec-core (2.11.1)
|
25
|
+
rspec-expectations (2.11.2)
|
26
|
+
diff-lcs (~> 1.1.3)
|
27
|
+
rspec-mocks (2.11.1)
|
28
|
+
sham_rack (1.3.4)
|
29
|
+
rack
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
actionpack (~> 2.3.8)
|
36
|
+
activerecord (~> 2.3.8)
|
37
|
+
activesupport (~> 2.3.8)
|
38
|
+
fakeweb (~> 1.3.0)
|
39
|
+
flail!
|
40
|
+
rake
|
41
|
+
rr
|
42
|
+
rspec
|
43
|
+
sham_rack (~> 1.3.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 John "asceth" Long
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
Remnant hooks into your Rails and discovers your hidden statistics.
|
2
|
+
|
3
|
+
##### Supports
|
4
|
+
|
5
|
+
* Rails 2.3.x
|
6
|
+
|
7
|
+
|
8
|
+
#### Install
|
9
|
+
|
10
|
+
```
|
11
|
+
$ [sudo] gem install remnant
|
12
|
+
```
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
# For Rails 2.3.x
|
16
|
+
gem 'remnant'
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
#### Usage
|
21
|
+
|
22
|
+
|
23
|
+
Add an initializer to configure (or call configure during application startup):
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Remnant.configure do
|
27
|
+
# hostname of statsd server
|
28
|
+
host "https://remnant.statsd"
|
29
|
+
|
30
|
+
# port of statsd server
|
31
|
+
port 8125
|
32
|
+
|
33
|
+
# app name or other unique key for multiple app usage
|
34
|
+
tagged "custom"
|
35
|
+
|
36
|
+
# environment of application, defaults to Rails.env
|
37
|
+
# included in payload
|
38
|
+
environment "production"
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
#### Author
|
44
|
+
|
45
|
+
|
46
|
+
Original author: John "asceth" Long
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require "rspec"
|
5
|
+
require "rspec/core/rake_task"
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
gemspec = eval(File.read(File.join(Dir.pwd, "flail.gemspec")))
|
10
|
+
|
11
|
+
task :build => "#{gemspec.full_name}.gem"
|
12
|
+
|
13
|
+
task :test => :spec
|
14
|
+
task :default => :spec
|
15
|
+
|
16
|
+
file "#{gemspec.full_name}.gem" => gemspec.files + ["flail.gemspec"] do
|
17
|
+
system "gem build flail.gemspec"
|
18
|
+
system "gem install flail-#{Flail::VERSION}.gem"
|
19
|
+
end
|
20
|
+
|
data/lib/remnant/base.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
class Remnant
|
2
|
+
module ClassMethods
|
3
|
+
def configure(&block)
|
4
|
+
configuration.instance_eval(&block)
|
5
|
+
end
|
6
|
+
|
7
|
+
def configuration
|
8
|
+
@configuration ||= Remnant::Configuration.new.defaults!
|
9
|
+
end
|
10
|
+
|
11
|
+
def handler
|
12
|
+
@handler ||= Statsd.new(Remnant.configuration.hostname, Remnant.configuration.port_number)
|
13
|
+
end
|
14
|
+
|
15
|
+
def collect
|
16
|
+
extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)
|
17
|
+
|
18
|
+
if ::Rails.env.production?
|
19
|
+
# send on
|
20
|
+
Remnant::Discover.results.map do |remnant_key, ms|
|
21
|
+
key = [
|
22
|
+
Remnant.configuration.tag,
|
23
|
+
Remnant.configuration.env,
|
24
|
+
extra_remnant_key,
|
25
|
+
remnant_key
|
26
|
+
].compact.join('.')
|
27
|
+
|
28
|
+
Remannt.handler.timing(key, ms.to_i)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
# log it
|
32
|
+
Rails.logger.info "--------------Remnants Discovered--------------"
|
33
|
+
|
34
|
+
Remnant::Discover.results.map do |remnant_key, ms|
|
35
|
+
key = [
|
36
|
+
extra_remnant_key,
|
37
|
+
remnant_key
|
38
|
+
].compact.join('.')
|
39
|
+
|
40
|
+
Rails.logger.info "#{ms.to_i}ms\t#{key}"
|
41
|
+
end
|
42
|
+
|
43
|
+
Rails.logger.info "-----------------------------------------------"
|
44
|
+
end
|
45
|
+
|
46
|
+
Remnant::Discover.results.clear
|
47
|
+
end
|
48
|
+
end
|
49
|
+
extend ClassMethods
|
50
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Remnant
|
2
|
+
class Configuration
|
3
|
+
# environment of application
|
4
|
+
attr_reader :env
|
5
|
+
|
6
|
+
# hostname to send to
|
7
|
+
attr_reader :hostname
|
8
|
+
|
9
|
+
# port to send to
|
10
|
+
attr_reader :port_number
|
11
|
+
|
12
|
+
# api key to use with payloads
|
13
|
+
attr_reader :tag
|
14
|
+
|
15
|
+
def host(value)
|
16
|
+
@hostname = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def port(value)
|
20
|
+
@port_number = value
|
21
|
+
end
|
22
|
+
|
23
|
+
def tagged(value)
|
24
|
+
@tag = value
|
25
|
+
end
|
26
|
+
|
27
|
+
def environment(value)
|
28
|
+
@env = value
|
29
|
+
end
|
30
|
+
|
31
|
+
def defaults!
|
32
|
+
# configure some defaults
|
33
|
+
|
34
|
+
@hostname = '127.0.0.1'
|
35
|
+
@port_number = 8125
|
36
|
+
@tag = 'remnant'
|
37
|
+
|
38
|
+
self
|
39
|
+
end # end defaults!
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class Remnant
|
2
|
+
module Discover
|
3
|
+
module ClassMethods
|
4
|
+
def find(key, klass, method, instance = true)
|
5
|
+
rediscover(key, klass, method, instance) if ActiveSupport::Dependencies.will_unload?(klass)
|
6
|
+
|
7
|
+
klass.class_eval <<-EOL, __FILE__, __LINE__
|
8
|
+
#{"class << self" unless instance}
|
9
|
+
def #{method}_with_remnant(*args, &block)
|
10
|
+
::Remnant::Discover.measure(#{key.inspect}) do
|
11
|
+
#{method}_without_remnant(*args, &block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method_chain :#{method}, :remnant
|
16
|
+
#{"end" unless instance}
|
17
|
+
EOL
|
18
|
+
end
|
19
|
+
|
20
|
+
def measure(key, &block)
|
21
|
+
if Remnant::Discover.running.include?(key)
|
22
|
+
yield
|
23
|
+
else
|
24
|
+
result = nil
|
25
|
+
Remnant::Discover.running << key
|
26
|
+
begin
|
27
|
+
Remnant::Discover.results[key] += Benchmark.ms { result = yield }
|
28
|
+
rescue
|
29
|
+
raise
|
30
|
+
ensure
|
31
|
+
Remnant::Discover.running.delete(key)
|
32
|
+
end
|
33
|
+
result
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def results
|
38
|
+
Thread.current[:result] ||= Hash.new(0)
|
39
|
+
end
|
40
|
+
|
41
|
+
def running
|
42
|
+
Thread.current[:running] ||= []
|
43
|
+
end
|
44
|
+
|
45
|
+
def remnants_to_rediscover
|
46
|
+
@remnants_to_rediscover ||= []
|
47
|
+
end
|
48
|
+
|
49
|
+
def rediscover(*args)
|
50
|
+
remnants_to_rediscover << args unless remnants_to_rediscover.include?(args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def rediscover!
|
54
|
+
remnants_to_rediscover.map do |(key, klass_name, method, instance)|
|
55
|
+
find(key, klass_name.constantize, method, instance)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
extend ClassMethods
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
class Remnant
|
2
|
+
class Rails
|
3
|
+
module ClassMethods
|
4
|
+
def logger
|
5
|
+
::Rails.logger
|
6
|
+
end
|
7
|
+
|
8
|
+
def setup!
|
9
|
+
Remnant.configure do
|
10
|
+
environment ::Rails.env
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# helper hooks
|
15
|
+
#
|
16
|
+
|
17
|
+
# hook into dependency unloading
|
18
|
+
::ActiveSupport::Dependencies.class_eval do
|
19
|
+
class << self
|
20
|
+
def clear_with_remnant_rediscover(*args, &block)
|
21
|
+
clear_without_remnant_rediscover(*args, &block).tap do
|
22
|
+
Remnant::Discover.rediscover!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
alias_method_chain :clear, :remnant_rediscover
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
#
|
31
|
+
# stat collection below
|
32
|
+
#
|
33
|
+
|
34
|
+
# hook remnants
|
35
|
+
Remnant::Discover.find('request', ActionController::Dispatcher, :call)
|
36
|
+
Remnant::Discover.find('dispatch', ActionController::Dispatcher, :_call)
|
37
|
+
Remnant::Discover.find('process', ActionController::Base, :process)
|
38
|
+
Remnant::Discover.find('filters', ActionController::Filters::BeforeFilter, :call)
|
39
|
+
Remnant::Discover.find('action', ActionController::Base, :perform_action)
|
40
|
+
Remnant::Discover.find('view', ActionController::Base, :render)
|
41
|
+
Remnant::Discover.find('filters', ActionController::Filters::AfterFilter, :call)
|
42
|
+
|
43
|
+
# last hook into request cycle for sending results
|
44
|
+
::ActionController::Dispatcher.class_eval do
|
45
|
+
def call_with_remnant_discovery(*args, &block) #:nodoc:
|
46
|
+
call_without_remnant_discovery(*args, &block).tap do |status, headers, response|
|
47
|
+
::Remnant.collect
|
48
|
+
::Rails.logger.flush if ::Rails.logger.respond_to? :flush
|
49
|
+
end
|
50
|
+
end
|
51
|
+
alias_method_chain :call, :remnant_discovery
|
52
|
+
end
|
53
|
+
|
54
|
+
# hook into perform_action for the extra remnant key
|
55
|
+
::ActionController::Base.class_eval do
|
56
|
+
def perform_action_with_remnant_key(*args, &block) #:nodoc:
|
57
|
+
::Remnant::Discover.results[:extra_remnant_key] = "#{params[:controller]}.#{params[:action]}"
|
58
|
+
perform_action_without_remnant_key(*args, &block)
|
59
|
+
end
|
60
|
+
alias_method_chain :perform_action, :remnant_key
|
61
|
+
end
|
62
|
+
end # setup!
|
63
|
+
end
|
64
|
+
extend ClassMethods
|
65
|
+
end
|
66
|
+
end
|
data/lib/remnant.rb
ADDED
data/remnant.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "remnant/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "remnant"
|
6
|
+
s.version = Remnant::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["John 'asceth' Long"]
|
9
|
+
s.email = ["machinist@asceth.com"]
|
10
|
+
s.homepage = "https://github.com/asceth/remnant"
|
11
|
+
s.summary = "Rails statistical discoverer"
|
12
|
+
s.description = "Remnant - peering into your ruby apps and discovering statistics you never knew could be so awful..."
|
13
|
+
|
14
|
+
s.rubyforge_project = "remnant"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_dependency 'statsd-ruby', '1.0.0'
|
22
|
+
|
23
|
+
s.add_development_dependency 'actionpack', '~> 2.3.8'
|
24
|
+
s.add_development_dependency 'activerecord', '~> 2.3.8'
|
25
|
+
s.add_development_dependency 'activesupport', '~> 2.3.8'
|
26
|
+
s.add_development_dependency 'rake'
|
27
|
+
s.add_development_dependency 'rspec'
|
28
|
+
s.add_development_dependency 'rr'
|
29
|
+
end
|
data/spec/base_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Flail do
|
4
|
+
|
5
|
+
context "#configuration" do
|
6
|
+
it "should return the same object for multiple calls" do
|
7
|
+
Flail.configuration.should == Flail.configuration
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context "#configure" do
|
12
|
+
it "should fail without a block" do
|
13
|
+
lambda { Flail.configure }.should raise_error
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should instance_eval the block onto configuration" do
|
17
|
+
block = Proc.new { handle {|payload| } }
|
18
|
+
mock(Flail).configuration.stub!.instance_eval(&block)
|
19
|
+
Flail.configure(&block)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.setup
|
4
|
+
|
5
|
+
require 'rspec'
|
6
|
+
require 'rr'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.mock_with :rr
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'action_controller'
|
13
|
+
require 'action_controller/test_process'
|
14
|
+
require 'active_record'
|
15
|
+
require 'active_support'
|
16
|
+
require 'rack'
|
17
|
+
require 'sham_rack'
|
18
|
+
|
19
|
+
require 'flail'
|
20
|
+
require 'flail/rails/controller_methods'
|
21
|
+
require 'flail/rails/rescue_action'
|
22
|
+
|
23
|
+
|
24
|
+
Dir["#{File.expand_path(File.dirname(__FILE__))}/support/*.rb"].map {|file| require(file)}
|
25
|
+
|
26
|
+
class FlailArmory
|
27
|
+
|
28
|
+
module ClassMethods
|
29
|
+
def define_constant(name, value)
|
30
|
+
@defined_constants ||= []
|
31
|
+
Object.const_set(name, value)
|
32
|
+
@defined_constants << name
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_controller_class(&definition)
|
36
|
+
Class.new(ActionController::Base).tap do |klass|
|
37
|
+
klass.__send__(:include, Flail::Rails::ControllerMethods)
|
38
|
+
klass.__send__(:include, Flail::Rails::RescueAction)
|
39
|
+
klass.class_eval(&definition) if definition
|
40
|
+
|
41
|
+
klass.class_eval do
|
42
|
+
def rescue_action_in_public_without_flail(*args)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
define_constant('FlailTestController', klass)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def process_action(options = {}, &action)
|
50
|
+
options[:request] ||= ActionController::TestRequest.new
|
51
|
+
options[:response] ||= ActionController::TestResponse.new
|
52
|
+
|
53
|
+
klass = build_controller_class do
|
54
|
+
cattr_accessor :local
|
55
|
+
define_method(:index, &action)
|
56
|
+
|
57
|
+
def current_user
|
58
|
+
@current_user
|
59
|
+
end
|
60
|
+
|
61
|
+
def local_request?
|
62
|
+
local
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
if options[:user_agent]
|
67
|
+
if options[:request].respond_to?(:user_agent=)
|
68
|
+
options[:request].user_agent = options[:user_agent]
|
69
|
+
else
|
70
|
+
options[:request].env["HTTP_USER_AGENT"] = options[:user_agent]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
klass.consider_all_requests_local = options[:all_local]
|
75
|
+
klass.local = options[:local]
|
76
|
+
|
77
|
+
controller = klass.new
|
78
|
+
|
79
|
+
if options[:user]
|
80
|
+
controller.instance_variable_set(:@current_user, options[:user])
|
81
|
+
end
|
82
|
+
|
83
|
+
options[:request].query_parameters = options[:request].query_parameters.merge(options[:params] || {})
|
84
|
+
options[:request].session = ActionController::TestSession.new(options[:session] || {})
|
85
|
+
options[:request].env['REQUEST_URI'] = options[:request].request_uri
|
86
|
+
|
87
|
+
controller.process(options[:request], options[:response])
|
88
|
+
controller
|
89
|
+
end
|
90
|
+
|
91
|
+
def process_action_with_error(options = {})
|
92
|
+
process_action(options) do
|
93
|
+
raise "Hello"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def setup
|
98
|
+
Flail.configure do
|
99
|
+
handle do |payload|
|
100
|
+
FlailArmory.payload = ActiveSupport::JSON.decode(payload)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
define_constant('RAILS_ROOT', '/path/to/rails/root')
|
104
|
+
end
|
105
|
+
|
106
|
+
def payload=(value)
|
107
|
+
@payload = value
|
108
|
+
end
|
109
|
+
|
110
|
+
def payload
|
111
|
+
@payload
|
112
|
+
end
|
113
|
+
|
114
|
+
def raid
|
115
|
+
@defined_constants.each do |constant|
|
116
|
+
Object.__send__(:remove_const, constant)
|
117
|
+
end
|
118
|
+
|
119
|
+
@payload = nil
|
120
|
+
@defined_constants = []
|
121
|
+
end
|
122
|
+
end
|
123
|
+
extend ClassMethods
|
124
|
+
end
|
data/spec/support/rr.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# --- add this as spec/support/rr.rb ---
|
2
|
+
|
3
|
+
# RR doesn't have support for RSpec 2.
|
4
|
+
#
|
5
|
+
# Source: <https://github.com/btakita/rr/issues#issue/45>
|
6
|
+
|
7
|
+
require 'rr'
|
8
|
+
|
9
|
+
module RR
|
10
|
+
module Adapters
|
11
|
+
module RSpec2
|
12
|
+
include RRMethods
|
13
|
+
|
14
|
+
def setup_mocks_for_rspec
|
15
|
+
RR.reset
|
16
|
+
end
|
17
|
+
def verify_mocks_for_rspec
|
18
|
+
RR.verify
|
19
|
+
end
|
20
|
+
def teardown_mocks_for_rspec
|
21
|
+
RR.reset
|
22
|
+
end
|
23
|
+
|
24
|
+
def have_received(method = nil)
|
25
|
+
RR::Adapters::Rspec::InvocationMatcher.new(method)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module RSpec
|
32
|
+
module Core
|
33
|
+
module MockFrameworkAdapter
|
34
|
+
include RR::Adapters::RSpec2
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
RSpec.configure do |config|
|
40
|
+
config.mock_framework = RSpec::Core::MockFrameworkAdapter
|
41
|
+
config.backtrace_clean_patterns.push(RR::Errors::BACKTRACE_IDENTIFIER)
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remnant
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- John 'asceth' Long
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: statsd-ruby
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: actionpack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.3.8
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.3.8
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: activerecord
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.3.8
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.3.8
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: activesupport
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.3.8
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.8
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rr
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Remnant - peering into your ruby apps and discovering statistics you
|
127
|
+
never knew could be so awful...
|
128
|
+
email:
|
129
|
+
- machinist@asceth.com
|
130
|
+
executables: []
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- Gemfile
|
135
|
+
- Gemfile.lock
|
136
|
+
- LICENSE
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- lib/remnant.rb
|
140
|
+
- lib/remnant/base.rb
|
141
|
+
- lib/remnant/configuration.rb
|
142
|
+
- lib/remnant/discover.rb
|
143
|
+
- lib/remnant/rails.rb
|
144
|
+
- lib/remnant/railtie.rb
|
145
|
+
- lib/remnant/version.rb
|
146
|
+
- remnant.gemspec
|
147
|
+
- spec/base_spec.rb
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
- spec/support/rr.rb
|
150
|
+
homepage: https://github.com/asceth/remnant
|
151
|
+
licenses: []
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
158
|
+
requirements:
|
159
|
+
- - ! '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
requirements: []
|
169
|
+
rubyforge_project: remnant
|
170
|
+
rubygems_version: 1.8.24
|
171
|
+
signing_key:
|
172
|
+
specification_version: 3
|
173
|
+
summary: Rails statistical discoverer
|
174
|
+
test_files:
|
175
|
+
- spec/base_spec.rb
|
176
|
+
- spec/spec_helper.rb
|
177
|
+
- spec/support/rr.rb
|