spinal_tap 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # SpinalTap
1
+ # Spinal Tap
2
2
 
3
- Spinal tap lets you easily connect to running Ruby processes such as daemons and cron scripts.
3
+ Spinal Tap lets you easily connect to running Ruby processes such as daemons and cron scripts.
4
4
  Once connected, you can execute arbitrary commands inside of your process.
5
5
 
6
6
  ## Installation
@@ -4,11 +4,11 @@ module SpinalTap
4
4
  def setup(server)
5
5
  @server = server
6
6
 
7
- @buffer = ''
8
- @cursor_pos = 1
9
7
  @history = []
10
8
  @history_pos = 0
11
9
 
10
+ reset_buffer
11
+
12
12
  setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
13
13
 
14
14
  suppress_go_ahead = [255, 251, 3].pack('C3')
@@ -40,10 +40,13 @@ module SpinalTap
40
40
  @server.unregister(Thread.current)
41
41
  end
42
42
 
43
- def read_parsed_line
43
+ def reset_buffer
44
44
  @buffer = ''
45
45
  @cursor_pos = 1
46
+ end
46
47
 
48
+ def read_parsed_line
49
+ reset_buffer
47
50
  redraw_cmd_line
48
51
 
49
52
  while byte = getbyte
@@ -68,11 +71,13 @@ module SpinalTap
68
71
  if @history_pos > 0
69
72
  @history_pos -= 1
70
73
  @buffer = @history[@history_pos].to_s
74
+ @cursor_pos = @buffer.length + 1
71
75
  end
72
76
  when 66 # B Char - Down Arrow.
73
77
  if @history_pos < @history.length
74
78
  @history_pos += 1
75
79
  @buffer = @history[@history_pos].to_s
80
+ @cursor_pos = @buffer.length + 1
76
81
  end
77
82
  when 67 # C Char - Right Arrow.
78
83
  if @cursor_pos < @buffer.length
@@ -100,7 +105,7 @@ module SpinalTap
100
105
 
101
106
  return {:command => command, :args => args}
102
107
 
103
- # Other Chars.
108
+ # Normal (letters, numbers, punctuation, etc) Chars.
104
109
  elsif byte >= 32 && byte <= 126
105
110
  @buffer.insert(@cursor_pos - 1, byte_s)
106
111
  @cursor_pos += 1
@@ -1,3 +1,3 @@
1
1
  module SpinalTap
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinal_tap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-13 00:00:00.000000000 Z
12
+ date: 2012-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  segments:
142
142
  - 0
143
- hash: -1445683883827967934
143
+ hash: 1112740283553525583
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: -1445683883827967934
152
+ hash: 1112740283553525583
153
153
  requirements: []
154
154
  rubyforge_project:
155
155
  rubygems_version: 1.8.23