superscript 0.7.0 → 0.11.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
  SHA256:
3
- metadata.gz: 319f3dadd5472b2736ea9311eda884988918edc2b6bf85d81e588d82869eefd6
4
- data.tar.gz: 442d82b1f0a9038e07c8b1d35a32ba314481d0e2fb3e9bfc6efc828d5ce28236
3
+ metadata.gz: b19663dfb05a7fbb830364787958acddcd1b3775b34602037859dbb68a760478
4
+ data.tar.gz: 6e5629534d4f07dfc6e66700d70ac3822ca981989b8e5c2e428e8a03139dc227
5
5
  SHA512:
6
- metadata.gz: c73cb8eb01c73067102195d9f3609e0b2bc1c8f7df9691e4c45c58999157609830b75ffe8e1712823942c417ad49231c4aa29c6f19444cad9c3565def98954e6
7
- data.tar.gz: 97c3d00746f22289807cbfcc8ab8f94b07a6012df589f31bb28544e91b9564c4af6cbcccbde06ca2c81a9abf14a88485dbfe7680f5a045236b87319c9e798c0e
6
+ metadata.gz: 03abe4121ccef1debd13a861b7c78eab5217390a8fe2a3c9be73b7be4508bb3e961bb66c5c87d7d876772ed084ad5596af7f826eba68bc3117f491712db1f867
7
+ data.tar.gz: 90369ee7481e75cacf420ea3b756ecd7dc1f47c276164649c3e7f695ec0a92e5d94ec37898e5145f811a4c72a33e6a16f6391e675158fb6bb230cf7fdf482d6e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superscript (0.7.0)
4
+ superscript (0.11.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -3,6 +3,17 @@ class Go < Superscript::Dsl
3
3
  self.say "Go #{args.join(" ")}!"
4
4
  end
5
5
 
6
+ def loop &block
7
+ ::Kernel.loop do
8
+ block.call
9
+ sleep 1
10
+ end
11
+ end
12
+
13
+ def hang
14
+ sleep 9999
15
+ end
16
+
6
17
  def say(message)
7
18
  puts message
8
19
  end
@@ -19,6 +30,10 @@ class Go < Superscript::Dsl
19
30
  asdf
20
31
  end
21
32
 
33
+ def raise!
34
+ raise "raising!"
35
+ end
36
+
22
37
  def exit
23
38
  Kernel.exit
24
39
  end
@@ -1,2 +1,4 @@
1
1
  a = struct
2
2
  go a.name
3
+
4
+ raise!
@@ -32,10 +32,20 @@ if ARGV[1]
32
32
  runner = Superscript::Runner.new ARGV[1], options
33
33
  runner.run! ctx
34
34
  else
35
+ require "readline"
36
+
35
37
  runner = Superscript::Runner.new nil, options
36
38
  loop do
37
- print "> "
38
- contents = STDIN.gets
39
+ contents = Readline.readline "> ", true
40
+ next if contents == ""
41
+
42
+ if contents == nil
43
+ puts "\n-- press ^D to end input"
44
+ contents = $stdin.readlines.join("\n")
45
+ end
46
+
47
+ next if contents == ""
48
+
39
49
  value = runner.run! ctx, contents: contents
40
50
  puts " => #{value.inspect}"
41
51
  end
@@ -1,3 +1,7 @@
1
+ Signal.trap "TERM" do
2
+ exit 0
3
+ end
4
+
1
5
  module Superscript
2
6
  class Runner
3
7
  def initialize path=nil, opts={}
@@ -14,27 +18,29 @@ module Superscript
14
18
 
15
19
  def error!(where, *args)
16
20
  puts "-- [ superscript error ] --"
17
- error_message = ""
18
- case where
21
+ exception, error_message = case where
19
22
  when :exception
20
- exception = args.first
21
- error_message = exception
23
+ ex = args.first
24
+ [ex.class, ex]
22
25
  when :tp_call_superscript, :tp_call_superscript_global
23
- error_message = "Can't touch this"
26
+ [:internal, "Can't touch this"]
24
27
  when :ctx_method_missing, :tp_singleton_method_added, :tp_command_not_found
25
- error_message = args.first
28
+ [:internal, args.first]
26
29
  when :tp_class_define, :tp_module_define
27
- error_message = args.first
30
+ [:internal, args.first]
28
31
  else
29
32
  pp [:unknown_where, where, args]
30
- error_message = args.join(" ")
33
+ [:uknown, args.join(" ")]
31
34
  end
32
35
 
33
- puts error_message
34
- if @on_error_exec
35
- system("#{@on_error_exec} #{error_message}")
36
- end
37
- exit 1
36
+ puts "#{exception}: #{error_message}"
37
+
38
+ # caller.each do |c|
39
+ # puts c
40
+ # end
41
+ system @on_error_exec, error_message if @on_error_exec
42
+
43
+ exit 1 unless @path == "<interactive>"
38
44
  end
39
45
 
40
46
  def arm!(reason=nil)
@@ -1,3 +1,3 @@
1
1
  module Superscript
2
- VERSION = "0.7.0"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-21 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,7 +85,7 @@ homepage: https://github.com/matti/superscript
85
85
  licenses:
86
86
  - MIT
87
87
  metadata: {}
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubygems_version: 3.0.8
104
- signing_key:
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: superscript
107
107
  test_files: []