mongodb_logger 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7463e7411319454a836c0d10ee7725c6d71fe02
4
- data.tar.gz: b12df4c637b7ef4e9860789cf2bbd3ba6d79b2b6
3
+ metadata.gz: 373211262f8835058278de0843ac944ee26590e1
4
+ data.tar.gz: 7a30efb9fbdd8a10a72e53f4996ba5183e15f007
5
5
  SHA512:
6
- metadata.gz: b88448aeb56f96356ded3c87f1881e734a862e52f5cbd7d95db5a27b2187f8673845993051d367939b46e1737fc443dde90abea297f2725457839fe9c457cfc8
7
- data.tar.gz: 5461c6c9af82e8fd914b596a7aebcc3b81e6827b6d44ab0edc5af0e83f077b73f09ccfe5666eb0e0f21472ba120756639101859f8ce5ef7bce0bcd9cdc1176df
6
+ metadata.gz: 7f5c5e7db9bf4caf28889c1fc893e9877fbc17e2d59274b9acdb9380b38149eeb586b0fa6096c91597ce748e45a516e57db454ed5609cf8d3f063bc8da3dde1f
7
+ data.tar.gz: a105c6b07ac2aee5d907a4ce8b4d89366bd5d0aaa88a0859a4af85f8408e01053429a2ae4339ba76d7e5eb396201a33461c996aa63fd5ed3870e1238d37c4439
@@ -1 +1 @@
1
- 2.1.1
1
+ 2.2.0
@@ -1,25 +1,34 @@
1
1
  language: ruby
2
+
2
3
  before_install:
3
4
  - "export DISPLAY=:99.0"
4
5
  - "sh -e /etc/init.d/xvfb start"
5
- - gem install bundler --pre
6
+
6
7
  before_script:
7
8
  - bundle exec rake appraisal:install
9
+
8
10
  services:
9
11
  - mongodb
12
+
10
13
  rvm:
11
14
  - 1.9.3
12
- - 2.0.0
13
- - 2.1.0
15
+ - 2.0
16
+ - 2.1
17
+ - 2.2
14
18
  - jruby-19mode
15
19
  - ruby-head
16
20
  - jruby-head
21
+
22
+ sudo: false
23
+
17
24
  notifications:
18
25
  email: false
26
+
19
27
  branches:
20
28
  only:
21
29
  - master
22
30
  - development
31
+
23
32
  matrix:
24
33
  allow_failures:
25
34
  - rvm: jruby-19mode
data/Appraisals CHANGED
@@ -1,17 +1,9 @@
1
- appraise "rails31" do
2
- gem "rails", "~> 3.1.12"
3
- end
4
-
5
- appraise "rails32" do
6
- gem "rails", "~> 3.2.14"
7
- end
8
-
9
- appraise "rails40" do
10
- gem "rails", "~> 4.0.2"
11
- gem "minitest", "~> 4.0"
1
+ appraise "rails41" do
2
+ gem "rails", "~> 4.1.8"
3
+ gem "rspec-rails", ">= 3.0"
12
4
  end
13
5
 
14
- appraise "rails41" do
15
- gem "rails", "4.1.0.rc1"
16
- gem "minitest", ">= 4.0"
6
+ appraise "rails42" do
7
+ gem "rails", "~> 4.2.0"
8
+ gem "rspec-rails", ">= 3.0"
17
9
  end
@@ -1,5 +1,10 @@
1
1
  ## master
2
2
 
3
+ ## 0.6.5
4
+
5
+ * Support new Rails 4.2 and Ruby 2.2.x
6
+ * Remove support Rails 3.x
7
+
3
8
  ## 0.6.4
4
9
 
5
10
  * Fixed for moped gem < 2
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # MongodbLogger
2
- [![Build Status](https://travis-ci.org/le0pard/mongodb_logger.png)](https://travis-ci.org/le0pard/mongodb_logger)
3
- [![Code Climate](https://codeclimate.com/github/le0pard/mongodb_logger.png)](https://codeclimate.com/github/le0pard/mongodb_logger)
2
+
3
+ [![Build Status](https://travis-ci.org/le0pard/mongodb_logger.svg?branch=master)](https://travis-ci.org/le0pard/mongodb_logger)
4
+ [![Code Climate](https://codeclimate.com/github/le0pard/mongodb_logger/badges/gpa.svg)](https://codeclimate.com/github/le0pard/mongodb_logger)
4
5
 
5
6
  MongodbLogger is a alternative logger for Rails or Rack based app, which log all requests of you application into MongoDB database.
6
7
  It:
@@ -59,6 +60,8 @@ Doesn't support the Rails version below 3.
59
60
  capsize: <%= 10.megabytes %> # default: 250MB
60
61
  host: localhost # default: localhost
61
62
  port: 27017 # default: 27017
63
+ username: null # default: null, username for MongoDB Auth
64
+ password: null # default: null, password for MongoDB Auth
62
65
  replica_set: true # default: false - Adds retries for ConnectionFailure during voting for replica set master
63
66
  write_options: # default: {w: 0, wtimeout: 200} - write options for inserts (w - wait for insert to propagate to "w" numbers of nodes)
64
67
  w: 0
@@ -79,7 +82,7 @@ Doesn't support the Rails version below 3.
79
82
  Also you can use "url" parameter for setup connection to mongodb:
80
83
 
81
84
  development:
82
- url: mongodb://localhost:27017/my_app
85
+ url: mongodb://username:password@localhost:27017/my_app
83
86
  capsize: <%= 10.megabytes %>
84
87
 
85
88
 
@@ -24,18 +24,10 @@ module RailsHelpers
24
24
  controller_filename = File.join(rails_root, 'app', 'controllers', "application_controller.rb")
25
25
  end
26
26
 
27
- def rails3?
28
- rails_version =~ /^3/
29
- end
30
-
31
27
  def rails_root
32
28
  LOCAL_RAILS_ROOT
33
29
  end
34
30
 
35
- def rails_uses_rack?
36
- rails3? || rails_version =~ /^2\.3/
37
- end
38
-
39
31
  def rails_version
40
32
  @rails_version ||= begin
41
33
  if ENV["RAILS_VERSION"]
@@ -61,14 +53,6 @@ module RailsHelpers
61
53
  rails_version =~ /^2\.[123]/
62
54
  end
63
55
 
64
- def rails_supports_initializers?
65
- rails3? || rails_version =~ /^2\./
66
- end
67
-
68
- def rails_finds_generators_in_gems?
69
- rails3? || rails_version =~ /^2\./
70
- end
71
-
72
56
  def version_string
73
57
  ENV['RAILS_VERSION'] || `tail -n 1 SUPPORTED_RAILS_VERSIONS` # use latest version if ENV["RAILS_VERSION"] is undefined
74
58
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "4.1.0.rc1"
6
- gem "minitest", ">= 4.0"
5
+ gem "rails", "~> 4.1.8"
6
+ gem "rspec-rails", ">= 3.0"
7
7
 
8
8
  gemspec :path=>"../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~> 4.2.0"
6
+ gem "rspec-rails", ">= 3.0"
7
+
8
+ gemspec :path=>"../"
@@ -3,10 +3,6 @@ require 'mongodb_logger/rails_logger'
3
3
  module MongodbLogger
4
4
  module InitializerMixin
5
5
 
6
- def rails3(minor = 0)
7
- 3 == Rails::VERSION::MAJOR && minor == Rails::VERSION::MINOR
8
- end
9
-
10
6
  def create_logger(config)
11
7
  path = config.paths['log'].first
12
8
  level = RailsLogger.const_get(config.log_level.to_s.upcase)
@@ -14,7 +10,6 @@ module MongodbLogger
14
10
  # decorating with TaggedLogging
15
11
  logger = MongodbLogger::TaggedLogger.new(logger) if defined?(ActiveSupport::TaggedLogging)
16
12
  logger.level = level
17
- logger.auto_flushing = false if Rails.env.production? && rails3(1)
18
13
  logger
19
14
  rescue StandardError => e
20
15
  logger = RailsLogger.new(STDERR)
@@ -1,4 +1,5 @@
1
1
  require 'erb'
2
+ require 'yaml'
2
3
  require 'uri'
3
4
  require 'active_support'
4
5
  require 'active_support/core_ext'
@@ -95,7 +96,7 @@ module MongodbLogger
95
96
  end
96
97
 
97
98
  def disable_file_logging?
98
- @db_configuration.fetch(:disable_file_logging, false)
99
+ @db_configuration && @db_configuration.fetch(:disable_file_logging, false)
99
100
  end
100
101
 
101
102
  def configure
@@ -159,7 +160,7 @@ module MongodbLogger
159
160
 
160
161
  def read_config_from_file(config_file)
161
162
  if File.file? config_file
162
- config = YAML.load(ERB.new(File.new(config_file).read).result)[app_env]
163
+ config = ::YAML.load(ERB.new(File.new(config_file).read).result)[app_env]
163
164
  config = config['mongodb_logger'] if config && config.has_key?('mongodb_logger')
164
165
  return config unless config.blank?
165
166
  end
@@ -1,3 +1,3 @@
1
1
  module MongodbLogger
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
@@ -14,8 +14,8 @@ Gem::Specification.new do |gem|
14
14
  gem.rdoc_options = ["--charset=UTF-8"]
15
15
  gem.licenses = ["MIT"]
16
16
 
17
- gem.add_development_dependency "rspec", "~> 2.14.1"
18
- gem.add_development_dependency "rspec-rails", "~> 2.14.1"
17
+ gem.add_development_dependency "rspec", ">= 3"
18
+ gem.add_development_dependency "rspec-rails", ">= 3"
19
19
  gem.add_development_dependency "cucumber", "~> 1.3.10"
20
20
  gem.add_development_dependency "cucumber-rails", "~> 1.4.0"
21
21
  gem.add_development_dependency "capybara", '~> 2.2.1'
@@ -23,11 +23,11 @@ Gem::Specification.new do |gem|
23
23
  gem.add_development_dependency "aruba", "~> 0.5.4"
24
24
  # for tests deps
25
25
  gem.add_development_dependency "coffee-script", "~> 2.2"
26
- gem.add_development_dependency "mongo", "~> 1.9"
26
+ gem.add_development_dependency "mongo", "~> 1.10"
27
27
  #gem.add_development_dependency "moped", "2.0.0.beta6"
28
28
 
29
29
  gem.add_dependency "rake", "~> 10.0"
30
- gem.add_dependency "multi_json", "~> 1.8"
30
+ gem.add_dependency "multi_json", ">= 1.8"
31
31
  gem.add_dependency "activesupport", ">= 3.1.0"
32
32
  gem.add_dependency "sprockets", ">= 2.0.0"
33
33
  gem.add_dependency "sinatra", ">= 1.3"
@@ -11,8 +11,8 @@ describe MongodbLogger::Logger do
11
11
 
12
12
  context "in instantiation" do
13
13
  before do
14
- described_class.any_instance.stub(:internal_initialize).and_return(nil)
15
- described_class.any_instance.stub(:disable_file_logging?).and_return(false)
14
+ allow_any_instance_of(described_class).to receive(:internal_initialize).and_return(nil)
15
+ allow_any_instance_of(described_class).to receive(:disable_file_logging?).and_return(false)
16
16
  @mongodb_logger = described_class.new
17
17
  end
18
18
 
@@ -41,7 +41,7 @@ describe MongodbLogger::Logger do
41
41
 
42
42
  it "authenticated by url" do
43
43
  @mongodb_logger.send(:connect)
44
- expect(@mongodb_logger.mongo_adapter.authenticated?).to be_true
44
+ expect(@mongodb_logger.mongo_adapter.authenticated?).to be_truthy
45
45
  expect(@mongodb_logger.db_configuration['database']).to eq("system_log")
46
46
  expect(@mongodb_logger.db_configuration[:database]).to eq("system_log")
47
47
  end
@@ -61,7 +61,7 @@ describe MongodbLogger::Logger do
61
61
 
62
62
  it "authenticate with the credentials in the configuration" do
63
63
  @mongodb_logger.send(:connect)
64
- expect(@mongodb_logger.mongo_adapter.authenticated?).to be_true
64
+ expect(@mongodb_logger.mongo_adapter.authenticated?).to be_truthy
65
65
  end
66
66
  end
67
67
 
@@ -103,12 +103,12 @@ describe MongodbLogger::Logger do
103
103
  end
104
104
 
105
105
  it "not authenticate" do
106
- expect(@mongo_adapter.authenticated?).to be_false
106
+ expect(@mongo_adapter.authenticated?).to be_falsey
107
107
  end
108
108
 
109
109
  it "create a capped collection in the database with the configured size" do
110
110
  @mongodb_logger.send(:check_for_collection)
111
- expect(@mongo_adapter.connection.collection_names.include?(@mongo_adapter.configuration['collection'])).to be_true
111
+ expect(@mongo_adapter.connection.collection_names.include?(@mongo_adapter.configuration['collection'])).to be_truthy
112
112
  # new capped collections are X MB + 5888 bytes, but don't be too strict in case that changes
113
113
  expect(@mongo_adapter.collection_stats[:storageSize]).to be < MongodbLogger::Logger::DEFAULT_COLLECTION_SIZE + 1.megabyte
114
114
  end
@@ -156,7 +156,7 @@ describe MongodbLogger::Logger do
156
156
  end
157
157
 
158
158
  it "detect logging is colorized" do
159
- expect(@mongodb_logger.send(:logging_colorized?)).to be_true
159
+ expect(@mongodb_logger.send(:logging_colorized?)).to be_truthy
160
160
  end
161
161
 
162
162
  should_contain_one_log_record
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe TestsController do
3
+ describe TestsController, type: :controller do
4
4
  before :each do
5
5
  @mongodb_logger = Rails.logger
6
6
  @mongo_adapter = @mongodb_logger.mongo_adapter
@@ -1,8 +1,8 @@
1
+ require 'rubygems'
1
2
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
3
  ENV["RAILS_ENV"] ||= 'test'
3
4
  require File.expand_path("../../config/environment", __FILE__)
4
5
  require 'rspec/rails'
5
- require 'rspec/autorun'
6
6
 
7
7
  # Requires supporting ruby files with custom matchers and macros, etc,
8
8
  # in spec/support/ and its subdirectories.
@@ -10,4 +10,8 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
10
10
 
11
11
  RSpec.configure do |config|
12
12
 
13
+ config.expect_with :rspec do |c|
14
+ c.syntax = :expect
15
+ end
16
+
13
17
  end
@@ -5,7 +5,7 @@ end
5
5
 
6
6
  class Rails
7
7
  module VERSION
8
- MAJOR = 3
8
+ MAJOR = 4
9
9
  end
10
10
 
11
11
  def self.env
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongodb_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Vasiliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.14.1
19
+ version: '3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.14.1
26
+ version: '3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.14.1
33
+ version: '3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.14.1
40
+ version: '3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cucumber
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.9'
131
+ version: '1.10'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.9'
138
+ version: '1.10'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -154,14 +154,14 @@ dependencies:
154
154
  name: multi_json
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.8'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.8'
167
167
  - !ruby/object:Gem::Dependency
@@ -329,10 +329,8 @@ files:
329
329
  - features/support/aruba.rb
330
330
  - features/support/env.rb
331
331
  - features/support/rails.rb
332
- - gemfiles/rails31.gemfile
333
- - gemfiles/rails32.gemfile
334
- - gemfiles/rails40.gemfile
335
332
  - gemfiles/rails41.gemfile
333
+ - gemfiles/rails42.gemfile
336
334
  - lib/mongodb_logger.rb
337
335
  - lib/mongodb_logger/adapters.rb
338
336
  - lib/mongodb_logger/adapters/base.rb
@@ -423,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
423
421
  version: '0'
424
422
  requirements: []
425
423
  rubyforge_project:
426
- rubygems_version: 2.2.2
424
+ rubygems_version: 2.4.5
427
425
  signing_key:
428
426
  specification_version: 4
429
427
  summary: MongoDB logger for Rails
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rails", "~> 3.1.12"
6
-
7
- gemspec :path=>"../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rails", "~> 3.2.14"
6
-
7
- gemspec :path=>"../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rails", "~> 4.0.2"
6
- gem "minitest", "~> 4.0"
7
-
8
- gemspec :path=>"../"