Permalink
Browse files

Merged v0.1.3 from Rubygem.

  • Loading branch information...
1 parent ad5c095 commit 303b13a1122503e640d01d699d218a4b39837215 @blackwinter blackwinter committed Sep 1, 2009
Showing with 1,832 additions and 61 deletions.
  1. +17 −17 COPYING
  2. +34 −15 README
  3. +115 −0 Rakefile
  4. +27 −0 _irbrc
  5. +30 −15 { → lib}/wirble.rb
  6. +1,596 −0 setup.rb
  7. +13 −14 wirble.gemspec
View
34 COPYING
@@ -1,20 +1,20 @@
-Copyright (C) 2002-2006 Paul Duncan
+Copyright (C) 2006-2009 Paul Duncan <pabs@pablotron.org>
-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:
+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 of the Software, its documentation and marketing & publicity
-materials, and acknowledgment shall be given in the documentation, materials
-and software packages that this Software was used.
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the 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 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.
+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 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.
View
49 README
@@ -1,9 +1,9 @@
-Wirble 0.1.2 README
+Wirble 0.1.3 README
===================
-This document was last updated on Fri Sep 08 13:16:55 2006. See the
-file COPYING for licensing and warranty information. The latest version
-of this software is available at the following URL:
+This document was last updated on 2009-05-30. See the file COPYING for
+licensing and warranty information. The latest version of this software
+is available at the following URL:
http://pablotron.org/software/wirble/
@@ -54,8 +54,14 @@ simply do the following, then skip to the "Using Wirble" section below:
# install wirble via RubyGems
sudo gem install wirble
-If you don't have RubyGems, you can also install the Wirble library
-this:
+If you don't have RubyGems, you can also install the Wirble using
+setup.rb:
+
+ # install wirble using setup.rb
+ ruby ./setup.rb config && ruby ./setup.rb setup
+ sudo ruby ./setup.rb install
+
+Or, install Wirble by hand using sudo:
# install wirble to library directory
sudo cp -v wirble.rb $(ruby -e 'puts $LOAD_PATH[0]')
@@ -80,28 +86,41 @@ Then add the following line at the _top_ of your ~/.irbrc file:
Using Wirble
============
+A sample ~/.irbrc is available in the file "_irbrc". If you just want
+to get Wirble up quickly, copy that to your home directory and be done
+with it. Otherwise. read on:
+
Using Wirble is easy: just add the following lines to your ~/.irbrc
file:
- # load rubygems and wirble
- require 'rubygems' rescue nil
- require 'wirble'
+ begin
+ require 'wirble'
- # load wirble
- Wirble.init
+ # init wirble
+ Wirble.init
+ rescue LoadError => err
+ $stderr.puts "Couldn't load Wirble: #{err}"
+ end
A lot of people really don't like colors, so I've kept the color
disabled by default. To enable it, add the following bit to your
-~/.irbrc file after "Wirble.init":
+~/.irbrc file immediately after the call to "Wirble.init":
# enable color
Wirble.colorize
If you want to terrify your grandmother and impress your buddies, your
entire ~/.irbrc can also be written like so:
- %w{rubygems wirble}.each { |lib| require lib rescue nil }
- %w{init colorize}.each { |str| Wirble.send(str.intern) }
+ %w{rubygems wirble}.each do |lib|
+ begin
+ require lib
+ rescue LoadError => err
+ $stderr.puts "Couldn't load #{lib}: #{err}"
+ end
+ end
+
+ %w{init colorize}.each { |str| Wirble.send(str) }
Configuring Wirble
==================
@@ -417,7 +436,7 @@ Feel free to email me at the address below. Alternatively, you can
submit your feature request or bug directly to my bug-tracking web
interface at the following URL:
- http://bugs.pablotron.org/
+ http://redmine.pablotron.org/projects/show/wirble
Note: you'll need to create an account in order to submit a feature
request or a bug report via the web interface. Also, I'm a busy guy! I
View
115 Rakefile
@@ -0,0 +1,115 @@
+
+# load libraries
+
+require 'rake/rdoctask'
+require 'rake/packagetask'
+require 'rake/gempackagetask'
+require 'lib/wirble.rb'
+
+def package_info
+ require 'ostruct'
+ require 'rubygems'
+
+ # create package
+ ret = OpenStruct.new
+
+ # set package information
+ ret.name = 'Wirble'
+ ret.blurb = 'Handful of common Irb features, made easy.'
+ ret.description = <<-EOF
+ A handful of useful Irb features, including colorized results,
+ tab-completion, history, a simple prompt, and several helper
+ methods, all rolled into one easy to use package.
+ EOF
+ ret.version = Wirble::VERSION
+ ret.platform = Gem::Platform::RUBY
+ ret.url = 'http://pablotron.org/software/wirble/'
+
+ # author information
+ ret.author_name = 'Paul Duncan'
+ ret.author_email = 'pabs@pablotron.org'
+
+ # requirements and files
+ ret.reqs = ['none']
+ ret.include_files = Dir['**/*'].delete_if { |path|
+ %w{CVS .svn .hg}.any? { |chunk| path.include?(chunk) }
+ }
+
+ # rdoc info
+ ret.rdoc_title = "#{ret.name} #{ret.version} API Documentation"
+ ret.rdoc_options = %w{--webcvs http://hg.pablotron.org/wirble}
+ ret.rdoc_dir = 'doc'
+ ret.rdoc_files = %w{lib/**/*.rb README}
+
+ # runtime info
+ ret.auto_require = 'wirble'
+ ret.require_path = 'lib'
+ ret.package_name = 'wirble'
+
+ # package release dir
+ if path = ENV['RAKE_PACKAGE_DIR']
+ ret.pkg_dir = File.join(File.expand_path(path), ret.package_name)
+ end
+
+ if files = ret.rdoc_files
+ ret.rdoc_files = files.map { |e| Dir.glob(e) }.flatten.compact
+ end
+
+ # return package
+ ret
+end
+
+pkg = package_info
+
+gem_spec = Gem::Specification.new do |s|
+ # package information
+ s.name = pkg.name.downcase
+ s.platform = pkg.platform
+ s.version = pkg.version
+ s.summary = s.description = pkg.blurb
+ s.rubyforge_project = 'pablotron'
+
+ # files
+ pkg.reqs.each { |req| s.requirements << req }
+ s.files = pkg.include_files
+
+ # runtime info
+ s.executables = pkg.executables
+ s.require_path = pkg.require_path
+ s.autorequire = pkg.auto_require
+
+ # dependencies
+ # pkg.dependencies.each { |dep| s.add_dependency(dep) }
+
+ # rdoc info
+ s.has_rdoc = true
+ s.rdoc_options = ['--title', pkg.rdoc_title] + pkg.rdoc_options + pkg.rdoc_files
+
+ # author and project details
+ s.author = pkg.author_name
+ s.email = pkg.author_email
+ s.homepage = pkg.url
+
+ # gem crypto stuff
+ if pkg.signing_key && pkg.signing_chain
+ s.signing_key = pkg.signing_key
+ s.signing_chain = pkg.signing_chain
+ end
+end
+
+Rake::GemPackageTask.new(gem_spec) do |p|
+ p.need_tar_gz = true
+ # p.need_pgp_signature = true
+ p.package_dir = pkg.pkg_dir if pkg.pkg_dir
+end
+
+
+Rake::RDocTask.new do |rd|
+ rd.title = pkg.rdoc_title
+ rd.rdoc_dir = pkg.rdoc_dir
+ rd.rdoc_files.include(*pkg.rdoc_files)
+ rd.options.concat(pkg.rdoc_options)
+end
+
+task :clean => [:clobber]
+task :release => [:clean, :package]
View
27 _irbrc
@@ -0,0 +1,27 @@
+######################################################################
+# _irbrc - Sample .irbrc file to enable Wirble. #
+######################################################################
+
+#
+# Uncomment the block below if you want to load RubyGems in Irb.
+#
+
+# begin
+# require 'rubygems'
+# rescue LoadError => err
+# warn "Couldn't load RubyGems: #{err}"
+# end
+
+begin
+ # load and initialize wirble
+ require 'wirble'
+ Wirble.init
+
+ #
+ # Uncomment the line below to enable Wirble colors.
+ #
+
+ # Wirble.colorize
+rescue LoadError => err
+ warn "Couldn't load Wirble: #{err}"
+end
@@ -19,21 +19,27 @@
# hair out sifting through the code below.
#
module Wirble
- VERSION = '0.1.2'
+ VERSION = '0.1.3'
#
- # Load internal Ruby features, including tab-completion, rubygems,
+ # Load internal Ruby features, including pp, tab-completion,
# and a simple prompt.
#
module Internals
# list of internal libraries to automatically load
- LIBRARIES = %w{pp irb/completion rubygems}
+ LIBRARIES = %w{pp irb/completion}
#
- # load tab completion and rubygems
+ # load libraries
#
def self.init_libraries
- LIBRARIES.each { |lib| require lib rescue nil }
+ LIBRARIES.each do |lib|
+ begin
+ require lib
+ rescue LoadError
+ nil
+ end
+ end
end
#
@@ -69,7 +75,7 @@ class History
private
def say(*args)
- puts *args if @verbose
+ puts(*args) if @verbose
end
def cfg(key)
@@ -138,21 +144,30 @@ def self.tokenize(str)
case state[-1]
when nil
case c
- when ':' then state << :symbol
- when '"' then state << :string
- when '#' then state << :object
+ when ':'
+ state << :symbol
+ when '"'
+ state << :string
+ when '#'
+ state << :object
when /[a-z]/i
state << :keyword
repeat = true
when /[0-9-]/
state << :number
repeat = true
- when '{' then yield :open_hash, '{'
- when '[' then yield :open_array, '['
- when ']' then yield :close_array, ']'
- when '}' then yield :close_hash, '}'
- when /\s/ then yield :whitespace, c
- when ',' then yield :comma, ','
+ when '{'
+ yield :open_hash, '{'
+ when '['
+ yield :open_array, '['
+ when ']'
+ yield :close_array, ']'
+ when '}'
+ yield :close_hash, '}'
+ when /\s/
+ yield :whitespace, c
+ when ','
+ yield :comma, ','
when '>'
yield :refers, '=>' if lc == '='
when '.'
Oops, something went wrong.

0 comments on commit 303b13a

Please sign in to comment.