db2fog 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/HISTORY +2 -0
  2. data/README.rdoc +23 -4
  3. data/lib/db2fog.rb +17 -4
  4. metadata +74 -113
data/HISTORY CHANGED
@@ -1,3 +1,5 @@
1
+ v0.6.0 (24th October 2011)
2
+ - Support for postgresql 8
1
3
  v0.5.4 (17th October 2011)
2
4
  - only clean files that were created by db2fog
3
5
  v0.5.3 (12th October 2011)
@@ -1,10 +1,10 @@
1
1
  = DB2Fog
2
2
 
3
- A rails plugin to backup Mysql to a cloud storage provider. You're looking at
3
+ A rails plugin to backup Mysql or PostgreSQL to a cloud storage provider. You're looking at
4
4
  a monthly spend of four cents. So pony up you cheap bastard, and store your
5
5
  backups offsite.
6
6
 
7
- A grandfather style system is decides what backups to keep copies of:
7
+ A grandfather style system is used to decide what backups to keep copies of:
8
8
 
9
9
  * all backups from the past 24 hours
10
10
  * one backup per day for the past week
@@ -53,6 +53,24 @@ providers they should work with just a config change to Db2Fog.
53
53
  :provider => 'Local'
54
54
  }
55
55
 
56
+ == Passing options to the database driver
57
+
58
+ Database adaptors may support further configuration via the :database_options hash.
59
+
60
+ DB2Fog.config = {
61
+ :directory => 'bucket-name',
62
+ :local_root => Rails.root.to_s + '/db/backups',
63
+ :provider => 'Local',
64
+ :database_options => {
65
+ :pg_version => 8
66
+ }
67
+ }
68
+
69
+ Supported database options:
70
+
71
+ pg_version 8 or 9
72
+ The major version of PostgreSQL installed on the server. Defaults to 9.
73
+
56
74
  == Usage
57
75
 
58
76
  # Add to your crontab or whatever
@@ -66,12 +84,13 @@ providers they should work with just a config change to Db2Fog.
66
84
 
67
85
  This is pure so ruby should run on most ruby VMs. I develop on MRI 1.9.2.
68
86
 
69
- This will only work work with rails 3. Supporting earlier versions is more
87
+ This will only work with rails 3. Supporting earlier versions is more
70
88
  complication than I feel like handling at the moment.
71
89
 
72
90
  == Development
73
91
 
74
- Specs are really weak. This code is bit hackish but is being used by quite a few people.
92
+ Specs are a little weak and mysql based. This code is bit hackish but is being
93
+ used by quite a few people.
75
94
 
76
95
  == Kudos
77
96
 
@@ -141,24 +141,37 @@ class DB2Fog
141
141
  def pg_dump_options
142
142
  cmd = ''
143
143
  cmd += " -U #{@credentials[:username]} " unless @credentials[:username].nil?
144
- cmd += " -w"
145
144
  cmd += " -h '#{@credentials[:host]}'" unless @credentials[:host].nil?
145
+ cmd += " -w" if pg_version >= 9
146
146
  cmd += " #{@credentials[:database]}"
147
147
  end
148
148
 
149
149
  def psql_options
150
150
  cmd = ''
151
151
  cmd += " -U #{@credentials[:username]} " unless @credentials[:username].nil?
152
- cmd += " -w"
153
152
  cmd += " -h '#{@credentials[:host]}'" unless @credentials[:host].nil?
153
+ cmd += " -w" if pg_version >= 9
154
154
  cmd += " -d #{@credentials[:database]}"
155
155
  end
156
156
 
157
+ def pg_version
158
+ opts = database_options || {}
159
+ opts[:pg_version] || 9
160
+ end
161
+
157
162
  def run(command)
158
163
  result = system(command)
159
164
  raise("error, process exited with status #{$?.exitstatus}") unless result
160
165
  end
161
166
 
167
+ def database_options
168
+ if DB2Fog.config.respond_to?(:[])
169
+ DB2Fog.config[:database_options]
170
+ else
171
+ raise "DB2Fog not configured"
172
+ end
173
+ end
174
+
162
175
  end
163
176
 
164
177
  class FogStore
@@ -188,7 +201,7 @@ class DB2Fog
188
201
 
189
202
  def fog_options
190
203
  if DB2Fog.config.respond_to?(:[])
191
- DB2Fog.config.except(:directory)
204
+ DB2Fog.config.except(:directory, :database_options)
192
205
  else
193
206
  raise "DB2Fog not configured"
194
207
  end
@@ -196,7 +209,7 @@ class DB2Fog
196
209
 
197
210
  def directory_name
198
211
  if DB2Fog.config.respond_to?(:[])
199
- DB2Fog.config[:directory]
212
+ DB2Fog.config[:directory]
200
213
  else
201
214
  raise "DB2Fog not configured"
202
215
  end
metadata CHANGED
@@ -1,171 +1,132 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: db2fog
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 5
8
- - 4
9
- version: 0.5.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - James Healy
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-10-17 00:00:00 +11:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rails
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &23501480 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 0
31
- version: "3.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: activerecord
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *23501480
25
+ - !ruby/object:Gem::Dependency
26
+ name: activerecord
27
+ requirement: &24626880 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
29
+ requirements:
40
30
  - - ~>
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 3
44
- - 0
45
- version: "3.0"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
46
33
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: fog
50
34
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *24626880
36
+ - !ruby/object:Gem::Dependency
37
+ name: fog
38
+ requirement: &24678760 !ruby/object:Gem::Requirement
52
39
  none: false
53
- requirements:
40
+ requirements:
54
41
  - - ~>
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 1
58
- - 0
59
- version: "1.0"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
60
44
  type: :runtime
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: rake
64
45
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *24678760
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: &24690660 !ruby/object:Gem::Requirement
66
50
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
73
55
  type: :development
74
- version_requirements: *id004
75
- - !ruby/object:Gem::Dependency
76
- name: mysql2
77
56
  prerelease: false
78
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *24690660
58
+ - !ruby/object:Gem::Dependency
59
+ name: mysql2
60
+ requirement: &24689120 !ruby/object:Gem::Requirement
79
61
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- segments:
84
- - 0
85
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
86
66
  type: :development
87
- version_requirements: *id005
88
- - !ruby/object:Gem::Dependency
89
- name: rspec
90
67
  prerelease: false
91
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *24689120
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &24699980 !ruby/object:Gem::Requirement
92
72
  none: false
93
- requirements:
73
+ requirements:
94
74
  - - ~>
95
- - !ruby/object:Gem::Version
96
- segments:
97
- - 2
98
- - 6
99
- version: "2.6"
75
+ - !ruby/object:Gem::Version
76
+ version: '2.6'
100
77
  type: :development
101
- version_requirements: *id006
102
- - !ruby/object:Gem::Dependency
103
- name: timecop
104
78
  prerelease: false
105
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *24699980
80
+ - !ruby/object:Gem::Dependency
81
+ name: timecop
82
+ requirement: &24715360 !ruby/object:Gem::Requirement
106
83
  none: false
107
- requirements:
84
+ requirements:
108
85
  - - ~>
109
- - !ruby/object:Gem::Version
110
- segments:
111
- - 0
112
- - 3
113
- - 5
86
+ - !ruby/object:Gem::Version
114
87
  version: 0.3.5
115
88
  type: :development
116
- version_requirements: *id007
117
- description: db2fog provides rake tasks for backing up and restoring your DB to cloud storage providers
118
- email:
89
+ prerelease: false
90
+ version_requirements: *24715360
91
+ description: db2fog provides rake tasks for backing up and restoring your DB to cloud
92
+ storage providers
93
+ email:
119
94
  - james@yob.id.au
120
95
  executables: []
121
-
122
96
  extensions: []
123
-
124
97
  extra_rdoc_files: []
125
-
126
- files:
98
+ files:
127
99
  - lib/db2fog/railtie.rb
128
100
  - lib/db2fog/tasks.rb
129
101
  - lib/db2fog.rb
130
102
  - README.rdoc
131
103
  - HISTORY
132
- has_rdoc: true
133
104
  homepage: http://github.com/yob/db2fog
134
105
  licenses: []
135
-
136
106
  post_install_message:
137
- rdoc_options:
107
+ rdoc_options:
138
108
  - --title
139
109
  - DB2Fog
140
110
  - --line-numbers
141
- require_paths:
111
+ require_paths:
142
112
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
113
+ required_ruby_version: !ruby/object:Gem::Requirement
144
114
  none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- segments:
149
- - 1
150
- - 8
151
- - 7
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
152
118
  version: 1.8.7
153
- required_rubygems_version: !ruby/object:Gem::Requirement
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
120
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- segments:
159
- - 1
160
- - 3
161
- - 2
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
162
124
  version: 1.3.2
163
125
  requirements: []
164
-
165
126
  rubyforge_project:
166
- rubygems_version: 1.3.7
127
+ rubygems_version: 1.8.10
167
128
  signing_key:
168
129
  specification_version: 3
169
- summary: db2fog provides rake tasks for backing up and restoring your DB to cloud storage providers
130
+ summary: db2fog provides rake tasks for backing up and restoring your DB to cloud
131
+ storage providers
170
132
  test_files: []
171
-