db_tasks 0.0.1

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.
@@ -0,0 +1 @@
1
+ *.gem
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Camel Punch Limited
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ Currently just a MySQL import script for copying from a MySQL server by SSHing
2
+ into a production box.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,3 @@
1
+ module DbTasks
2
+ require 'db_tasks/railtie.rb' if defined?(Rails)
3
+ end
@@ -0,0 +1,10 @@
1
+ require 'db_tasks'
2
+ require 'rails'
3
+
4
+ module DbTasks
5
+ class Railtie < Rails::Railtie
6
+ rake_tasks do
7
+ load 'db_tasks/railties/tasks.rake'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ namespace :db do
2
+ desc "Import production database to current environment"
3
+ task :import_production => :environment do
4
+ config = YAML.load_file(File.join(Rails.root, 'config', 'database.yml'))
5
+ source = config['production']
6
+ dest = config[Rails.env]
7
+
8
+ %w(ssh_username ssh_host).each do |key|
9
+ if source[key].blank?
10
+ raise "Missing #{key} key in production stanza of config/database.yml"
11
+ end
12
+ end
13
+
14
+ command = "ssh #{source['ssh_username']}@#{source['ssh_host']} 'mysqldump -h #{source['host']} -u #{source['username']} -p#{source['password']} #{source['database']}' | mysql -h #{dest['host']} -u #{dest['username']} #{dest['database']}"
15
+ `#{command}`
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: db_tasks
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Andrew Bruce
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-01 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: |
23
+ Currently just a MySQL import script for copying from a MySQL server by SSHing
24
+ into a production box.
25
+
26
+ email: andrew@camelpunch.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .gitignore
36
+ - LICENSE
37
+ - README.rdoc
38
+ - VERSION
39
+ - lib/db_tasks/railtie.rb
40
+ - lib/db_tasks/railties/tasks.rake
41
+ - lib/db_tasks.rb
42
+ has_rdoc: true
43
+ homepage: http://github.com/camelpunch/db_tasks
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.3.7
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: Various database tasks for Rails / MySQL
76
+ test_files: []
77
+