redcar 0.3.7.1 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +16 -0
- data/README.md +5 -0
- data/ROADMAP.md +7 -9
- data/Rakefile +55 -22
- data/lib/redcar.rb +12 -6
- data/lib/redcar/installer.rb +119 -44
- data/plugins/application/features/step_definitions/speedbar_steps.rb +62 -0
- data/plugins/application/features/step_definitions/tree_steps.rb +3 -3
- data/plugins/application/features/support/env.rb +2 -1
- data/plugins/application/lib/application/notebook.rb +53 -7
- data/plugins/application/lib/application/speedbar.rb +12 -0
- data/plugins/application/lib/application/tab.rb +16 -5
- data/plugins/application/lib/application/treebook.rb +21 -1
- data/plugins/application_swt/lib/application_swt.rb +12 -2
- data/plugins/application_swt/lib/application_swt/html_tab.rb +4 -0
- data/plugins/application_swt/lib/application_swt/notebook.rb +5 -3
- data/plugins/application_swt/lib/application_swt/speedbar.rb +15 -27
- data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +1 -0
- data/plugins/application_swt/lib/application_swt/tab.rb +1 -0
- data/plugins/application_swt/lib/application_swt/treebook.rb +36 -8
- data/plugins/application_swt/lib/application_swt/window.rb +24 -18
- data/plugins/auto_completer/lib/auto_completer.rb +5 -20
- data/plugins/core/lib/core.rb +7 -4
- data/plugins/core/lib/core/observable_struct.rb +2 -2
- data/plugins/declarations/lib/declarations.rb +3 -17
- data/plugins/document_search/features/search.feature +163 -0
- data/plugins/document_search/features/support/env.rb +4 -0
- data/plugins/document_search/lib/document_search.rb +121 -0
- data/plugins/document_search/plugin.rb +8 -0
- data/plugins/edit_view/features/line_delimiter.feature +7 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +49 -1
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +10 -11
- data/plugins/edit_view/features/switch_tabs.feature +61 -10
- data/plugins/edit_view/lib/edit_view.rb +4 -0
- data/plugins/edit_view/lib/edit_view/document.rb +56 -0
- data/plugins/edit_view/lib/edit_view/document/command.rb +1 -1
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +0 -8
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +4 -0
- data/plugins/html_view/lib/html_controller.rb +19 -1
- data/plugins/html_view/lib/html_view.rb +28 -1
- data/plugins/html_view/lib/html_view/html_tab.rb +10 -1
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +3 -1
- data/plugins/project/features/open_directory_tree.feature +3 -3
- data/plugins/project/lib/project.rb +4 -6
- data/plugins/project/lib/project/commands.rb +17 -0
- data/plugins/project/lib/project/dir_controller.rb +2 -1
- data/plugins/project/lib/project/dir_mirror.rb +8 -0
- data/plugins/project/lib/project/manager.rb +2 -0
- data/plugins/project/plugin.rb +2 -1
- data/plugins/project/vendor/net-sftp/Manifest +55 -0
- data/plugins/project/vendor/net-sftp/Rakefile +30 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp.rb +70 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/constants.rb +187 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/errors.rb +39 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/dir.rb +93 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/download.rb +364 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/file.rb +176 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/file_factory.rb +60 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/upload.rb +387 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/packet.rb +21 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol.rb +32 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/01/attributes.rb +315 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/01/base.rb +268 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/01/name.rb +43 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/02/base.rb +31 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/03/base.rb +35 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/04/attributes.rb +152 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/04/base.rb +94 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/04/name.rb +67 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/05/base.rb +66 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/06/attributes.rb +107 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/06/base.rb +63 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/base.rb +50 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/request.rb +91 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/response.rb +76 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/session.rb +951 -0
- data/plugins/project/vendor/net-sftp/lib/net/sftp/version.rb +18 -0
- data/plugins/project/vendor/net-sftp/setup.rb +1331 -0
- data/plugins/project/vendor/net-sftp/test/common.rb +171 -0
- data/plugins/project/vendor/net-sftp/test/protocol/01/test_attributes.rb +97 -0
- data/plugins/project/vendor/net-sftp/test/protocol/01/test_base.rb +210 -0
- data/plugins/project/vendor/net-sftp/test/protocol/01/test_name.rb +27 -0
- data/plugins/project/vendor/net-sftp/test/protocol/02/test_base.rb +26 -0
- data/plugins/project/vendor/net-sftp/test/protocol/03/test_base.rb +27 -0
- data/plugins/project/vendor/net-sftp/test/protocol/04/test_attributes.rb +148 -0
- data/plugins/project/vendor/net-sftp/test/protocol/04/test_base.rb +74 -0
- data/plugins/project/vendor/net-sftp/test/protocol/04/test_name.rb +53 -0
- data/plugins/project/vendor/net-sftp/test/protocol/05/test_base.rb +62 -0
- data/plugins/project/vendor/net-sftp/test/protocol/06/test_attributes.rb +124 -0
- data/plugins/project/vendor/net-sftp/test/protocol/06/test_base.rb +51 -0
- data/plugins/project/vendor/net-sftp/test/protocol/test_base.rb +42 -0
- data/plugins/project/vendor/net-sftp/test/test_all.rb +7 -0
- data/plugins/project/vendor/net-sftp/test/test_dir.rb +47 -0
- data/plugins/project/vendor/net-sftp/test/test_download.rb +252 -0
- data/plugins/project/vendor/net-sftp/test/test_file.rb +159 -0
- data/plugins/project/vendor/net-sftp/test/test_file_factory.rb +48 -0
- data/plugins/project/vendor/net-sftp/test/test_packet.rb +9 -0
- data/plugins/project/vendor/net-sftp/test/test_protocol.rb +17 -0
- data/plugins/project/vendor/net-sftp/test/test_request.rb +71 -0
- data/plugins/project/vendor/net-sftp/test/test_response.rb +53 -0
- data/plugins/project/vendor/net-sftp/test/test_session.rb +741 -0
- data/plugins/project/vendor/net-sftp/test/test_upload.rb +219 -0
- data/plugins/project/vendor/net-ssh/Manifest +110 -0
- data/plugins/project/vendor/net-ssh/Rakefile +85 -0
- data/plugins/project/vendor/net-ssh/Rudyfile +96 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh.rb +215 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/agent.rb +179 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/constants.rb +18 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/key_manager.rb +193 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/abstract.rb +60 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/hostbased.rb +71 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/keyboard_interactive.rb +66 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/password.rb +39 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/publickey.rb +92 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/pageant.rb +183 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/session.rb +134 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/buffer.rb +340 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/buffered_io.rb +198 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/config.rb +202 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/channel.rb +630 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/constants.rb +33 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/session.rb +597 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/term.rb +178 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/errors.rb +85 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/key_factory.rb +102 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/known_hosts.rb +129 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/loggable.rb +61 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/packet.rb +102 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/prompt.rb +93 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/command.rb +75 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/errors.rb +14 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/http.rb +94 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/socks4.rb +70 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/socks5.rb +142 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/ruby_compat.rb +43 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/service/forward.rb +288 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test.rb +89 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/channel.rb +129 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/extensions.rb +152 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/kex.rb +44 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/local_packet.rb +51 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/packet.rb +81 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/remote_packet.rb +38 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/script.rb +157 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/test/socket.rb +64 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/algorithms.rb +384 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/cipher_factory.rb +97 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/constants.rb +30 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac.rb +31 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/abstract.rb +79 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/md5.rb +12 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/none.rb +15 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/sha1.rb +13 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/identity_cipher.rb +55 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/kex.rb +13 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +208 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +77 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/openssl.rb +128 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/packet_stream.rb +235 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/server_version.rb +71 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/session.rb +276 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/state.rb +206 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/verifiers/lenient.rb +30 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/verifiers/null.rb +12 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/verifiers/strict.rb +53 -0
- data/plugins/project/vendor/net-ssh/lib/net/ssh/version.rb +62 -0
- data/plugins/project/vendor/net-ssh/net-ssh.gemspec +138 -0
- data/plugins/project/vendor/net-ssh/setup.rb +1585 -0
- data/plugins/project/vendor/net-ssh/support/arcfour_check.rb +20 -0
- data/plugins/project/vendor/net-ssh/support/ssh_tunnel_bug.rb +65 -0
- data/plugins/project/vendor/net-ssh/test/README.txt +42 -0
- data/plugins/project/vendor/net-ssh/test/authentication/methods/common.rb +28 -0
- data/plugins/project/vendor/net-ssh/test/authentication/methods/test_abstract.rb +51 -0
- data/plugins/project/vendor/net-ssh/test/authentication/methods/test_hostbased.rb +114 -0
- data/plugins/project/vendor/net-ssh/test/authentication/methods/test_keyboard_interactive.rb +98 -0
- data/plugins/project/vendor/net-ssh/test/authentication/methods/test_password.rb +50 -0
- data/plugins/project/vendor/net-ssh/test/authentication/methods/test_publickey.rb +127 -0
- data/plugins/project/vendor/net-ssh/test/authentication/test_agent.rb +205 -0
- data/plugins/project/vendor/net-ssh/test/authentication/test_key_manager.rb +105 -0
- data/plugins/project/vendor/net-ssh/test/authentication/test_session.rb +93 -0
- data/plugins/project/vendor/net-ssh/test/common.rb +107 -0
- data/plugins/project/vendor/net-ssh/test/configs/eqsign +3 -0
- data/plugins/project/vendor/net-ssh/test/configs/exact_match +8 -0
- data/plugins/project/vendor/net-ssh/test/configs/host_plus +10 -0
- data/plugins/project/vendor/net-ssh/test/configs/multihost +4 -0
- data/plugins/project/vendor/net-ssh/test/configs/nohost +19 -0
- data/plugins/project/vendor/net-ssh/test/configs/numeric_host +4 -0
- data/plugins/project/vendor/net-ssh/test/configs/wild_cards +14 -0
- data/plugins/project/vendor/net-ssh/test/connection/test_channel.rb +467 -0
- data/plugins/project/vendor/net-ssh/test/connection/test_session.rb +488 -0
- data/plugins/project/vendor/net-ssh/test/manual/test_forward.rb +185 -0
- data/plugins/project/vendor/net-ssh/test/test_all.rb +9 -0
- data/plugins/project/vendor/net-ssh/test/test_buffer.rb +336 -0
- data/plugins/project/vendor/net-ssh/test/test_buffered_io.rb +63 -0
- data/plugins/project/vendor/net-ssh/test/test_config.rb +117 -0
- data/plugins/project/vendor/net-ssh/test/test_key_factory.rb +67 -0
- data/plugins/project/vendor/net-ssh/test/transport/hmac/test_md5.rb +39 -0
- data/plugins/project/vendor/net-ssh/test/transport/hmac/test_md5_96.rb +25 -0
- data/plugins/project/vendor/net-ssh/test/transport/hmac/test_none.rb +34 -0
- data/plugins/project/vendor/net-ssh/test/transport/hmac/test_sha1.rb +34 -0
- data/plugins/project/vendor/net-ssh/test/transport/hmac/test_sha1_96.rb +25 -0
- data/plugins/project/vendor/net-ssh/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
- data/plugins/project/vendor/net-ssh/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_algorithms.rb +302 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_cipher_factory.rb +213 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_hmac.rb +34 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_identity_cipher.rb +40 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_packet_stream.rb +441 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_server_version.rb +78 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_session.rb +315 -0
- data/plugins/project/vendor/net-ssh/test/transport/test_state.rb +173 -0
- data/plugins/redcar/plugin.rb +3 -1
- data/plugins/redcar/redcar.rb +108 -121
- data/plugins/redcar_debug/lib/redcar_debug.rb +2 -0
- data/plugins/runnables/lib/runnables.rb +80 -23
- data/plugins/runnables/lib/runnables/command_output_controller.rb +102 -0
- data/plugins/runnables/lib/runnables/running_process_checker.rb +34 -0
- data/plugins/runnables/{plugin_no_load.rb → plugin.rb} +2 -1
- data/plugins/runnables/vendor/session-2.4.0/HISTORY +73 -0
- data/plugins/runnables/vendor/session-2.4.0/README +89 -0
- data/plugins/runnables/vendor/session-2.4.0/TODO +3 -0
- data/plugins/runnables/vendor/session-2.4.0/VERSION +1 -0
- data/plugins/runnables/vendor/session-2.4.0/gemspec.rb +22 -0
- data/plugins/runnables/vendor/session-2.4.0/install.rb +143 -0
- data/plugins/runnables/vendor/session-2.4.0/lib/session.rb +757 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/bash.rb +60 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/driver.rb +47 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/session_idl.rb +25 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/session_sh.rb +29 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/sh0.rb +23 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/stdin.rb +17 -0
- data/plugins/runnables/vendor/session-2.4.0/sample/threadtest.rb +42 -0
- data/plugins/runnables/vendor/session-2.4.0/session-2.4.0.gem +0 -0
- data/plugins/runnables/vendor/session-2.4.0/test/session.rb +227 -0
- data/plugins/runnables/views/command_output.html.erb +32 -0
- data/plugins/task_manager/lib/task_manager.rb +2 -0
- data/plugins/textmate/lib/textmate/plist.rb +1 -1
- data/plugins/textmate/lib/textmate/snippet.rb +1 -0
- data/plugins/tree/lib/tree/mirror.rb +8 -1
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +29 -2
- metadata +191 -6
- data/plugins/declarations/TODO +0 -3
- data/plugins/redcar/spec/redcar/redcar_spec.rb +0 -70
- data/plugins/redcar/spec/spec_helper.rb +0 -4
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift '.', '..', 'lib', File.join('..','lib')
|
3
|
+
|
4
|
+
require 'session'
|
5
|
+
|
6
|
+
|
7
|
+
bash = Session::Bash.new
|
8
|
+
|
9
|
+
|
10
|
+
puts "======== ======== ======== ========"
|
11
|
+
puts "#1"
|
12
|
+
puts "======== ======== ======== ========"
|
13
|
+
|
14
|
+
stdout, stderr = bash.execute 'ls'
|
15
|
+
|
16
|
+
puts "STDOUT:\n#{ stdout }"
|
17
|
+
puts "STDERR:\n#{ stderr }"
|
18
|
+
|
19
|
+
puts "STATUS: #{ bash.status }"
|
20
|
+
puts "======== ======== ======== ========"
|
21
|
+
|
22
|
+
|
23
|
+
puts "======== ======== ======== ========"
|
24
|
+
puts "#2"
|
25
|
+
puts "======== ======== ======== ========"
|
26
|
+
|
27
|
+
bash.execute 'ls' do |stdout, stderr|
|
28
|
+
puts "STDOUT:\n#{ stdout }"
|
29
|
+
puts "STDERR:\n#{ stderr }"
|
30
|
+
end
|
31
|
+
|
32
|
+
puts "STATUS: #{ bash.status }"
|
33
|
+
puts "======== ======== ======== ========"
|
34
|
+
|
35
|
+
|
36
|
+
puts "======== ======== ======== ========"
|
37
|
+
puts "#3"
|
38
|
+
puts "======== ======== ======== ========"
|
39
|
+
|
40
|
+
stdout, stderr = '', ''
|
41
|
+
bash.execute 'ls', :stdout => stdout, :stderr => stderr
|
42
|
+
|
43
|
+
puts "STDOUT:\n#{ stdout }"
|
44
|
+
puts "STDERR:\n#{ stderr }"
|
45
|
+
|
46
|
+
puts "STATUS: #{ bash.status }"
|
47
|
+
puts "======== ======== ======== ========"
|
48
|
+
|
49
|
+
|
50
|
+
puts "======== ======== ======== ========"
|
51
|
+
puts "#4"
|
52
|
+
puts "======== ======== ======== ========"
|
53
|
+
|
54
|
+
bash.outproc = lambda{|out| puts "#{ out }"}
|
55
|
+
bash.errproc = lambda{|err| raise err}
|
56
|
+
|
57
|
+
bash.execute('while test 1; do echo 42; sleep 1; done') # => 42 ... 42 ... 42
|
58
|
+
puts "======== ======== ======== ========"
|
59
|
+
|
60
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'tempfile'
|
3
|
+
require 'logger'
|
4
|
+
$:.unshift '.', '..', 'lib', File.join('..','lib')
|
5
|
+
require 'session'
|
6
|
+
|
7
|
+
DIV = ('=' * 79) << "\n"
|
8
|
+
|
9
|
+
|
10
|
+
# start session with bash
|
11
|
+
bash = Session::Bash.new
|
12
|
+
|
13
|
+
|
14
|
+
# create two tempory external programs to drive
|
15
|
+
prog_a = Tempfile.new('prog_a_')
|
16
|
+
prog_a.write <<-code
|
17
|
+
puts $0
|
18
|
+
puts 42
|
19
|
+
code
|
20
|
+
prog_a.close
|
21
|
+
prog_a = prog_a.path
|
22
|
+
|
23
|
+
prog_b = Tempfile.new('prog_b_')
|
24
|
+
prog_b.write <<-code
|
25
|
+
puts $0
|
26
|
+
puts 'forty-two'
|
27
|
+
code
|
28
|
+
prog_b.close
|
29
|
+
prog_b = prog_b.path
|
30
|
+
|
31
|
+
|
32
|
+
# set up logging
|
33
|
+
logger = Logger.new STDOUT
|
34
|
+
|
35
|
+
|
36
|
+
# run both programs redirect the stdout into the log
|
37
|
+
logger.info{ 'running program a' }
|
38
|
+
logger << DIV
|
39
|
+
bash.execute "ruby #{ prog_a}", :stdout => logger, :stderr => STDERR
|
40
|
+
logger << DIV
|
41
|
+
|
42
|
+
logger.info{ 'running program b' }
|
43
|
+
logger << DIV
|
44
|
+
bash.execute "ruby #{ prog_b}", :stdout => logger, :stderr => STDERR
|
45
|
+
logger << DIV
|
46
|
+
|
47
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'tempfile'
|
3
|
+
require 'readline'
|
4
|
+
include Readline
|
5
|
+
|
6
|
+
$:.unshift '.', '..', 'lib', File.join('..','lib')
|
7
|
+
require 'session'
|
8
|
+
|
9
|
+
idl = Session::IDL.new
|
10
|
+
|
11
|
+
n = 0
|
12
|
+
loop do
|
13
|
+
command = readline("#{ n }: IDL_WRAP > ", true)
|
14
|
+
if command =~ /^\s*\!*history\!*\s*$/
|
15
|
+
open('idl_wrap.history','w'){|f| f.puts idl.history}
|
16
|
+
next
|
17
|
+
end
|
18
|
+
exit if command =~ /^\s*exit\s*$/io
|
19
|
+
|
20
|
+
out, err = idl.execute command
|
21
|
+
out ||= ''
|
22
|
+
err ||= ''
|
23
|
+
printf "STDOUT:\n%s\nSTDERR:\n%s\n", out.gsub(%r/^/,"\t"), err.gsub(%r/^/,"\t")
|
24
|
+
n += 1
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'tempfile'
|
3
|
+
require 'readline'
|
4
|
+
include Readline
|
5
|
+
|
6
|
+
$:.unshift '.', '..', 'lib', File.join('..','lib')
|
7
|
+
require 'session'
|
8
|
+
|
9
|
+
shell = Session::Shell.new
|
10
|
+
|
11
|
+
require 'tempfile'
|
12
|
+
require 'readline'
|
13
|
+
include Readline
|
14
|
+
|
15
|
+
n = 0
|
16
|
+
loop do
|
17
|
+
command = readline("#{ n }: SHELL > ", true)
|
18
|
+
if command =~ /^\s*\!*history\!*\s*$/
|
19
|
+
open('shell.history','w'){|f| f.puts shell.history}
|
20
|
+
next
|
21
|
+
end
|
22
|
+
exit if command =~ /^\s*(?:exit|quit)\s*$/io
|
23
|
+
|
24
|
+
out, err = shell.execute command
|
25
|
+
out ||= ''
|
26
|
+
err ||= ''
|
27
|
+
printf "STDOUT:\n%s\nSTDERR:\n%s\n", out.gsub(%r/^/,"\t"), err.gsub(%r/^/,"\t")
|
28
|
+
n += 1
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
$:.unshift '.', '..', 'lib', File.join('..','lib')
|
5
|
+
require 'session'
|
6
|
+
|
7
|
+
shell = Session::Shell.new :history => false
|
8
|
+
|
9
|
+
shell.execute('ls -ltar') do |out, err|
|
10
|
+
if out
|
11
|
+
puts "OUT:\n#{ out }"
|
12
|
+
elsif err
|
13
|
+
puts "ERR:\n#{ err }"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
puts shell.history
|
17
|
+
|
18
|
+
shell.outproc = lambda{|out| puts "OUT:\n#{ out }"}
|
19
|
+
shell.errproc = lambda{|err| puts "ERR:\n#{ err }"}
|
20
|
+
#shell.execute('ls -1')
|
21
|
+
#shell.execute('ls no-exit')
|
22
|
+
shell.execute('while test 1; do echo `date` && ls no-exist; sleep 1; done')
|
23
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift '.', '..', 'lib', File.join('..','lib')
|
3
|
+
require 'session'
|
4
|
+
|
5
|
+
sh = Session::new
|
6
|
+
|
7
|
+
stdout, stderr = sh.execute('cat', :stdin => open('/etc/passwd'))
|
8
|
+
|
9
|
+
stdout.each{|line| print line}
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
stdin, stdout, stderr = "42\n", '', ''
|
14
|
+
|
15
|
+
sh.execute('cat', 0 => stdin, 1 => stdout, 2 => stderr)
|
16
|
+
|
17
|
+
stdout.each{|line| print line}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# usage:
|
2
|
+
# ruby -I lib -r session test/threadtest.rb
|
3
|
+
# SESSION_USE_SPAWN=1 ruby -I lib -r session test/threadtest.rb
|
4
|
+
|
5
|
+
%w(lib ../lib . ..).each{|d| $:.unshift d}
|
6
|
+
require 'session'
|
7
|
+
|
8
|
+
def display obj
|
9
|
+
Thread.critical = true
|
10
|
+
STDOUT.print obj
|
11
|
+
STDOUT.flush
|
12
|
+
ensure
|
13
|
+
Thread.critical = false
|
14
|
+
end
|
15
|
+
|
16
|
+
$VERBOSE=nil
|
17
|
+
STDOUT.sync = true
|
18
|
+
STDERR.sync = true
|
19
|
+
STDOUT.puts "Session::VERSION <#{ Session::VERSION }>"
|
20
|
+
STDOUT.puts "Session.use_spawn <#{ Session.use_spawn ? 'true' : 'false' }>"
|
21
|
+
STDOUT.puts "the timestamps of each tid should come back about 1 second apart or there are problems..."
|
22
|
+
STDOUT.puts
|
23
|
+
|
24
|
+
|
25
|
+
threads = []
|
26
|
+
|
27
|
+
3.times do |i|
|
28
|
+
threads <<
|
29
|
+
Thread::new(i) do |i|
|
30
|
+
cmd = 'echo 42; sleep 1;' * 3
|
31
|
+
sh = Session.new #:use_spawn=>true
|
32
|
+
sh.execute(cmd) do |o,e|
|
33
|
+
which = o ? 'stdout' : 'stderr'
|
34
|
+
line = (o || e).strip
|
35
|
+
indent = '| ' * i
|
36
|
+
display "#{ indent }tid<#{ i }> #{ which }<#{ line }> time<#{ Time.now.to_f }>\n"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
sleep rand
|
40
|
+
end
|
41
|
+
|
42
|
+
threads.map{|t| t.join}
|
Binary file
|
@@ -0,0 +1,227 @@
|
|
1
|
+
|
2
|
+
%w(lib ../lib . ..).each{|d| $:.unshift d}
|
3
|
+
require 'session'
|
4
|
+
|
5
|
+
$VERBOSE=nil
|
6
|
+
STDOUT.sync = true
|
7
|
+
STDERR.sync = true
|
8
|
+
STDOUT.puts "Session::VERSION <#{ Session::VERSION }>"
|
9
|
+
STDOUT.puts "Session.use_spawn <#{ Session.use_spawn ? 'true' : 'false' }>"
|
10
|
+
STDOUT.puts "Session.use_open3 <#{ Session.use_open3 ? 'true' : 'false' }>"
|
11
|
+
Session::debug = true
|
12
|
+
|
13
|
+
#
|
14
|
+
# a timeout method which does not stop all threads!
|
15
|
+
# for testing only!
|
16
|
+
#
|
17
|
+
class TimeoutError < StandardError; end
|
18
|
+
def timeout n
|
19
|
+
#{{{
|
20
|
+
ret = nil
|
21
|
+
cid = fork
|
22
|
+
unless cid
|
23
|
+
trap('SIGQUIT'){ exit! }
|
24
|
+
sleep n
|
25
|
+
begin; Process.kill 'SIGUSR1', Process.ppid; rescue Errno::Exception; end
|
26
|
+
exit!
|
27
|
+
else
|
28
|
+
begin
|
29
|
+
handler = trap('SIGUSR1'){throw :timeout, TimeoutError.new}
|
30
|
+
thrown = catch(:timeout){ ret = yield }
|
31
|
+
if TimeoutError === thrown
|
32
|
+
display
|
33
|
+
STDIN.gets
|
34
|
+
raise thrown
|
35
|
+
end
|
36
|
+
ensure
|
37
|
+
begin; Process.kill 'SIGQUIT', cid; rescue Exception; end
|
38
|
+
begin; Process.wait; rescue Exception => e; end
|
39
|
+
trap 'SIGUSR1', handler if defined? handler
|
40
|
+
end
|
41
|
+
end
|
42
|
+
ret
|
43
|
+
#}}}
|
44
|
+
end
|
45
|
+
def display
|
46
|
+
#{{{
|
47
|
+
puts "$session_command < #{ $session_command.inspect }> "
|
48
|
+
puts "$session_iodat < #{ $session_iodat.inspect }> "
|
49
|
+
puts "$session_selecting < #{ $session_selecting.inspect }> "
|
50
|
+
# puts "$session_buffer < #{ $session_buffer.inspect }> "
|
51
|
+
# puts "$session_err < #{ $session_err.inspect }> "
|
52
|
+
# puts "$session_out < #{ $session_out.inspect }> "
|
53
|
+
# puts "$session_iodat_name < #{ $session_iodat_name.inspect }> "
|
54
|
+
# puts "$session_reading < #{ $session_reading.inspect }> "
|
55
|
+
# puts "$session_buf < #{ $session_buf.inspect }> "
|
56
|
+
# puts "$session_lines < #{ $session_lines.inspect }> "
|
57
|
+
# puts "$session_line < #{ $session_line.inspect }> "
|
58
|
+
# puts "$session_getting_status < #{ $session_getting_status.inspect }> "
|
59
|
+
self
|
60
|
+
#}}}
|
61
|
+
end
|
62
|
+
|
63
|
+
system "which idl > /dev/null 2>&1"
|
64
|
+
HAVE_IDL = ($?.exitstatus == 0 ? true : false)
|
65
|
+
|
66
|
+
require "test/unit"
|
67
|
+
module Session
|
68
|
+
class Test < Test::Unit::TestCase
|
69
|
+
def test_0
|
70
|
+
#{{{
|
71
|
+
sh = nil
|
72
|
+
assert_nothing_raised { sh = Shell.new }
|
73
|
+
#}}}
|
74
|
+
end
|
75
|
+
def test_1
|
76
|
+
#{{{
|
77
|
+
assert_nothing_raised {
|
78
|
+
timeout(16) {
|
79
|
+
sh = nil
|
80
|
+
assert_nothing_raised { sh = Shell.new }
|
81
|
+
sh.execute 'ls'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
#}}}
|
85
|
+
end
|
86
|
+
def test_3
|
87
|
+
#{{{
|
88
|
+
assert_nothing_raised {
|
89
|
+
timeout(64) {
|
90
|
+
sh = nil
|
91
|
+
assert_nothing_raised { sh = Shell.new }
|
92
|
+
128.times { sh.execute 'echo 42' }
|
93
|
+
}
|
94
|
+
}
|
95
|
+
#}}}
|
96
|
+
end
|
97
|
+
def test_4
|
98
|
+
#{{{
|
99
|
+
cmds = ['ls', 'echo 42', 'printf "foobar"', 'printf "foobar\n"']
|
100
|
+
assert_nothing_raised {
|
101
|
+
timeout(64) {
|
102
|
+
sh = nil
|
103
|
+
assert_nothing_raised { sh = Shell.new }
|
104
|
+
128.times { cmds.each{|cmd| sh.execute cmd;sh.execute "#{cmd} 1>&2"} }
|
105
|
+
}
|
106
|
+
}
|
107
|
+
#}}}
|
108
|
+
end
|
109
|
+
def test_5
|
110
|
+
#{{{
|
111
|
+
assert_nothing_raised {
|
112
|
+
timeout(16) {
|
113
|
+
sh = nil
|
114
|
+
assert_nothing_raised { sh = Shell.new }
|
115
|
+
out, err = sh.execute 'echo 42'
|
116
|
+
assert_equal '42', out.strip
|
117
|
+
out, err = sh.execute 'echo "forty-two" 1>&2'
|
118
|
+
assert_equal 'forty-two', err.strip
|
119
|
+
}
|
120
|
+
}
|
121
|
+
#}}}
|
122
|
+
end
|
123
|
+
def test_6
|
124
|
+
#{{{
|
125
|
+
out = ''
|
126
|
+
err = ''
|
127
|
+
assert_nothing_raised {
|
128
|
+
timeout(16) {
|
129
|
+
sh = nil
|
130
|
+
assert_nothing_raised { sh = Shell.new }
|
131
|
+
sh.execute 'echo 42', :stdout => out, :stderr => err
|
132
|
+
assert_equal '42', out.strip
|
133
|
+
sh.execute 'echo "forty-two" 1>&2', :stdout => out, :stderr => err
|
134
|
+
assert_equal 'forty-two', err.strip
|
135
|
+
}
|
136
|
+
}
|
137
|
+
#}}}
|
138
|
+
end
|
139
|
+
def test_7
|
140
|
+
#{{{
|
141
|
+
#$DEBUG = true
|
142
|
+
assert_nothing_raised {
|
143
|
+
timeout(16) {
|
144
|
+
sh = nil
|
145
|
+
assert_nothing_raised { sh = Shell.new }
|
146
|
+
sh.execute('echo 42') do |out, err|
|
147
|
+
if out
|
148
|
+
assert_equal '42', out.strip
|
149
|
+
end
|
150
|
+
end
|
151
|
+
sh.execute('echo "forty-two" 1>&2') do |out, err|
|
152
|
+
if err
|
153
|
+
assert_equal 'forty-two', err.strip
|
154
|
+
end
|
155
|
+
end
|
156
|
+
}
|
157
|
+
}
|
158
|
+
#ensure
|
159
|
+
#$DEBUG = true
|
160
|
+
#}}}
|
161
|
+
end
|
162
|
+
if HAVE_IDL
|
163
|
+
def test_8
|
164
|
+
#{{{
|
165
|
+
assert_nothing_raised {
|
166
|
+
timeout(16) {
|
167
|
+
idl = nil
|
168
|
+
assert_nothing_raised { idl = IDL.new }
|
169
|
+
|
170
|
+
out = ''; err = ''
|
171
|
+
idl.execute 'printf, -1, 42', :stdout => out, :stderr => err
|
172
|
+
assert_equal '42', out.strip
|
173
|
+
|
174
|
+
out = ''; err = ''
|
175
|
+
idl.execute 'printf, -2, \'forty-two\'', :stdout => out, :stderr => err
|
176
|
+
assert_equal 'forty-two', err.strip
|
177
|
+
|
178
|
+
out = ''; err = ''
|
179
|
+
idl.execute 'foo', :stdout => out, :stderr => err
|
180
|
+
assert_match %r/undefined procedure/io, err
|
181
|
+
}
|
182
|
+
}
|
183
|
+
#}}}
|
184
|
+
end
|
185
|
+
end
|
186
|
+
def test_9
|
187
|
+
#{{{
|
188
|
+
assert_nothing_raised {
|
189
|
+
timeout(16) {
|
190
|
+
lines = []
|
191
|
+
Thread.new {
|
192
|
+
sh = nil
|
193
|
+
assert_nothing_raised { sh = Shell.new }
|
194
|
+
sh.debug = true
|
195
|
+
#cmd = 'date; sleep 1;' * 3
|
196
|
+
cmd = 'ruby -e "puts 42; sleep 0.1"' * 3
|
197
|
+
sh.execute(cmd) do |o,e|
|
198
|
+
line = o || e
|
199
|
+
lines << [Time.now.to_f, line]
|
200
|
+
end
|
201
|
+
}.join
|
202
|
+
|
203
|
+
i = 0
|
204
|
+
while((a = lines[i]) and (b = lines[i + 1]))
|
205
|
+
ta = a.first
|
206
|
+
tb = b.first
|
207
|
+
# they all come back at once if thread hung sending cmd...
|
208
|
+
# make sure we got output about a second apart...
|
209
|
+
begin
|
210
|
+
assert( (tb - ta) >= 0.1 )
|
211
|
+
rescue Exception
|
212
|
+
STDERR.puts "lines : <#{ lines.inspect}>"
|
213
|
+
STDERR.puts "i : <#{ i }>"
|
214
|
+
STDERR.puts "b : <#{ b.inspect }>"
|
215
|
+
STDERR.puts "a : <#{ a.inspect }>"
|
216
|
+
STDERR.puts "tb : <#{ tb }>"
|
217
|
+
STDERR.puts "ta : <#{ ta }>"
|
218
|
+
raise
|
219
|
+
end
|
220
|
+
i += 1
|
221
|
+
end
|
222
|
+
}
|
223
|
+
}
|
224
|
+
#}}}
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|