intar 2.2 → 2.3

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
  SHA256:
3
- metadata.gz: 2321cc815a7cfbdca083a93c4398557a04e0e9ba250ae6027999270a575b1955
4
- data.tar.gz: 7a4ec6cbc2188805c4e49f1f3c0b19ee7aa3c4b046e426c31966574225a90719
3
+ metadata.gz: f69cab2073de237de8c934b10e796b5a424fde33d92ab2bc41ab1aa612da14b7
4
+ data.tar.gz: 8095bb85ab4571c089859e0274c5e6df02e971f2d79334b20fceb93699857870
5
5
  SHA512:
6
- metadata.gz: cdd4525b5de83ce80d9b0368c8cadde74222f5f0b66621490741f717cfed92af77ed9a9ec644685eeaca10cf5b445821fa99d825028444e5f3b88ceaa4de04de
7
- data.tar.gz: 204c9e1dbfbd81ef89f595761b99a55bbe1543b3f4b3b09537c8622d1834add6976dccf31c18d288abb94d23744d9fce75f7a708cb13fe909eacf688cdbf8b57
6
+ metadata.gz: ecc99bcf076cd30fa4463e229f5ce6fcc02d4952d360ab683b10693de718da6de06bb6155a09446b40f3b4d671a4755888c3752472aa6482fed3b542f260ef9f
7
+ data.tar.gz: e0a1b9c484c4062a098b4881020aca84392a87bf99a6ff4f1a53826cf7841e90d13c2659e699ed066181295f537b11f36e349e0b4b4ccc55991ec25ef1e61f8e
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ = ruby-intar
2
+
3
+ Copyright (c) 2020, Bertram Scharpf <software@bertram-scharpf.de>.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are
8
+ met:
9
+
10
+ * Redistributions of source code must retain the above copyright
11
+ notice, this list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright
14
+ notice, this list of conditions and the following disclaimer in
15
+ the documentation and/or other materials provided with the
16
+ distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
22
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
data/README ADDED
@@ -0,0 +1,30 @@
1
+ = ruby-intar -- Interactive Ruby
2
+
3
+ A simple Irb replacement
4
+
5
+
6
+
7
+ == About
8
+
9
+ The Intar project was started in times when Irb was a rather
10
+ unconvenient tool, without colors, difficult to call from
11
+ inside an application and so on.
12
+
13
+ Today, Intar is a tool far less complex than Irb.
14
+
15
+ Yet, Intar is more robust. Try this in Irb and in Intar:
16
+
17
+ prompt> Thread.new { sleep 3 ; Thread.main.raise "stop" }
18
+
19
+
20
+
21
+ == Author
22
+
23
+ Bertram Scharpf <software@bertram-scharpf.de>
24
+
25
+
26
+
27
+ == TODO
28
+
29
+ Write some more documentation.
30
+
data/lib/intar/prompt.rb CHANGED
@@ -19,8 +19,11 @@ class Intar
19
19
  def ask prompt
20
20
  l = Readline.readline prompt
21
21
  rescue Interrupt
22
- puts "^C -- #{$!.inspect}"
22
+ puts
23
23
  retry
24
+ rescue Exception
25
+ puts
26
+ raise
24
27
  end
25
28
 
26
29
  def last
data/lib/intar/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  class Intar
6
6
 
7
- VERSION = "2.2".freeze
7
+ VERSION = "2.3".freeze
8
8
 
9
9
  end
10
10
 
data/lib/intar.rb CHANGED
@@ -78,7 +78,7 @@ class Intar
78
78
  @obj = obj.nil? ? (eval "self", TOPLEVEL_BINDING) : obj
79
79
  @params = DEFAULTS.dup.update params
80
80
  @binding = @obj.intar_binding
81
- @n = 0
81
+ @n = 1
82
82
  @prompt = Prompt.new
83
83
  end
84
84
 
@@ -89,8 +89,10 @@ class Intar
89
89
  def run
90
90
  prompt_load_history
91
91
  oldset = eval OLDSET, @binding
92
- while l = readline do
92
+ loop do
93
93
  begin
94
+ l = readline
95
+ l or break
94
96
  @redir = find_redirect l
95
97
  r = if l =~ /\A\\(\w+|.)\s*(.*?)\s*\Z/ then
96
98
  m = get_metacommand $1
@@ -119,6 +121,7 @@ class Intar
119
121
  display r
120
122
  end
121
123
  oldset.call r, @n
124
+ @n += 1
122
125
  end
123
126
  prompt_save_history
124
127
  end
@@ -198,7 +201,6 @@ class Intar
198
201
 
199
202
  def readline
200
203
  r, @previous = @previous, nil
201
- r or @n += 1
202
204
  begin
203
205
  cp = cur_prompt r
204
206
  l = @prompt.ask cp
@@ -240,6 +242,8 @@ class Intar
240
242
  puts i
241
243
  end
242
244
 
245
+ PACKAGE_BACKTRACE = %r/#{File.basename __FILE__, ".rb"}.*:\d+:in/
246
+
243
247
  def show_exception
244
248
  unless $!.to_s.empty? then
245
249
  switchcolor 31, 1
@@ -250,8 +254,7 @@ class Intar
250
254
  puts "(#{$!.class})"
251
255
  switchcolor 33
252
256
  $@.each { |b|
253
- r = b.starts_with? __FILE__
254
- break if r and (b.rest r) =~ /\A:\d+:/
257
+ break if b =~ PACKAGE_BACKTRACE
255
258
  puts b
256
259
  }
257
260
  switchcolor
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intar
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-24 00:00:00.000000000 Z
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appl
@@ -47,6 +47,8 @@ executables:
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - LICENSE
51
+ - README
50
52
  - bin/intar
51
53
  - lib/intar.rb
52
54
  - lib/intar/prompt.rb