mongoid-shell 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.md +1 -1
- data/README.md +26 -5
- data/lib/mongoid/shell/commands.rb +2 -0
- data/lib/mongoid/shell/commands/mongoexport.rb +69 -0
- data/lib/mongoid/shell/commands/mongoimport.rb +74 -0
- data/lib/mongoid/shell/version.rb +1 -1
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8d3471c6d71f5f41ca2c8e0b45f0188ffda678
|
4
|
+
data.tar.gz: 3b5c41c1caba5e21f4803aece1b0f975c224c716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4220dc0b160a4cda04b8c4d2361f4d4e4788d96dbd1a08bc6ce3835369ac68d5aa3741de636d531352db8432286788bdd428529ea30cb9c6f38b92d2f2bbf43a
|
7
|
+
data.tar.gz: eb954eecda14094f4aaadf730ffb0c8419295eee358fa1e8daad220b901cbb10b40015c91b753075e9e3b75d19999b94cf0260301e51fd0850b4f26ce42066c4
|
data/CHANGELOG.md
CHANGED
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Mongoid::Shell
|
2
2
|
==============
|
3
3
|
|
4
|
-
[![Gem Version](
|
5
|
-
[![Build Status](
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/mongoid-shell.svg)](https://badge.fury.io/rb/mongoid-shell)
|
5
|
+
[![Build Status](https://travis-ci.org/dblock/mongoid-shell.svg?branch=master)](https://travis-ci.org/dblock/mongoid-shell)
|
6
6
|
[![Dependency Status](https://gemnasium.com/dblock/mongoid-shell.svg)](https://gemnasium.com/dblock/mongoid-shell)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/dblock/mongoid-shell.svg)](https://codeclimate.com/github/dblock/mongoid-shell)
|
8
8
|
|
@@ -76,6 +76,29 @@ mongorestore.to_s # mongorestore --db test --collection test /tmp/db_backup
|
|
76
76
|
|
77
77
|
The `Mongoid::Shell::Commands::Mongorestore` class supports `--db`, `--host`, `--username`, `--password`, `--collection`, `--ipv6`, `--dbpath`, `--directoryperdb`, `--journal`, `--objcheck`, `--filter`, `--drop`, `--oplogReplay`, `--keepIndexVersion` and `--noIndexRestore`.
|
78
78
|
|
79
|
+
### Mongoexport
|
80
|
+
|
81
|
+
The mongoexport tool produces a JSON or CSV export of data stored in a MongoDB instance.
|
82
|
+
|
83
|
+
``` ruby
|
84
|
+
mongoexport = Mongoid::Shell::Commands::Mongoexport.new({ collection: 'traffic', out: 'traffic.json' })
|
85
|
+
mongoexport.to_s # mongoexport --db test --collection traffic --out traffic.json
|
86
|
+
```
|
87
|
+
|
88
|
+
The `Mongoid::Shell::Commands::Mongoexport` class supports '--verbose', '--quiet', '--version', '--port', '--ipv6', '--ssl', '--sslCAFile', '--sslPEMKeyFile', '--sslPEMKeyPassword', '--sslCRLFile', '--sslAllowInvalidCertificates', '--sslAllowInvalidHostnames', '--sslFIPSMode', '--authenticationDatabase', '--authenticationMechanism', '--gssapiServiceName', '--gssapiHostName', '--collection', '--fields', '--fieldFile', '--query', '--csv', '--type', '--out', '--jsonArray', '--pretty', '--slaveOk', '--forceTableScan', '--skip', '--limit', '--sort', '--directoryperdb', '--journal', '--dbpath'.
|
89
|
+
|
90
|
+
### Mongoimport
|
91
|
+
|
92
|
+
The mongoimport tool imports content from an Extended JSON, CSV, or TSV export created by mongoexport, or potentially, another third-party export tool.
|
93
|
+
|
94
|
+
|
95
|
+
``` ruby
|
96
|
+
mongoimport = Mongoid::Shell::Commands::Mongoimport.new({ collection: 'contacts', file: 'contacts.json' })
|
97
|
+
mongoimport.to_s # mongoimport --db test --collection contacts --file contacts.json
|
98
|
+
```
|
99
|
+
|
100
|
+
The `Mongoid::Shell::Commands::Mongoimport` class supports '--verbose', '--quiet', '--version', '--host', '--username', '--password', '--port', '--ipv6', '--ssl', '--sslCAFile', '--sslPEMKeyFile', '--sslPEMKeyPassword', '--sslCRLFile', '--sslAllowInvalidCertificates', '--sslAllowInvalidHostnames', '--sslFIPSMode', '--authenticationDatabase', '--authenticationMechanism', '--gssapiServiceName', '--gssapiHostName', '--db', '--collection', '--fields', '--directoryperdb', '--journal', '--dbpath', '--fieldFile', '--ignoreBlanks', '--type', '--file', '--drop', '--headerline', '--upsert', '--upsertFields', '--stopOnError', '--jsonArray', '--maintainInsertionOrder', '--numInsertionWorkers', '--writeConcern'
|
101
|
+
|
79
102
|
### Mongostat
|
80
103
|
|
81
104
|
The mongostat utility provides a quick overview of the status of a currently running mongod or mongos instance.
|
@@ -92,6 +115,4 @@ Copyright and License
|
|
92
115
|
|
93
116
|
MIT License, see [LICENSE](http://github.com/dblock/mongoid-shell/raw/master/LICENSE.md) for details.
|
94
117
|
|
95
|
-
(c) 2013 [Daniel Doubrovkine](http://github.com/dblock), [Artsy Inc.](http://artsy.net)
|
96
|
-
|
97
|
-
|
118
|
+
(c) 2013-2015 [Daniel Doubrovkine](http://github.com/dblock), [Artsy Inc.](http://artsy.net)
|
@@ -2,4 +2,6 @@ require 'mongoid/shell/commands/base'
|
|
2
2
|
require 'mongoid/shell/commands/mongo'
|
3
3
|
require 'mongoid/shell/commands/mongodump'
|
4
4
|
require 'mongoid/shell/commands/mongorestore'
|
5
|
+
require 'mongoid/shell/commands/mongoexport'
|
6
|
+
require 'mongoid/shell/commands/mongoimport'
|
5
7
|
require 'mongoid/shell/commands/mongostat'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Mongoid
|
2
|
+
module Shell
|
3
|
+
module Commands
|
4
|
+
class Mongoexport < Mongoid::Shell::Commands::Base
|
5
|
+
include Mongoid::Shell::Properties::Host
|
6
|
+
include Mongoid::Shell::Properties::Database
|
7
|
+
include Mongoid::Shell::Properties::Username
|
8
|
+
include Mongoid::Shell::Properties::Password
|
9
|
+
|
10
|
+
attr_accessor :verbose, :quiet, :port, :ipv6, :ssl, :sslCAFile,
|
11
|
+
:sslPEMKeyFile, :sslPEMKeyPassword, :sslCRLFile,
|
12
|
+
:sslAllowInvalidCertificates, :sslAllowInvalidHostnames, :sslFIPSMode,
|
13
|
+
:authenticationDatabase, :authenticationMechanism, :gssapiServiceName,
|
14
|
+
:gssapiHostName, :collection, :fields, :fieldFile, :query, :csv,
|
15
|
+
:type, :out, :jsonArray, :pretty, :slaveOk, :forceTableScan, :skip,
|
16
|
+
:limit, :sort, :directoryperdb, :journal, :dbpath
|
17
|
+
|
18
|
+
def initialize(attrs = {})
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def vargs
|
23
|
+
super var_options.merge(boolean_options)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def var_options
|
29
|
+
{
|
30
|
+
'--db' => :db, '--host' => :host, '--port' => :port,
|
31
|
+
'--sslCAFile' => :sslCAFile,
|
32
|
+
'--sslPEMKeyFile' => :sslPEMKeyFile,
|
33
|
+
'--sslPEMKeyPassword' => :sslPEMKeyPassword,
|
34
|
+
'--sslCRLFile' => :sslCRLFile,
|
35
|
+
'--username' => :username,
|
36
|
+
'--password' => :password,
|
37
|
+
'--authenticationDatabase' => :authenticationDatabase,
|
38
|
+
'--authenticationMechanism' => :authenticationMechanism,
|
39
|
+
'--collection' => :collection,
|
40
|
+
'--fields' => :fields, '--fieldFile' => :fieldFile,
|
41
|
+
'--query' => :query,
|
42
|
+
'--type' => :type, '--out' => :out,
|
43
|
+
'--skip' => :skip, '--limit' => :limit, '--sort' => :sort
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def boolean_options
|
48
|
+
{
|
49
|
+
'--verbose' => :verbose, '--quiet' => :quiet,
|
50
|
+
'--ipv6' => :ipv6, '--ssl' => :ssl,
|
51
|
+
'--sslAllowInvalidCertificates' => :sslAllowInvalidCertificates,
|
52
|
+
'--sslAllowInvalidHostnames' => :sslAllowInvalidHostnames,
|
53
|
+
'--sslFIPSMode' => :sslFIPSMode,
|
54
|
+
'--gssapiServiceName' => :gssapiServiceName,
|
55
|
+
'--gssapiHostName' => :gssapiHostName,
|
56
|
+
'--jsonArray' => :jsonArray,
|
57
|
+
'--pretty' => :pretty,
|
58
|
+
'--slaveOk' => :slaveOk,
|
59
|
+
'--forceTableScan' => :forceTableScan,
|
60
|
+
'--csv' => :csv, # is deprecated from Mongo version 3.0.0, use type instead
|
61
|
+
# these 3 below are deprecated from Mongo version 3.0.0
|
62
|
+
'--directoryperdb' => :directoryperdb,
|
63
|
+
'--journal' => :journal, '--dbpath' => :dbpath
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Mongoid
|
2
|
+
module Shell
|
3
|
+
module Commands
|
4
|
+
class Mongoimport < Mongoid::Shell::Commands::Base
|
5
|
+
include Mongoid::Shell::Properties::Host
|
6
|
+
include Mongoid::Shell::Properties::Database
|
7
|
+
include Mongoid::Shell::Properties::Username
|
8
|
+
include Mongoid::Shell::Properties::Password
|
9
|
+
|
10
|
+
attr_accessor :verbose, :quiet, :port, :ipv6, :ssl, :sslCAFile,
|
11
|
+
:sslPEMKeyFile, :sslPEMKeyPassword, :sslCRLFile,
|
12
|
+
:sslAllowInvalidCertificates, :sslAllowInvalidHostnames, :sslFIPSMode,
|
13
|
+
:authenticationDatabase, :authenticationMechanism, :gssapiServiceName,
|
14
|
+
:gssapiHostName, :collection, :fields, :directoryperdb, :journal, :dbpath,
|
15
|
+
:fieldFile, :ignoreBlanks, :type, :file, :drop, :headerline, :upsert,
|
16
|
+
:upsertFields, :stopOnError, :jsonArray, :maintainInsertionOrder,
|
17
|
+
:numInsertionWorkers, :writeConcern
|
18
|
+
|
19
|
+
def initialize(attrs = {})
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def vargs
|
24
|
+
super({
|
25
|
+
|
26
|
+
})
|
27
|
+
end
|
28
|
+
|
29
|
+
def vargs
|
30
|
+
super var_options.merge(boolean_options)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def var_options
|
36
|
+
{
|
37
|
+
'--db' => :db, '--host' => :host, '--port' => :port,
|
38
|
+
'--sslCAFile' => :sslCAFile,
|
39
|
+
'--sslPEMKeyFile' => :sslPEMKeyFile,
|
40
|
+
'--sslPEMKeyPassword' => :sslPEMKeyPassword,
|
41
|
+
'--sslCRLFile' => :sslCRLFile,
|
42
|
+
'--username' => :username, '--password' => :password,
|
43
|
+
'--authenticationDatabase' => :authenticationDatabase,
|
44
|
+
'--authenticationMechanism' => :authenticationMechanism,
|
45
|
+
'--collection' => :collection, '--fields' => :fields,
|
46
|
+
'--fieldFile' => :fieldFile, '--type' => :type, '--file' => :file,
|
47
|
+
'--upsertFields' => :upsertFields,
|
48
|
+
'--maintainInsertionOrder' => :maintainInsertionOrder,
|
49
|
+
'--numInsertionWorkers' => :numInsertionWorkers,
|
50
|
+
'--writeConcern' => :writeConcern,
|
51
|
+
# these 3 below are deprecated from Mongo version 3.0.0
|
52
|
+
'--directoryperdb' => :directoryperdb,
|
53
|
+
'--journal' => :journal, '--dbpath' => :dbpath
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def boolean_options
|
58
|
+
{
|
59
|
+
'--verbose' => :verbose, '--quiet' => :quiet,
|
60
|
+
'--ipv6' => :ipv6, '--ssl' => :ssl,
|
61
|
+
'--sslAllowInvalidCertificates' => :sslAllowInvalidCertificates,
|
62
|
+
'--sslAllowInvalidHostnames' => :sslAllowInvalidHostnames,
|
63
|
+
'--sslFIPSMode' => :sslFIPSMode,
|
64
|
+
'--gssapiServiceName' => :gssapiServiceName,
|
65
|
+
'--gssapiHostName' => :gssapiHostName,
|
66
|
+
'--ignoreBlanks' => :ignoreBlanks, '--drop' => :drop,
|
67
|
+
'--headerline' => :headerline, '--upsert' => :upsert,
|
68
|
+
'--stopOnError' => :stopOnError, '--jsonArray' => :jsonArray
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mongoid-compatibility
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description:
|
@@ -67,6 +67,8 @@ files:
|
|
67
67
|
- lib/mongoid/shell/commands/base.rb
|
68
68
|
- lib/mongoid/shell/commands/mongo.rb
|
69
69
|
- lib/mongoid/shell/commands/mongodump.rb
|
70
|
+
- lib/mongoid/shell/commands/mongoexport.rb
|
71
|
+
- lib/mongoid/shell/commands/mongoimport.rb
|
70
72
|
- lib/mongoid/shell/commands/mongorestore.rb
|
71
73
|
- lib/mongoid/shell/commands/mongostat.rb
|
72
74
|
- lib/mongoid/shell/errors.rb
|
@@ -92,17 +94,17 @@ require_paths:
|
|
92
94
|
- lib
|
93
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
96
|
requirements:
|
95
|
-
- -
|
97
|
+
- - ">="
|
96
98
|
- !ruby/object:Gem::Version
|
97
99
|
version: '0'
|
98
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
101
|
requirements:
|
100
|
-
- -
|
102
|
+
- - ">="
|
101
103
|
- !ruby/object:Gem::Version
|
102
104
|
version: 1.3.6
|
103
105
|
requirements: []
|
104
106
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.4.
|
107
|
+
rubygems_version: 2.4.8
|
106
108
|
signing_key:
|
107
109
|
specification_version: 4
|
108
110
|
summary: Derive shell commands from Mongoid configuration options.
|