dbmanager 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## v0.0.5
2
+
3
+ * remove exception when dbmanager.yml is empty
4
+
5
+ ## v0.0.4
6
+
7
+ * bugfixes
8
+
9
+ ## v0.0.3
10
+
11
+ * allow skipping tables
12
+
1
13
  ## v0.0.1
2
14
 
3
15
  * initial release
data/README.md CHANGED
@@ -30,6 +30,7 @@ that will copy the gem rake tasks file into the lib/tasks directory.
30
30
  ```ruby
31
31
  rake db:dump
32
32
  ```
33
+ This rake task will dump the requested db to a file on the local machine.
33
34
 
34
35
  You will be prompted to choose the target dir (defaults to tmp) and the sql file
35
36
  name (sql extension will be added automatically). If the file already exists, it
@@ -42,6 +43,9 @@ will be overwritten.
42
43
  rake db:import
43
44
  ```
44
45
 
46
+ This task will import a source db to a destination db. Tipical use is to import
47
+ the production db into your development one.
48
+
45
49
  You will be prompted to choose the source and the target environment db, and the
46
50
  source db will be imported into the target db. All environments containing the
47
51
  string 'production' in their name are protected by default, which means you cannot
@@ -64,7 +68,7 @@ You can also use this file to tell the dumper to ignore certain tables with
64
68
  the ignoretables directive:
65
69
 
66
70
  ```yaml
67
- beta
71
+ beta:
68
72
  ignoretables:
69
73
  - users
70
74
  - prods_view
@@ -98,4 +102,3 @@ production:
98
102
  ### TODO
99
103
 
100
104
  * Add more db adapters
101
- * remove views from mysql dumps so they don't interfere in the import process
@@ -1,3 +1,3 @@
1
1
  module Dbmanager
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -36,7 +36,7 @@ module Dbmanager
36
36
  private
37
37
 
38
38
  def yml_load(path)
39
- YAML.load ERB.new(File.read(path)).result
39
+ YAML.load(ERB.new(File.read(path)).result) || {}
40
40
  end
41
41
 
42
42
  def db_config_file
@@ -39,17 +39,26 @@ module Dbmanager
39
39
  end
40
40
 
41
41
  context 'when there is a dbmanager_override file' do
42
- it 'overrides regular settings' do
43
- YmlParser.config['beta']['host'].should == '345.345.345.345'
42
+ context 'whe the file is empty' do
43
+ it 'doesnt raise any error' do
44
+ YAML.stub!(:load => nil)
45
+ expect { YmlParser.config }.to_not raise_error
46
+ end
44
47
  end
45
48
 
46
- it 'removes old unchanged settings' do
47
- YmlParser.config['beta']['username'].should == 'beta_username'
48
- end
49
+ context 'when the file is populated' do
50
+ it 'overrides regular settings' do
51
+ YmlParser.config['beta']['host'].should == '345.345.345.345'
52
+ end
53
+
54
+ it 'removes old unchanged settings' do
55
+ YmlParser.config['beta']['username'].should == 'beta_username'
56
+ end
49
57
 
50
- context 'when the environment has a ignoretables directive' do
51
- it 'should populate ignoretables with the expected array' do
52
- YmlParser.config['beta']['ignoretables'].should == ['view0']
58
+ context 'when the environment has a ignoretables directive' do
59
+ it 'should populate ignoretables with the expected array' do
60
+ YmlParser.config['beta']['ignoretables'].should == ['view0']
61
+ end
53
62
  end
54
63
  end
55
64
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dbmanager
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - andrea longhi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-04-05 00:00:00 Z
13
+ date: 2012-04-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport