irbtools 1.7.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6fc5dfb78450feaf9825ea3493ea0963bc615459
4
- data.tar.gz: 77fb25ba999ee31c84d838ed2ab202d494e2a1c7
3
+ metadata.gz: bd8775be982770b7eccbe9b8a373d17dbde79af3
4
+ data.tar.gz: 2b6b6ca680bbe778b051ba48a02a23a21e92fe9b
5
5
  SHA512:
6
- metadata.gz: 241cbd2266bbf07dc84ffd03ca4ed44e185764195c876dd120b3a896655b7022f1a31d647293d7f69426aa6369f6b464f13ed6542464d6f0deacceff91663c07
7
- data.tar.gz: 4d3421692e19e5d76846b8afdf7ea105e82d4e3f5187d7e378dc5278db2a02424054c7a56c2a5e57d5601aeb12cdb9a36e421b325325264f7ff98891d43e67b9
6
+ metadata.gz: 2551c24c94f4afd8138c6fc058564c3f46348edf367ecd2584d9e7887b7333ca38e67e38c3ecce2feedde8db044c11f122333986236520f355cecb845d9b6093
7
+ data.tar.gz: 650846cfed1e20fae1d16f02cb4f9531be6fd8b16bfe1967d22a86e648aedd1cd3ef9d1d458b0940a9db1cf98833093ba56cea847f27c9d03c70601a1055262c
@@ -1,3 +1,17 @@
1
+ 2.0.0
2
+ * Use Wirb 2.0 and FancyIrb 1.0
3
+ * Drop support for Ruby 1
4
+ * Simplify starting from code via: require 'irbtools/binding'
5
+ * Rename method to show a method's source to: code
6
+ * Add instance gem
7
+ * Remove code organization gems (boson + alias)
8
+ * Don't add '.' to the load path, use rr (require_relative) instead
9
+ * Improve loading order of libraries
10
+ * Remove aliases for Irbtools configuration
11
+ * Integrate irbtools-more into irbtools main repo
12
+ * EveryDayIrb now gets released on its own, instead with every new irbtools version
13
+ * Improve documentation in Readme
14
+
1
15
  1.7.1
2
16
  * bump binding.repl, hirb, methodfinder
3
17
 
data/CONFIGURE.md ADDED
@@ -0,0 +1,55 @@
1
+ ## Advanced Tweaking
2
+ ### Welcome Message
3
+
4
+ The welcome message can be customized with `Irbtools.welcome_message=`
5
+
6
+ ### Customize Libraries to Load
7
+
8
+ It is possible to modify, which libraries to load:
9
+
10
+ # Don't require 'irbtools', but:
11
+ require 'irbtools/configure'
12
+ # Here you can modify the libraries using the methods below
13
+ Irbtools.start
14
+
15
+ If you do not want to load the default set of **irbtools** gems, you will have
16
+ to use `require 'irbtools/minimal'` instead of `configure`.
17
+
18
+ You can use the following methods:
19
+
20
+ * `Irbtools.add_library(lib, options_hash, &block)`
21
+ * `Irbtools.remove_library(lib)`
22
+
23
+
24
+ The `options_hash` defines the way in which **irbtools** loads the library.
25
+ The following options are possible
26
+ (no options)/`:start`
27
+ : The library is required on startup before doing anything else (before
28
+ displaying the prompt)
29
+ `:thread => identifier`
30
+ : After loading everything else, the library is required in a thread (while
31
+ continuing loading). You can choose any identifier, but if you take the
32
+ same one for multiple libraries, they will be loaded in the same thread
33
+ (in the order that you define)
34
+ `:late => true`
35
+ : The library is required just before showing the prompt.
36
+ `:late_thread => identifier`
37
+ : Same as `:thread`, but after loading late libraries.
38
+ `:sub_session => true`
39
+ : The library is loaded every time a sub-session starts (using
40
+ `IRB.conf[:IRB_RC]`). In [ripl](https://github.com/cldwalker/ripl),
41
+ `ripl-after_rc` is used.
42
+ `:autoload => :Constant`
43
+ : Use Ruby's `autoload` feature. It loads the library as soon as the
44
+ constant is encountered.
45
+
46
+
47
+ You can pass a block as third argument, which gets executed after the library
48
+ has completed loading (except for `:autoload`, in which case the code will be
49
+ executed directly on startup). You can modify the callbacks by using
50
+ `Irbtools.add_library_callback` and `Irbtools.replace_library_callback`.
51
+
52
+ When adding a new library, you should firstly consider some way to load it via
53
+ `:autoload`. If this is not possible, try loading via `:thread`. If that is
54
+ not possible either, you will need to fallback to the default loading
55
+ mechanism.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2014 Jan Lelis
1
+ Copyright (c) 2010-2015 Jan Lelis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # Irbtools [![version](https://badge.fury.io/rb/irbtools.svg)](http://badge.fury.io/rb/irbtools)
2
+
3
+ _ _| | | |
4
+ | __| __ \ __| _ \ _ \ | __|
5
+ | | | | | ( | ( | | \__ \
6
+ ___| _| _.__/ \__| \___/ \___/ _| ____/
7
+
8
+
9
+ Improvements for Ruby's IRB console, like colored output and a lot of
10
+ debugging and introspection methods. Unlike with PRY, you are still in your
11
+ normal IRB. It is designed to work out-of-the-box, so there is no reason to not
12
+ use it!
13
+
14
+ ## Setup
15
+
16
+ $ gem install irbtools
17
+
18
+ IRB executes code in `~/.irbrc` on start-up. If the file does not exist, yet,
19
+ just create a new one. Add the following content:
20
+
21
+ require 'irbtools'
22
+
23
+ You also need to add irbtools to your project's Gemfile:
24
+
25
+ gem 'irbtools', require: 'irbtools/binding'
26
+
27
+ Then start IRB (with **Irbtools** loaded) from the console or directly from your code with:
28
+
29
+ binding.irb
30
+
31
+ If the `binding_of_caller` gem is available (e.g. see below), you can omit the `binding`:
32
+
33
+ irb
34
+
35
+ ### More Improvements
36
+
37
+ Some suggested gems will not be installed to ensure wider general support. For
38
+ the full feature set, you can add **irbtools-more** and change your
39
+ `.irbrc` to:
40
+
41
+ require 'irbtools/more'
42
+
43
+ and edit your Gemfile to
44
+
45
+ gem 'irbtools-more', require: 'irbtools/binding'
46
+
47
+
48
+ ### Included Gems and Libraries
49
+ #### IRB Improvements
50
+
51
+ * Colored output:
52
+ [wirb](https://github.com/janlelis/wirb/)
53
+ [fanycy_irb](https://github.com/janlelis/fancy_irb)
54
+ * Custom views for specific objects:
55
+ [hirb](http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html)
56
+ * **(irbtools-more)** Correction suggestions for misspelled method/constant names:
57
+ [did_you_mean](https://github.com/yuki24/did_you_mean)
58
+ * **(irbtools-more)** Better tab-completion:
59
+ [bond](http://tagaholic.me/bond/)
60
+
61
+ #### Utils
62
+
63
+ * Useful IRB commands (see below):
64
+ [every_day_irb](https://github.com/janlelis/irbtools/tree/master/lib/every
65
+ _day_irb.rb)
66
+ [debugging](https:/github.com/janlelis/debugging)
67
+ [fileutils](http://ruby-doc.org/stdlib-2.2.1/libdoc/fileutils/rdoc/FileUtils.html)
68
+ * Clipboard Access:
69
+ [clipboard](https://github.com/janlelis/clipboard)
70
+ * Terminal colors:
71
+ [paint](https://github.com/janlelis/paint)
72
+ * Load an editor into your IRB session:
73
+ [interactive_editor](https://github.com/jberkel/interactive_editor)
74
+
75
+ #### Introspection
76
+
77
+ * Displays a method's source:
78
+ [code](https://github.com/janlelis/code)
79
+ * Access to `ri` docs:
80
+ [ori](https://github.com/dadooda/ori)
81
+ * Manipulate instance variables with ease:
82
+ [instance](https://github.com/rubyworks/instance/)
83
+ * Platform information:
84
+ [ruby_version](https://github.com/janlelis/ruby_version)
85
+ [ruby_engine](https://github.com/janlelis/ruby_engine)
86
+ [os](https://github.com/rdp/os)
87
+ [ruby_info](https://github.com/janlelis/ruby_info)
88
+ * Improved method lookup path inspection:
89
+ [method_locator](https://github.com/ryanlecompte/method_locator)
90
+ * Finds methods that turn one value into another value:
91
+ [methodfinder](https://github.com/citizen428/methodfinder)
92
+ * **irbtools-more** Awesome lookup path inspection:
93
+ [looksee](https://github.com/oggy/looksee)
94
+
95
+
96
+ ### Irbtools Methods
97
+
98
+ Besides improving IRB itself, you will get the following methods:
99
+
100
+ Method | Arguments | Description
101
+ ------ | ---------- | -----------
102
+ `beep` | | Ring terminal bell.
103
+ `cat` | path | Read file contents.
104
+ `cd` | path = nil | Changes the directory. Can also be used in these forms: `~cd` (change to home directory), `-cd` (change to previous directory).
105
+ `clear` | | Clear the terminal.
106
+ `code` | object = self, method_name | Display the method source with syntax highlighting. Will also look up C methods if the **core_docs** gem is available.
107
+ `colorize` | string | Syntax highlight a Ruby string.
108
+ `copy` | string | Copy something to the clipboard.
109
+ `copy_input` | | Copy session history to the clipboard.
110
+ `copy_output` | | Copy session output history to the clipboard.
111
+ `ed` / `emacs` / `mate` / `mvim` / `nano` / `vi` / `vim` | filename = nil | Start an editor in the session context.
112
+ `engine` | | Show the Ruby engine.
113
+ `g` | *args | Like `Kernel#p`, but using terminal-notifier or growl.
114
+ `howtocall` | object = self, method_or_proc | Displays parameter names and types for a proc or method.
115
+ `info` | | List general information about the Ruby environment.
116
+ `ld` | file | Shortcut for `load lib.to_s + '.rb'`.
117
+ `ls` | path = "." | List directory content.
118
+ `mf` | object1, object2 | Find methods that turn one value into another value:w
119
+ `mof` | object, depth = 0, grep = // | Print a method list, ordered by modules.
120
+ `os` | | Query operating system information.
121
+ `pa` | string, color | Print a string in the specified color.
122
+ `page` | what, options = {} | Page long content.
123
+ `paste` | | Paste clipboard content.
124
+ `q` | *args | Like `Kernel#p`, but prints results on one line, with different colors.
125
+ `ray` | path | Syntax highlight a Ruby file.
126
+ `re` | string, regexg, groups = nil | Assists you when matching regexes againts strings.
127
+ `reset!` | | Restart the current IRB session.
128
+ `rq` | lib | Shortcut for `require lib.to_s`. Use it like this: `rq:prime`.
129
+ `rrq` / `rerequire` | lib | Hack to remove a library from `$LOADED_FEATURES` and `require` it again.
130
+ `session_history` | number_of_lines = nil | Return a string of all commands issued in the current session.
131
+ `version` | | Show the Ruby version.
132
+ `wp` | inspect_string | Syntax-highlight a Ruby object.
133
+ `Object#instance` | | Proxy object to read and manipulate instance variables / run eval.
134
+ `Object#lp` | | **irbtools-more** Supercharged method introspection in IRB
135
+ `Object#mlp` / `Object#method_lookup_path` | | Traverse an object's method lookup path to find all places where a method may be defined.
136
+ `Object#ri` | *args | Show ri documentation for this object or method.
137
+
138
+
139
+ ### Advanced tweaking
140
+
141
+ See [CONFIGURE.md](https://github.com/janlelis/irbtools/blob/master/CONFIGURE.md).
142
+
143
+
144
+ ### Troubleshooting: ANSI colors on Windows
145
+
146
+ Windows: ANSI support can be enabled via
147
+ [ansicon](https://github.com/adoxa/ansicon) or
148
+ [ConEmu](http://code.google.com/p/conemu-maximus5/).
149
+
150
+
151
+ ### Troubleshooting: Clipboard not working on Linux
152
+
153
+ Clipboard support requires **xclip** or **xsel**. On ubuntu, do: `sudo apt-get
154
+ install xclip`
155
+
156
+
157
+ ### Troubleshooting: Unicode causes wrong display widths
158
+
159
+ If you use double-width unicode characterss, you will need to paste the
160
+ following snippet to your `.irbrc` file.
161
+
162
+ Irbtools.replace_library_callback :fancy_irb do
163
+ FancyIrb.start east_asian_width: true
164
+ end
165
+
166
+ This setting is deactivated by default, because of performance issues.
167
+
168
+
169
+ ### Hint: Debundle
170
+
171
+ If you do not want to add **Irbtools** to your project's Gemfile, you will need a
172
+ [debundle hack](https://github.com/janlelis/debundle.rb). Put it at the
173
+ beginning of your `~/.irbrc` file and you are fine (until it breaks).
174
+
175
+
176
+ ### Hint: No ANSI / IRB extension
177
+
178
+ You can use Irbtools without colors/irb extensions. To do so, put this into `~/.irbrc`:
179
+
180
+ ```ruby
181
+ require 'irbtools/non_fancy'
182
+ Irbtools.start
183
+ ```
184
+
185
+
186
+ ### Hint: Web Console
187
+
188
+ **Irbtools** works well together with the amazing
189
+ [web-console!](https://github.com/rails/web-console)
190
+
191
+
192
+ ## J-_-L
193
+
194
+ Copyright (c) 2010-2015 Jan Lelis <http://janlelis.com> released under the MIT
195
+ license.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- # require 'rake'
2
1
  require 'fileutils'
3
2
  require "rspec/core/rake_task"
4
3
 
4
+
5
5
  task :test => :spec
6
6
  task :default => :spec
7
7
  RSpec::Core::RakeTask.new(:spec) do |t|
@@ -10,36 +10,38 @@ end
10
10
 
11
11
 
12
12
  def gemspec1
13
- @gemspec1 ||= eval(File.read('irbtools.gemspec'), binding, 'irbtools.gemspec')
13
+ @gemspec1 ||= eval(File.read('every_day_irb.gemspec'), binding, 'every_day_irb.gemspec')
14
14
  end
15
15
 
16
16
  def gemspec2
17
- @gemspec2 ||= eval(File.read('every_day_irb.gemspec'), binding, 'every_day_irb.gemspec')
17
+ @gemspec2 ||= eval(File.read('irbtools.gemspec'), binding, 'irbtools.gemspec')
18
+ end
19
+
20
+ def gemspec3
21
+ @gemspec3 ||= eval(File.read('irbtools-more.gemspec'), binding, 'irbtools-more.gemspec')
18
22
  end
19
23
 
20
- desc "Build the gem"
24
+ desc "Build the gems"
21
25
  task :gem => :gemspec do
22
- sh "gem build irbtools.gemspec"
23
- sh "gem build every_day_irb.gemspec"
26
+ sh "gem build #{gemspec1.name}.gemspec"
27
+ sh "gem build #{gemspec2.name}.gemspec"
28
+ sh "gem build #{gemspec3.name}.gemspec"
24
29
  FileUtils.mkdir_p 'pkg'
25
30
  FileUtils.mv "#{gemspec1.name}-#{gemspec1.version}.gem", 'pkg'
26
31
  FileUtils.mv "#{gemspec2.name}-#{gemspec2.version}.gem", 'pkg'
32
+ FileUtils.mv "#{gemspec3.name}-#{gemspec3.version}.gem", 'pkg'
27
33
  end
28
34
 
29
35
  desc "Install the gem locally (without docs)"
30
36
  task :install => :gem do
31
- sh %{gem install pkg/#{gemspec2.name}-#{gemspec2.version}.gem --no-rdoc --no-ri}
32
- sh %{gem install pkg/#{gemspec1.name}-#{gemspec1.version}.gem --no-rdoc --no-ri}
33
- end
34
-
35
- desc "Generate the gemspec"
36
- task :generate do
37
- puts gemspec1.to_ruby
38
- puts gemspec2.to_ruby
37
+ sh %{gem install pkg/#{gemspec1.name}-#{gemspec1.version}.gem --no-document}
38
+ sh %{gem install pkg/#{gemspec2.name}-#{gemspec2.version}.gem --no-document}
39
+ sh %{gem install pkg/#{gemspec3.name}-#{gemspec3.version}.gem --no-document}
39
40
  end
40
41
 
41
42
  desc "Validate the gemspec"
42
43
  task :gemspec do
43
44
  gemspec1.validate
44
45
  gemspec2.validate
46
+ gemspec3.validate
45
47
  end
data/irbtools.gemspec CHANGED
@@ -1,57 +1,66 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.dirname(__FILE__) + '/lib/irbtools/configure'
2
+ require File.dirname(__FILE__) + '/lib/irbtools/version'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'irbtools'
6
6
  s.version = Irbtools::VERSION
7
7
 
8
+ s.homepage = 'https://github.com/janlelis/irbtools'
8
9
  s.authors = ["Jan Lelis"]
9
- s.summary = 'irbtools happy irb.'
10
- s.description = "irbtools makes using Ruby's IRB easier and more fun. Put a require 'irbtools' in a .irbrc file in your home directory to get started."
10
+ s.summary = 'Irbtools happy IRB.'
11
+ s.description = "Irbtools make Ruby's IRB more productive."
11
12
  s.email = 'mail@janlelis.de'
12
- s.extra_rdoc_files = %w[MIT-LICENSE README.rdoc]
13
- s.files = %w[lib/irbtools.rb lib/irbtools/configure.rb lib/irbtools/libraries.rb lib/irbtools/minimal.rb CHANGELOG Rakefile irbtools.gemspec]
14
- s.homepage = 'https://github.com/janlelis/irbtools'
15
- s.required_ruby_version = '>= 1.9.3'
13
+ s.files = %w[
14
+ lib/irbtools.rb
15
+ lib/irbtools/version.rb
16
+ lib/irbtools/configure.rb
17
+ lib/irbtools/implementation.rb
18
+ lib/irbtools/libraries.rb
19
+ lib/irbtools/non_fancy.rb
20
+ lib/irbtools/hirb.rb
21
+ lib/irbtools/minimal.rb
22
+ lib/irbtools/binding.rb
23
+ Rakefile
24
+ irbtools.gemspec
25
+ ]
26
+ s.extra_rdoc_files = %w[
27
+ README.md
28
+ CONFIGURE.md
29
+ CHANGELOG.txt
30
+ MIT-LICENSE.txt
31
+ ]
16
32
  s.license = 'MIT'
17
33
 
18
- # functionality
19
- s.add_dependency %q<every_day_irb>, ">= #{ s.version }"
20
- s.add_dependency %q<binding.repl>, "~> 3.0"
21
- s.add_dependency %q<boson>, "~> 1.3.0"
22
- s.add_dependency %q<boson-more>, "~> 0.3.0"
23
- s.add_dependency %q<alias>, "~> 0.2.3"
24
- s.add_dependency %q<clipboard>, "~> 1.0.5"
25
- s.add_dependency %q<interactive_editor>, ">= 0.0.10"
34
+ s.required_ruby_version = '~> 2.0'
35
+ s. add_development_dependency 'rspec', '~> 3.2'
36
+ s. add_development_dependency 'rake', '~> 10.4'
37
+
38
+ # # #
39
+ # Dependencies
26
40
 
27
- # irb patches / display helpers
28
- s.add_dependency %q<fancy_irb>, ">= 0.7.3"
29
- s.add_dependency %q<wirb>, ">= 1.0.3"
30
- s.add_dependency %q<paint>, ">= 0.8.7"
41
+ # core functionality
42
+ s.add_dependency %q<every_day_irb>, "~> 2.0"
43
+ s.add_dependency %q<fancy_irb>, "~> 1.0"
44
+ s.add_dependency %q<wirb>, "~> 2.0"
31
45
  s.add_dependency %q<hirb>, "~> 0.7", ">= 0.7.3"
32
- s.add_dependency %q<coderay>, "~> 1.1.0"
46
+ s.add_dependency %q<binding.repl>, "~> 3.0"
33
47
 
34
- # debugging
35
- s.add_dependency %q<debugging>, "~> 1.0"
36
- s.add_dependency %q<g>, ">= 1.7.2"
48
+ # utils
49
+ s.add_dependency %q<paint>, ">= 0.9", "< 2.0"
50
+ s.add_dependency %q<clipboard>, "~> 1.0", ">= 1.0.6"
51
+ s.add_dependency %q<interactive_editor>, "~> 0.0", ">= 0.0.10"
52
+ s.add_dependency %q<coderay>, "~> 1.1"
53
+ s.add_dependency %q<debugging>, "~> 1.1"
54
+ s.add_dependency %q<g>, "~> 1.7", ">= 1.7.2"
37
55
 
38
56
  # introspection / docs
57
+ s.add_dependency %q<code>, "~> 0.9"
39
58
  s.add_dependency %q<ori>, "~> 0.1.0"
40
59
  s.add_dependency %q<methodfinder>, "~> 2.0"
41
- s.add_dependency %q<method_locator>,">= 0.0.4"
42
- s.add_dependency %q<method_source>, ">= 0.8.2"
43
-
44
- # information
60
+ s.add_dependency %q<method_locator>,"~> 0.0", ">= 0.0.4"
45
61
  s.add_dependency %q<ruby_version>, "~> 1.0"
46
62
  s.add_dependency %q<ruby_engine>, "~> 1.0"
47
63
  s.add_dependency %q<ruby_info>, "~> 1.0"
48
64
  s.add_dependency %q<os>, "~> 0.9"
49
-
50
- len = s.homepage.size
51
- s.post_install_message = \
52
- " ┌── " + "info ".ljust(len-2,'─') + "─┐\n" +
53
- " J-_-L │ " + s.homepage + " │\n" +
54
- " ├── " + "usage ".ljust(len-2,'─') + "─┤\n" +
55
- " │ " + "require 'irbtools'".ljust(len,' ') + " │\n" +
56
- " └─" + '─'*len + "─┘"
65
+ s.add_dependency %q<instance>, "~> 0.2"
57
66
  end