scriptty 1.2.0-java → 1.3.0-java

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.0
@@ -176,8 +176,10 @@ module ScripTTY
176
176
  end
177
177
 
178
178
  # Sleep for the specified number of seconds
179
- def sleep(seconds)
180
- @transcript_writer.info("Script executing command", "sleep", seconds.inspect) if @transcript_writer
179
+ #
180
+ # Pass :transcribe=>false to this method to suppress output to the transcript.
181
+ def sleep(seconds, options={})
182
+ @transcript_writer.info("Script executing command", "sleep", seconds.inspect) if @transcript_writer and options[:transcribe] != false
181
183
  sleep_done = false
182
184
  @net.timer(seconds) { sleep_done = true ; @net.suspend }
183
185
  dispatch until sleep_done
@@ -254,7 +254,7 @@ module ScripTTY
254
254
  end
255
255
 
256
256
  def idle
257
- @expect.sleep(0.1)
257
+ @expect.sleep(0.1, :transcribe=>false)
258
258
  end
259
259
 
260
260
  def show_exception(exc, context=nil)
@@ -18,6 +18,8 @@
18
18
  require File.dirname(__FILE__) + "/test_helper.rb"
19
19
  require 'scriptty/expect'
20
20
  require 'scriptty/net/event_loop'
21
+ require 'scriptty/util/transcript/writer'
22
+ require 'stringio'
21
23
 
22
24
  class ExpectTest < Test::Unit::TestCase
23
25
 
@@ -65,5 +67,44 @@ class ExpectTest < Test::Unit::TestCase
65
67
  e.load_screens "screens.txt"
66
68
  assert_not_nil e.screen(:hello_world), "screen should load successfully"
67
69
  end
70
+
71
+ def test_sleep_with_and_without_transcribe
72
+ sio = StringIO.new
73
+ writer = ScripTTY::Util::Transcript::Writer.new(sio)
74
+
75
+ e = ScripTTY::Expect.new
76
+ e.transcript_writer = writer
77
+
78
+ writer.override_timestamp = 1.0
79
+ e.puts "Normal sleep should output transcript records"
80
+ e.sleep(0.1)
81
+ e.sleep(0.1)
82
+ e.sleep(0.1)
83
+
84
+ writer.override_timestamp = 2.0
85
+ e.puts "sleep with :transcribe=>false should output nothing to the transcript"
86
+ e.sleep(0.1, :transcribe=>false)
87
+ e.sleep(0.1, :transcribe=>false)
88
+ e.sleep(0.1, :transcribe=>false)
89
+
90
+ writer.override_timestamp = 3.0
91
+ e.puts "sleep with :transcribe=>true should output nothing to the transcript"
92
+ e.sleep(0.1, :transcribe=>true)
93
+ e.sleep(0.1, :transcribe=>true)
94
+ e.sleep(0.1, :transcribe=>true)
95
+
96
+ expected = <<-'EOF'.strip.split("\n").map{|line| line.strip}.join("\n") + "\n"
97
+ [1.000] * "puts" "Normal sleep should output transcript records"
98
+ [1.000] * "Script executing command" "sleep" "0.1"
99
+ [1.000] * "Script executing command" "sleep" "0.1"
100
+ [1.000] * "Script executing command" "sleep" "0.1"
101
+ [2.000] * "puts" "sleep with :transcribe=>false should output nothing to the transcript"
102
+ [3.000] * "puts" "sleep with :transcribe=>true should output nothing to the transcript"
103
+ [3.000] * "Script executing command" "sleep" "0.1"
104
+ [3.000] * "Script executing command" "sleep" "0.1"
105
+ [3.000] * "Script executing command" "sleep" "0.1"
106
+ EOF
107
+ assert_equal expected, sio.string
108
+ end
68
109
  end
69
110
  end
@@ -17,6 +17,8 @@
17
17
  # along with ScripTTY. If not, see <http://www.gnu.org/licenses/>.
18
18
  require File.dirname(__FILE__) + "/test_helper.rb"
19
19
  require 'scriptty/request_dispatcher'
20
+ require 'scriptty/util/transcript/writer'
21
+ require 'stringio'
20
22
 
21
23
  class RequestDispatcherTest < Test::Unit::TestCase
22
24
 
@@ -71,6 +73,18 @@ class RequestDispatcherTest < Test::Unit::TestCase
71
73
  end
72
74
  end
73
75
 
76
+ def test_idle_does_not_write_to_transcript
77
+ sio = StringIO.new
78
+ @r.after_init {
79
+ self.transcript_writer = ScripTTY::Util::Transcript::Writer.new(sio)
80
+ self.transcript_writer.override_timestamp = 88.0
81
+ }
82
+ @r.start
83
+ sleep 0.5
84
+ @r.finish
85
+ assert_equal sio.string, %Q([88.000] * "Script executing command" "exit"\n)
86
+ end
87
+
74
88
  end
75
89
  end
76
90
 
@@ -52,6 +52,7 @@ class TranscriptWriterTest < Test::Unit::TestCase
52
52
  [88.000] EX+ "line1"
53
53
  [88.000] EX+ "line2"
54
54
  EOF
55
+ assert_equal expected, sio.string
55
56
  end
56
57
 
57
58
  def test_string_encoding
metadata CHANGED
@@ -1,46 +1,51 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scriptty
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
- - 1
7
- - 2
8
- - 0
9
- version: 1.2.0
7
+ - 1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
10
11
  platform: java
11
12
  authors:
12
- - Dwayne Litzenberger
13
+ - Dwayne Litzenberger
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-15 00:00:00 -04:00
18
+ date: 2010-12-07 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: treetop
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
30
- type: :runtime
31
- version_requirements: *id001
32
- - !ruby/object:Gem::Dependency
33
- name: multibyte
34
- prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- segments:
40
- - 0
41
- version: "0"
42
- type: :runtime
43
- version_requirements: *id002
21
+ - !ruby/object:Gem::Dependency
22
+ name: treetop
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: multibyte
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
44
49
  description: |
45
50
  ScripTTY is a JRuby application and library that lets you control full-screen
46
51
  terminal applications using an expect-like scripting language and a full-screen
@@ -48,144 +53,147 @@ description: |
48
53
 
49
54
  email: dlitz@infonium.ca
50
55
  executables:
51
- - scriptty-capture
52
- - scriptty-dump-screens
53
- - scriptty-replay
54
- - scriptty-term-test
55
- - scriptty-transcript-parse
56
+ - scriptty-dump-screens
57
+ - scriptty-capture
58
+ - scriptty-transcript-parse
59
+ - scriptty-replay
60
+ - scriptty-term-test
56
61
  extensions: []
57
62
 
58
63
  extra_rdoc_files:
59
- - README.rdoc
64
+ - README.rdoc
60
65
  files:
61
- - .gitattributes
62
- - .gitignore
63
- - COPYING
64
- - COPYING.LESSER
65
- - README.rdoc
66
- - Rakefile
67
- - VERSION
68
- - bin/scriptty-capture
69
- - bin/scriptty-dump-screens
70
- - bin/scriptty-replay
71
- - bin/scriptty-term-test
72
- - bin/scriptty-transcript-parse
73
- - examples/captures/xterm-overlong-line-prompt.bin
74
- - examples/captures/xterm-vim-session.bin
75
- - examples/demo-capture.rb
76
- - examples/demo-telnet-session-screens.txt
77
- - examples/demo-telnet-session.rb
78
- - examples/rdispatch/demo-request-dispatcher.rb
79
- - examples/rdispatch/done_screen.txt
80
- - examples/rdispatch/login.rb
81
- - examples/rdispatch/start_screen.txt
82
- - examples/rdispatch/vim_screen.txt
83
- - examples/telnet-nego.rb
84
- - lib/scriptty/apps/capture_app.rb
85
- - lib/scriptty/apps/dump_screens_app.rb
86
- - lib/scriptty/apps/replay_app.rb
87
- - lib/scriptty/apps/term_test_app.rb
88
- - lib/scriptty/apps/transcript_parse_app.rb
89
- - lib/scriptty/cursor.rb
90
- - lib/scriptty/exception.rb
91
- - lib/scriptty/expect.rb
92
- - lib/scriptty/multiline_buffer.rb
93
- - lib/scriptty/net/console.rb
94
- - lib/scriptty/net/event_loop.rb
95
- - lib/scriptty/net/password_prompt.rb
96
- - lib/scriptty/request_dispatcher.rb
97
- - lib/scriptty/screen_pattern.rb
98
- - lib/scriptty/screen_pattern/generator.rb
99
- - lib/scriptty/screen_pattern/parser.rb
100
- - lib/scriptty/term.rb
101
- - lib/scriptty/term/dg410.rb
102
- - lib/scriptty/term/dg410/dg410-client-escapes.txt
103
- - lib/scriptty/term/dg410/dg410-escapes.txt
104
- - lib/scriptty/term/dg410/parser.rb
105
- - lib/scriptty/term/xterm.rb
106
- - lib/scriptty/term/xterm/xterm-escapes.txt
107
- - lib/scriptty/util/fsm.rb
108
- - lib/scriptty/util/fsm/definition_parser.rb
109
- - lib/scriptty/util/fsm/scriptty_fsm_definition.treetop
110
- - lib/scriptty/util/transcript/reader.rb
111
- - lib/scriptty/util/transcript/writer.rb
112
- - test.watchr
113
- - test/apps/capture_app_test.rb
114
- - test/apps/transcript_parse_app_test.rb
115
- - test/cursor_test.rb
116
- - test/expect/screens.txt
117
- - test/expect_test.rb
118
- - test/fsm_definition_parser_test.rb
119
- - test/fsm_test.rb
120
- - test/multiline_buffer_test.rb
121
- - test/net/event_loop_test.rb
122
- - test/request_dispatcher_test.rb
123
- - test/screen_pattern/generator_test.rb
124
- - test/screen_pattern/parser_test.rb
125
- - test/screen_pattern/parser_test/explicit_cursor_pattern.txt
126
- - test/screen_pattern/parser_test/explicit_fields.txt
127
- - test/screen_pattern/parser_test/multiple_patterns.txt
128
- - test/screen_pattern/parser_test/simple_pattern.txt
129
- - test/screen_pattern/parser_test/truncated_heredoc.txt
130
- - test/screen_pattern/parser_test/utf16bebom_pattern.bin
131
- - test/screen_pattern/parser_test/utf16lebom_pattern.bin
132
- - test/screen_pattern/parser_test/utf8_pattern.bin
133
- - test/screen_pattern/parser_test/utf8_unix_pattern.bin
134
- - test/screen_pattern/parser_test/utf8bom_pattern.bin
135
- - test/term/dg410/parser_test.rb
136
- - test/term/xterm_test.rb
137
- - test/test_helper.rb
138
- - test/util/transcript/reader_test.rb
139
- - test/util/transcript/writer_test.rb
66
+ - .gitattributes
67
+ - COPYING
68
+ - COPYING.LESSER
69
+ - README.rdoc
70
+ - Rakefile
71
+ - VERSION
72
+ - bin/scriptty-capture
73
+ - bin/scriptty-dump-screens
74
+ - bin/scriptty-replay
75
+ - bin/scriptty-term-test
76
+ - bin/scriptty-transcript-parse
77
+ - examples/captures/xterm-overlong-line-prompt.bin
78
+ - examples/captures/xterm-vim-session.bin
79
+ - examples/demo-capture.rb
80
+ - examples/demo-telnet-session-screens.txt
81
+ - examples/demo-telnet-session.rb
82
+ - examples/rdispatch/demo-request-dispatcher.rb
83
+ - examples/rdispatch/done_screen.txt
84
+ - examples/rdispatch/login.rb
85
+ - examples/rdispatch/start_screen.txt
86
+ - examples/rdispatch/vim_screen.txt
87
+ - examples/telnet-nego.rb
88
+ - lib/scriptty/apps/capture_app.rb
89
+ - lib/scriptty/apps/dump_screens_app.rb
90
+ - lib/scriptty/apps/replay_app.rb
91
+ - lib/scriptty/apps/term_test_app.rb
92
+ - lib/scriptty/apps/transcript_parse_app.rb
93
+ - lib/scriptty/cursor.rb
94
+ - lib/scriptty/exception.rb
95
+ - lib/scriptty/expect.rb
96
+ - lib/scriptty/multiline_buffer.rb
97
+ - lib/scriptty/net/console.rb
98
+ - lib/scriptty/net/event_loop.rb
99
+ - lib/scriptty/net/password_prompt.rb
100
+ - lib/scriptty/request_dispatcher.rb
101
+ - lib/scriptty/screen_pattern.rb
102
+ - lib/scriptty/screen_pattern/generator.rb
103
+ - lib/scriptty/screen_pattern/parser.rb
104
+ - lib/scriptty/term.rb
105
+ - lib/scriptty/term/dg410.rb
106
+ - lib/scriptty/term/dg410/dg410-client-escapes.txt
107
+ - lib/scriptty/term/dg410/dg410-escapes.txt
108
+ - lib/scriptty/term/dg410/parser.rb
109
+ - lib/scriptty/term/xterm.rb
110
+ - lib/scriptty/term/xterm/xterm-escapes.txt
111
+ - lib/scriptty/util/fsm.rb
112
+ - lib/scriptty/util/fsm/definition_parser.rb
113
+ - lib/scriptty/util/fsm/scriptty_fsm_definition.treetop
114
+ - lib/scriptty/util/transcript/reader.rb
115
+ - lib/scriptty/util/transcript/writer.rb
116
+ - test.watchr
117
+ - test/apps/capture_app_test.rb
118
+ - test/apps/transcript_parse_app_test.rb
119
+ - test/cursor_test.rb
120
+ - test/expect/screens.txt
121
+ - test/expect_test.rb
122
+ - test/fsm_definition_parser_test.rb
123
+ - test/fsm_test.rb
124
+ - test/multiline_buffer_test.rb
125
+ - test/net/event_loop_test.rb
126
+ - test/request_dispatcher_test.rb
127
+ - test/screen_pattern/generator_test.rb
128
+ - test/screen_pattern/parser_test.rb
129
+ - test/screen_pattern/parser_test/explicit_cursor_pattern.txt
130
+ - test/screen_pattern/parser_test/explicit_fields.txt
131
+ - test/screen_pattern/parser_test/multiple_patterns.txt
132
+ - test/screen_pattern/parser_test/simple_pattern.txt
133
+ - test/screen_pattern/parser_test/truncated_heredoc.txt
134
+ - test/screen_pattern/parser_test/utf16bebom_pattern.bin
135
+ - test/screen_pattern/parser_test/utf16lebom_pattern.bin
136
+ - test/screen_pattern/parser_test/utf8_pattern.bin
137
+ - test/screen_pattern/parser_test/utf8_unix_pattern.bin
138
+ - test/screen_pattern/parser_test/utf8bom_pattern.bin
139
+ - test/term/dg410/parser_test.rb
140
+ - test/term/xterm_test.rb
141
+ - test/test_helper.rb
142
+ - test/util/transcript/reader_test.rb
143
+ - test/util/transcript/writer_test.rb
140
144
  has_rdoc: true
141
145
  homepage: http://github.com/infonium/scriptty
142
146
  licenses: []
143
147
 
144
148
  post_install_message:
145
- rdoc_options:
146
- - --charset=UTF-8
149
+ rdoc_options: []
150
+
147
151
  require_paths:
148
- - lib
152
+ - lib
149
153
  required_ruby_version: !ruby/object:Gem::Requirement
154
+ none: false
150
155
  requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- segments:
154
- - 0
155
- version: "0"
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ hash: 3
159
+ segments:
160
+ - 0
161
+ version: "0"
156
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
157
164
  requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- segments:
161
- - 0
162
- version: "0"
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
163
171
  requirements: []
164
172
 
165
173
  rubyforge_project:
166
- rubygems_version: 1.3.6
174
+ rubygems_version: 1.3.7
167
175
  signing_key:
168
176
  specification_version: 3
169
177
  summary: write expect-like script to control full-screen terminal-based applications
170
178
  test_files:
171
- - test/cursor_test.rb
172
- - test/expect_test.rb
173
- - test/fsm_definition_parser_test.rb
174
- - test/fsm_test.rb
175
- - test/multiline_buffer_test.rb
176
- - test/request_dispatcher_test.rb
177
- - test/test_helper.rb
178
- - test/apps/capture_app_test.rb
179
- - test/apps/transcript_parse_app_test.rb
180
- - test/net/event_loop_test.rb
181
- - test/screen_pattern/generator_test.rb
182
- - test/screen_pattern/parser_test.rb
183
- - test/term/xterm_test.rb
184
- - test/term/dg410/parser_test.rb
185
- - test/util/transcript/reader_test.rb
186
- - test/util/transcript/writer_test.rb
187
- - examples/demo-capture.rb
188
- - examples/demo-telnet-session.rb
189
- - examples/telnet-nego.rb
190
- - examples/rdispatch/demo-request-dispatcher.rb
191
- - examples/rdispatch/login.rb
179
+ - examples/demo-capture.rb
180
+ - examples/demo-telnet-session.rb
181
+ - examples/rdispatch/demo-request-dispatcher.rb
182
+ - examples/rdispatch/login.rb
183
+ - examples/telnet-nego.rb
184
+ - test/apps/capture_app_test.rb
185
+ - test/apps/transcript_parse_app_test.rb
186
+ - test/cursor_test.rb
187
+ - test/expect_test.rb
188
+ - test/fsm_definition_parser_test.rb
189
+ - test/fsm_test.rb
190
+ - test/multiline_buffer_test.rb
191
+ - test/net/event_loop_test.rb
192
+ - test/request_dispatcher_test.rb
193
+ - test/screen_pattern/generator_test.rb
194
+ - test/screen_pattern/parser_test.rb
195
+ - test/term/dg410/parser_test.rb
196
+ - test/term/xterm_test.rb
197
+ - test/test_helper.rb
198
+ - test/util/transcript/reader_test.rb
199
+ - test/util/transcript/writer_test.rb
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- /coverage
2
- /html
3
- /pkg