rib 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGES.md +5 -0
- data/lib/rib/core/history.rb +2 -2
- data/lib/rib/core/strip_backtrace.rb +8 -4
- data/lib/rib/more/color.rb +2 -2
- data/lib/rib/test.rb +1 -2
- data/lib/rib/version.rb +1 -1
- data/rib.gemspec +6 -4
- data/test/core/test_history.rb +5 -3
- data/test/core/test_squeeze_history.rb +6 -4
- data/test/core/test_strip_backtrace.rb +19 -0
- data/test/more/test_color.rb +4 -8
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2cc6e3966230aac382f90352549a7545c8e27ff
|
4
|
+
data.tar.gz: 6bb97f019cc41dffbc900fa2d5aa1f44024d65a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a0519f630b28351cf2d6f636c976eea2d904b1703fbf63c9ad1824944cb204dd5490f39d7d3ebffa1ffe81e994324135e8c5176eb3f905172d259bb3902a76b
|
7
|
+
data.tar.gz: 87d41ae852dfb60039bd785fcc9b141fd01cc1bfc304f5b2047891d29ab04ccc05d989075cbec8068b6b35c1a2e7c6bf2a0013c489290b4322d9c132ce639e20
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Rib 1.3.1 -- 2016-11-03
|
4
|
+
|
5
|
+
* [core/strip_backtrace], [more/color] No longer show `./` for current path.
|
6
|
+
This would be more friendly to some editors like Sublime.
|
7
|
+
|
3
8
|
## Rib 1.3.0 -- 2016-06-28
|
4
9
|
|
5
10
|
* Now `rib` would accept `-p` or `--prefix` to allow setting where we want to
|
data/lib/rib/core/history.rb
CHANGED
@@ -45,8 +45,8 @@ module Rib::History
|
|
45
45
|
# Write #history into config[:history_file], handled in history_file plugin
|
46
46
|
def write_history
|
47
47
|
return super if History.disabled?
|
48
|
-
|
49
|
-
|
48
|
+
history_text = "#{history.to_a.last(history_size).join("\n")}\n"
|
49
|
+
File.write(history_file_path, history_text)
|
50
50
|
end
|
51
51
|
|
52
52
|
|
@@ -22,19 +22,23 @@ module Rib::StripBacktrace
|
|
22
22
|
|
23
23
|
module_function
|
24
24
|
def strip_backtrace backtrace
|
25
|
-
strip_home_backtrace(strip_cwd_backtrace(
|
25
|
+
strip_home_backtrace(strip_cwd_backtrace(strip_rib_backtrace(backtrace)))
|
26
26
|
end
|
27
27
|
|
28
28
|
def strip_home_backtrace backtrace
|
29
|
-
backtrace.map
|
29
|
+
backtrace.map(&method(:replace_path_prefix).curry[ENV['HOME'], '~/'])
|
30
30
|
end
|
31
31
|
|
32
32
|
def strip_cwd_backtrace backtrace
|
33
|
-
backtrace.map
|
33
|
+
backtrace.map(&method(:replace_path_prefix).curry[Dir.pwd, ''])
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def strip_rib_backtrace backtrace
|
37
37
|
backtrace[
|
38
38
|
0..backtrace.rindex{ |l| l =~ /\(#{name}\):\d+:in `.+?'/ } || -1]
|
39
39
|
end
|
40
|
+
|
41
|
+
def replace_path_prefix prefix, substitute, path
|
42
|
+
path.sub(/\A#{Regexp.escape(prefix)}\//, substitute)
|
43
|
+
end
|
40
44
|
end
|
data/lib/rib/more/color.rb
CHANGED
@@ -77,10 +77,10 @@ module Rib::Color
|
|
77
77
|
def colorize_backtrace backtrace
|
78
78
|
backtrace.map{ |b|
|
79
79
|
path, msgs = b.split(':', 2)
|
80
|
-
dir , file =
|
80
|
+
dir, sep, file = path.rpartition('/')
|
81
81
|
msg = msgs.sub(/(\d+):/){red{$1}+':'}.sub(/`.+?'/){green{$&}}
|
82
82
|
|
83
|
-
"#{dir+
|
83
|
+
"#{dir+sep}#{yellow{file}}:#{msg}"
|
84
84
|
}
|
85
85
|
end
|
86
86
|
|
data/lib/rib/test.rb
CHANGED
data/lib/rib/version.rb
CHANGED
data/rib.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rib 1.3.
|
2
|
+
# stub: rib 1.3.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rib".freeze
|
6
|
-
s.version = "1.3.
|
6
|
+
s.version = "1.3.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)".freeze]
|
11
|
-
s.date = "2016-
|
11
|
+
s.date = "2016-11-03"
|
12
12
|
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".freeze
|
13
13
|
s.email = ["godfat (XD) godfat.org".freeze]
|
14
14
|
s.executables = [
|
@@ -78,6 +78,7 @@ Gem::Specification.new do |s|
|
|
78
78
|
"test/core/test_multiline.rb".freeze,
|
79
79
|
"test/core/test_readline.rb".freeze,
|
80
80
|
"test/core/test_squeeze_history.rb".freeze,
|
81
|
+
"test/core/test_strip_backtrace.rb".freeze,
|
81
82
|
"test/core/test_underscore.rb".freeze,
|
82
83
|
"test/extra/test_autoindent.rb".freeze,
|
83
84
|
"test/more/test_color.rb".freeze,
|
@@ -88,7 +89,7 @@ Gem::Specification.new do |s|
|
|
88
89
|
"test/test_shell.rb".freeze]
|
89
90
|
s.homepage = "https://github.com/godfat/rib".freeze
|
90
91
|
s.licenses = ["Apache License 2.0".freeze]
|
91
|
-
s.rubygems_version = "2.6.
|
92
|
+
s.rubygems_version = "2.6.7".freeze
|
92
93
|
s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell".freeze
|
93
94
|
s.test_files = [
|
94
95
|
"test/core/test_completion.rb".freeze,
|
@@ -96,6 +97,7 @@ Gem::Specification.new do |s|
|
|
96
97
|
"test/core/test_multiline.rb".freeze,
|
97
98
|
"test/core/test_readline.rb".freeze,
|
98
99
|
"test/core/test_squeeze_history.rb".freeze,
|
100
|
+
"test/core/test_strip_backtrace.rb".freeze,
|
99
101
|
"test/core/test_underscore.rb".freeze,
|
100
102
|
"test/extra/test_autoindent.rb".freeze,
|
101
103
|
"test/more/test_color.rb".freeze,
|
data/test/core/test_history.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'rib/test'
|
3
3
|
require 'rib/core/history'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
copy :history do
|
6
7
|
would '#after_loop save history' do
|
@@ -13,7 +14,7 @@ copy :history do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
would '#before_loop load previous history' do
|
16
|
-
File.
|
17
|
+
File.write(@history_file, "check\nthe\nmike")
|
17
18
|
@shell.before_loop
|
18
19
|
@shell.history.to_a.should.eq %w[check the mike]
|
19
20
|
end
|
@@ -55,13 +56,14 @@ describe Rib::History do
|
|
55
56
|
::Readline::HISTORY.clear
|
56
57
|
stub_readline
|
57
58
|
end
|
58
|
-
@
|
59
|
+
@tempfile = Tempfile.new('rib')
|
60
|
+
@history_file = @tempfile.path
|
59
61
|
@shell = Rib::Shell.new(
|
60
62
|
:history_file => @history_file).before_loop
|
61
63
|
end
|
62
64
|
|
63
65
|
after do
|
64
|
-
|
66
|
+
@tempfile.unlink
|
65
67
|
end
|
66
68
|
|
67
69
|
paste :history
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'rib/test'
|
3
3
|
require 'rib/core/squeeze_history'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
copy :squeeze_history do
|
6
7
|
would 'after_loop saves squeezed history' do
|
@@ -34,14 +35,15 @@ describe Rib::SqueezeHistory do
|
|
34
35
|
|
35
36
|
test_for Rib::History, Rib::SqueezeHistory do
|
36
37
|
before do
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
38
|
+
@tempfile = Tempfile.new('rib')
|
39
|
+
@history = @tempfile.path
|
40
|
+
@shell = Rib::Shell.new(:history_file => @history).before_loop
|
41
|
+
@input = %w[foo bar bar foo bar]
|
40
42
|
@shell.history.clear
|
41
43
|
end
|
42
44
|
|
43
45
|
after do
|
44
|
-
|
46
|
+
@tempfile.unlink
|
45
47
|
end
|
46
48
|
|
47
49
|
paste :squeeze_history
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require 'rib/test'
|
3
|
+
require 'rib/core/strip_backtrace'
|
4
|
+
|
5
|
+
describe Rib::StripBacktrace do
|
6
|
+
would 'strip home' do
|
7
|
+
backtrace = ["#{ENV['HOME']}/test", "/prefix/#{ENV['HOME']}/test"]
|
8
|
+
|
9
|
+
expect(Rib::StripBacktrace.strip_home_backtrace(backtrace)).
|
10
|
+
eq ['~/test', "/prefix/#{ENV['HOME']}/test"]
|
11
|
+
end
|
12
|
+
|
13
|
+
would 'strip current working directory' do
|
14
|
+
backtrace = [File.expand_path(__FILE__)]
|
15
|
+
|
16
|
+
expect(Rib::StripBacktrace.strip_cwd_backtrace(backtrace)).
|
17
|
+
eq ['test/core/test_strip_backtrace.rb']
|
18
|
+
end
|
19
|
+
end
|
data/test/more/test_color.rb
CHANGED
@@ -37,18 +37,14 @@ describe Rib::Color do
|
|
37
37
|
|
38
38
|
# regression test
|
39
39
|
would "colorize errors with `/' inside" do
|
40
|
-
|
41
|
-
1
|
42
|
-
else
|
43
|
-
0
|
44
|
-
end
|
40
|
+
error = Class.new(Exception)
|
45
41
|
|
46
42
|
begin
|
47
|
-
line = __LINE__;
|
48
|
-
rescue
|
43
|
+
line = __LINE__; raise error
|
44
|
+
rescue error => e
|
49
45
|
msg = "test/more/#{Rib::Color.yellow{'test_color.rb'}}:" \
|
50
46
|
"#{Rib::Color.red{line}}:in #{Rib::Color.green}"
|
51
|
-
Rib::Color.colorize_backtrace(e.backtrace)
|
47
|
+
Rib::Color.colorize_backtrace(e.backtrace).first.should =~ \
|
52
48
|
Regexp.new(
|
53
49
|
"#{Regexp.escape(msg)}`.+'#{Regexp.escape(Rib::Color.reset)}")
|
54
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- test/core/test_multiline.rb
|
93
93
|
- test/core/test_readline.rb
|
94
94
|
- test/core/test_squeeze_history.rb
|
95
|
+
- test/core/test_strip_backtrace.rb
|
95
96
|
- test/core/test_underscore.rb
|
96
97
|
- test/extra/test_autoindent.rb
|
97
98
|
- test/more/test_color.rb
|
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
123
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.6.
|
124
|
+
rubygems_version: 2.6.7
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
|
@@ -130,6 +131,7 @@ test_files:
|
|
130
131
|
- test/core/test_multiline.rb
|
131
132
|
- test/core/test_readline.rb
|
132
133
|
- test/core/test_squeeze_history.rb
|
134
|
+
- test/core/test_strip_backtrace.rb
|
133
135
|
- test/core/test_underscore.rb
|
134
136
|
- test/extra/test_autoindent.rb
|
135
137
|
- test/more/test_color.rb
|