Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first commit

  • Loading branch information...
commit 91c8808220616a66a4d250a24de76e327d88c5fd 0 parents
@defunkt defunkt authored
Showing with 196 additions and 0 deletions.
  1. +20 −0 LICENSE
  2. +115 −0 README.md
  3. +18 −0 Rakefile
  4. +43 −0 bin/repl
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009 Chris Wanstrath
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
115 README.md
@@ -0,0 +1,115 @@
+repl(1) -- sometimes you just need a repl
+=========================================
+
+`repl` is an interactive program which tenderly wraps another,
+non-interactive program.
+
+For example:
+
+ $ repl redis-cli
+ >> set name chris
+ OK
+ >> get name
+ chris
+ >> info
+ redis_version:1.000
+ uptime_in_seconds:182991
+ uptime_in_days:2
+ .. etc ..
+
+Or:
+
+ $ repl gem
+ >> --version
+ 1.3.5
+ >> search yajl
+
+ *** LOCAL GEMS ***
+
+ yajl-ruby (0.6.7)
+ >> search yajl -r
+
+ *** REMOTE GEMS ***
+
+ brianmario-yajl-ruby (0.6.3)
+ filipegiusti-yajl-ruby (0.6.4)
+ jdg-yajl-ruby (0.5.12)
+ oortle-yajl-ruby (0.5.8)
+ yajl-ruby (0.6.7)
+
+Or even:
+
+ $ repl git
+ >> branch
+ gh-pages
+ * master
+ >> tag
+ rm
+ v0.1.0
+ v0.1.1
+ v0.1.2
+ v0.1.3
+ >> tag -d rm
+ Deleted tag 'rm'
+ >> pwd
+ git: 'pwd' is not a git-command. See 'git --help'.
+
+ Did you mean this?
+ add
+
+
+If you have [rlwrap(1)][0] installed you'll get the full benefits of
+readline: history, reverse searches, etc.
+
+
+Install
+-------
+
+### Standalone
+
+`repl` is easily installed as a standalone script:
+
+ export REPL_BIN=~/bin/repl
+ curl -s http://github.com/defunkt/repl/raw/latest/bin/repl > $REPL_BIN
+ chmod 755 $REPL_BIN
+
+Change `$REPL_BIN` to your desired location and have at! (Just make
+sure it's in your `$PATH`.)
+
+### RubyGems
+
+`repl` can also be installed as a RubyGem:
+
+ $ gem install repl -s http://gemcutter.org/
+
+
+Contributing
+------------
+
+Once you've made your great commits:
+
+1. [Fork][1] repl
+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!
+
+
+Meta
+----
+
+* Code: `git clone git://gitrepl.com/defunkt/repl.git`
+* Home: <http://gitrepl.com/defunkt/repl>
+* Bugs: <http://gitrepl.com/defunkt/repl/issues>
+* Gems: <http://gemcutter.org/gems/repl>
+
+
+Author
+------
+
+Chris Wanstrath :: chris@ozmm.org :: @defunkt
+
+
+[0]: http://utopia.knoware.nl/~hlub/rlwrap/
+[1]: http://help.github.com/forking/
+[2]: http://github.com/defunkt/repl/issues
18 Rakefile
@@ -0,0 +1,18 @@
+module Repl
+ Version = '0.1.0'
+end
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gemspec|
+ gemspec.name = "repl"
+ gemspec.summary = gemspec.description = "repl tenderly wraps another program"
+ gemspec.homepage = "http://github.com/defunkt/repl"
+ gemspec.version = Repl::Version
+ gemspec.authors = ["Chris Wanstrath"]
+ gemspec.email = "chris@ozmm.org"
+ end
+rescue LoadError
+ puts "Jeweler not available."
+ puts "Install it with: gem install jeweler"
+end
43 bin/repl
@@ -0,0 +1,43 @@
+#!/usr/bin/env ruby
+
+# repl(1) -- because sometimes you just need a repl
+#
+# repl is an interactive program which tenderly wraps another,
+# non-interactive program.
+#
+# For example:
+#
+# $ repl redis-cli
+# >> set name chris
+# OK
+# >> get name
+# chris
+#
+# If you have rlwrap(1) installed you'll get the full benefits of
+# readline: history, reverse searches, etc.
+
+if !ENV['__REPL_WRAPPED'] && system("which rlwrap > /dev/null")
+ ENV['__REPL_WRAPPED'] = '0'
+ exec "rlwrap #$0 #{ARGV.join(' ')}"
+end
+
+debug = ARGV.delete('--debug')
+command = ARGV.join(' ')
+
+if debug
+ print 'rlwrap ' if ENV['__REPL_WRAPPED']
+ puts command.inspect
+end
+
+loop do
+ print '>> '
+
+ begin
+ line = $stdin.gets.chomp
+ rescue NoMethodError, Interrupt
+ exit
+ end
+
+ puts "$ #{command} #{line}" if debug
+ system "#{command} #{line}"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.