mysh 0.1.4 → 0.1.5
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.
- checksums.yaml +4 -4
- data/lib/mysh.rb +11 -6
- data/lib/mysh/expression.rb +10 -2
- data/lib/mysh/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 828ee0a66f1bb5ca97672511c524b698f68ed19b
|
4
|
+
data.tar.gz: 413ae8403c09cc03f279481b0d7d9b20c389548e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 180b7d137796638361cd2c016d33a00d1a4b1e8cb28ea76eecdad0daf3bcf842860ffe45b9c56a2b13b7c108d1f8566f66278f055dfad37c544b6ef860abc226
|
7
|
+
data.tar.gz: 1e497e09e730eb98f115831e897903e75e67a1696c5b4596f345f10b5919f9eb6905fcdc1786e1d691dd725d35f7ce19a74fe0c0b11ce727be32d245870079ef
|
data/lib/mysh.rb
CHANGED
@@ -27,11 +27,7 @@ module Mysh
|
|
27
27
|
#<br>Endemic Code Smells
|
28
28
|
#* :reek:TooManyStatements
|
29
29
|
def self.run
|
30
|
-
|
31
|
-
@input = MiniReadline::Readline.new(history: true,
|
32
|
-
eoi_detect: true,
|
33
|
-
auto_complete: true,
|
34
|
-
auto_source: SmartSource)
|
30
|
+
init_run
|
35
31
|
|
36
32
|
loop do
|
37
33
|
input = @input.readline(prompt: 'mysh> ')
|
@@ -48,8 +44,17 @@ module Mysh
|
|
48
44
|
rescue Interrupt, MiniReadlineEOI
|
49
45
|
end
|
50
46
|
|
47
|
+
#Set up for the run command.
|
48
|
+
def self.init_run
|
49
|
+
reset_host
|
50
|
+
@input = MiniReadline::Readline.new(history: true,
|
51
|
+
eoi_detect: true,
|
52
|
+
auto_complete: true,
|
53
|
+
auto_source: SmartSource)
|
54
|
+
end
|
55
|
+
|
51
56
|
#Reset the state of the execution hosting environment.
|
52
|
-
def self.
|
57
|
+
def self.reset_host
|
53
58
|
@exec_host = ExecHost.new
|
54
59
|
end
|
55
60
|
|
data/lib/mysh/expression.rb
CHANGED
@@ -27,12 +27,14 @@ module Mysh
|
|
27
27
|
#<br>Endemic Code Smells
|
28
28
|
#* :reek:UtilityFunction
|
29
29
|
def reset
|
30
|
-
Mysh.
|
30
|
+
Mysh.reset_host
|
31
31
|
nil
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
35
35
|
#Do the actual work of executing an expression.
|
36
|
+
#<br>Endemic Code Smells
|
37
|
+
#* :reek:TooManyStatements
|
36
38
|
def do_execute(str)
|
37
39
|
if /\\\s*$/ =~ str
|
38
40
|
parms = {
|
@@ -44,7 +46,13 @@ module Mysh
|
|
44
46
|
else
|
45
47
|
begin
|
46
48
|
eval("@result" + str)
|
47
|
-
|
49
|
+
|
50
|
+
if @result
|
51
|
+
pp @result
|
52
|
+
else
|
53
|
+
puts @result
|
54
|
+
end
|
55
|
+
|
48
56
|
rescue StandardError, ScriptError => err
|
49
57
|
puts "Error: #{err}"
|
50
58
|
end
|
data/lib/mysh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|