ripl-rc 0.2.3 → 0.2.4
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 +9 -0
- data/CHANGES +15 -0
- data/Gemfile +1 -0
- data/README +1 -1
- data/README.md +1 -1
- data/lib/ripl/rc.rb +1 -0
- data/lib/ripl/rc/anchor.rb +1 -1
- data/lib/ripl/rc/color.rb +1 -0
- data/lib/ripl/rc/ensure_after_loop.rb +18 -0
- data/lib/ripl/rc/multiline_history.rb +2 -2
- data/lib/ripl/rc/multiline_history_file.rb +0 -1
- data/lib/ripl/rc/squeeze_history.rb +2 -3
- data/lib/ripl/rc/test.rb +2 -0
- data/lib/ripl/rc/version.rb +1 -1
- data/ripl-rc.gemspec +10 -3
- data/task/.gitignore +1 -0
- data/task/gemgem.rb +29 -8
- data/test/test_color.rb.rb +17 -0
- data/test/test_disable_shortcut.rb +2 -1
- data/test/test_ensure_after_loop.rb +14 -0
- metadata +16 -9
data/.travis.yml
ADDED
data/CHANGES
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
= ripl-rc changes history
|
2
2
|
|
3
|
+
== ripl-rc 0.2.4 -- 2011-08-03
|
4
|
+
|
5
|
+
* [ensure_after_loop] A plugin which would make sure after_loop is called.
|
6
|
+
(Some plugins need to do cleaning up in after_loop)
|
7
|
+
|
8
|
+
* [anchor ] Fixed a bug for buggy EditLine, which would raise
|
9
|
+
weird exception upon calling `HISTORY == nil`.
|
10
|
+
Now we use `.nil?` to lookup if it's nil or not.
|
11
|
+
|
12
|
+
* [multiline_history] Fixed a bug when multiline evaluation raised an
|
13
|
+
exception, it wouldn't handle the history correctly.
|
14
|
+
Moving the handling to an ensure block fixed this.
|
15
|
+
|
16
|
+
* [squeeze_history ] (Internal) Take the advantage of the new history API
|
17
|
+
|
3
18
|
== ripl-rc 0.2.3 -- 2011-06-16
|
4
19
|
|
5
20
|
Please read this for detail:
|
data/Gemfile
CHANGED
data/README
CHANGED
data/README.md
CHANGED
data/lib/ripl/rc.rb
CHANGED
data/lib/ripl/rc/anchor.rb
CHANGED
@@ -31,7 +31,7 @@ module Ripl::Rc::Anchor
|
|
31
31
|
# if the object is the same, then we're exiting from an anchor,
|
32
32
|
# so don't print anything.
|
33
33
|
def print_result result
|
34
|
-
super unless result
|
34
|
+
super unless !result.nil? &&
|
35
35
|
result.object_id == Ripl.config[:rc_anchor_last].object_id
|
36
36
|
end
|
37
37
|
|
data/lib/ripl/rc/color.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
require 'ripl/rc/u'
|
3
|
+
|
4
|
+
module Ripl::Rc::EnsureAfterLoop
|
5
|
+
include Ripl::Rc::U
|
6
|
+
|
7
|
+
def in_loop
|
8
|
+
return super if EnsureAfterLoop.disabled?
|
9
|
+
begin
|
10
|
+
super
|
11
|
+
rescue Exception
|
12
|
+
after_loop
|
13
|
+
raise
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Ripl::Shell.include(Ripl::Rc::EnsureAfterLoop)
|
@@ -7,14 +7,14 @@ module Ripl::Rc::MultilineHistory
|
|
7
7
|
|
8
8
|
def loop_eval(input)
|
9
9
|
return super if MultilineHistory.disabled?
|
10
|
-
|
10
|
+
super # might throw
|
11
|
+
ensure
|
11
12
|
unless @rc_multiline_buffer.empty?
|
12
13
|
(@rc_multiline_buffer.size + (@rc_multiline_trash || 0)).
|
13
14
|
times{ history.pop }
|
14
15
|
@rc_multiline_trash = 0
|
15
16
|
history << "\n" + @rc_multiline_buffer.join("\n")
|
16
17
|
end
|
17
|
-
result
|
18
18
|
end
|
19
19
|
|
20
20
|
def handle_interrupt
|
@@ -7,9 +7,8 @@ module Ripl::Rc::SqueezeHistory
|
|
7
7
|
# write squeezed history
|
8
8
|
def write_history
|
9
9
|
return super if SqueezeHistory.disabled?
|
10
|
-
|
11
|
-
|
12
|
-
}
|
10
|
+
@history = [U.squeeze_history(history).join("\n") + "\n"]
|
11
|
+
super
|
13
12
|
end
|
14
13
|
|
15
14
|
# squeeze history on memory too
|
data/lib/ripl/rc/test.rb
CHANGED
data/lib/ripl/rc/version.rb
CHANGED
data/ripl-rc.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ripl-rc}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = [%q{Lin Jen-Shin (godfat)}]
|
9
|
-
s.date = %q{2011-
|
9
|
+
s.date = %q{2011-08-03}
|
10
10
|
s.description = %q{ripl plugins collection, take you want, leave you don't.}
|
11
11
|
s.email = [%q{godfat (XD) godfat.org}]
|
12
12
|
s.executables = [%q{ripl-rc}]
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.files = [
|
19
19
|
%q{.gitignore},
|
20
20
|
%q{.gitmodules},
|
21
|
+
%q{.travis.yml},
|
21
22
|
%q{2011-02-28.md},
|
22
23
|
%q{CHANGES},
|
23
24
|
%q{CONTRIBUTORS},
|
@@ -35,6 +36,7 @@ Gem::Specification.new do |s|
|
|
35
36
|
%q{lib/ripl/rc/ctrld_newline.rb},
|
36
37
|
%q{lib/ripl/rc/debug.rb},
|
37
38
|
%q{lib/ripl/rc/eat_whites.rb},
|
39
|
+
%q{lib/ripl/rc/ensure_after_loop.rb},
|
38
40
|
%q{lib/ripl/rc/last_exception.rb},
|
39
41
|
%q{lib/ripl/rc/mkdir_history.rb},
|
40
42
|
%q{lib/ripl/rc/multiline.rb},
|
@@ -48,18 +50,23 @@ Gem::Specification.new do |s|
|
|
48
50
|
%q{lib/ripl/rc/version.rb},
|
49
51
|
%q{ripl-rc.gemspec},
|
50
52
|
%q{screenshot.png},
|
53
|
+
%q{task/.gitignore},
|
51
54
|
%q{task/gemgem.rb},
|
55
|
+
%q{test/test_color.rb.rb},
|
52
56
|
%q{test/test_disable_shortcut.rb},
|
57
|
+
%q{test/test_ensure_after_loop.rb},
|
53
58
|
%q{test/test_squeeze_history.rb}]
|
54
59
|
s.homepage = %q{https://github.com/godfat/ripl-rc}
|
55
60
|
s.rdoc_options = [
|
56
61
|
%q{--main},
|
57
62
|
%q{README}]
|
58
63
|
s.require_paths = [%q{lib}]
|
59
|
-
s.rubygems_version = %q{1.8.
|
64
|
+
s.rubygems_version = %q{1.8.6}
|
60
65
|
s.summary = %q{ripl plugins collection, take you want, leave you don't.}
|
61
66
|
s.test_files = [
|
67
|
+
%q{test/test_color.rb.rb},
|
62
68
|
%q{test/test_disable_shortcut.rb},
|
69
|
+
%q{test/test_ensure_after_loop.rb},
|
63
70
|
%q{test/test_squeeze_history.rb}]
|
64
71
|
|
65
72
|
if s.respond_to? :specification_version then
|
data/task/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.rbc
|
data/task/gemgem.rb
CHANGED
@@ -12,11 +12,15 @@ module Gemgem
|
|
12
12
|
s.authors = ['Lin Jen-Shin (godfat)']
|
13
13
|
s.email = ['godfat (XD) godfat.org']
|
14
14
|
|
15
|
-
|
16
|
-
match(/DESCRIPTION:\n\n(.+?)
|
17
|
-
|
15
|
+
description = File.read("#{Gemgem.dir}/README").
|
16
|
+
match(/DESCRIPTION:\n\n(.+?)(?=\n\n[^\n]+:\n)/m)[1].
|
17
|
+
lines.to_a
|
18
18
|
|
19
|
-
s.
|
19
|
+
s.description = description.join
|
20
|
+
s.summary = description.first
|
21
|
+
|
22
|
+
s.extra_rdoc_files = %w[CHANGES CONTRIBUTORS LICENSE TODO].select{ |f|
|
23
|
+
File.exist?(f) }
|
20
24
|
s.rdoc_options = %w[--main README]
|
21
25
|
s.rubygems_version = Gem::VERSION
|
22
26
|
s.date = Time.now.strftime('%Y-%m-%d')
|
@@ -24,8 +28,7 @@ module Gemgem
|
|
24
28
|
s.test_files = gem_files.grep(%r{^test/(.+?/)*test_.+?\.rb$})
|
25
29
|
s.require_paths = %w[lib]
|
26
30
|
})
|
27
|
-
spec.homepage
|
28
|
-
spec.homepage
|
31
|
+
spec.homepage ||= "https://github.com/godfat/#{spec.name}"
|
29
32
|
spec
|
30
33
|
end
|
31
34
|
|
@@ -142,9 +145,27 @@ end
|
|
142
145
|
|
143
146
|
end # of gem namespace
|
144
147
|
|
145
|
-
desc 'Run tests'
|
148
|
+
desc 'Run tests in memory'
|
146
149
|
task :test do
|
147
|
-
|
150
|
+
require 'bacon'
|
151
|
+
Bacon.extend(Bacon::TestUnitOutput)
|
152
|
+
Bacon.summary_on_exit
|
153
|
+
$LOAD_PATH.unshift('lib')
|
154
|
+
Dir['test/test_*.rb'].each{ |file| load file }
|
155
|
+
end
|
156
|
+
|
157
|
+
desc 'Run tests with shell'
|
158
|
+
task 'test:shell', :RUBY_OPTS do |t, args|
|
159
|
+
files = unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
160
|
+
'test/test_*.rb'
|
161
|
+
else
|
162
|
+
Dir['test/test_*.rb'].join(' ')
|
163
|
+
end
|
164
|
+
|
165
|
+
cmd = [Gem.ruby, args[:RUBY_OPTS],
|
166
|
+
'-I', 'lib', '-S', 'bacon', '--quiet', files]
|
167
|
+
|
168
|
+
sh(cmd.compact.join(' '))
|
148
169
|
end
|
149
170
|
|
150
171
|
desc 'Generate rdoc'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
require 'ripl/rc/test'
|
3
|
+
require 'ripl/rc/color'
|
4
|
+
|
5
|
+
describe Ripl::Rc::Color do
|
6
|
+
should 'give correct color' do
|
7
|
+
Ripl::Rc::Color.format_result(
|
8
|
+
[{0 => :a}, 'b', [nil, {false => Object}], {true => Exception.new}]).
|
9
|
+
should ==
|
10
|
+
"\e[34m[\e[m\e[34m{\e[m\e[31m0\e[m\e[34m=>\e[m\e[36m:a\e[m\e[" \
|
11
|
+
"34m}\e[m\e[34m, \e[m\e[32m\"b\"\e[m\e[34m, \e[m\e[34m[\e[m\e" \
|
12
|
+
"[35mnil\e[m\e[34m, \e[m\e[34m{\e[m\e[35mfalse\e[m\e[34m=>\e[" \
|
13
|
+
"m\e[33mObject\e[m\e[34m}\e[m\e[34m]\e[m\e[34m, \e[m\e[34m{\e" \
|
14
|
+
"[m\e[35mtrue\e[m\e[34m=>\e[m\e[35m#<Exception: Exception>\e[" \
|
15
|
+
"m\e[34m}\e[m\e[34m]\e[m"
|
16
|
+
end
|
17
|
+
end
|
@@ -7,7 +7,8 @@ describe Ripl::Rc::U do
|
|
7
7
|
@names = Dir[File.expand_path(
|
8
8
|
"#{File.dirname(__FILE__)}/../lib/ripl/rc/*.rb")].
|
9
9
|
map {|path| File.basename(path)[0..-4] }.
|
10
|
-
reject{|name| %w[version u noirbrc test debug].include?(name)}
|
10
|
+
reject{|name| %w[version u noirbrc test debug].include?(name)}.
|
11
|
+
each {|name| require "ripl/rc/#{name}"}
|
11
12
|
@mods = Ripl::Shell.ancestors[1..-1].select{ |mod| mod < Ripl::Rc }
|
12
13
|
end
|
13
14
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
require 'ripl/rc/test'
|
3
|
+
require 'ripl/rc/ensure_after_loop'
|
4
|
+
|
5
|
+
describe Ripl::Rc::EnsureAfterLoop do
|
6
|
+
after do; RR.verify; end
|
7
|
+
|
8
|
+
should 'call after_loop even if in_loop raises' do
|
9
|
+
@shell = Ripl.shell
|
10
|
+
mock(@shell).loop_once{ raise 'boom' }
|
11
|
+
mock(@shell).after_loop
|
12
|
+
lambda{ @shell.loop }.should.raise(RuntimeError)
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripl-rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-08-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ripl
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153474960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.4.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153474960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bacon
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153474400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153474400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rr
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153473720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153473720
|
47
47
|
description: ripl plugins collection, take you want, leave you don't.
|
48
48
|
email:
|
49
49
|
- godfat (XD) godfat.org
|
@@ -58,6 +58,7 @@ extra_rdoc_files:
|
|
58
58
|
files:
|
59
59
|
- .gitignore
|
60
60
|
- .gitmodules
|
61
|
+
- .travis.yml
|
61
62
|
- 2011-02-28.md
|
62
63
|
- CHANGES
|
63
64
|
- CONTRIBUTORS
|
@@ -75,6 +76,7 @@ files:
|
|
75
76
|
- lib/ripl/rc/ctrld_newline.rb
|
76
77
|
- lib/ripl/rc/debug.rb
|
77
78
|
- lib/ripl/rc/eat_whites.rb
|
79
|
+
- lib/ripl/rc/ensure_after_loop.rb
|
78
80
|
- lib/ripl/rc/last_exception.rb
|
79
81
|
- lib/ripl/rc/mkdir_history.rb
|
80
82
|
- lib/ripl/rc/multiline.rb
|
@@ -88,8 +90,11 @@ files:
|
|
88
90
|
- lib/ripl/rc/version.rb
|
89
91
|
- ripl-rc.gemspec
|
90
92
|
- screenshot.png
|
93
|
+
- task/.gitignore
|
91
94
|
- task/gemgem.rb
|
95
|
+
- test/test_color.rb.rb
|
92
96
|
- test/test_disable_shortcut.rb
|
97
|
+
- test/test_ensure_after_loop.rb
|
93
98
|
- test/test_squeeze_history.rb
|
94
99
|
homepage: https://github.com/godfat/ripl-rc
|
95
100
|
licenses: []
|
@@ -113,10 +118,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
118
|
version: '0'
|
114
119
|
requirements: []
|
115
120
|
rubyforge_project:
|
116
|
-
rubygems_version: 1.8.
|
121
|
+
rubygems_version: 1.8.6
|
117
122
|
signing_key:
|
118
123
|
specification_version: 3
|
119
124
|
summary: ripl plugins collection, take you want, leave you don't.
|
120
125
|
test_files:
|
126
|
+
- test/test_color.rb.rb
|
121
127
|
- test/test_disable_shortcut.rb
|
128
|
+
- test/test_ensure_after_loop.rb
|
122
129
|
- test/test_squeeze_history.rb
|