mysh 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 598d1b6c7d25d38608c3cf63401013b9b3509a3b
4
- data.tar.gz: c2e011cf3e1d038f79c243ca981fa68e4293ffff
3
+ metadata.gz: 828ee0a66f1bb5ca97672511c524b698f68ed19b
4
+ data.tar.gz: 413ae8403c09cc03f279481b0d7d9b20c389548e
5
5
  SHA512:
6
- metadata.gz: b9e5714a1804a5cfbf72d76e6c10909c9c8fcf7150b0614ef632f0869fc34f7f3709ea3d18f3cd9fd522d4c27acffa4c4c68b24a5f01068834f84951aad8ff6c
7
- data.tar.gz: 851b8fb0d1dc2615516beb2cd39b55370678ce36d7f64c8f1a1e21e83e7086a07e3d4912b07816dcfbb558334c031db974b24e84d0183da763967ec7a5894361
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
- reset
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.reset
57
+ def self.reset_host
53
58
  @exec_host = ExecHost.new
54
59
  end
55
60
 
@@ -27,12 +27,14 @@ module Mysh
27
27
  #<br>Endemic Code Smells
28
28
  #* :reek:UtilityFunction
29
29
  def reset
30
- Mysh.reset
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
- pp @result unless @result.nil?
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
 
7
7
  #A brief summary of this gem.
8
8
  SUMMARY = "mysh -- a Ruby inspired command shell"
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
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-08-25 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler