This repository has been archived by the owner on Dec 24, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial wrapper script, inspired by defunkt/repl
- Loading branch information
0 parents
commit 175e2b6
Showing
9 changed files
with
406 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
|
||
Copyleft 2011 Samer Abukhait <samer@abukhaitNOSPAM.com> | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
a db2 console with with history and autocomplete support | ||
==================================== | ||
|
||
DB2 console mode does not support readline and autocomplete, this is a wrapper for the db2 command with support for both. | ||
|
||
Install | ||
------- | ||
|
||
$ apt-get install [rlwrap][0] | ||
$ gem install db2c | ||
|
||
Contributing | ||
------------ | ||
|
||
Once you've made your great commits: | ||
|
||
1. [Fork][1] db2c | ||
2. Create a topic branch - `git checkout -b my_branch` | ||
3. Push to your branch - `git push origin my_branch` | ||
4. Create an [Issue][2] with a link to your branch | ||
5. That's it! | ||
|
||
Acknowledgement | ||
------------ | ||
|
||
The initial script was inspired by [defunkt's repl][3], for a genenral purpose repl/wrapper, this is your friend. | ||
|
||
Meta | ||
---- | ||
|
||
* Code: `git clone git://github.com/on-site/db2c.git` | ||
* Home: <https://github.com/on-site/db2c> | ||
* Bugs: <https://github.com/on-site/db2c/issues> | ||
* Gems: <http://rubygems.org/gems/db2c> | ||
|
||
Author | ||
------ | ||
|
||
Samer Abukhait <samer@on-siteNOSPAM.com>, @s4mer | ||
|
||
[0]: http://utopia.knoware.nl/~hlub/rlwrap/ | ||
[1]: http://help.github.com/forking/ | ||
[2]: https://github.com/on-site/db2c/issues | ||
[3]: https://github.com/defunkt/repl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$LOAD_PATH.unshift 'lib' | ||
require "db2c/version" | ||
|
||
def version | ||
Db2c::VERSION | ||
end | ||
|
||
def git(command) | ||
system("git #{command}") | ||
end | ||
|
||
desc "Push new version" | ||
task :publish do | ||
git "tag v#{version}" | ||
git "push origin v#{version}" | ||
git "push origin master" | ||
git "push origin master:latest" | ||
sh "gem build db2c.gemspec" | ||
sh "gem push db2c-#{version}.gem" | ||
git "clean -fd" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env ruby | ||
|
||
if !system("which db2 > /dev/null 2> /dev/null") | ||
puts "The db2 command was not found!" | ||
exit | ||
end | ||
|
||
if !system("which rlwrap > /dev/null 2> /dev/null") | ||
puts "This program depends on rlwrap, install rlwrap" | ||
exit | ||
end | ||
|
||
def show_help | ||
puts <<-help | ||
Usage: db2c | ||
Options: | ||
--help Display this message | ||
--man Display the man page | ||
Bug reports, suggestions, updates: http://github.com/on-site/db2c | ||
help | ||
exit | ||
end | ||
|
||
if ARGV.any? { |arg| %w( -h --help -help help ).include?(arg) } | ||
show_help | ||
end | ||
|
||
cdir = File.dirname(__FILE__) | ||
if ARGV.include? '--man' | ||
exec "man #{cdir}/../man/db2c.1" | ||
end | ||
|
||
exec "rlwrap -A -pblue -f #{cdir}/ac -H ~/.db2c_history db2 #{ARGV.join(' ')}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$LOAD_PATH.unshift 'lib' | ||
require "db2c/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "db2c" | ||
s.version = Db2c::VERSION | ||
s.date = Time.now.strftime('%Y-%m-%d') | ||
s.summary = "a db2 console with with history and autocomplete support" | ||
s.description = "a db2 console with with history and autocomplete support" | ||
s.homepage = "http://github.com/on-site/db2c" | ||
s.email = "samer@on-siteNOSPAM.com" | ||
s.authors = [ "Samer Abukhait" ] | ||
s.has_rdoc = false | ||
|
||
s.files = %w( README.md Rakefile LICENSE ) | ||
s.files += Dir.glob("bin/**/*") | ||
s.files += Dir.glob("man/**/*") | ||
|
||
s.executables = %w( db2c ) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Db2c | ||
VERSION = "0.0.1" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
.\" generated with Ronn/v0.7.3 | ||
.\" http://github.com/rtomayko/ronn/tree/0.7.3 | ||
. | ||
.TH "DB2C" "1" "November 2011" "" "" | ||
. | ||
.SH "NAME" | ||
\fBdb2c\fR \- a db2 console with with history and autocomplete support | ||
. | ||
.SH "SYNOPSIS" | ||
\fBdb2c\fR \fI\fIoptions\fR\fR <\.\.\.> | ||
. | ||
.SH "DESCRIPTION" | ||
DB2 console mode does not support readline and autocomplete, this is a wrapper for the db2 command with support for both\. | ||
. | ||
.SH "EXAMPLES" | ||
. | ||
.nf | ||
|
||
$ db2c | ||
db2 => connect to testdb | ||
|
||
Database Connection Information | ||
|
||
Database server = DB2/LINUXX8664 9\.7\.4 | ||
SQL authorization ID = SAMER | ||
Local database alias = TESTDB | ||
|
||
db2 => ? sql\-107 | ||
|
||
|
||
SQL0107N The name "<name>" is too long\. The maximum length is | ||
"<length>"\. | ||
|
||
\.\.\. | ||
|
||
db2 => values current date | ||
|
||
1 | ||
\-\-\-\-\-\-\-\-\-\- | ||
11/17/2011 | ||
|
||
1 record(s) selected\. | ||
|
||
|
||
Then use the arrows for history | ||
. | ||
.fi | ||
. | ||
.SH "OPTIONS" | ||
. | ||
.TP | ||
\fB\-h\fR, \fB\-\-help\fR | ||
Displays usage information\. | ||
. | ||
.TP | ||
\fB\-\-man\fR | ||
Displays this man page\. | ||
. | ||
.SH "BUGS" | ||
\fIhttp://github\.com/on\-site/db2c/issues\fR | ||
. | ||
.SH "AUTHOR" | ||
Samer Abukhait \fIsamer@on\-siteNOSPAM\.com\fR, @s4mer | ||
. | ||
.SH "SEE ALSO" | ||
rlwrap(1), readline(3) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.