mysqlconn 0.0.1 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +12 -3
- data/bin/mysqlconn +8 -0
- metadata +2 -6
- data/README.html +0 -35
- data/README.md~ +0 -1
- data/bin/mysqlconn~ +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 33b059c109f934635f30660baa41c0734217bdb7
|
|
4
|
+
data.tar.gz: ab5e09aa4ee8da4bb4617ce11f45e17ca5647b98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ff5c4184351c935e866d1da7771e20d04a1295f2ab987896a0f8eff7fef1dfd3c11832aff0f1f456927c4807f87b9b24ece5b96905caffcb70abc9c084bab03
|
|
7
|
+
data.tar.gz: 10a6e080b10c399ea47928203f2016c44ba990f4e6e1537b38631d4b9ff33c07d75ac432b390ff1f80af289af16f70c5e69a8b42137982866ec2f5b219f5874d
|
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
mysqlconn - The mysql connection assistant
|
|
2
|
-
|
|
2
|
+
------------------------------------------
|
|
3
3
|
|
|
4
4
|
### Instructions
|
|
5
5
|
|
|
@@ -34,7 +34,16 @@ Pipe:
|
|
|
34
34
|
|
|
35
35
|
etc..
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Autocomplete
|
|
38
|
+
|
|
39
|
+
Add to bash.completion.d
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
_mysqlconn() {
|
|
42
|
+
local cur=${COMP_WORDS[COMP_CWORD]}
|
|
43
|
+
COMPREPLY=( $( compgen -W "$(mysqlconn -l)" -- $cur ) )
|
|
44
|
+
}
|
|
45
|
+
complete -F _mysqlconn mysqlconn
|
|
46
|
+
|
|
47
|
+
### License
|
|
40
48
|
|
|
49
|
+
Apache 2.0 - go nuts
|
data/bin/mysqlconn
CHANGED
|
@@ -18,6 +18,14 @@ rescue Errno::ENOENT => e
|
|
|
18
18
|
end
|
|
19
19
|
raise("Config file is world readable. Exiting...") if File.stat(CONFIG_LOCATION).world_readable?
|
|
20
20
|
|
|
21
|
+
if db_key == '-l'
|
|
22
|
+
filter = /.*#{ARGV.shift||'.*'}.*/
|
|
23
|
+
config.keys.each do |k|
|
|
24
|
+
puts k if filter =~ k
|
|
25
|
+
end
|
|
26
|
+
exit(0)
|
|
27
|
+
end
|
|
28
|
+
|
|
21
29
|
db = config[db_key] || raise("No #{db_key} found")
|
|
22
30
|
|
|
23
31
|
db['host'] || raise("No #{db_key}.host found")
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mysqlconn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Neville Kadwa
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-03-
|
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Save your various database credentials to a configuration file and zip
|
|
14
14
|
around easily
|
|
@@ -16,15 +16,11 @@ email:
|
|
|
16
16
|
- neville@kadwa.com
|
|
17
17
|
executables:
|
|
18
18
|
- mysqlconn
|
|
19
|
-
- mysqlconn~
|
|
20
19
|
extensions: []
|
|
21
20
|
extra_rdoc_files: []
|
|
22
21
|
files:
|
|
23
|
-
- README.html
|
|
24
22
|
- README.md
|
|
25
|
-
- README.md~
|
|
26
23
|
- bin/mysqlconn
|
|
27
|
-
- bin/mysqlconn~
|
|
28
24
|
homepage: http://github.com/kadwanev/mysqlconn
|
|
29
25
|
licenses:
|
|
30
26
|
- Apache-2.0
|
data/README.html
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<h1>mysqlconn - The mysql connection assistant</h1>
|
|
2
|
-
|
|
3
|
-
<h3>Instructions</h3>
|
|
4
|
-
|
|
5
|
-
<p>Install:</p>
|
|
6
|
-
|
|
7
|
-
<p><code>gem install mysqlconn</code></p>
|
|
8
|
-
|
|
9
|
-
<p>Create <code>~/.db_connection_alias.yml</code></p>
|
|
10
|
-
|
|
11
|
-
<pre><code>db_key:
|
|
12
|
-
host: hostname
|
|
13
|
-
user: username # Optional
|
|
14
|
-
password: password # Optional
|
|
15
|
-
# password: '' # Optional, prompt for password
|
|
16
|
-
database: database # Optional
|
|
17
|
-
db_key2:
|
|
18
|
-
...
|
|
19
|
-
</code></pre>
|
|
20
|
-
|
|
21
|
-
<p>Protect configuration file:</p>
|
|
22
|
-
|
|
23
|
-
<p><code>chmod 600 ~/.db_connection_alias.yml</code></p>
|
|
24
|
-
|
|
25
|
-
<h3>Usage</h3>
|
|
26
|
-
|
|
27
|
-
<p>Connect:</p>
|
|
28
|
-
|
|
29
|
-
<p><code>mysqlconn db_key [additional options]</code></p>
|
|
30
|
-
|
|
31
|
-
<p>Pipe:</p>
|
|
32
|
-
|
|
33
|
-
<p><code>mysqlconn db_key < script.sql > output</code></p>
|
|
34
|
-
|
|
35
|
-
<p>etc..</p>
|
data/README.md~
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
help
|
data/bin/mysqlconn~
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'yaml'
|
|
4
|
-
require 'fileutils'
|
|
5
|
-
|
|
6
|
-
CONFIG_LOCATION=File.expand_path("~/.db_connection_alias.yml")
|
|
7
|
-
|
|
8
|
-
db_key = ARGV.shift || raise('no db key provided. Usage mysqlconn db_key [mysql opts]*')
|
|
9
|
-
|
|
10
|
-
config = begin
|
|
11
|
-
File.open(CONFIG_LOCATION, 'r') do |f|
|
|
12
|
-
YAML.load(f)
|
|
13
|
-
end
|
|
14
|
-
rescue Errno::ENOENT => e
|
|
15
|
-
raise("No config found. Please follow instructions for creating #{CONFIG_LOCATION}")
|
|
16
|
-
end
|
|
17
|
-
raise("Config file is world readable. Exiting...") if File.stat(CONFIG_LOCATION).world_readable?
|
|
18
|
-
|
|
19
|
-
db = config[db_key] || raise("No #{db_key} found")
|
|
20
|
-
|
|
21
|
-
db['host'] || raise("No #{db_key}.host found")
|
|
22
|
-
|
|
23
|
-
command = "mysql -h #{db['host']} --prompt=\"\\u@#{db_key} [\\d]> \""
|
|
24
|
-
|
|
25
|
-
command << " -u #{db['user']}" if db['user']
|
|
26
|
-
command << " -p#{db['password']}" if db['password']
|
|
27
|
-
command << " -D #{db['database']}" if db['database']
|
|
28
|
-
unless ARGV.empty?
|
|
29
|
-
command << " "
|
|
30
|
-
command << ARGV.map{|s| "'#{s}'"}.join(' ')
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
exec(command)
|