dbsync 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +64 -0
- data/dbsync.gemspec +16 -18
- data/lib/dbsync/version.rb +1 -1
- metadata +26 -11
- data/README.rdoc +0 -48
data/README.markdown
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# dbsync
|
2
|
+
|
3
|
+
A set of rake tasks to help you sync your production
|
4
|
+
data with your local database for development.
|
5
|
+
|
6
|
+
Currently only supports:
|
7
|
+
* Rails
|
8
|
+
* MySQL
|
9
|
+
|
10
|
+
Support for more things will happen if anybody needs it.
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Add to your gemfile for the groups that will need it:
|
15
|
+
|
16
|
+
group :development, :staging do
|
17
|
+
gem 'dbsync'
|
18
|
+
end
|
19
|
+
|
20
|
+
Add the following to your `config/environments/development.rb`
|
21
|
+
file. Depending on your staging setup, it may also be useful
|
22
|
+
to you to add some `dbsync` config to your `staging.rb`
|
23
|
+
environment file. **Note** `dbsync` will not run in production.
|
24
|
+
|
25
|
+
config.dbsync = ActiveSupport::OrderedOptions.new
|
26
|
+
|
27
|
+
config.dbsync.filename = "yourapp_production_data.dump" # The name of the remote dumpfile
|
28
|
+
config.dbsync.local_dir = "#{Rails.root}/../dbsync" # The local directory to store the dump file. No trailing slash
|
29
|
+
config.dbsync.remote_host = "66.123.4.567" # Remote server where the dumpfile is
|
30
|
+
config.dbsync.remote_dir = "~dbsync" # The directory on the remote server where the dumpfile is
|
31
|
+
|
32
|
+
Now just make sure you have something on the remote
|
33
|
+
server updating that dumpfile. I recommend a cronjob:
|
34
|
+
|
35
|
+
0 */12 * * * /usr/bin/mysqldump yourapp_production > /home/dbsync/yourapp_production_data.dump
|
36
|
+
|
37
|
+
|
38
|
+
You will need proper SSH access into the remote server,
|
39
|
+
as the tasks use `rsync` and `scp` directly.
|
40
|
+
|
41
|
+
Run `rake -T dbsync` for all of the available tasks. The
|
42
|
+
tasks are named after `git` commands mostly, so they
|
43
|
+
should be pretty straight-forward for those who use `git`:
|
44
|
+
|
45
|
+
rake dbsync # Alias for dbsync:pull
|
46
|
+
rake dbsync:clone # Copy the remote dump file, reset the local database, and load in the dump file
|
47
|
+
rake dbsync:clone_dump # Copy the remote dump file to a local destination
|
48
|
+
rake dbsync:config # Show the dbsync configuration
|
49
|
+
rake dbsync:fetch # Update the local dump file from the remote source
|
50
|
+
rake dbsync:merge # Merge the local dump file into the local database
|
51
|
+
rake dbsync:pull # Update the local dump file, and merge it into the local database
|
52
|
+
rake dbsync:reset # Drop & Create the database, then load the dump file.
|
53
|
+
|
54
|
+
### TODO
|
55
|
+
|
56
|
+
- Specs!
|
57
|
+
|
58
|
+
### Copyright
|
59
|
+
|
60
|
+
Copyright (c) 2012 Bryan Ricker/SCPR.
|
61
|
+
|
62
|
+
### Licence
|
63
|
+
|
64
|
+
See MIT-LICENSE for more.
|
data/dbsync.gemspec
CHANGED
@@ -2,25 +2,23 @@
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "dbsync/version"
|
4
4
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "dbsync"
|
7
|
+
gem.version = Dbsync::VERSION
|
8
|
+
gem.authors = ["Bryan Ricker"]
|
9
|
+
gem.email = ["bricker88@gmail.com"]
|
10
|
+
gem.description = %q{A set of rake tasks to help you sync your remote production data with your local database for development.}
|
11
|
+
gem.summary = %q{Easy syncing from remote to development database in Rails.}
|
12
|
+
gem.homepage = "http://github.com/bricker/dbsync"
|
13
13
|
|
14
|
-
|
14
|
+
gem.rubyforge_project = "dbsync"
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
gem.require_paths = ["lib", "lib/tasks"]
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
s.add_runtime_dependency "activerecord", "~> 3.2.8"
|
25
|
-
s.add_runtime_dependency "railties", "~> 3.2.8"
|
21
|
+
gem.add_runtime_dependency "activesupport", "~> 3.2.8"
|
22
|
+
gem.add_runtime_dependency "activerecord", "~> 3.2.8"
|
23
|
+
gem.add_runtime_dependency "railties", "~> 3.2.8"
|
26
24
|
end
|
data/lib/dbsync/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.2.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.8
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: activerecord
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 3.2.8
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.2.8
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: railties
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: 3.2.8
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.2.8
|
47
62
|
description: A set of rake tasks to help you sync your remote production data with
|
48
63
|
your local database for development.
|
49
64
|
email:
|
@@ -55,13 +70,13 @@ files:
|
|
55
70
|
- .gitignore
|
56
71
|
- Gemfile
|
57
72
|
- MIT-LICENSE
|
58
|
-
- README.
|
73
|
+
- README.markdown
|
59
74
|
- Rakefile
|
60
75
|
- dbsync.gemspec
|
61
76
|
- lib/dbsync.rb
|
62
77
|
- lib/dbsync/version.rb
|
63
78
|
- lib/tasks/dbsync.rake
|
64
|
-
homepage: http://github.com/
|
79
|
+
homepage: http://github.com/bricker/dbsync
|
65
80
|
licenses: []
|
66
81
|
post_install_message:
|
67
82
|
rdoc_options: []
|
@@ -82,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
97
|
version: '0'
|
83
98
|
requirements: []
|
84
99
|
rubyforge_project: dbsync
|
85
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.24
|
86
101
|
signing_key:
|
87
102
|
specification_version: 3
|
88
103
|
summary: Easy syncing from remote to development database in Rails.
|
data/README.rdoc
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
= dbsync
|
2
|
-
|
3
|
-
A set of rake tasks to help you sync your production
|
4
|
-
data with your local database for development.
|
5
|
-
|
6
|
-
Currently only supports:
|
7
|
-
* Rails
|
8
|
-
* MySQL
|
9
|
-
|
10
|
-
Support for more things will happen if anybody needs it.
|
11
|
-
|
12
|
-
Add the following to your +config/environments/development.rb+
|
13
|
-
file:
|
14
|
-
config.dbsync = ActiveSupport::OrderedOptions.new
|
15
|
-
|
16
|
-
config.dbsync.filename = "yourapp_production_data.dump" # The name of the remote dumpfile
|
17
|
-
config.dbsync.local_dir = "#{Rails.root}/../dbsync" # The local directory to store the dump file. No trailing slash
|
18
|
-
config.dbsync.remote_host = "66.123.4.567" # Remote server where the dumpfile is
|
19
|
-
config.dbsync.remote_dir = "~dbsync" # The directory on the remote server where the dumpfile is
|
20
|
-
|
21
|
-
Now just make sure you have something on the remote
|
22
|
-
server updating that dumpfile. I recommend a cronjob:
|
23
|
-
0 */12 * * * /usr/bin/mysqldump yourapp_production > /home/dbsync/yourapp_production_data.dump
|
24
|
-
|
25
|
-
You will need proper SSH access into the remote server,
|
26
|
-
as the tasks use +rsync+ and +scp+ directly.
|
27
|
-
|
28
|
-
Run +rake -T dbsync+ for all of the available tasks:
|
29
|
-
rake dbsync # Alias for dbsync:pull
|
30
|
-
rake dbsync:clone # Copy the remote dump file, reset the local database, and load in the dump file
|
31
|
-
rake dbsync:clone_dump # Copy the remote dump file to a local destination
|
32
|
-
rake dbsync:config # Show the dbsync configuration
|
33
|
-
rake dbsync:fetch # Update the local dump file from the remote source
|
34
|
-
rake dbsync:merge # Merge the local dump file into the local database
|
35
|
-
rake dbsync:pull # Update the local dump file, and merge it into the local database
|
36
|
-
rake dbsync:reset # Drop & Create the database, then load the dump file.
|
37
|
-
|
38
|
-
== TODO
|
39
|
-
|
40
|
-
- Specs!
|
41
|
-
|
42
|
-
== Copyright
|
43
|
-
|
44
|
-
Copyright (c) 2012 Bryan Ricker/SCPR.
|
45
|
-
|
46
|
-
== Licence
|
47
|
-
|
48
|
-
See MIT-LICENSE for more.
|