blackwinter-wirble 0.1.2 → 0.1.3.1

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.
data/COPYING CHANGED
@@ -1,20 +1,21 @@
1
- Copyright (C) 2002-2006 Paul Duncan
1
+ Copyright (C) 2006-2009 Paul Duncan <pabs@pablotron.org>
2
+ Copyright (C) 2009 Jens Wille <jens.wille@gmail.com>
2
3
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to
5
- deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
4
+ Permission is hereby granted, free of charge, to any person obtaining a
5
+ copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
9
11
 
10
- The above copyright notice and this permission notice shall be included in
11
- all copies of the Software, its documentation and marketing & publicity
12
- materials, and acknowledgment shall be given in the documentation, materials
13
- and software packages that this Software was used.
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the of the Software.
14
14
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ DEALINGS IN THE SOFTWARE.
data/MANIFEST ADDED
@@ -0,0 +1,5 @@
1
+ ./ChangeLog
2
+ ./COPYING
3
+ ./wirble.rb
4
+ ./README
5
+ ./wirble.gemspec
data/README CHANGED
@@ -1,9 +1,9 @@
1
- Wirble 0.1.2 README
1
+ Wirble 0.1.3 README
2
2
  ===================
3
3
 
4
- This document was last updated on Fri Sep 08 13:16:55 2006. See the
5
- file COPYING for licensing and warranty information. The latest version
6
- of this software is available at the following URL:
4
+ This document was last updated on 2009-05-30. See the file COPYING for
5
+ licensing and warranty information. The latest version of this software
6
+ is available at the following URL:
7
7
 
8
8
  http://pablotron.org/software/wirble/
9
9
 
@@ -54,8 +54,14 @@ simply do the following, then skip to the "Using Wirble" section below:
54
54
  # install wirble via RubyGems
55
55
  sudo gem install wirble
56
56
 
57
- If you don't have RubyGems, you can also install the Wirble library
58
- this:
57
+ If you don't have RubyGems, you can also install the Wirble using
58
+ setup.rb:
59
+
60
+ # install wirble using setup.rb
61
+ ruby ./setup.rb config && ruby ./setup.rb setup
62
+ sudo ruby ./setup.rb install
63
+
64
+ Or, install Wirble by hand using sudo:
59
65
 
60
66
  # install wirble to library directory
61
67
  sudo cp -v wirble.rb $(ruby -e 'puts $LOAD_PATH[0]')
@@ -80,19 +86,25 @@ Then add the following line at the _top_ of your ~/.irbrc file:
80
86
 
81
87
  Using Wirble
82
88
  ============
89
+ A sample ~/.irbrc is available in the file "_irbrc". If you just want
90
+ to get Wirble up quickly, copy that to your home directory and be done
91
+ with it. Otherwise. read on:
92
+
83
93
  Using Wirble is easy: just add the following lines to your ~/.irbrc
84
94
  file:
85
95
 
86
- # load rubygems and wirble
87
- require 'rubygems' rescue nil
88
- require 'wirble'
96
+ begin
97
+ require 'wirble'
89
98
 
90
- # load wirble
91
- Wirble.init
99
+ # init wirble
100
+ Wirble.init
101
+ rescue LoadError => err
102
+ $stderr.puts "Couldn't load Wirble: #{err}"
103
+ end
92
104
 
93
105
  A lot of people really don't like colors, so I've kept the color
94
106
  disabled by default. To enable it, add the following bit to your
95
- ~/.irbrc file after "Wirble.init":
107
+ ~/.irbrc file immediately after the call to "Wirble.init":
96
108
 
97
109
  # enable color
98
110
  Wirble.colorize
@@ -100,8 +112,15 @@ disabled by default. To enable it, add the following bit to your
100
112
  If you want to terrify your grandmother and impress your buddies, your
101
113
  entire ~/.irbrc can also be written like so:
102
114
 
103
- %w{rubygems wirble}.each { |lib| require lib rescue nil }
104
- %w{init colorize}.each { |str| Wirble.send(str.intern) }
115
+ %w{rubygems wirble}.each do |lib|
116
+ begin
117
+ require lib
118
+ rescue LoadError => err
119
+ $stderr.puts "Couldn't load #{lib}: #{err}"
120
+ end
121
+ end
122
+
123
+ %w{init colorize}.each { |str| Wirble.send(str) }
105
124
 
106
125
  Configuring Wirble
107
126
  ==================
@@ -417,7 +436,7 @@ Feel free to email me at the address below. Alternatively, you can
417
436
  submit your feature request or bug directly to my bug-tracking web
418
437
  interface at the following URL:
419
438
 
420
- http://bugs.pablotron.org/
439
+ http://redmine.pablotron.org/projects/show/wirble
421
440
 
422
441
  Note: you'll need to create an account in order to submit a feature
423
442
  request or a bug report via the web interface. Also, I'm a busy guy! I
@@ -425,9 +444,11 @@ make every effort to respond quickly to bug reports, but detailed
425
444
  descriptions and or patches really do make my life a whole lot easier.
426
445
 
427
446
 
428
- About the Author
429
- ================
447
+ About the Authors
448
+ =================
430
449
  Paul Duncan <pabs@pablotron.org>
431
450
  http://pablotron.org/
432
451
 
452
+ Jens Wille <jens.wille@gmail.com>
453
+
433
454
  And of course, all the fine folks from the Ruby Garden Wiki. :)
data/Rakefile ADDED
@@ -0,0 +1,115 @@
1
+
2
+ # load libraries
3
+
4
+ require 'rake/rdoctask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'lib/wirble.rb'
8
+
9
+ def package_info
10
+ require 'ostruct'
11
+ require 'rubygems'
12
+
13
+ # create package
14
+ ret = OpenStruct.new
15
+
16
+ # set package information
17
+ ret.name = 'Wirble'
18
+ ret.blurb = 'Handful of common Irb features, made easy.'
19
+ ret.description = <<-EOF
20
+ A handful of useful Irb features, including colorized results,
21
+ tab-completion, history, a simple prompt, and several helper
22
+ methods, all rolled into one easy to use package.
23
+ EOF
24
+ ret.version = Wirble::VERSION
25
+ ret.platform = Gem::Platform::RUBY
26
+ ret.url = 'http://pablotron.org/software/wirble/'
27
+
28
+ # author information
29
+ ret.author_names = ['Paul Duncan', 'Jens Wille']
30
+ ret.author_emails = ['pabs@pablotron.org', 'jens.wille@gmail.com']
31
+
32
+ # requirements and files
33
+ ret.reqs = ['none']
34
+ ret.include_files = Dir['**/*'].delete_if { |path|
35
+ %w{CVS .svn .hg}.any? { |chunk| path.include?(chunk) }
36
+ }
37
+
38
+ # rdoc info
39
+ ret.rdoc_title = "#{ret.name} #{ret.version} API Documentation"
40
+ ret.rdoc_options = %w{--webcvs http://hg.pablotron.org/wirble}
41
+ ret.rdoc_dir = 'doc'
42
+ ret.rdoc_files = %w{lib/**/*.rb README}
43
+
44
+ # runtime info
45
+ ret.auto_require = 'wirble'
46
+ ret.require_path = 'lib'
47
+ ret.package_name = 'wirble'
48
+
49
+ # package release dir
50
+ if path = ENV['RAKE_PACKAGE_DIR']
51
+ ret.pkg_dir = File.join(File.expand_path(path), ret.package_name)
52
+ end
53
+
54
+ if files = ret.rdoc_files
55
+ ret.rdoc_files = files.map { |e| Dir.glob(e) }.flatten.compact
56
+ end
57
+
58
+ # return package
59
+ ret
60
+ end
61
+
62
+ pkg = package_info
63
+
64
+ gem_spec = Gem::Specification.new do |s|
65
+ # package information
66
+ s.name = 'blackwinter-' + pkg.name.downcase
67
+ s.platform = pkg.platform
68
+ s.version = pkg.version
69
+ s.summary = s.description = pkg.blurb
70
+ s.rubyforge_project = 'pablotron'
71
+
72
+ # files
73
+ pkg.reqs.each { |req| s.requirements << req }
74
+ s.files = pkg.include_files
75
+
76
+ # runtime info
77
+ s.executables = pkg.executables
78
+ s.require_path = pkg.require_path
79
+ s.autorequire = pkg.auto_require
80
+
81
+ # dependencies
82
+ # pkg.dependencies.each { |dep| s.add_dependency(dep) }
83
+
84
+ # rdoc info
85
+ s.has_rdoc = true
86
+ s.rdoc_options = ['--title', pkg.rdoc_title] + pkg.rdoc_options + pkg.rdoc_files
87
+
88
+ # author and project details
89
+ s.authors = pkg.author_names
90
+ s.email = pkg.author_emails
91
+ s.homepage = pkg.url
92
+
93
+ # gem crypto stuff
94
+ if pkg.signing_key && pkg.signing_chain
95
+ s.signing_key = pkg.signing_key
96
+ s.signing_chain = pkg.signing_chain
97
+ end
98
+ end
99
+
100
+ Rake::GemPackageTask.new(gem_spec) do |p|
101
+ p.need_tar_gz = true
102
+ # p.need_pgp_signature = true
103
+ p.package_dir = pkg.pkg_dir if pkg.pkg_dir
104
+ end
105
+
106
+
107
+ Rake::RDocTask.new do |rd|
108
+ rd.title = pkg.rdoc_title
109
+ rd.rdoc_dir = pkg.rdoc_dir
110
+ rd.rdoc_files.include(*pkg.rdoc_files)
111
+ rd.options.concat(pkg.rdoc_options)
112
+ end
113
+
114
+ task :clean => [:clobber]
115
+ task :release => [:clean, :package]
data/_irbrc ADDED
@@ -0,0 +1,27 @@
1
+ ######################################################################
2
+ # _irbrc - Sample .irbrc file to enable Wirble. #
3
+ ######################################################################
4
+
5
+ #
6
+ # Uncomment the block below if you want to load RubyGems in Irb.
7
+ #
8
+
9
+ # begin
10
+ # require 'rubygems'
11
+ # rescue LoadError => err
12
+ # warn "Couldn't load RubyGems: #{err}"
13
+ # end
14
+
15
+ begin
16
+ # load and initialize wirble
17
+ require 'wirble'
18
+ Wirble.init
19
+
20
+ #
21
+ # Uncomment the line below to enable Wirble colors.
22
+ #
23
+
24
+ # Wirble.colorize
25
+ rescue LoadError => err
26
+ warn "Couldn't load Wirble: #{err}"
27
+ end
@@ -19,21 +19,27 @@ require 'ostruct'
19
19
  # hair out sifting through the code below.
20
20
  #
21
21
  module Wirble
22
- VERSION = '0.1.2'
22
+ VERSION = '0.1.3.1'
23
23
 
24
24
  #
25
- # Load internal Ruby features, including tab-completion, rubygems,
25
+ # Load internal Ruby features, including pp, tab-completion,
26
26
  # and a simple prompt.
27
27
  #
28
28
  module Internals
29
29
  # list of internal libraries to automatically load
30
- LIBRARIES = %w{pp irb/completion rubygems}
30
+ LIBRARIES = %w{pp irb/completion}
31
31
 
32
32
  #
33
- # load tab completion and rubygems
33
+ # load libraries
34
34
  #
35
35
  def self.init_libraries
36
- LIBRARIES.each { |lib| require lib rescue nil }
36
+ LIBRARIES.each do |lib|
37
+ begin
38
+ require lib
39
+ rescue LoadError
40
+ nil
41
+ end
42
+ end
37
43
  end
38
44
 
39
45
  #
@@ -64,12 +70,13 @@ module Wirble
64
70
  :history_path => ENV['IRB_HISTORY_FILE'] || "~/.irb_history",
65
71
  :history_size => (ENV['IRB_HISTORY_SIZE'] || 1000).to_i,
66
72
  :history_perms => File::WRONLY | File::CREAT | File::TRUNC,
73
+ :history_uniq => true,
67
74
  }
68
75
 
69
76
  private
70
77
 
71
78
  def say(*args)
72
- puts *args if @verbose
79
+ puts(*args) if @verbose
73
80
  end
74
81
 
75
82
  def cfg(key)
@@ -77,10 +84,21 @@ module Wirble
77
84
  end
78
85
 
79
86
  def save_history
80
- path, max_size, perms = %w{path size perms}.map { |v| cfg(v) }
87
+ path, max_size, perms, uniq = %w{path size perms uniq}.map { |v| cfg(v) }
81
88
 
82
89
  # read lines from history, and truncate the list (if necessary)
83
- lines = Readline::HISTORY.to_a.uniq
90
+ lines = Readline::HISTORY.to_a
91
+
92
+ if uniq
93
+ if uniq.to_s == 'reverse'
94
+ lines.reverse!
95
+ lines.uniq!
96
+ lines.reverse!
97
+ else
98
+ lines.uniq!
99
+ end
100
+ end
101
+
84
102
  lines = lines[-max_size, -1] if lines.size > max_size
85
103
 
86
104
  # write the history file
@@ -138,21 +156,30 @@ module Wirble
138
156
  case state[-1]
139
157
  when nil
140
158
  case c
141
- when ':' then state << :symbol
142
- when '"' then state << :string
143
- when '#' then state << :object
159
+ when ':'
160
+ state << :symbol
161
+ when '"'
162
+ state << :string
163
+ when '#'
164
+ state << :object
144
165
  when /[a-z]/i
145
166
  state << :keyword
146
167
  repeat = true
147
168
  when /[0-9-]/
148
169
  state << :number
149
170
  repeat = true
150
- when '{' then yield :open_hash, '{'
151
- when '[' then yield :open_array, '['
152
- when ']' then yield :close_array, ']'
153
- when '}' then yield :close_hash, '}'
154
- when /\s/ then yield :whitespace, c
155
- when ',' then yield :comma, ','
171
+ when '{'
172
+ yield :open_hash, '{'
173
+ when '['
174
+ yield :open_array, '['
175
+ when ']'
176
+ yield :close_array, ']'
177
+ when '}'
178
+ yield :close_hash, '}'
179
+ when /\s/
180
+ yield :whitespace, c
181
+ when ','
182
+ yield :comma, ','
156
183
  when '>'
157
184
  yield :refers, '=>' if lc == '='
158
185
  when '.'
Binary file