mongo-db-utils 0.0.9.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/mongo-db-utils/cli.rb +18 -13
- data/lib/mongo-db-utils/version.rb +1 -1
- data/mongo-db-utils.gemspec +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4b606d4315fee51104eb916d246ddb99f72f1e7
|
4
|
+
data.tar.gz: 1fa85aef6b8ba85fc9003816104a5fa148f58cfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3b8e02d0069b541d7c65da085dc6df197e4adf96206ec9f54b47e79ae013a115802a5e35b062295eda0a5ed2737d28243f1494853cd34d4cea3a18737ad0f61
|
7
|
+
data.tar.gz: 64fdf69be96e95b613d8daff5ecd81c243d4db1efe10f3f4e03cf862d2b205802df8c75ceefd9ea79ab99bb381106acdffbee5df7f16f4a6eff60e7b64f0712a
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Build Status](https://travis-ci.org/edeustace/mongo-db-utils.png)](https://travis-ci.org/edeustace/mongo-db-utils)
|
4
4
|
|
5
5
|
|
6
|
-
### !Current version 0.0.9.
|
6
|
+
### !Current version 0.0.9.3 is in Beta - for a safer version use 0.0.9
|
7
7
|
|
8
8
|
A little gem that simplifies backing up and copying your mongo dbs.
|
9
9
|
|
@@ -30,7 +30,7 @@ And then execute:
|
|
30
30
|
|
31
31
|
## Limitatons
|
32
32
|
|
33
|
-
ruby >= 1.9.3
|
33
|
+
ruby >= 1.9.3
|
34
34
|
|
35
35
|
## Usage
|
36
36
|
Once you launch the console it'll provide you with a set of options - pretty self explanatory.
|
@@ -55,8 +55,13 @@ When it does backups it stores them in ````~/.mongo-db-utils/backups/````. The n
|
|
55
55
|
|
56
56
|
|
57
57
|
## Release Notes
|
58
|
+
* 0.1.0 - BETA
|
59
|
+
- Fixed CLI backup and backup_s3 not using the config-loader correctly.
|
58
60
|
|
59
|
-
* 0.0.9.
|
61
|
+
* 0.0.9.3 - BETA!
|
62
|
+
- Fixed config-loader require bug
|
63
|
+
|
64
|
+
* 0.0.9.2 - BETA! Warning - there was an error with config loader in this version use 0.0.9.3 instead.
|
60
65
|
- Added support for Replica Sets
|
61
66
|
- console can be run pointing to any config file: `console myconfig.yml`
|
62
67
|
- More specs
|
data/lib/mongo-db-utils/cli.rb
CHANGED
@@ -9,44 +9,49 @@ require 'mongo-db-utils/s3'
|
|
9
9
|
module MongoDbUtils
|
10
10
|
class CLI < Thor
|
11
11
|
|
12
|
+
include MongoDbUtils
|
13
|
+
|
12
14
|
desc "console", "run the interactive console @param path - path to config file"
|
13
|
-
def console(path =
|
15
|
+
def console(path = ConfigLoader::CONFIG_LOCATION)
|
14
16
|
|
15
17
|
if File.extname(path) != ".yml"
|
16
18
|
puts "Error: You must use a yaml file as your config file location"
|
17
19
|
else
|
18
|
-
|
19
|
-
|
20
|
-
console = MongoDbUtils::Console.new(@config, MongoDbUtils::Cmd)
|
20
|
+
config = get_config(path)
|
21
|
+
console = Console.new(config, Cmd)
|
21
22
|
console.run
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
desc "backup MONGO_URI", "backup a db with a mongo uri eg: mongodb://user:pass@server:port/dbname"
|
26
27
|
def backup(mongo_uri, replica_set_name = nil)
|
27
|
-
|
28
|
-
|
28
|
+
config = get_config
|
29
29
|
db = get_db(mongo_uri, replica_set_name)
|
30
30
|
raise "can't parse uri" if db.nil?
|
31
|
-
|
31
|
+
Cmd.backup(db, config.backup_folder)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
34
|
desc "backup_s3 MONGO_URI BUCKET ACCESS_KEY SECRET_ACCESS_KEY", "backup a db to Amason s3 with a mongo uri eg: mongodb://user:pass@server:port/dbname"
|
36
35
|
def backup_s3(mongo_uri, bucket_name, access_key_id, secret_access_key, replica_set_name = nil)
|
37
|
-
|
38
|
-
backup_folder =
|
36
|
+
config = get_config
|
37
|
+
backup_folder = config.backup_folder
|
39
38
|
db = get_db(mongo_uri, replica_set_name)
|
40
39
|
raise "can't parse uri" if db.nil?
|
41
|
-
|
40
|
+
Cmd.backup_s3(backup_folder, db, bucket_name, access_key_id, secret_access_key)
|
42
41
|
end
|
43
42
|
|
44
43
|
private
|
44
|
+
|
45
|
+
def get_config(path = ConfigLoader::CONFIG_LOCATION)
|
46
|
+
loader = ConfigLoader.new(path)
|
47
|
+
loader.config
|
48
|
+
end
|
49
|
+
|
45
50
|
def get_db(uri, name = nil)
|
46
51
|
if(name.nil?)
|
47
|
-
|
52
|
+
Model::Db.new(uri)
|
48
53
|
else
|
49
|
-
|
54
|
+
Model::ReplicaSetDb.new(uri, name)
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
data/mongo-db-utils.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_development_dependency "rspec", "~> 2.6"
|
19
19
|
gem.add_development_dependency "cucumber"
|
20
20
|
gem.add_development_dependency "aruba"
|
21
|
+
gem.add_development_dependency "rake", "~> 10.1.0"
|
21
22
|
gem.add_dependency "highline", "~> 1.6.13"
|
22
23
|
gem.add_dependency "thor"
|
23
24
|
gem.add_dependency "mongo", "1.9.0"
|
@@ -25,4 +26,5 @@ Gem::Specification.new do |gem|
|
|
25
26
|
gem.add_dependency "bson_ext", "1.9.0"
|
26
27
|
gem.add_dependency "aws-s3", "~> 0.6.3"
|
27
28
|
|
29
|
+
|
28
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo-db-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- edeustace
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 10.1.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 10.1.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: highline
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|