injectedlogger 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8c8f884728a154171e33be54c516bebdd67f1d39
4
+ data.tar.gz: e476903483e37e687d098c9903eb68c87db01a99
5
+ SHA512:
6
+ metadata.gz: aa0f517e66beebe541ce91cd99404a8e4578cf6e6ee1ff9ba45c958cc5c93abcc0d0769e1717a5da9349541e7a114e1e8f94385dd1b09de5d971edfd223c0714
7
+ data.tar.gz: d5ed9228db640c67c965e402b2410612f7a001be754173ca441f4f7419d9756f64564c699edfb3de85907ff096a19aa837b9a865a3bde5f4bc7e8e160ceee2e2
data/.gitignore ADDED
@@ -0,0 +1,27 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+ ## Specific to RubyMotion:
12
+ .dat*
13
+ .repl_history
14
+ build/
15
+ ## Documentation cache and generated files:
16
+ /.yardoc/
17
+ /_yardoc/
18
+ /doc/
19
+ /rdoc/
20
+ ## Environment normalisation:
21
+ /.bundle/
22
+ /lib/bundler/man/
23
+ # for a library or gem, you might want to ignore these files since the code is
24
+ # intended to run in multiple environments; otherwise, check them in:
25
+ Gemfile.lock
26
+ .ruby-version
27
+ .ruby-gemset
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format d
3
+ --order rand
4
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in infinity2008.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem "codeclimate-test-reporter", require: nil
8
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Alejandro Martinez Ruiz <alex at flawedcode dot org>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # A logger injection gem
2
+
3
+ This gem can be used to inject a logger in your Ruby code.
4
+
5
+ It will try to support as many methods and levels as the underlying object supports, and fall back to a supported level in case some levels are not available
6
+
7
+ ## Usage
8
+
9
+ ```ruby
10
+ logger = InjectedLogger.use somelogger
11
+ raise 'No info :(' unless logger.level_info[:supported].include? :info
12
+ logger.info 'You now have a logger!'
13
+ ```
14
+
15
+ ## Generating the gem
16
+
17
+ Both bundler and rspec are required to build the gem:
18
+
19
+ $ gem install bundler rspec
20
+
21
+ Run rake -T to see available tasks. The gem can be built with:
22
+
23
+ $ rake build
24
+
25
+ Or, if you want to make sure everything works correctly:
26
+
27
+ $ bundle exec rake build
28
+
29
+ ## Installation
30
+
31
+ After generating the gem, install it using:
32
+
33
+ $ gem install pkg/injectedlogger-*.gem
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ ENV['gem_push'] = 'false'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'injectedlogger/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'injectedlogger'
8
+ spec.version = InjectedLogger::VERSION
9
+ spec.authors = ["Alejandro Martinez Ruiz"]
10
+ spec.email = ['alex@flawedcode.org']
11
+ spec.description = %q{This gem injects a given logger into your code}
12
+ spec.summary = %q{This gem injects a given logger into your code}
13
+ spec.homepage = "http://github.com/unleashed/injectedlogger"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '>= 2.1.0'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec", "~> 3.1"
26
+ end
@@ -0,0 +1,149 @@
1
+ module InjectedLogger
2
+ module Delegator
3
+ class << self
4
+ # creates methods in klass according to the supported levels in the
5
+ # object specified. (levels are supposed to be methods)
6
+ #
7
+ # Arguments:
8
+ #
9
+ # on: class which we'll create methods on
10
+ # from: underlying logger object, which responds to some levels
11
+ # prefix: prefix log messages with this string
12
+ # extra_levels: extra levels we want to use from klass delegating to logger
13
+ # old_levels: the old levels that the class was delegating previously
14
+ # fallback: not required, suggested fallback level for non-native lvls
15
+ # info: not required, suggested level usable for information
16
+ #
17
+ # Returns a hash with information about supported and fallback levels:
18
+ #
19
+ # native: levels natively supported by the underlying object
20
+ # nonnative: non-native levels, callable only if there is fallback
21
+ # fallback: (if existing) native level used as fallback for others
22
+ # supported: supported levels, some maybe via fallback to native ones
23
+ # info: level the caller can use to give info (can be nil)
24
+ #
25
+ def delegate_levels(on:, from:, prefix:, extra_levels: [],
26
+ old_levels: [], fallback: UNKNOWN, info: INFO)
27
+ self.logger = from
28
+ self.klass = on
29
+ self.prefix = prefix
30
+ supp, unsupp = add_level_methods(extra_levels)
31
+ { native: supp,
32
+ nonnative: unsupp,
33
+ info: preferred_lvl(supp, info) }.
34
+ tap do |level_info|
35
+ level_info.merge!(
36
+ if fallback and unsupp.any?
37
+ flvl = preferred_lvl(supp, fallback)
38
+ add_as_fallback(unsupp, flvl)
39
+ { fallback: flvl, supported: supp + unsupp }
40
+ else
41
+ { supported: supp }
42
+ end)
43
+ (old_levels - level_info[:supported]).each { |lvl| remove_level lvl }
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ UNKNOWN = :unk
50
+ INFO = :info
51
+
52
+ attr_accessor :klass, :logger, :prefix
53
+
54
+ def remove_level(lvl)
55
+ klass.singleton_class.send :undef_method, lvl rescue nil
56
+ end
57
+
58
+ def add_level(lvl, &blk)
59
+ klass.define_singleton_method lvl, &blk
60
+ end
61
+
62
+ def add_as_fallback(nonnative, fallback)
63
+ nonnative.each do |lvl|
64
+ remove_level lvl
65
+ add_level lvl do |msg|
66
+ public_send fallback, "[#{lvl.upcase}] #{msg}"
67
+ end
68
+ end
69
+ end
70
+
71
+ def remove_unsupported(unsupported)
72
+ unsupported.each do |lvl|
73
+ remove_level lvl
74
+ end
75
+ end
76
+
77
+ def add_level_methods(extra_levels)
78
+ get_all_levels_with(extra_levels).partition do |lvl|
79
+ remove_level lvl
80
+ if logger.respond_to? lvl
81
+ add_level_method lvl
82
+ elsif logger.respond_to? :log
83
+ add_log_method lvl
84
+ end
85
+ end
86
+ end
87
+
88
+ def get_all_levels_with(extra_levels)
89
+ (extra_levels + (logger.respond_to?(:levels) ?
90
+ logger.levels.map { |l| l.downcase.to_sym } : [])).uniq
91
+ end
92
+
93
+ def add_level_method(lvl)
94
+ if prefix.nil? or prefix.empty?
95
+ add_level lvl do |msg|
96
+ logger.send lvl, msg
97
+ end
98
+ else
99
+ add_level lvl do |msg|
100
+ logger.send lvl, "#{prefix} #{msg}"
101
+ end
102
+ end
103
+ end
104
+
105
+ # Useful for Ruby 'logger' from stdlib and compatible interfaces
106
+ # called when logger.log exists only
107
+ def add_log_method(lvl)
108
+ arity = logger.method(:log).arity
109
+ if arity.abs == 1
110
+ # one single mandatory parameter, the string logged
111
+ prefix_s = "[#{lvl.upcase}]"
112
+ if prefix and not prefix.empty?
113
+ prefix_s += " " + prefix
114
+ end
115
+ klass.define_singleton_method lvl do |msg|
116
+ logger.send :log, "#{prefix_s} #{msg}"
117
+ end
118
+ else
119
+ # assume two or more params, best effort with 1st being level
120
+ if lvl_s = ruby_logger_severity(lvl)
121
+ klass.define_singleton_method lvl do |msg|
122
+ logger.send :log, lvl_s, msg
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ # try to map a severity level with one compatible with Ruby's Logger
129
+ def ruby_logger_severity(level)
130
+ lvl_s = level.upcase
131
+ l = logger
132
+ begin
133
+ l.const_get(lvl_s)
134
+ rescue NoMethodError
135
+ l = l.class
136
+ retry
137
+ rescue NameError
138
+ end
139
+ end
140
+
141
+ # return the preferred level if matched in levels, else first one
142
+ def preferred_lvl(levels, preference)
143
+ preference_r = Regexp.new("^#{Regexp.escape(preference.to_s)}")
144
+ levels.find { |l| preference_r.match l } || levels.first
145
+ end
146
+ end
147
+ end
148
+
149
+ end
@@ -0,0 +1,89 @@
1
+ require 'injectedlogger/delegator'
2
+
3
+ module InjectedLogger
4
+ module Logger
5
+ Error = Class.new StandardError
6
+ InUse = Class.new Error
7
+
8
+ UNKNOWN = :unknown
9
+ LOGLEVELS = [:debug, :verbose, :info, :notice, :warn, :error, :critical, :fatal, :unknown]
10
+
11
+ class << self
12
+ attr_reader :prefix, :levels, :level_info, :fallback
13
+
14
+ def use(logger_obj, levels: LOGLEVELS, fallback: UNKNOWN)
15
+ if logger and logger != logger_obj
16
+ raise InUse, "#{self} was already using logger #{logger}"
17
+ end
18
+ use! logger_obj, levels: levels, fallback: fallback
19
+ end
20
+
21
+ def use!(logger_obj, levels: LOGLEVELS, fallback: UNKNOWN)
22
+ self.logger = logger_obj
23
+ set_prefix '[core]'
24
+ set_levels levels
25
+ set_fallback fallback
26
+ add_methods
27
+ end
28
+
29
+ def prefix=(prefix)
30
+ set_prefix prefix
31
+ add_methods
32
+ end
33
+
34
+ def levels=(levels)
35
+ set_levels(levels)
36
+ add_methods
37
+ end
38
+
39
+ def fallback=(level)
40
+ set_fallback level
41
+ add_methods
42
+ end
43
+
44
+ def method_missing(method, *args, &blk)
45
+ logger.send method, *args, &blk
46
+ end
47
+
48
+ private
49
+
50
+ attr_accessor :logger
51
+ attr_writer :level_info
52
+
53
+ def set_prefix(prefix)
54
+ @prefix = prefix
55
+ end
56
+
57
+ def set_levels(levels)
58
+ @levels = levels
59
+ end
60
+
61
+ def set_fallback(level)
62
+ @fallback = level
63
+ end
64
+
65
+ def add_methods
66
+ old_levels = level_info ? level_info[:supported] : []
67
+ self.level_info = InjectedLogger::Delegator.delegate_levels(
68
+ from: logger, on: self, prefix: prefix, extra_levels: self.levels,
69
+ old_levels: old_levels, fallback: fallback)
70
+ set_levels(level_info[:supported]).tap do
71
+ info_message(level_info) if level_info[:info]
72
+ end
73
+ end
74
+
75
+ def info_message(level_info)
76
+ message = if level_info[:fallback]
77
+ "non-native log levels #{level_info[:nonnative].join ', '} emulated" \
78
+ " using #{level_info[:fallback].upcase} severity"
79
+ elsif level_info[:nonnative].any?
80
+ "unsupported log levels #{level_info[:nonnative].join ', '}"
81
+ else
82
+ nil
83
+ end
84
+ send level_info[:info], message if message
85
+ end
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,3 @@
1
+ module InjectedLogger
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,2 @@
1
+ require 'injectedlogger/logger'
2
+ require 'injectedlogger/version'
data/spec/helpers.rb ADDED
@@ -0,0 +1,84 @@
1
+ module Helpers
2
+ module LevelsMethod
3
+ def levels
4
+ if self.singleton_class.const_defined? :LEVELS
5
+ self.singleton_class.const_get(:LEVELS).map(&:downcase)
6
+ else
7
+ @levels || []
8
+ end
9
+ end
10
+ end
11
+
12
+ module RubyLoggerCompat
13
+ LEVELS = [:DEBUG, :VERBOSE, :INFO, :NOTICE, :WARN, :ERROR, :CRITICAL, :FATAL]
14
+
15
+ include LevelsMethod
16
+
17
+ def self.included(base)
18
+ define_constant_levels_on base
19
+ end
20
+
21
+ def self.define_constant_levels_on(base)
22
+ num = rand(LEVELS.size) + 1
23
+ num -= 1 if num == LEVELS.size # always leave out at least one level
24
+ # so that we can spec non-native levels
25
+ LEVELS.sample(rand(LEVELS.size) + 1).each_with_index do |lvl, i|
26
+ base.const_set(lvl, i)
27
+ end.tap do |levels|
28
+ base.const_set(:LEVELS, levels)
29
+ #base.define_singleton_method :levels do
30
+ # levels
31
+ #end
32
+ end
33
+ end
34
+
35
+ def log(level, msg)
36
+ out.puts "#{level} #{msg}"
37
+ end
38
+ end
39
+
40
+ class Outputter
41
+ attr_reader :msgs
42
+
43
+ def initialize
44
+ @msgs = []
45
+ end
46
+
47
+ def puts(msg)
48
+ msgs << msg
49
+ end
50
+
51
+ def match(re)
52
+ re = Regexp.new("#{Regexp.escape(re)}$") unless re.is_a? Regexp
53
+ msgs.any? do |m|
54
+ re.match m
55
+ end
56
+ end
57
+ alias_method :<<, :puts
58
+ end
59
+
60
+ class SpecLogger
61
+ attr_accessor :out, :called
62
+
63
+ def initialize(levels, out = Outputter.new)
64
+ @levels = if self.singleton_class.const_defined? :LEVELS
65
+ self.singleton_class.const_get :LEVELS
66
+ else
67
+ levels
68
+ end
69
+ self.out = out
70
+ self.called = Hash.new do |h, k|
71
+ h[k] = 0
72
+ end
73
+ @levels.each do |lvl|
74
+ self.singleton_class.send :define_method, lvl.downcase do |msg|
75
+ out.puts "#{lvl.upcase} #{msg}"
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ class RubyLikeLogger < SpecLogger
82
+ include RubyLoggerCompat
83
+ end
84
+ end
@@ -0,0 +1,84 @@
1
+ module InjectedLogger
2
+ RSpec.describe Logger do
3
+ RSpec.shared_examples "an injected logger" do
4
+ subject { InjectedLogger::Logger }
5
+
6
+ context 'levels' do
7
+ it { is_expected.to respond_to :levels }
8
+
9
+ it 'provides an array when asked for the levels' do
10
+ expect(subject.levels).to be_kind_of(Array)
11
+ end
12
+
13
+ it 'lists the supported levels' do
14
+ expect(subject.levels.sort).to eq(subject.level_info[:supported].sort)
15
+ end
16
+ end
17
+
18
+ context 'level info' do
19
+ it { is_expected.to respond_to :level_info }
20
+
21
+ it 'provides a hash as information for level info' do
22
+ expect(subject.level_info).to be_kind_of(Hash)
23
+ end
24
+
25
+ [:supported, :native, :nonnative, :fallback, :info].each do |key|
26
+ it "provides a :#{key} key in level info" do
27
+ expect(subject.level_info).to have_key(key)
28
+ end
29
+ end
30
+
31
+ it 'responds to all native levels' do
32
+ subject.level_info[:native].each do |lvl|
33
+ expect(subject).to respond_to lvl
34
+ end
35
+ end
36
+
37
+ it 'responds to all supported levels' do
38
+ subject.level_info[:supported].each do |lvl|
39
+ expect(subject).to respond_to lvl
40
+ end
41
+ end
42
+
43
+ it 'maps all native levels to the underlying logger methods' do
44
+ subject.level_info[:native].each do |lvl|
45
+ expect(logger_object).to respond_to lvl
46
+ end
47
+ end
48
+
49
+ it 'uses a native level as fallback' do
50
+ fallback = subject.level_info.fetch :fallback, nil
51
+ expect(subject.level_info[:native]).to include(fallback) if fallback
52
+ end
53
+
54
+ it 'writes to the logger native methods for each native level' do
55
+ subject.level_info[:native].each_with_index do |lvl, i|
56
+ str = lvl.to_s + i.to_s
57
+ expect(logger_object).to receive(lvl).with(Regexp.new("#{Regexp.escape(str)}$"))
58
+ subject.send lvl, str
59
+ end
60
+ end
61
+
62
+ end
63
+ end
64
+
65
+ context 'with a Ruby-like logger' do
66
+ let(:logger_object) { Helpers::RubyLikeLogger.new [] }
67
+
68
+ before do
69
+ InjectedLogger::Logger.use! logger_object
70
+ #l = InjectedLogger::Logger
71
+ #STDERR.puts "Native: #{l.level_info[:native]} Non-native: #{l.level_info[:nonnative]} Fallback: #{l.level_info[:fallback]} Info: #{l.level_info[:info]}"
72
+ end
73
+
74
+ it_behaves_like 'an injected logger'
75
+
76
+ it 'responds to all levels defined as constants in the underlying logger' do
77
+ logger_object.singleton_class.const_get(:LEVELS).each do |lvl|
78
+ expect(subject).to respond_to lvl.downcase
79
+ end
80
+ end
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,95 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+ $LOAD_PATH << File.expand_path('../lib', __FILE__)
4
+
5
+ # This file was generated by the `rspec --init` command. Conventionally, all
6
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
8
+ # file to always be loaded, without a need to explicitly require it in any files.
9
+ #
10
+ # Given that it is always loaded, you are encouraged to keep this file as
11
+ # light-weight as possible. Requiring heavyweight dependencies from this file
12
+ # will add to the boot time of your test suite on EVERY test run, even for an
13
+ # individual file that may not need all of that loaded. Instead, make a
14
+ # separate helper file that requires this one and then use it only in the specs
15
+ # that actually need it.
16
+ #
17
+ # The `.rspec` file also contains a few flags that are not defaults but that
18
+ # users commonly want.
19
+ #
20
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+
22
+ require 'stringio'
23
+ require_relative './helpers'
24
+ require 'injectedlogger'
25
+
26
+ RSpec.configure do |config|
27
+ orig_stdout = $stdout
28
+ config.before :all do
29
+ $stdout = StringIO.new
30
+ end
31
+ config.after :all do
32
+ $stdout = orig_stdout
33
+ end
34
+
35
+ # The settings below are suggested to provide a good initial experience
36
+ # with RSpec, but feel free to customize to your heart's content.
37
+ =begin
38
+ # These two settings work together to allow you to limit a spec run
39
+ # to individual examples or groups you care about by tagging them with
40
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
41
+ # get run.
42
+ config.filter_run :focus
43
+ config.run_all_when_everything_filtered = true
44
+
45
+ # Many RSpec users commonly either run the entire suite or an individual
46
+ # file, and it's useful to allow more verbose output when running an
47
+ # individual spec file.
48
+ if config.files_to_run.one?
49
+ # Use the documentation formatter for detailed output,
50
+ # unless a formatter has already been configured
51
+ # (e.g. via a command-line flag).
52
+ config.default_formatter = 'doc'
53
+ end
54
+
55
+ # Print the 10 slowest examples and example groups at the
56
+ # end of the spec run, to help surface which specs are running
57
+ # particularly slow.
58
+ config.profile_examples = 10
59
+
60
+ # Run specs in random order to surface order dependencies. If you find an
61
+ # order dependency and want to debug it, you can fix the order by providing
62
+ # the seed, which is printed after each run.
63
+ # --seed 1234
64
+ config.order = :random
65
+
66
+ # Seed global randomization in this process using the `--seed` CLI option.
67
+ # Setting this allows you to use `--seed` to deterministically reproduce
68
+ # test failures related to randomization by passing the same `--seed` value
69
+ # as the one that triggered the failure.
70
+ Kernel.srand config.seed
71
+
72
+ # rspec-expectations config goes here. You can use an alternate
73
+ # assertion/expectation library such as wrong or the stdlib/minitest
74
+ # assertions if you prefer.
75
+ config.expect_with :rspec do |expectations|
76
+ # Enable only the newer, non-monkey-patching expect syntax.
77
+ # For more details, see:
78
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
79
+ expectations.syntax = :expect
80
+ end
81
+
82
+ # rspec-mocks config goes here. You can use an alternate test double
83
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
84
+ config.mock_with :rspec do |mocks|
85
+ # Enable only the newer, non-monkey-patching expect syntax.
86
+ # For more details, see:
87
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
88
+ mocks.syntax = :expect
89
+
90
+ # Prevents you from mocking or stubbing a method that does not exist on
91
+ # a real object. This is generally recommended.
92
+ mocks.verify_partial_doubles = true
93
+ end
94
+ =end
95
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: injectedlogger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alejandro Martinez Ruiz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description: This gem injects a given logger into your code
56
+ email:
57
+ - alex@flawedcode.org
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE
67
+ - README.md
68
+ - Rakefile
69
+ - injectedlogger.gemspec
70
+ - lib/injectedlogger.rb
71
+ - lib/injectedlogger/delegator.rb
72
+ - lib/injectedlogger/logger.rb
73
+ - lib/injectedlogger/version.rb
74
+ - spec/helpers.rb
75
+ - spec/logger_spec.rb
76
+ - spec/spec_helper.rb
77
+ homepage: http://github.com/unleashed/injectedlogger
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.1.0
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.3
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: This gem injects a given logger into your code
101
+ test_files:
102
+ - spec/helpers.rb
103
+ - spec/logger_spec.rb
104
+ - spec/spec_helper.rb