-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into custom-field-type-support
- Loading branch information
Showing
33 changed files
with
1,968 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source "https://rubygems.org" | ||
gemspec path: '..' | ||
|
||
gem 'bson', '4.14.0' | ||
# This configuration doesn't require a specific driver version. When bson-4.14.0 | ||
# was released, current driver version was 2.17.0 | ||
gem 'mongo', '2.17.0' | ||
|
||
require_relative './standard' | ||
|
||
standard_dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
require "mongoid/deprecation" | ||
|
||
module Mongoid | ||
|
||
# Adds ability to declare Mongoid-specific deprecations. | ||
# | ||
# @api private | ||
module Deprecable | ||
|
||
# Declares method(s) as deprecated. | ||
# | ||
# @example Deprecate a method. | ||
# Mongoid.deprecate(Cat, :meow); Cat.new.meow | ||
# #=> Mongoid.logger.warn("meow is deprecated and will be removed from Mongoid 8.0") | ||
# | ||
# @example Deprecate a method and declare the replacement method. | ||
# Mongoid.deprecate(Cat, meow: :speak); Cat.new.meow | ||
# #=> Mongoid.logger.warn("meow is deprecated and will be removed from Mongoid 8.0 (use speak instead)") | ||
# | ||
# @example Deprecate a method and give replacement instructions. | ||
# Mongoid.deprecate(Cat, meow: 'eat :catnip instead'); Cat.new.meow | ||
# #=> Mongoid.logger.warn("meow is deprecated and will be removed from Mongoid 8.0 (eat :catnip instead)") | ||
# | ||
# @param [ Module ] target_module The parent which contains the method. | ||
# @param [ Symbol | Hash<Symbol, [Symbol|String]> ] method_descriptors | ||
# The methods to deprecate, with optional replacement instructions. | ||
def deprecate(target_module, *method_descriptors) | ||
Mongoid::Deprecation.deprecate_methods(target_module, *method_descriptors) | ||
end | ||
end | ||
end | ||
|
||
# Ensure Mongoid.deprecate can be used during initialization | ||
Mongoid.extend(Mongoid::Deprecable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module Mongoid | ||
|
||
# Utility class for logging deprecation warnings. | ||
class Deprecation < ::ActiveSupport::Deprecation | ||
|
||
@gem_name = 'Mongoid' | ||
|
||
# Per change policy, deprecations will be removed in the next major version. | ||
@deprecation_horizon = "#{Mongoid::VERSION.split('.').first.to_i + 1}.0".freeze | ||
|
||
# Overrides default ActiveSupport::Deprecation behavior | ||
# to use Mongoid's logger. | ||
# | ||
# @return Array<Proc> The deprecation behavior. | ||
def behavior | ||
@behavior ||= Array(->(message, callstack, _deprecation_horizon, _gem_name) { | ||
logger = Mongoid.logger | ||
logger.warn(message) | ||
logger.debug(callstack.join("\n ")) if debug | ||
}) | ||
end | ||
end | ||
end |
Oops, something went wrong.