Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
- { ruby: '2.7', mongoid: '4' }
- { ruby: '2.7', mongoid: '5' }
- { ruby: '3.3', mongoid: '6' }
- { ruby: '2.7', mongoid: '7' }
- { ruby: '3.2', mongoid: '8' }
- { ruby: '3.3', mongoid: '9' }

name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }})

Expand Down
23 changes: 12 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
### 0.4.7 (Next)
### 0.5.0 (Next)

* Your contribution here.
* [#20](https://github.com/mongoid/mongoid-shell/pull/20): Added compatibility with Mongoid 7, 8, 9 - [@dblock](https://github.com/dblock).
* Migrated CI from Travis CI to GitHub Actions - [@dblock](https://github.com/dblock).

### 0.4.6 (12/29/2017)
### 0.4.6 (2017/12/29)

* [#16](https://github.com/mongoid/mongoid-shell/pull/16): Add `--ssl` and `--authenticationDatabase` support to all commands - [@cavvia](https://github.com/cavvia).

### 0.4.5 (9/7/2017)
### 0.4.5 (2017/09/07)

* [#13](https://github.com/mongoid/mongoid-shell/issues/13): Support masking sensitive values with `to_s(mask_sensitive: true)` - [@dblock](https://github.com/dblock).
* [#14](https://github.com/mongoid/mongoid-shell/pull/14): Refactored arg definitions into `arg` and `option` - [@dblock](https://github.com/dblock).

### 0.4.4 (6/4/2017)
### 0.4.4 (2017/06/04)

* [#11](https://github.com/mongoid/mongoid-shell/pull/11): Compatibility with Mongoid 6 - [@jbach](https://github.com/jbach).
* [#12](https://github.com/mongoid/mongoid-shell/pull/12): Added Danger, PR linter - [@dblock](https://github.com/dblock).

### 0.4.3 (6/1/2016)
### 0.4.3 (2016/06/01)

* [#9](https://github.com/mongoid/mongoid-shell/pull/9): Remove example and spec alleging that `--collection` can be specified multiple times - [@joeyAghion](https://github.com/joeyAghion).

### 0.4.2 (2/9/2015)
### 0.4.2 (2015/02/09)

* [#8](https://github.com/mongoid/mongoid-shell/pull/8): Support repeatable parameters; add `excludeCollection` and `excludeCollectionsWithPrefix` to `mongodump` - [@joeyAghion](https://github.com/joeyAghion).

### 0.4.1 (10/25/2015)
### 0.4.1 (2015/10/25)

* [#7](https://github.com/mongoid/mongoid-shell/pull/7): Added support for `mongoimport` and `mongoexport` - [@hoang1417](https://github.com/hoang1417).

### 0.4.0 (10/20/2015)
### 0.4.0 (2015/10/20)

* [#6](https://github.com/mongoid/mongoid-shell/pull/6): Compatibility with Mongoid 5.x - [@dblock](https://github.com/dblock).

### 0.3.0 (7/1/2014)
### 0.3.0 (2014/07/01)

* [#3](https://github.com/mongoid/mongoid-shell/pull/3): Added Mongoid 4.x support - [@pawelniewie](https://github.com/pawelniewie), [@dblock](https://github.com/dblock).
* [#2](https://github.com/mongoid/mongoid-shell/pull/2): Added support for `--noIndexRestore` to `Mongoid::Shell::Commands::Mongorestore` - [@macreery](https://github.com/macreery).
Expand All @@ -42,7 +43,7 @@
* Added Rubocop, Ruby style linter - [@dblock](https://github.com/dblock).
* Upgraded to RSpec 3.x expectation syntax - [@dblock](https://github.com/dblock).

### 0.2.0 (1/29/2013)
### 0.2.0 (2013/01/29)

* Added `Mongoid::Shell::Commands::Mongo` that generates a command line which connects to the session's primary node - [@dblock](https://github.com/dblock).
* Added `Mongoid::Shell::Commands::Mongostat` that generates a command line for `mongostat` - [@dblock](https://github.com/dblock).
Expand All @@ -52,6 +53,6 @@
* Added support for `--nodb`, `--norc`, `--quiet` and `--ipv6` to `Mongoid::Shell::Commands::Mongo` - [@dblock](https://github.com/dblock).
* It's now possible to override built-in `db`, `username`, `password`, `host` and `primary` - [@dblock](https://github.com/dblock).

### 0.1.0 (1/27/2013)
### 0.1.0 (2013/01/27)

* Initial public release with support for `mongodump` - [@dblock](https://github.com/dblock).
4 changes: 3 additions & 1 deletion Dangerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

danger.import_dangerfile(gem: 'mongoid-danger')
danger.import_dangerfile(gem: 'danger-pr-comment')

changelog.check!
15 changes: 13 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ source 'http://rubygems.org'

gemspec

case version = ENV['MONGOID_VERSION'] || '6.0'
case version = ENV['MONGOID_VERSION'] || '9.0'
when /^9/
gem 'bigdecimal'
gem 'mongoid', '~> 9.0'
when /^8/
gem 'bigdecimal'
gem 'mongoid', '~> 8.0'
when /^7/
gem 'bigdecimal'
gem 'mongoid', '~> 7.0'
when /^6/
gem 'bigdecimal'
gem 'mongoid', '~> 6.0'
Expand All @@ -24,7 +33,9 @@ end

group :development, :test do
gem 'bundler'
gem 'mongoid-danger', '~> 0.1.1'
gem 'danger'
gem 'danger-changelog'
gem 'danger-pr-comment'
gem 'rake'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.84.1'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To use output in logs, pass the `mask_sensitive` option to `to_s`.
Compatibility
-------------

This gem supports Mongoid 3, 4, 5 and 6.
This gem supports Mongoid 3, 4, 5, 6, 7, 8 and 9.

Supported Commands
------------------
Expand Down
6 changes: 3 additions & 3 deletions lib/mongoid/shell/commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ def to_s(options = {})

private

if ::Mongoid::Compatibility::Version.mongoid3? || ::Mongoid::Compatibility::Version.mongoid4?
if ::Mongoid::Compatibility::Version.mongoid5_or_newer?
def default_client_or_session
Mongoid.default_session
Mongoid.default_client
end
else
def default_client_or_session
Mongoid.default_client
Mongoid.default_session
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/shell/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Mongoid
module Shell
VERSION = '0.4.7'
VERSION = '0.5.0'
end
end
4 changes: 2 additions & 2 deletions spec/mongoid/commands/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

context 'without a default session' do
before do
default_function = Mongoid::Compatibility::Version.mongoid3? || Mongoid::Compatibility::Version.mongoid4? ? :default_session : :default_client
default_function = Mongoid::Compatibility::Version.mongoid5_or_newer? ? :default_client : :default_session
allow(Mongoid).to receive(default_function).and_return(nil)
end

Expand All @@ -24,7 +24,7 @@
end
end

if Mongoid::Compatibility::Version.mongoid5? || Mongoid::Compatibility::Version.mongoid6?
if Mongoid::Compatibility::Version.mongoid5_or_newer?
it 'creates a command using the default session' do
command = Mongoid::Shell::Commands::Base.new
expect(command.session).to eq Mongoid.default_client
Expand Down
2 changes: 1 addition & 1 deletion spec/mongoid/properties/host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def session
end

it 'raises an exception when the session is not connected' do
if Mongoid::Compatibility::Version.mongoid5? || Mongoid::Compatibility::Version.mongoid6?
if Mongoid::Compatibility::Version.mongoid5_or_newer?
allow(Mongoid.default_client.cluster).to receive(:servers).and_return([])
else
allow(Mongoid.default_session.cluster).to receive(:nodes).and_return([])
Expand Down
6 changes: 3 additions & 3 deletions spec/support/helpers/mongoid_session_helper.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

module MongoidSessionHelper
if ::Mongoid::Compatibility::Version.mongoid3? || ::Mongoid::Compatibility::Version.mongoid4?
if ::Mongoid::Compatibility::Version.mongoid5_or_newer?
def default_client_or_session
Mongoid.default_session
Mongoid.default_client
end
else
def default_client_or_session
Mongoid.default_client
Mongoid.default_session
end
end
end