dumper 1.5.0 → 1.6.0

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: b16439142fa2a5ef2a1dec86b7eee1d15608d1c2
4
- data.tar.gz: 0561661bc427fcf22528f477072a2997165a7c22
3
+ metadata.gz: 8ddcc886bc80c09614b912f249e2e1c96de04361
4
+ data.tar.gz: 55fb944b5d106efcd0b43f612e994cc2b8fb15dc
5
5
  SHA512:
6
- metadata.gz: 1b9d2bcb26049fa2e3c4df9aaa9cfe3b97ce2a9b9fa085066f3496766e29e953bf36cb5d4a3013d4aae5225a217337733708eba356aa245ca5c41bb60d26a006
7
- data.tar.gz: 97bb1279b84d2bafcc6fa84f191233acbd37d3d9d6e0bc34d2f2abdd56074cc046a270f9ed7b9a6adbf7b5ef439058a86046c008a01718651d9e88a3d6c7b424
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
+ ```
@@ -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::FILE_EXT
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
- FILE_EXT = 'tar.gz'
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
- FILE_EXT = 'sql.gz'
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
- FILE_EXT = 'sql.gz'
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
@@ -2,7 +2,7 @@ module Dumper
2
2
  module Database
3
3
  class Redis < Base
4
4
  DUMP_TOOL = 'redis-cli'
5
- FILE_EXT = 'rdb.gz'
5
+ FORMAT = 'rdb'
6
6
 
7
7
  def command
8
8
  uncompressed = filename.sub('.gz','')
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Dumper
2
- VERSION = '1.5.0'
2
+ VERSION = '1.6.0'
3
3
  end
@@ -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).should be_true
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.should == :rails
31
- stack.rails_env.should == 'development'
30
+ expect(stack.framework).to eq(:rails)
31
+ expect(stack.rails_env).to eq('development')
32
32
  end
33
33
 
34
- it 'detects mongoid 3' do
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].should_not == nil
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].should_not == nil
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].should_not == nil
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].should_not == nil
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].should_not == nil
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.5.0
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-03-08 00:00:00.000000000 Z
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.0.rc.1
191
+ rubygems_version: 2.2.2
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: The Dumper Agent for Rails