shell-base 0.0.1 → 0.1.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
  SHA1:
3
- metadata.gz: c3e78ba5ab815f90654e810978e0ca0f95b8e162
4
- data.tar.gz: 5143b3e5d125b7cf7a1f7ae3854d2732497fad87
3
+ metadata.gz: f9b78e3438680d50f8451f0f148e1fdeca5f6bb4
4
+ data.tar.gz: 579d5264ebe68ab5641a6ee367f8266ff9f70f27
5
5
  SHA512:
6
- metadata.gz: 6d76109e2d9f5228f0f5ae5321da4aef59cad3c68e151502541b2e68df60a4a41812cdb91ee432db9e6fc13cebc486e9fdfea57e81662f238d818d11ac82481a
7
- data.tar.gz: b216904b1d11290c0b307e57498db5190deb0ea6d5ec27e16421556ab368965bbf3e6cbc1b50c53e65f5c80cccfc196de2b880ad54eda3a43a50e1b5f99682bf
6
+ metadata.gz: a9692848ebd5a75c62b628ca37f0fb9037159c098c709c3a0d0c50750430e9bf1bfe20c228c0cf3d4ba257c4e285d858c905829e663e3bc64e08def8b6981e0d
7
+ data.tar.gz: e75c1cf3651a62ee3ff4c8f85411226316a4361d71df497b75bf7855be9a4c46a3a3e29b2f0f9f7ee90c3c6f575a03c158c91338808b2b5390c3d8f824e57e75
@@ -1,3 +1,3 @@
1
1
  class ShellBase
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/shell_base.rb CHANGED
@@ -3,15 +3,24 @@ require 'readline'
3
3
 
4
4
  class ShellBase
5
5
  def self.prompt(s)
6
- @@prompt = s
6
+ @@default_prompt = s
7
7
  end
8
8
 
9
9
  def initialize
10
+ @prompt = @@default_prompt
10
11
  while readline; end
11
12
  end
12
13
 
13
14
  def readline
14
- input = Readline.readline(@@prompt, true)
15
- input != 'exit'
15
+ input = Readline.readline(@prompt, true).split(" ")
16
+ cmd = input.shift
17
+
18
+ return if cmd == 'exit'
19
+ if respond_to? cmd
20
+ send(cmd, input)
21
+ else
22
+ puts cmd + ": Command not found"
23
+ end
24
+ true
16
25
  end
17
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shell-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - myun2
@@ -14,28 +14,28 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Ruby Shell Base Library Gem.
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
48
+ - .gitignore
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -64,12 +64,12 @@ require_paths:
64
64
  - lib
65
65
  required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
67
+ - - '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []