dumper 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/dumper/database/base.rb +2 -2
- data/lib/dumper/database/mongodb.rb +2 -2
- data/lib/dumper/database/mysql.rb +2 -2
- data/lib/dumper/database/postgresql.rb +2 -2
- data/lib/dumper/database/redis.rb +1 -1
- data/lib/dumper/stack.rb +4 -0
- data/lib/dumper/version.rb +1 -1
- data/spec/dumper_spec.rb +9 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ddcc886bc80c09614b912f249e2e1c96de04361
|
4
|
+
data.tar.gz: 55fb944b5d106efcd0b43f612e994cc2b8fb15dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da24a826a085f9d4820f75a70e9f7eb9dd1682eaee4ffd4ce44290a7ac64e0c5f6c4c19dc5a63e689ae881ebc2d3ef47052f5b8d30e3f12cc79490037c9effc
|
7
|
+
data.tar.gz: c0b5852129da910212d5d8aca0008422981b33a913764170b8665e49324d54ddfe19fd2e18414d6182281dc44406470db41917e5d24f699fbfcaefab82949bcd
|
data/README.md
CHANGED
@@ -82,3 +82,17 @@ Dumper::Agent.start(app_key: 'YOUR_APP_KEY', debug: true)
|
|
82
82
|
```
|
83
83
|
|
84
84
|
It gives verbose logging that helps us to understand the problem.
|
85
|
+
|
86
|
+
## Custom Options
|
87
|
+
|
88
|
+
You can also pass custom dump options, with `custom_options` and `format` for the database type.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
Dumper::Agent.start(
|
92
|
+
app_key: 'YOUR_APP_KEY',
|
93
|
+
postgresql: {
|
94
|
+
format: 'dump',
|
95
|
+
custom_options: '-Fc --no-acl --no-owner'
|
96
|
+
}
|
97
|
+
)
|
98
|
+
```
|
data/lib/dumper/database/base.rb
CHANGED
@@ -3,10 +3,10 @@ module Dumper
|
|
3
3
|
class Base
|
4
4
|
include Dumper::Utility::ObjectFinder
|
5
5
|
|
6
|
-
attr_accessor :tmpdir, :filename, :config
|
6
|
+
attr_accessor :tmpdir, :filename, :config, :custom_options, :format
|
7
7
|
|
8
8
|
def file_ext
|
9
|
-
self.class::
|
9
|
+
(format || self.class::FORMAT) + '.gz'
|
10
10
|
end
|
11
11
|
|
12
12
|
def dump_path
|
@@ -2,10 +2,10 @@ module Dumper
|
|
2
2
|
module Database
|
3
3
|
class MongoDB < Base
|
4
4
|
DUMP_TOOL = 'mongodump'
|
5
|
-
|
5
|
+
FORMAT = 'tar'
|
6
6
|
|
7
7
|
def command
|
8
|
-
"cd #{tmpdir} && #{dump_tool_path} #{connection_options} #{additional_options} && tar -czf #{filename} --exclude='#{filename}' ."
|
8
|
+
"cd #{tmpdir} && #{dump_tool_path} #{connection_options} #{additional_options} #{custom_options} && tar -czf #{filename} --exclude='#{filename}' ."
|
9
9
|
end
|
10
10
|
|
11
11
|
def connection_options
|
@@ -2,10 +2,10 @@ module Dumper
|
|
2
2
|
module Database
|
3
3
|
class MySQL < Base
|
4
4
|
DUMP_TOOL = 'mysqldump'
|
5
|
-
|
5
|
+
FORMAT = 'sql'
|
6
6
|
|
7
7
|
def command
|
8
|
-
"cd #{tmpdir} && #{dump_tool_path} #{connection_options} #{additional_options} #{@config[:database]} | gzip > #{filename}"
|
8
|
+
"cd #{tmpdir} && #{dump_tool_path} #{connection_options} #{additional_options} #{custom_options} #{@config[:database]} | gzip > #{filename}"
|
9
9
|
end
|
10
10
|
|
11
11
|
def connection_options
|
@@ -2,10 +2,10 @@ module Dumper
|
|
2
2
|
module Database
|
3
3
|
class PostgreSQL < Base
|
4
4
|
DUMP_TOOL = 'pg_dump'
|
5
|
-
|
5
|
+
FORMAT = 'sql'
|
6
6
|
|
7
7
|
def command
|
8
|
-
"cd #{tmpdir} && #{password_variable} #{dump_tool_path} #{connection_options} #{@config[:database]} | gzip > #{filename}"
|
8
|
+
"cd #{tmpdir} && #{password_variable} #{dump_tool_path} #{connection_options} #{custom_options} #{@config[:database]} | gzip > #{filename}"
|
9
9
|
end
|
10
10
|
|
11
11
|
def connection_options
|
data/lib/dumper/stack.rb
CHANGED
@@ -34,6 +34,10 @@ module Dumper
|
|
34
34
|
DATABASES.each do |key, klass|
|
35
35
|
database = klass.new
|
36
36
|
next unless database.set_config_for(@rails_env) || database.set_config_for(options[:additional_env])
|
37
|
+
if options[key].is_a?(Hash)
|
38
|
+
database.custom_options = options[key][:custom_options]
|
39
|
+
database.format = options[key][:format]
|
40
|
+
end
|
37
41
|
@databases[key] = database
|
38
42
|
end
|
39
43
|
|
data/lib/dumper/version.rb
CHANGED
data/spec/dumper_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rails'
|
|
4
4
|
|
5
5
|
describe Dumper do
|
6
6
|
it 'conforms to public API' do
|
7
|
-
Dumper::Agent.respond_to?(:start).
|
7
|
+
expect(Dumper::Agent.respond_to?(:start)).to be_truthy
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'loads everything' do
|
@@ -27,16 +27,16 @@ describe Dumper do
|
|
27
27
|
describe :Stack do
|
28
28
|
it 'initializes stack' do
|
29
29
|
stack = Dumper::Stack.new
|
30
|
-
stack.framework.
|
31
|
-
stack.rails_env.
|
30
|
+
expect(stack.framework).to eq(:rails)
|
31
|
+
expect(stack.rails_env).to eq('development')
|
32
32
|
end
|
33
33
|
|
34
|
-
it 'detects mongoid
|
34
|
+
it 'detects mongoid' do
|
35
35
|
require 'mongoid'
|
36
36
|
Mongoid::Config.send :load_configuration, { sessions: { default: { hosts: ['localhost:27017'], database: 'test' } } }
|
37
37
|
|
38
38
|
stack = Dumper::Stack.new
|
39
|
-
stack.databases[:mongodb].
|
39
|
+
expect(stack.databases[:mongodb]).not_to eq(nil)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'detects mongo_mapper' do
|
@@ -45,7 +45,7 @@ describe Dumper do
|
|
45
45
|
MongoMapper.database
|
46
46
|
|
47
47
|
stack = Dumper::Stack.new
|
48
|
-
stack.databases[:mongodb].
|
48
|
+
expect(stack.databases[:mongodb]).not_to eq(nil)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'detects mysql' do
|
@@ -53,7 +53,7 @@ describe Dumper do
|
|
53
53
|
ActiveRecord::Base.configurations['development'] = { 'adapter' => 'mysql2' }
|
54
54
|
|
55
55
|
stack = Dumper::Stack.new
|
56
|
-
stack.databases[:mysql].
|
56
|
+
expect(stack.databases[:mysql]).not_to eq(nil)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'detects postgresql' do
|
@@ -61,7 +61,7 @@ describe Dumper do
|
|
61
61
|
ActiveRecord::Base.configurations['development'] = { 'adapter' => 'postgresql' }
|
62
62
|
|
63
63
|
stack = Dumper::Stack.new
|
64
|
-
stack.databases[:postgresql].
|
64
|
+
expect(stack.databases[:postgresql]).not_to eq(nil)
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'detects redis' do
|
@@ -69,7 +69,7 @@ describe Dumper do
|
|
69
69
|
redis = Redis.new
|
70
70
|
|
71
71
|
stack = Dumper::Stack.new
|
72
|
-
stack.databases[:redis].
|
72
|
+
expect(stack.databases[:redis]).not_to eq(nil)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenn Ejima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.2.
|
191
|
+
rubygems_version: 2.2.2
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: The Dumper Agent for Rails
|