lazydb 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/lazydb +1 -0
- data/lazydb.gemspec +24 -0
- data/lib/lazydb.rb +38 -0
- data/lib/lazydb/version.rb +3 -0
- metadata +54 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/lazydb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "lazydb"
|
data/lazydb.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "lazydb/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "lazydb"
|
7
|
+
s.version = Lazydb::VERSION
|
8
|
+
s.authors = ["Jeff Sebring"]
|
9
|
+
s.email = ["jeff@jeffsebring.com"]
|
10
|
+
s.homepage = "http://jeffsebring.com"
|
11
|
+
s.summary = %q{Saves a few keystrokes importing and dumping gzipped mysql databases.}
|
12
|
+
s.description = %q{Saves a few keystrokes importing and dumping gzipped mysql databases.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "lazydb"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = %w( lazydb )
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
data/lib/lazydb.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module Lazydb
|
4
|
+
|
5
|
+
puts 'Enter the database name: '
|
6
|
+
db = gets.chomp
|
7
|
+
|
8
|
+
puts 'Enter the dump file name: '
|
9
|
+
dumpfile = gets.chomp
|
10
|
+
|
11
|
+
puts 'Enter the database user: '
|
12
|
+
user = gets.chomp
|
13
|
+
|
14
|
+
puts 'Import or Dump? '
|
15
|
+
puts '1 - Import'
|
16
|
+
puts '2 - Dump'
|
17
|
+
|
18
|
+
action = gets.to_i
|
19
|
+
|
20
|
+
if action == 1
|
21
|
+
|
22
|
+
mysql = `sudo gunzip -c #{dumpfile}.sql.gz | mysql -u #{user} -p #{db}`
|
23
|
+
|
24
|
+
elsif action == 2
|
25
|
+
|
26
|
+
mysql = `sudo mysqldump -u root -p #{db} | gzip > #{dumpfile}.sql.gz`
|
27
|
+
|
28
|
+
else
|
29
|
+
|
30
|
+
puts 'Fail!'
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
system( mysql )
|
35
|
+
|
36
|
+
puts 'kthnxbye!'
|
37
|
+
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lazydb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jeff Sebring
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Saves a few keystrokes importing and dumping gzipped mysql databases.
|
15
|
+
email:
|
16
|
+
- jeff@jeffsebring.com
|
17
|
+
executables:
|
18
|
+
- lazydb
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- Rakefile
|
25
|
+
- lazydb.gemspec
|
26
|
+
- lib/lazydb.rb
|
27
|
+
- lib/lazydb/version.rb
|
28
|
+
- !binary |-
|
29
|
+
YmluL2xhenlkYg==
|
30
|
+
homepage: http://jeffsebring.com
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project: lazydb
|
50
|
+
rubygems_version: 1.8.15
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: Saves a few keystrokes importing and dumping gzipped mysql databases.
|
54
|
+
test_files: []
|