dylansm-wirble 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 +20 -0
- data/ChangeLog +29 -0
- data/README +452 -0
- data/Rakefile +115 -0
- data/_irbrc +27 -0
- data/dylansm-wirble.gemspec +40 -0
- data/lib/wirble.rb +536 -0
- data/setup.rb +1596 -0
- metadata +70 -0
data/COPYING
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2006-2009 Paul Duncan <pabs@pablotron.org>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
+
copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included
|
12
|
+
in all copies or substantial portions of the of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
15
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
19
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
20
|
+
DEALINGS IN THE SOFTWARE.
|
data/ChangeLog
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
* Wed Sep 06 00:01:21 2006, pabs <pabs@pablotron.org>
|
3
|
+
* initial import
|
4
|
+
|
5
|
+
* Wed Sep 06 00:10:13 2006, pabs <pabs@pablotron.org>
|
6
|
+
* wirble.rb: remove symbol hackery to prevent
|
7
|
+
ri/rdoc from barfing
|
8
|
+
|
9
|
+
* Wed Sep 6 02:49:02 EDT 2006, Paul Duncan <pabs@pablotron.org>
|
10
|
+
* wirble.rb: fix typo
|
11
|
+
* re-release 0.1.0
|
12
|
+
|
13
|
+
* Fri Sep 8 04:01:40 EDT 2006, Paul Duncan <pabs@pablotron.org>
|
14
|
+
* README: updated version to 0.1.1
|
15
|
+
* wirble.gemspec: ditto
|
16
|
+
* wirble.rb: ditto
|
17
|
+
* wirble.rb: wrap colorize in an exception (just in case)
|
18
|
+
|
19
|
+
* Fri Sep 08 13:11:05 2006, pabs <pabs@pablotron.org>
|
20
|
+
* increment version to 0.1.2
|
21
|
+
* wirble.gemspec: remove rubilicious dependency
|
22
|
+
|
23
|
+
* Fri Sep 8 13:17:29 EDT 2006, Paul Duncan <pabs@pablotron.org>
|
24
|
+
* README: increment version to 0.1.2
|
25
|
+
* wirble.gemspec: ditto
|
26
|
+
* wirble.rb: ditto
|
27
|
+
|
28
|
+
* Fri Sep 08 13:18:15 2006, pabs <pabs@pablotron.org>
|
29
|
+
* releasing 0.1.2
|
data/README
ADDED
@@ -0,0 +1,452 @@
|
|
1
|
+
Wirble 0.1.3 README
|
2
|
+
===================
|
3
|
+
|
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
|
+
|
8
|
+
http://pablotron.org/software/wirble/
|
9
|
+
|
10
|
+
Table of Contents
|
11
|
+
=================
|
12
|
+
* Introduction to Wirble
|
13
|
+
* Installing Wirble
|
14
|
+
o Via RubyGems
|
15
|
+
o Via a Tarball
|
16
|
+
o As a User
|
17
|
+
* Using Wirble
|
18
|
+
o Editing Your ~/.irbrc
|
19
|
+
o Enabling Color
|
20
|
+
* Configuring Wirble
|
21
|
+
* Color Settings
|
22
|
+
o Color Keys
|
23
|
+
o Color Values
|
24
|
+
o Default Color Map
|
25
|
+
* Frequently Asked Questions (FAQ)
|
26
|
+
* Reporting Bugs
|
27
|
+
* About the Author
|
28
|
+
|
29
|
+
|
30
|
+
Introduction to Wirble
|
31
|
+
======================
|
32
|
+
Wirble is a set of enhancements to Irb all included together in one
|
33
|
+
easy-to-use package. Specifically, Wirble adds a saved history, a
|
34
|
+
couple of useful shortcuts, and color to Irb. Wirble also enables a
|
35
|
+
Irb's built-in tab-completion and a simpler prompt.
|
36
|
+
|
37
|
+
Before we begin, I should mention that several of Wirble's features were
|
38
|
+
shamelessly inspired (read: borrowed with extreme prejudice) from the
|
39
|
+
"Irb Tips and Tricks" page of the Ruby Garden Wiki, which you can find
|
40
|
+
at the following URL:
|
41
|
+
|
42
|
+
http://wiki.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks
|
43
|
+
|
44
|
+
In particular, the Irb history and ri features bear a striking
|
45
|
+
resemblence to their Ruby Garden counterparts.
|
46
|
+
|
47
|
+
|
48
|
+
Installing Wirble
|
49
|
+
=================
|
50
|
+
The easiest way to install Wirble is via RubyGems
|
51
|
+
(http://rubygems.org/). If you've already got RubyGems installed,
|
52
|
+
simply do the following, then skip to the "Using Wirble" section below:
|
53
|
+
|
54
|
+
# install wirble via RubyGems
|
55
|
+
sudo gem install wirble
|
56
|
+
|
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:
|
65
|
+
|
66
|
+
# install wirble to library directory
|
67
|
+
sudo cp -v wirble.rb $(ruby -e 'puts $LOAD_PATH[0]')
|
68
|
+
|
69
|
+
Or, if you don't use sudo, you can do the same thing with su, like so:
|
70
|
+
|
71
|
+
# install wirble to library directory
|
72
|
+
su -c "cp -v wirble.rb $(ruby -e 'puts $LOAD_PATH[0]')"
|
73
|
+
|
74
|
+
Finally, if you don't have an administrator account, you can still
|
75
|
+
install Wirble in your local home directory like so:
|
76
|
+
|
77
|
+
# create local ruby library directory
|
78
|
+
mkdir ~/.ruby && chmod 700 ~/.ruby
|
79
|
+
cp -v wirble.rb ~/.ruby
|
80
|
+
|
81
|
+
Then add the following line at the _top_ of your ~/.irbrc file:
|
82
|
+
|
83
|
+
# add ~/.ruby to the library search path
|
84
|
+
$LOAD_PATH << File.expand_path('~/.ruby')
|
85
|
+
|
86
|
+
|
87
|
+
Using Wirble
|
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
|
+
|
93
|
+
Using Wirble is easy: just add the following lines to your ~/.irbrc
|
94
|
+
file:
|
95
|
+
|
96
|
+
begin
|
97
|
+
require 'wirble'
|
98
|
+
|
99
|
+
# init wirble
|
100
|
+
Wirble.init
|
101
|
+
rescue LoadError => err
|
102
|
+
$stderr.puts "Couldn't load Wirble: #{err}"
|
103
|
+
end
|
104
|
+
|
105
|
+
A lot of people really don't like colors, so I've kept the color
|
106
|
+
disabled by default. To enable it, add the following bit to your
|
107
|
+
~/.irbrc file immediately after the call to "Wirble.init":
|
108
|
+
|
109
|
+
# enable color
|
110
|
+
Wirble.colorize
|
111
|
+
|
112
|
+
If you want to terrify your grandmother and impress your buddies, your
|
113
|
+
entire ~/.irbrc can also be written like so:
|
114
|
+
|
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) }
|
124
|
+
|
125
|
+
Configuring Wirble
|
126
|
+
==================
|
127
|
+
You can pass a hash of options to Wirble.init in order to adjust the
|
128
|
+
behavior of Wirble. Here's a full list of options and a brief
|
129
|
+
description of each one:
|
130
|
+
|
131
|
+
* :skip_internals
|
132
|
+
|
133
|
+
Don't load the internal Irb features. Equivalent to setting both
|
134
|
+
:skip_libraries and :skip_prompt (see below).
|
135
|
+
|
136
|
+
* :skip_libraries
|
137
|
+
|
138
|
+
Don't load any libraries. At the moment, Wirble attempts to load
|
139
|
+
the following libraries: "pp", "irb/completion", and "rubygems".
|
140
|
+
|
141
|
+
* :skip_prompt
|
142
|
+
|
143
|
+
Down't load the simple prompt. Shouldn't ever be necessary, but
|
144
|
+
I've included it for the sake of completeness. Wirble's default
|
145
|
+
behavior is to the prompt setting before making any changes. If the
|
146
|
+
prompt is anything other than :DEFAULT, Wirble won't override it.
|
147
|
+
|
148
|
+
* :skip_history
|
149
|
+
|
150
|
+
Don't load the Irb history. There are a few additional history
|
151
|
+
options as well; see :history_path, :history_size, and
|
152
|
+
:history_perms below.
|
153
|
+
|
154
|
+
* :history_path
|
155
|
+
|
156
|
+
Set the path to the Irb history file. Defaults to "~/.irb_history".
|
157
|
+
If an environment variable named IRB_HISTORY_FILE is set, Wirble
|
158
|
+
will use that instead of the default value.
|
159
|
+
|
160
|
+
* :history_size
|
161
|
+
|
162
|
+
Set the size (in lines) of the Irb history file. Defaults to 1000
|
163
|
+
lines. If an environment variable named IRB_HISTORY_SIZE is set,
|
164
|
+
Wirble will use that instead of the default value.
|
165
|
+
|
166
|
+
* :history_perms
|
167
|
+
|
168
|
+
Set the permissions of the Irb history file. Defaults to
|
169
|
+
File::WRONLY.
|
170
|
+
|
171
|
+
* :skip_shortcuts
|
172
|
+
|
173
|
+
Don't load any shortcut methods. at the moment there are three
|
174
|
+
shortcut methods: "ri", "po", and "poc". The first calls the "ri"
|
175
|
+
command on the specified value -- you"ll need to use proper quoting
|
176
|
+
to pass the name properly. As for "po" and "poc": the former lists
|
177
|
+
an object's instance methods (excluding methods that belong to
|
178
|
+
Object), sorted by name, and the latter lists an object's constants,
|
179
|
+
sorted by name.
|
180
|
+
|
181
|
+
* :init_colors
|
182
|
+
|
183
|
+
Enable colors. Equivalent to calling Wirble.colorize directly.
|
184
|
+
|
185
|
+
* :colors
|
186
|
+
|
187
|
+
A hash of colors. Only makes sense in conjunction with the
|
188
|
+
:init_colors option. See below for additional information on
|
189
|
+
customizing color settings.
|
190
|
+
|
191
|
+
Here's an example of passing a list of options to Wirble.init():
|
192
|
+
|
193
|
+
wirble_opts = {
|
194
|
+
# skip shortcuts
|
195
|
+
:skip_shortcuts => true,
|
196
|
+
|
197
|
+
# don't set the prompt
|
198
|
+
:skip_prompt => true,
|
199
|
+
|
200
|
+
# override some of the default colors
|
201
|
+
:colors => {
|
202
|
+
:open_hash => :green.
|
203
|
+
:close_hash => :green.
|
204
|
+
:string => :blue,
|
205
|
+
},
|
206
|
+
|
207
|
+
# enable color
|
208
|
+
:init_color => true,
|
209
|
+
}
|
210
|
+
|
211
|
+
# initialize wirble with options above
|
212
|
+
Wirble.init(wirble_opts)
|
213
|
+
|
214
|
+
For a full description of the color options, see the next section.
|
215
|
+
|
216
|
+
|
217
|
+
Color Settings
|
218
|
+
==============
|
219
|
+
You can set colors in Wirble by passing a hash of color options via
|
220
|
+
Wirble.init (see the :color option for Wirble.init above), or by setting
|
221
|
+
Wirble::Colorize.color directly. For example:
|
222
|
+
|
223
|
+
# get the default colors and add in your own
|
224
|
+
colors = Wirble::Colorize.colors.merge({
|
225
|
+
# set the comma color to blue
|
226
|
+
:comma => :blue,
|
227
|
+
})
|
228
|
+
|
229
|
+
# set the colors used by Wirble
|
230
|
+
Wirble::Colorize.colors = colors
|
231
|
+
|
232
|
+
Below is a list of all the recognized color keys.
|
233
|
+
|
234
|
+
* :comma (',')
|
235
|
+
|
236
|
+
A comma character. The element delimiter in arrays and hashes.
|
237
|
+
|
238
|
+
* :refers ('=>')
|
239
|
+
|
240
|
+
The hash reference operator. The key/value delimiter in hashes.
|
241
|
+
|
242
|
+
* :open_hash ('{')
|
243
|
+
|
244
|
+
The opening curly brace for a hash.
|
245
|
+
|
246
|
+
* :close_hash ('}')
|
247
|
+
|
248
|
+
The opening curly brace for a hash.
|
249
|
+
|
250
|
+
* :open_array ('[')
|
251
|
+
|
252
|
+
The opening brace for a array.
|
253
|
+
|
254
|
+
* :close_array (']')
|
255
|
+
|
256
|
+
The opening brace for a array.
|
257
|
+
|
258
|
+
* :open_object ('#<')
|
259
|
+
|
260
|
+
The opening delimiter for an object.
|
261
|
+
|
262
|
+
* :close_object ('>')
|
263
|
+
|
264
|
+
The closing delimiter for an object inspection.
|
265
|
+
|
266
|
+
* :object_class
|
267
|
+
|
268
|
+
The class attribute of an object inspection. For example, in the
|
269
|
+
string "#<Proc:0xb7be4968@(irb):8>", the string "Proc" is the class
|
270
|
+
attribute.
|
271
|
+
|
272
|
+
* :object_addr_prefix (':')
|
273
|
+
|
274
|
+
The colon prefixing the address attribute of an object inspection.
|
275
|
+
For example, in the string "#<Proc:0xb7be4968@(irb):8>", the string
|
276
|
+
"0xb7be4968" is the memory address attribute, so the ':' is the
|
277
|
+
address prefix.
|
278
|
+
|
279
|
+
* :object_addr
|
280
|
+
|
281
|
+
The memory address attribute of an object inspection. For example,
|
282
|
+
in the string "#<Proc:0xb7be4968@(irb):8>", the string "0xb7be4968"
|
283
|
+
is the memory address attribute.
|
284
|
+
|
285
|
+
* :object_addr_prefix ('@')
|
286
|
+
|
287
|
+
The at symbol prefixing the line attribute of an object inspection.
|
288
|
+
For example, in the string "#<Proc:0xb7be4968@(irb):8>", the string
|
289
|
+
"(irb):8" is the line attribute, so the '@' is the line attribute
|
290
|
+
prefix.
|
291
|
+
|
292
|
+
* :object_line
|
293
|
+
|
294
|
+
The line number attribute of an object inspection. For example,
|
295
|
+
in the string "#<Proc:0xb7be4968@(irb):8>", the string "(irb):8"
|
296
|
+
is the line number attribute.
|
297
|
+
|
298
|
+
* :symbol_prefix (':')
|
299
|
+
|
300
|
+
The colon prefix for a symbol object.
|
301
|
+
|
302
|
+
* :symbol
|
303
|
+
|
304
|
+
The string of a symbol object.
|
305
|
+
|
306
|
+
* :open_string ('"')
|
307
|
+
|
308
|
+
The opening quote of a string object.
|
309
|
+
|
310
|
+
* :close_string ('"')
|
311
|
+
|
312
|
+
The closing quote of a string object.
|
313
|
+
|
314
|
+
* :number
|
315
|
+
|
316
|
+
A number (integer or float).
|
317
|
+
|
318
|
+
* :range ('..')
|
319
|
+
|
320
|
+
The delimeter of a range object.
|
321
|
+
|
322
|
+
* :keyword
|
323
|
+
|
324
|
+
A built-in Ruby keyword. This includes values like "true", "false",
|
325
|
+
and "nil".
|
326
|
+
|
327
|
+
* :class
|
328
|
+
|
329
|
+
A class. This includes strings like "Class" and "Object".
|
330
|
+
|
331
|
+
* :whitespace
|
332
|
+
|
333
|
+
Whitespace character (i.e. space, newline, tab, etc).
|
334
|
+
|
335
|
+
The highlighting is implemented with a simple hand-rolled state-based
|
336
|
+
tokenizer (wow, that was a mouthful). This should be adequate most of
|
337
|
+
the time, but since it's not a actual LALR parser, Wirble can get
|
338
|
+
confused in a few specific instances. If you find a serious
|
339
|
+
highlighting problem, please let me know. Oh yeah, before I forget,
|
340
|
+
here's a list of the valid color codes:
|
341
|
+
|
342
|
+
:nothing :green :light_purple
|
343
|
+
:black :light_blue :purple
|
344
|
+
:blue :light_cyan :red
|
345
|
+
:brown :light_gray :white
|
346
|
+
:cyan :light_green :yellow
|
347
|
+
:dark_gray :light_red
|
348
|
+
|
349
|
+
Note that I'm not a designer, and I also use a terminal with a dark
|
350
|
+
background. I've also been accused of having a Vim color scheme that
|
351
|
+
looks like "a beat up clown". With those caveats in mind, here's the
|
352
|
+
default color scheme for Wirble:
|
353
|
+
|
354
|
+
#
|
355
|
+
# Default Wirble color scheme.
|
356
|
+
#
|
357
|
+
DEFAULT_COLORS = {
|
358
|
+
# delimiter colors
|
359
|
+
:comma => :blue,
|
360
|
+
:refers => :blue,
|
361
|
+
|
362
|
+
# container colors (hash and array)
|
363
|
+
:open_hash => :green,
|
364
|
+
:close_hash => :green,
|
365
|
+
:open_array => :green,
|
366
|
+
:close_array => :green,
|
367
|
+
|
368
|
+
# object colors
|
369
|
+
:open_object => :light_red,
|
370
|
+
:object_class => :white,
|
371
|
+
:object_addr_prefix => :blue,
|
372
|
+
:object_line_prefix => :blue,
|
373
|
+
:close_object => :light_red,
|
374
|
+
|
375
|
+
# symbol colors
|
376
|
+
:symbol => :yellow,
|
377
|
+
:symbol_prefix => :yellow,
|
378
|
+
|
379
|
+
# string colors
|
380
|
+
:open_string => :red,
|
381
|
+
:string => :cyan,
|
382
|
+
:close_string => :red,
|
383
|
+
|
384
|
+
# misc colors
|
385
|
+
:number => :cyan,
|
386
|
+
:keyword => :green,
|
387
|
+
:class => :light_green,
|
388
|
+
:range => :red,
|
389
|
+
}
|
390
|
+
|
391
|
+
This map is also available via programmatically via
|
392
|
+
Wirble::Colorize::DEFAULT_COLORS.
|
393
|
+
|
394
|
+
|
395
|
+
Frequently Asked Questions (FAQ)
|
396
|
+
================================
|
397
|
+
Q. Where did the name come from?
|
398
|
+
A. Beats me. It's the only thing I could find in the dictionary, and
|
399
|
+
the only name I came up with that I could pronounce.
|
400
|
+
|
401
|
+
Q. How do I use color in my Irb prompts?
|
402
|
+
A. You can use standard color escape codes in the format string used by
|
403
|
+
Irb. For example, to set the user prompt to cyan, you could do
|
404
|
+
something like this:
|
405
|
+
|
406
|
+
ctx = IRB.CurrentContext
|
407
|
+
ctx.prompt_i = Wirble::Colorize.colorize_string(ctx.prompt_i, :cyan)
|
408
|
+
|
409
|
+
Q. How can I do syntax highlighting as I type?
|
410
|
+
A. I don't know. If there is an answer, I suspect it's not very
|
411
|
+
portable and probably requires some modification to Irb. There's a
|
412
|
+
sneaky hack called eval.rb that seems to do a little bit of
|
413
|
+
highlight, but it doesn't use Irb, and it doesn't really do what
|
414
|
+
you're asking. That said, you can find it here:
|
415
|
+
|
416
|
+
http://www.rubyist.net/~slagell/ruby/eval.txt
|
417
|
+
|
418
|
+
Incidentally, part of the problem is that there's no real easy way
|
419
|
+
to do the following:
|
420
|
+
|
421
|
+
1. Access to the token stream or parser state incrementally.
|
422
|
+
2. Process partial strings in readline.
|
423
|
+
|
424
|
+
A bit more about #1: both Irb and the internal Ruby lexer kind of
|
425
|
+
muddle the traditionally separate concepts of lexer and parser, so
|
426
|
+
it's difficult to, say, parse a string into components and do syntax
|
427
|
+
highlighting on them. Vim and Emacs both handle this with sneaky
|
428
|
+
regular expressions, and a simple Ruby parser, respectively. Wirble
|
429
|
+
and Irb both roll their own (albeit limited) Ruby lexers.
|
430
|
+
|
431
|
+
|
432
|
+
Reporting Bugs
|
433
|
+
==============
|
434
|
+
Have a bug to report or a feature you'd like me to add to Wirble?
|
435
|
+
Feel free to email me at the address below. Alternatively, you can
|
436
|
+
submit your feature request or bug directly to my bug-tracking web
|
437
|
+
interface at the following URL:
|
438
|
+
|
439
|
+
http://redmine.pablotron.org/projects/show/wirble
|
440
|
+
|
441
|
+
Note: you'll need to create an account in order to submit a feature
|
442
|
+
request or a bug report via the web interface. Also, I'm a busy guy! I
|
443
|
+
make every effort to respond quickly to bug reports, but detailed
|
444
|
+
descriptions and or patches really do make my life a whole lot easier.
|
445
|
+
|
446
|
+
|
447
|
+
About the Author
|
448
|
+
================
|
449
|
+
Paul Duncan <pabs@pablotron.org>
|
450
|
+
http://pablotron.org/
|
451
|
+
|
452
|
+
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_name = 'Paul Duncan'
|
30
|
+
ret.author_email = 'pabs@pablotron.org'
|
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 = 'dylansm-' + 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.author = pkg.author_name
|
90
|
+
s.email = pkg.author_email
|
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
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
|
5
|
+
#### Basic information.
|
6
|
+
|
7
|
+
s.name = 'dylansm-wirble'
|
8
|
+
s.version = '0.1.3.1'
|
9
|
+
s.summary = <<-EOF
|
10
|
+
Handful of common Irb features, made easy.
|
11
|
+
EOF
|
12
|
+
s.description = <<-EOF
|
13
|
+
A handful of useful Irb features, including colorized results,
|
14
|
+
tab-completion, history, a simple prompt, and several helper
|
15
|
+
methods, all rolled into one easy to use package.
|
16
|
+
EOF
|
17
|
+
|
18
|
+
s.requirements << 'Ruby, version 1.8.0 (or newer)'
|
19
|
+
|
20
|
+
# Which files are to be included in this gem? Everything! (Except .hg directories.)
|
21
|
+
s.files = Dir.glob("**/*").delete_if { |item| item.include?(".hg") }
|
22
|
+
|
23
|
+
# C code extensions.
|
24
|
+
|
25
|
+
s.require_path = '.' # is this correct?
|
26
|
+
|
27
|
+
# Load-time details: library and application (you will need one or both).
|
28
|
+
s.autorequire = 'wirble'
|
29
|
+
s.has_rdoc = true
|
30
|
+
s.rdoc_options = ['--webcvs',
|
31
|
+
'http://hg.pablotron.org/wirble', '--title',
|
32
|
+
'Wirble API Documentation', 'wirble.rb', 'README', 'ChangeLog',
|
33
|
+
'COPYING']
|
34
|
+
|
35
|
+
# Author and project details.
|
36
|
+
s.author = 'Paul Duncan'
|
37
|
+
s.email = 'pabs@pablotron.org'
|
38
|
+
s.homepage = 'http://pablotron.org/software/wirble/'
|
39
|
+
s.rubyforge_project = 'wirble'
|
40
|
+
end
|