irbtools 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -31,7 +31,8 @@ You have the following ways:
31
31
  * <tt>Irbtools.remove_library(lib)</tt>
32
32
  * <tt>Irbtools.add_package(pkg)</tt>
33
33
  * <tt>Irbtools.remove_package(pkg)</tt>
34
- * Edit the <tt>Irbtools.libraries</tt>, <tt>Irbtools.libraries_in_proc</tt> or <tt>Irbtools.packages</tt> arrays directly (no way to set callbacks).
34
+
35
+ Edit the <tt>Irbtools.libraries</tt>, <tt>Irbtools.libraries_in_proc</tt> or <tt>Irbtools.packages</tt> arrays directly. If you use the <tt>add_library</tt> method, you can apply a block which gets executed when the library is loaded.
35
36
 
36
37
  == Features
37
38
 
@@ -40,22 +41,22 @@ See http://rbjl.net/40-irbtools-release-the-power-of-irb or read the commented s
40
41
  === Included gems and libraries
41
42
 
42
43
  * wirble[http://pablotron.org/software/wirble/] colorize output
43
- * fancy_irbt[tODO] put result as comment and more colorization
44
+ * fancy_irbt[https://github.com/janlelis/fancy_irb] put result as comment and more colorization
44
45
  * hirb[http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html] (active record) tables and custom views for specific objects
45
46
  * *fileutils* cd, pwd, ln_s, mv, rm, mkdir, touch ... ;)
46
47
  * zucker/env[http://rubyzucker.info] Info, OS, RubyVersion, RubyEngine
47
48
  * zucker/debug[http:/rubyzucker.info] nice debug printing (q, o, c, .m, .d)
48
- * ap[http://github.com/michaeldv/awesome_print] nice debug printing (ap)
49
+ * ap[https://github.com/michaeldv/awesome_print] nice debug printing (ap)
49
50
  * *yaml* nice debug printing (y)
50
51
  * clipboard[http://github.com/janlelis/clipboard] easy clipboard access (copy & paste)
51
52
  * guessmethod[http://guessmethod.rubyforge.org/] automatically corrects typos (method_missing hook)
52
- * interactive_editor[http://github.com/jberkel/interactive_editor] lets you open vim, hack something, and it gets loaded into the current session
53
+ * interactive_editor[https://github.com/jberkel/interactive_editor] lets you open vim, hack something, and it gets loaded into the current session
53
54
  * sketches[http://sketches.rubyforge.org/] another, more flexible "start editor and it gets loaded into your irb session" plugin
54
55
  * coderay[http://coderay.rubychan.de/] some nice colorful display ;)
55
56
  * boson[http://tagaholic.me/boson/] IRB commands repository (which also works for the shell!)
56
57
 
57
58
  === Helper methods
58
- See the source/rdoc for a description. These methods are defined directly by irbtools. Each gem may add its own helper methods.
59
+ See the source for a description. These methods are defined directly by irbtools. Each gem may add its own helper methods.
59
60
 
60
61
  *General*: <tt>ls, cat, rq, rrq/rerequire, ld, session_history, reset!, clear, use_ruby/use, dbg, Object#ri</tt>
61
62
 
data/Rakefile CHANGED
@@ -5,22 +5,22 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "irbtools"
8
- gem.summary = %Q{irbtools is a meta gem which installs some useful irb gems and configures your irb.}
8
+ gem.summary = %Q{irbtools is a meta gem which installs some useful irb gems and configures your irb.}
9
9
  gem.description = %Q{irbtools is a meta gem which installs some useful irb gems and configures your irb. Simply put a require 'irbtools' in the .irbrc file in your home directory.}
10
10
  gem.email = "mail@janlelis.de"
11
11
  gem.homepage = "http://github.com/janlelis/irbtools"
12
12
  gem.authors = ["Jan Lelis"]
13
+ gem.add_dependency 'fancy_irb', '>=0.6.2'
14
+ gem.add_dependency 'zucker', '>=8'
15
+ gem.add_dependency 'hirb', '~>0.3'
16
+ gem.add_dependency 'awesome_print', '~>0.3'
17
+ gem.add_dependency 'clipboard', '~>0.9'
18
+ gem.add_dependency 'coderay', '~>0.9'
19
+ gem.add_dependency 'boson', '~>0.3'
13
20
  gem.add_dependency 'wirble'
14
- gem.add_dependency 'fancy_irb'
15
- gem.add_dependency 'hirb'
16
- gem.add_dependency 'zucker', '>=8'
17
- gem.add_dependency 'awesome_print'
18
21
  gem.add_dependency 'g'
19
- gem.add_dependency 'clipboard', '>=0.9'
20
22
  gem.add_dependency 'guessmethod'
21
23
  gem.add_dependency 'interactive_editor'
22
- gem.add_dependency 'coderay'
23
- gem.add_dependency 'boson'
24
24
  gem.add_dependency 'sketches'
25
25
  end
26
26
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
data/irbtools.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{irbtools}
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jan Lelis"]
12
- s.date = %q{2010-11-10}
12
+ s.date = %q{2010-11-17}
13
13
  s.description = %q{irbtools is a meta gem which installs some useful irb gems and configures your irb. Simply put a require 'irbtools' in the .irbrc file in your home directory.}
14
14
  s.email = %q{mail@janlelis.de}
15
15
  s.extra_rdoc_files = [
@@ -17,7 +17,6 @@ Gem::Specification.new do |s|
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".document",
21
20
  ".gitignore",
22
21
  "CHANGELOG",
23
22
  "LICENSE",
@@ -41,44 +40,44 @@ Gem::Specification.new do |s|
41
40
  s.specification_version = 3
42
41
 
43
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
- s.add_runtime_dependency(%q<wirble>, [">= 0"])
45
- s.add_runtime_dependency(%q<fancy_irb>, [">= 0"])
46
- s.add_runtime_dependency(%q<hirb>, [">= 0"])
43
+ s.add_runtime_dependency(%q<fancy_irb>, [">= 0.6.2"])
47
44
  s.add_runtime_dependency(%q<zucker>, [">= 8"])
48
- s.add_runtime_dependency(%q<awesome_print>, [">= 0"])
45
+ s.add_runtime_dependency(%q<hirb>, ["~> 0.3"])
46
+ s.add_runtime_dependency(%q<awesome_print>, ["~> 0.3"])
47
+ s.add_runtime_dependency(%q<clipboard>, ["~> 0.9"])
48
+ s.add_runtime_dependency(%q<coderay>, ["~> 0.9"])
49
+ s.add_runtime_dependency(%q<boson>, ["~> 0.3"])
50
+ s.add_runtime_dependency(%q<wirble>, [">= 0"])
49
51
  s.add_runtime_dependency(%q<g>, [">= 0"])
50
- s.add_runtime_dependency(%q<clipboard>, [">= 0.9"])
51
52
  s.add_runtime_dependency(%q<guessmethod>, [">= 0"])
52
53
  s.add_runtime_dependency(%q<interactive_editor>, [">= 0"])
53
- s.add_runtime_dependency(%q<coderay>, [">= 0"])
54
- s.add_runtime_dependency(%q<boson>, [">= 0"])
55
54
  s.add_runtime_dependency(%q<sketches>, [">= 0"])
56
55
  else
57
- s.add_dependency(%q<wirble>, [">= 0"])
58
- s.add_dependency(%q<fancy_irb>, [">= 0"])
59
- s.add_dependency(%q<hirb>, [">= 0"])
56
+ s.add_dependency(%q<fancy_irb>, [">= 0.6.2"])
60
57
  s.add_dependency(%q<zucker>, [">= 8"])
61
- s.add_dependency(%q<awesome_print>, [">= 0"])
58
+ s.add_dependency(%q<hirb>, ["~> 0.3"])
59
+ s.add_dependency(%q<awesome_print>, ["~> 0.3"])
60
+ s.add_dependency(%q<clipboard>, ["~> 0.9"])
61
+ s.add_dependency(%q<coderay>, ["~> 0.9"])
62
+ s.add_dependency(%q<boson>, ["~> 0.3"])
63
+ s.add_dependency(%q<wirble>, [">= 0"])
62
64
  s.add_dependency(%q<g>, [">= 0"])
63
- s.add_dependency(%q<clipboard>, [">= 0.9"])
64
65
  s.add_dependency(%q<guessmethod>, [">= 0"])
65
66
  s.add_dependency(%q<interactive_editor>, [">= 0"])
66
- s.add_dependency(%q<coderay>, [">= 0"])
67
- s.add_dependency(%q<boson>, [">= 0"])
68
67
  s.add_dependency(%q<sketches>, [">= 0"])
69
68
  end
70
69
  else
71
- s.add_dependency(%q<wirble>, [">= 0"])
72
- s.add_dependency(%q<fancy_irb>, [">= 0"])
73
- s.add_dependency(%q<hirb>, [">= 0"])
70
+ s.add_dependency(%q<fancy_irb>, [">= 0.6.2"])
74
71
  s.add_dependency(%q<zucker>, [">= 8"])
75
- s.add_dependency(%q<awesome_print>, [">= 0"])
72
+ s.add_dependency(%q<hirb>, ["~> 0.3"])
73
+ s.add_dependency(%q<awesome_print>, ["~> 0.3"])
74
+ s.add_dependency(%q<clipboard>, ["~> 0.9"])
75
+ s.add_dependency(%q<coderay>, ["~> 0.9"])
76
+ s.add_dependency(%q<boson>, ["~> 0.3"])
77
+ s.add_dependency(%q<wirble>, [">= 0"])
76
78
  s.add_dependency(%q<g>, [">= 0"])
77
- s.add_dependency(%q<clipboard>, [">= 0.9"])
78
79
  s.add_dependency(%q<guessmethod>, [">= 0"])
79
80
  s.add_dependency(%q<interactive_editor>, [">= 0"])
80
- s.add_dependency(%q<coderay>, [">= 0"])
81
- s.add_dependency(%q<boson>, [">= 0"])
82
81
  s.add_dependency(%q<sketches>, [">= 0"])
83
82
  end
84
83
  end
data/lib/irbtools.rb CHANGED
@@ -31,12 +31,7 @@ load_libraries_proc = proc{ |libs|
31
31
  Irbtools.send :library_loaded, lib
32
32
 
33
33
  rescue LoadError => err
34
- if err.to_s =~ /irb_rocket/ && RubyEngine.mri?
35
- warn "Couldn't load the irb_rocket gem.
36
- You can install it with: gem install irb_rocket --source http://merbi.st"
37
- else
38
- warn "Couldn't load an irb library: #{err}"
39
- end
34
+ warn "Couldn't load an irb library: #{err}"
40
35
  end
41
36
  }
42
37
  $VERBOSE, $DEBUG = remember_verbose_and_debug
@@ -45,12 +40,16 @@ You can install it with: gem install irb_rocket --source http://merbi.st"
45
40
  # load them :)
46
41
  load_libraries_proc[ Irbtools.libraries ]
47
42
 
48
- # load these each time a new sub irb starts
49
- original_irbrc_proc = IRB.conf[:IRB_RC]
50
- IRB.conf[:IRB_RC] = proc{
43
+ # load these each time a new sub irb starts (only if supported)
44
+ if defined? ::IRB
45
+ original_irbrc_proc = IRB.conf[:IRB_RC]
46
+ IRB.conf[:IRB_RC] = proc{
47
+ load_libraries_proc[ Irbtools.libraries_in_proc ]
48
+ original_irbrc_proc[ ] if original_irbrc_proc
49
+ }
50
+ else
51
51
  load_libraries_proc[ Irbtools.libraries_in_proc ]
52
- original_irbrc_proc[ ] if original_irbrc_proc
53
- }
52
+ end
54
53
 
55
54
 
56
55
  # # # # #
@@ -59,31 +58,33 @@ require File.expand_path('irbtools/general', File.dirname(__FILE__) )
59
58
 
60
59
  # # # # #
61
60
  # irb options
62
- IRB.conf[:AUTO_INDENT] = true # simple auto indent
63
- IRB.conf[:EVAL_HISTORY] = 42424242424242424242 # creates the special __ variable
64
- IRB.conf[:SAVE_HISTORY] = 2000 # how many lines will go to ~/.irb_history
65
-
66
- # prompt
67
- (IRB.conf[:PROMPT] ||= {} ).merge!( {:IRBTOOLS => {
68
- :PROMPT_I => ">> ", # normal
69
- :PROMPT_N => "| ", # indenting
70
- :PROMPT_C => ".> ", # continuing a statement
71
- :PROMPT_S => "%l> ", # continuing a string
72
- :RETURN => "=> %s \n",
73
- :AUTO_INDENT => true,
74
- }})
75
-
76
- IRB.conf[:PROMPT_MODE] = :IRBTOOLS
61
+ if defined? ::IRB && !defined? ::Ripl
62
+ IRB.conf[:AUTO_INDENT] = true # simple auto indent
63
+ IRB.conf[:EVAL_HISTORY] = 42424242424242424242 # creates the special __ variable
64
+ IRB.conf[:SAVE_HISTORY] = 2000 # how many lines will go to ~/.irb_history
65
+
66
+ # prompt
67
+ (IRB.conf[:PROMPT] ||= {} ).merge!( {:IRBTOOLS => {
68
+ :PROMPT_I => ">> ", # normal
69
+ :PROMPT_N => "| ", # indenting
70
+ :PROMPT_C => ".> ", # continuing a statement
71
+ :PROMPT_S => "%l> ", # continuing a string
72
+ :RETURN => "=> %s \n",
73
+ :AUTO_INDENT => true,
74
+ }})
75
+
76
+ IRB.conf[:PROMPT_MODE] = :IRBTOOLS
77
+ end
77
78
 
78
79
  # # # # #
79
80
  # misc
80
81
 
81
- # add current directory to the loadpath
82
+ # add current directory to the load path
82
83
  $: << '.' if RubyVersion.is.at_least? '1.9.2'
83
84
 
84
85
  # shorter ruby info constants
85
- Object.const_set 'RV', RubyVersion rescue nil
86
- Object.const_set 'RE', RubyEngine rescue nil
86
+ Object.const_set :RV, RubyVersion rescue nil
87
+ Object.const_set :RE, RubyEngine rescue nil
87
88
 
88
89
  # load rails.rc
89
90
  begin
@@ -9,23 +9,27 @@ begin
9
9
  require 'zucker/alias_for'
10
10
  require 'zucker/env' # Info, OS, RubyVersion, RubyEngine
11
11
  rescue LoadError
12
- raise "Sorry, the irbtools couldn't load, because the zucker gem is not available"
12
+ raise LoadError, "Sorry, the irbtools couldn't load, because the zucker gem is not available"
13
13
  end
14
14
 
15
15
  # # # # #
16
16
  # define module methods
17
17
  module Irbtools
18
- @lib_hooks = Hash.new{|h,k| h[k] = [] }
19
- @libs = [] # %w[rubygems]
20
- @libs_in_proc = []
21
- @packages = []
22
- @railsrc = '~/.railsrc'
23
- @welcome_message = "Welcome to IRB. You are using #{ RUBY_DESCRIPTION }. Have fun ;)"
18
+ @lib_hooks = Hash.new{|h,k| h[k] = [] }
19
+ @libs = [] # %w[rubygems]
20
+ @libs_in_proc = []
21
+ @packages = []
22
+ @railsrc = '~/.railsrc'
23
+ @shell_name = File.split($0)[-1].upcase
24
+ @welcome_message = "Welcome to #{ @shell_name }. You are using #{ RUBY_DESCRIPTION }. Have fun ;)"
24
25
 
25
26
  class << self
26
27
  # message to display when starting. Set to nil to disable
27
28
  attr_accessor :welcome_message
28
29
 
30
+ # shell name (usually irb), retrieved from $0
31
+ attr_reader :shell_name
32
+
29
33
  # lets you define the path to the irbrc or deactivate this feature with nil
30
34
  attr_accessor :railsrc
31
35
 
@@ -78,8 +78,8 @@ def dbg
78
78
  begin
79
79
  require 'ruby-debug'
80
80
  debugger
81
- rescue LoadError => e
82
- throw "Sorry, unable to load ruby-debug gem for debugger: #{e}"
81
+ rescue LoadError => err
82
+ throw "Sorry, unable to load ruby-debug gem for debugger: #{err}"
83
83
  end
84
84
  end
85
85
 
@@ -97,4 +97,8 @@ if RubyVersion.is? 1.9
97
97
  Irbtools.libraries_in_proc -= %w[guessmethod]
98
98
  end
99
99
 
100
+ if defined? Ripl
101
+ Irbtools.libraries -= %w[wirble fancy_irb]
102
+ end
103
+
100
104
  # J-_-L
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irbtools
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Lelis
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-10 00:00:00 +01:00
18
+ date: 2010-11-17 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: wirble
22
+ name: fancy_irb
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
@@ -29,21 +29,23 @@ dependencies:
29
29
  hash: 3
30
30
  segments:
31
31
  - 0
32
- version: "0"
32
+ - 6
33
+ - 2
34
+ version: 0.6.2
33
35
  type: :runtime
34
36
  version_requirements: *id001
35
37
  - !ruby/object:Gem::Dependency
36
- name: fancy_irb
38
+ name: zucker
37
39
  prerelease: false
38
40
  requirement: &id002 !ruby/object:Gem::Requirement
39
41
  none: false
40
42
  requirements:
41
43
  - - ">="
42
44
  - !ruby/object:Gem::Version
43
- hash: 3
45
+ hash: 19
44
46
  segments:
45
- - 0
46
- version: "0"
47
+ - 8
48
+ version: "8"
47
49
  type: :runtime
48
50
  version_requirements: *id002
49
51
  - !ruby/object:Gem::Dependency
@@ -52,73 +54,77 @@ dependencies:
52
54
  requirement: &id003 !ruby/object:Gem::Requirement
53
55
  none: false
54
56
  requirements:
55
- - - ">="
57
+ - - ~>
56
58
  - !ruby/object:Gem::Version
57
- hash: 3
59
+ hash: 13
58
60
  segments:
59
61
  - 0
60
- version: "0"
62
+ - 3
63
+ version: "0.3"
61
64
  type: :runtime
62
65
  version_requirements: *id003
63
66
  - !ruby/object:Gem::Dependency
64
- name: zucker
67
+ name: awesome_print
65
68
  prerelease: false
66
69
  requirement: &id004 !ruby/object:Gem::Requirement
67
70
  none: false
68
71
  requirements:
69
- - - ">="
72
+ - - ~>
70
73
  - !ruby/object:Gem::Version
71
- hash: 19
74
+ hash: 13
72
75
  segments:
73
- - 8
74
- version: "8"
76
+ - 0
77
+ - 3
78
+ version: "0.3"
75
79
  type: :runtime
76
80
  version_requirements: *id004
77
81
  - !ruby/object:Gem::Dependency
78
- name: awesome_print
82
+ name: clipboard
79
83
  prerelease: false
80
84
  requirement: &id005 !ruby/object:Gem::Requirement
81
85
  none: false
82
86
  requirements:
83
- - - ">="
87
+ - - ~>
84
88
  - !ruby/object:Gem::Version
85
- hash: 3
89
+ hash: 25
86
90
  segments:
87
91
  - 0
88
- version: "0"
92
+ - 9
93
+ version: "0.9"
89
94
  type: :runtime
90
95
  version_requirements: *id005
91
96
  - !ruby/object:Gem::Dependency
92
- name: g
97
+ name: coderay
93
98
  prerelease: false
94
99
  requirement: &id006 !ruby/object:Gem::Requirement
95
100
  none: false
96
101
  requirements:
97
- - - ">="
102
+ - - ~>
98
103
  - !ruby/object:Gem::Version
99
- hash: 3
104
+ hash: 25
100
105
  segments:
101
106
  - 0
102
- version: "0"
107
+ - 9
108
+ version: "0.9"
103
109
  type: :runtime
104
110
  version_requirements: *id006
105
111
  - !ruby/object:Gem::Dependency
106
- name: clipboard
112
+ name: boson
107
113
  prerelease: false
108
114
  requirement: &id007 !ruby/object:Gem::Requirement
109
115
  none: false
110
116
  requirements:
111
- - - ">="
117
+ - - ~>
112
118
  - !ruby/object:Gem::Version
113
- hash: 25
119
+ hash: 13
114
120
  segments:
115
121
  - 0
116
- - 9
117
- version: "0.9"
122
+ - 3
123
+ version: "0.3"
118
124
  type: :runtime
119
125
  version_requirements: *id007
120
126
  - !ruby/object:Gem::Dependency
121
- name: guessmethod
127
+ name: wirble
122
128
  prerelease: false
123
129
  requirement: &id008 !ruby/object:Gem::Requirement
124
130
  none: false
@@ -132,7 +138,7 @@ dependencies:
132
138
  type: :runtime
133
139
  version_requirements: *id008
134
140
  - !ruby/object:Gem::Dependency
135
- name: interactive_editor
141
+ name: g
136
142
  prerelease: false
137
143
  requirement: &id009 !ruby/object:Gem::Requirement
138
144
  none: false
@@ -146,7 +152,7 @@ dependencies:
146
152
  type: :runtime
147
153
  version_requirements: *id009
148
154
  - !ruby/object:Gem::Dependency
149
- name: coderay
155
+ name: guessmethod
150
156
  prerelease: false
151
157
  requirement: &id010 !ruby/object:Gem::Requirement
152
158
  none: false
@@ -160,7 +166,7 @@ dependencies:
160
166
  type: :runtime
161
167
  version_requirements: *id010
162
168
  - !ruby/object:Gem::Dependency
163
- name: boson
169
+ name: interactive_editor
164
170
  prerelease: false
165
171
  requirement: &id011 !ruby/object:Gem::Requirement
166
172
  none: false
@@ -197,7 +203,6 @@ extra_rdoc_files:
197
203
  - LICENSE
198
204
  - README.rdoc
199
205
  files:
200
- - .document
201
206
  - .gitignore
202
207
  - CHANGELOG
203
208
  - LICENSE
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE