rib 1.0.5 → 1.1.0
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/.travis.yml +3 -4
- data/CHANGES.md +10 -0
- data/README.md +1 -1
- data/lib/rib.rb +2 -1
- data/lib/rib/api.rb +7 -9
- data/lib/rib/core/completion.rb +1 -1
- data/lib/rib/core/history.rb +1 -1
- data/lib/rib/core/multiline.rb +1 -1
- data/lib/rib/core/readline.rb +1 -1
- data/lib/rib/core/squeeze_history.rb +1 -1
- data/lib/rib/core/strip_backtrace.rb +1 -1
- data/lib/rib/core/underscore.rb +1 -1
- data/lib/rib/extra/autoindent.rb +1 -1
- data/lib/rib/extra/hirb.rb +1 -1
- data/lib/rib/more/anchor.rb +3 -11
- data/lib/rib/more/color.rb +2 -2
- data/lib/rib/more/edit.rb +1 -1
- data/lib/rib/more/multiline_history.rb +1 -1
- data/lib/rib/more/multiline_history_file.rb +1 -1
- data/lib/rib/plugin.rb +22 -26
- data/lib/rib/version.rb +1 -1
- data/rib.gemspec +2 -2
- metadata +2 -2
data/.travis.yml
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
1
|
+
before_install: 'git submodule update --init'
|
2
|
+
script: 'ruby -r bundler/setup -S rake test'
|
3
|
+
|
2
4
|
rvm:
|
3
|
-
- 1.8.7
|
4
5
|
- 1.9.2
|
5
6
|
- 1.9.3
|
6
|
-
- rbx-18mode
|
7
7
|
- rbx-19mode
|
8
|
-
- jruby-18mode
|
9
8
|
- jruby-19mode
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Rib 1.1.0 -- 2012-07-18
|
4
|
+
|
5
|
+
* Support for Ruby 1.8 is dropped.
|
6
|
+
* Now `Rib::Plugin` should be extended to the module, instead of included.
|
7
|
+
This fits more naturally with Ruby, but not really compatible with Ruby 1.8?
|
8
|
+
* [more/anchor] Fixed a bug where you run rib in top level while anchor in
|
9
|
+
the other source, exit from the inner shell would break from the original
|
10
|
+
call. Now you can safely exit from the inner shell and keep doing the
|
11
|
+
original work.
|
12
|
+
|
3
13
|
## Rib 1.0.5 -- 2012-05-15
|
4
14
|
|
5
15
|
* [app/rails] Fixed SystemStackError issue. It's because ConsoleMethods
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ be simple, lightweight and modular so that everyone could customize Rib.
|
|
23
23
|
|
24
24
|
## REQUIREMENTS:
|
25
25
|
|
26
|
-
* Tested with MRI (official CRuby) 1.
|
26
|
+
* Tested with MRI (official CRuby) 1.9.2, 1.9.3, Rubinius and JRuby.
|
27
27
|
* All gem dependencies are optional, but it's highly recommended to use
|
28
28
|
Rib with [bond][] for tab completion.
|
29
29
|
|
data/lib/rib.rb
CHANGED
@@ -3,6 +3,7 @@ require 'rib/shell'
|
|
3
3
|
|
4
4
|
module Rib
|
5
5
|
autoload :VERSION, 'rib/version'
|
6
|
+
Skip = Object.new
|
6
7
|
|
7
8
|
module_function
|
8
9
|
# All default Rib configs, would be passed to Shell.new in Rib.shell,
|
@@ -45,7 +46,7 @@ module Rib
|
|
45
46
|
# All plugins which have been loaded into the memory regardless
|
46
47
|
# it's enabled or not.
|
47
48
|
def plugins
|
48
|
-
Shell.ancestors[1..-1].select{ |a| a < Plugin }
|
49
|
+
Shell.ancestors[1..-1].select{ |a| a.singleton_class < Plugin }
|
49
50
|
end
|
50
51
|
|
51
52
|
# Convenient way to disable all plugins in the memory.
|
data/lib/rib/api.rb
CHANGED
@@ -36,15 +36,13 @@ module Rib::API
|
|
36
36
|
def loop_once
|
37
37
|
input, result, err = get_input, nil, nil
|
38
38
|
throw(:rib_exit, input) if config[:exit].include?(input)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
# print nothing for blank input
|
47
|
-
end
|
39
|
+
result, err = eval_input(input)
|
40
|
+
if err
|
41
|
+
print_eval_error(err)
|
42
|
+
elsif input.strip != '' && result != Rib::Skip
|
43
|
+
print_result(result)
|
44
|
+
else
|
45
|
+
# print nothing for blank input
|
48
46
|
end
|
49
47
|
[result, err]
|
50
48
|
rescue Interrupt
|
data/lib/rib/core/completion.rb
CHANGED
data/lib/rib/core/history.rb
CHANGED
data/lib/rib/core/multiline.rb
CHANGED
data/lib/rib/core/readline.rb
CHANGED
data/lib/rib/core/underscore.rb
CHANGED
data/lib/rib/extra/autoindent.rb
CHANGED
data/lib/rib/extra/hirb.rb
CHANGED
data/lib/rib/more/anchor.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'rib'
|
3
3
|
|
4
4
|
module Rib::Anchor
|
5
|
-
|
5
|
+
extend Rib::Plugin
|
6
6
|
Shell.use(self)
|
7
7
|
|
8
8
|
# --------------- Rib API ---------------
|
@@ -68,18 +68,10 @@ module Rib::Anchor
|
|
68
68
|
end
|
69
69
|
|
70
70
|
Rib.shell.loop
|
71
|
+
Rib::Skip
|
71
72
|
|
72
|
-
|
73
|
-
# (i.e. throw :rib_skip) if there's no exception. this can't be
|
74
|
-
# done via ensure because then we don't know if there's an
|
75
|
-
# exception or not, and ensure block is always executed last
|
76
|
-
rescue
|
73
|
+
ensure
|
77
74
|
Rib.shells.pop
|
78
|
-
raise
|
79
|
-
else
|
80
|
-
# only skip printing anchor result while there's another shell running
|
81
|
-
Rib.shells.pop
|
82
|
-
throw :rib_skip if Rib.shell.running?
|
83
75
|
end
|
84
76
|
end
|
85
77
|
|
data/lib/rib/more/color.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'rib'
|
3
3
|
|
4
4
|
module Rib::Color
|
5
|
-
|
5
|
+
extend Rib::Plugin
|
6
6
|
Shell.use(self)
|
7
7
|
|
8
8
|
# --------------- Rib API ---------------
|
@@ -80,7 +80,7 @@ module Rib::Color
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def find_color colors, value
|
83
|
-
(colors.sort{ |(k1,
|
83
|
+
(colors.sort{ |(k1, _), (k2, _)|
|
84
84
|
# Class <=> Class
|
85
85
|
if k1 < k2 then -1
|
86
86
|
elsif k1 > k2 then 1
|
data/lib/rib/more/edit.rb
CHANGED
data/lib/rib/plugin.rb
CHANGED
@@ -1,30 +1,32 @@
|
|
1
1
|
|
2
2
|
module Rib; end
|
3
3
|
module Rib::Plugin
|
4
|
-
|
5
|
-
mod.send(:include, Rib)
|
4
|
+
attr_accessor :disabled
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
def enable
|
7
|
+
self.disabled = false
|
8
|
+
if block_given? then yield else enabled? end
|
9
|
+
ensure
|
10
|
+
self.disabled = true if block_given?
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
def disable
|
14
|
+
self.disabled = true
|
15
|
+
if block_given? then yield else enabled? end
|
16
|
+
ensure
|
17
|
+
self.disabled = false if block_given?
|
18
|
+
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
20
|
+
def enabled?
|
21
|
+
!disabled
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
def disabled?
|
25
|
+
!!disabled
|
26
|
+
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
+
def self.extended mod
|
29
|
+
mod.send(:include, Rib)
|
28
30
|
|
29
31
|
snake_name = mod.name.sub(/(\w+::)+?(\w+)$/, '\2').
|
30
32
|
gsub(/([A-Z][a-z]*)/, '\\1_').downcase[0..-2]
|
@@ -43,12 +45,6 @@ module Rib::Plugin
|
|
43
45
|
RUBY
|
44
46
|
}).join("\n")
|
45
47
|
|
46
|
-
|
47
|
-
Rib.singleton_class
|
48
|
-
else
|
49
|
-
class << Rib; self; end
|
50
|
-
end
|
51
|
-
|
52
|
-
meta_rib.module_eval(code, __FILE__, __LINE__)
|
48
|
+
Rib.singleton_class.module_eval(code, __FILE__, __LINE__)
|
53
49
|
end
|
54
50
|
end
|
data/lib/rib/version.rb
CHANGED
data/rib.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rib"
|
5
|
-
s.version = "1.0
|
5
|
+
s.version = "1.1.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-07-18"
|
10
10
|
s.description = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell\n\nRib is based on the design of [ripl][] and the work of [ripl-rc][], some of\nthe features are also inspired by [pry][]. The aim of Rib is to be fully\nfeatured and yet very easy to opt-out or opt-in other features. It shall\nbe simple, lightweight and modular so that everyone could customize Rib.\n\n[ripl]: https://github.com/cldwalker/ripl\n[ripl-rc]: https://github.com/godfat/ripl-rc\n[pry]: https://github.com/pry/pry"
|
11
11
|
s.email = ["godfat (XD) godfat.org"]
|
12
12
|
s.executables = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
|
15
15
|
|