mongo_sync 0.1.1 → 0.1.2

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: 02b246444c20f0a2d3b86ebba7c368f96811e58f
4
- data.tar.gz: a9ab33f1c9e0a2c3db648abf4555f321e1434860
3
+ metadata.gz: e8465776703c0c1d48a595cb27c8e5bce56fb0c7
4
+ data.tar.gz: edf1461081606f6a6573fbdaef2a883ee34804c3
5
5
  SHA512:
6
- metadata.gz: 9e17dc26dbfb7343cbbdc7a9cc5dceea1633afd2eab7aacdd6047e0733fae63384f822489e422dc15989a340ed12c2783ab08e5b490a2f3a48f8671b8a0e5166
7
- data.tar.gz: 53da72230fb5985f6967169a1a630de0c8a10ecc4f329af4d4281b8ede384e57a901abb4b7a07cd8e6b601ac21f7cee3279bee39d816f89080757b9530ef1519
6
+ metadata.gz: 8e1338e1f0cf1b6bb3c15dbf536a40762819970537947eb152f3507f58abde773e4870141d54f67200a3ff627f5c975ae25c70b92a1f187e067b081028ee59fc
7
+ data.tar.gz: f25459fd62dc93b501fcfe178585e5c2ad12d13f551d81c727d2513f7d690c8397964ca42ae3c1be5a691d3a58af21f0d24ebb96c588b23645857e5f5f1a6fab
data/README.md CHANGED
@@ -1,30 +1,148 @@
1
- mongo_sync
2
- ==========
1
+ MongoSync
2
+ =========
3
+
4
+ > Sync Remote and Local MongoDB Databases in Ruby! Works with MongoHQ/Compose, MongoLab and other Heroku-hosted MongoDBs too!
5
+
6
+ Based on my [mongo-sync](https://github.com/sheharyarn/mongo-sync) shell script.
3
7
 
4
- > Sync Remote and Local MongoDB Databases in Ruby!
5
8
 
6
9
  ## Installation
7
10
 
8
11
  Add this line to your application's Gemfile:
9
12
 
13
+ ```ruby
14
+ group :development do
10
15
  gem 'mongo_sync'
16
+ end
17
+ ```
11
18
 
12
19
  And then execute:
13
20
 
14
- $ bundle
21
+ ```bash
22
+ $ bundle
23
+ ```
15
24
 
16
25
  Or install it yourself as:
17
26
 
18
- $ gem install mongo_sync
27
+ ```bash
28
+ $ gem install mongo_sync
29
+ ```
30
+
19
31
 
20
32
  ## Usage
21
33
 
22
- TODO: Write usage instructions here
34
+ ### Rails
35
+
36
+ In Rails, run this generator to set up a `mongo_sync.yml` configuration template:
37
+
38
+ ```bash
39
+ rails g mongo_sync:config
40
+ ```
41
+
42
+ Now edit the newly created `config/mongo_sync.yml`, putting in details of your remote and local DBs:
43
+
44
+ ```yaml
45
+ local:
46
+ db: 'local_db_name'
47
+
48
+ remote:
49
+ db: 'remote_db_name'
50
+ host:
51
+ url: 'some.remoteurl.com'
52
+ port: 27017
53
+ access:
54
+ username: 'remote_mongo_user'
55
+ password: 'remote_mongo_pass'
56
+
57
+ # For Heroku MongoDB URLs, here's the legend:
58
+ # mongodb://username:password@hosturl.com:port/db_name
59
+
60
+ # All fields are required
61
+ ```
62
+
63
+ Now, to start syncing, use these rake tasks:
64
+
65
+ ```sh
66
+ rake mongo_sync:push # Push DB to Remote
67
+ rake mongo_sync:pull # Pull DB to Local
68
+ ```
69
+
70
+ ### Non-Rails
71
+
72
+ 1. Create a `mongo_sync.yml` in your project.
73
+ 2. In your project, add this:
74
+
75
+ ```ruby
76
+ require 'rake'
77
+ require 'mongo_sync'
78
+ load 'tasks/mongo_sync.rake'
79
+ ```
80
+
81
+ 3. Pass the path of your config file in the tasks:
82
+
83
+ ```sh
84
+ rake mongo_sync:push['path/to/mongo_sync.yml']
85
+ ```
86
+
87
+ ### Console / Command-line
88
+
89
+ ```ruby
90
+ require 'mongo_sync'
91
+
92
+ # Looks for config/mongo_sync.yml - Rails only
93
+ MongoSync.pull
94
+
95
+ # You can pass path of your config file as well
96
+ MongoSync.push "path/to/mongo_sync.yml"
97
+ ```
98
+
99
+
100
+ ## Notes
101
+
102
+ - Pushing/Pulling overwrites the Target DB
103
+ - It's a good idea to keep your `mongo_sync.yml` in `.gitignore` or load the values from the `ENV`
104
+
105
+
106
+ ## TODO
107
+
108
+ - Add more options and ways to enter DB details in `mongo_sync.yml`
109
+ - Add a `backup` command/task and an `auto-backup` feature
110
+ - Write Tests
111
+ - Add a `no-overwrite` feature, so that it doesn't drop the target DB before restoring it, and _actually_ tries to sync it
112
+
23
113
 
24
114
  ## Contributing
25
115
 
26
- 1. Fork it ( http://github.com/<my-github-username>/mongo_sync/fork )
27
- 2. Create your feature branch (`git checkout -b my-new-feature`)
116
+ 1. [Fork it](https://github.com/sheharyarn/mongo-sync-ruby/fork)
117
+ 2. Create your feature/fix branch (`git checkout -b feature/my-feature`)
28
118
  3. Commit your changes (`git commit -am 'Add some feature'`)
29
- 4. Push to the branch (`git push origin my-new-feature`)
30
- 5. Create new Pull Request
119
+ 4. Push to the branch (`git push origin feature/my-feature`)
120
+ 5. Create a new Pull Request
121
+
122
+
123
+ ## License
124
+
125
+ Copyright (c) 2015 Sheharyar Naseer
126
+
127
+ MIT License
128
+
129
+ Permission is hereby granted, free of charge, to any person obtaining
130
+ a copy of this software and associated documentation files (the
131
+ "Software"), to deal in the Software without restriction, including
132
+ without limitation the rights to use, copy, modify, merge, publish,
133
+ distribute, sublicense, and/or sell copies of the Software, and to
134
+ permit persons to whom the Software is furnished to do so, subject to
135
+ the following conditions:
136
+
137
+ The above copyright notice and this permission notice shall be
138
+ included in all copies or substantial portions of the Software.
139
+
140
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
141
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
142
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
143
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
144
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
145
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
146
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
147
+
148
+
@@ -1,3 +1,3 @@
1
1
  module MongoSync
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,4 +1,4 @@
1
- namespace :mongosync do
1
+ namespace :mongo_sync do
2
2
 
3
3
  desc "Push DB to Remote from Local"
4
4
  task :push, [:config] => :environment do |t, args|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheharyar Naseer