Sha256: a1c1314965d27ee41d7d2f15d7796507b78f845d17a3d832457c33eb912bccf6
Contents?: true
Size: 1.38 KB
Versions: 7
Compression:
Stored size: 1.38 KB
Contents
= Expectr Expectr is an API to the functionality of Expect (see http://expect.nist.gov/) implemented in ruby. == Using Expectr Effort is taken to make implementation as simple as possible. === Automation Implementation of task automation should be relatively straightforward. A lightweight application might look similar to the following: # myapp.rb require 'expectr' exp = Expectr.new( '/bin/bash', flush_buffer: false ) exp.send( "ls\n" ) match = exp.expect( %r{bash} ) # => MatchData match = exp.expect( "this shouldn't match anything" ) # raises Timeout::Error === Interaction It is possible to allow a user to interact directly with an Expectr object as with the Expect functionality in TCL # logmein.rb require 'expectr' ssh = { host: 'example.com', user: 'example', pass: 'password' } exp = Expectr.new( "ssh #{ssh[:user]}@#{ssh[:host]}" ) exp.expect( %r{#{ssh[:user]}@#{ssh[:host]}'s password:} ) ssh.send( ssh[:pass] + "\n" ) ssh.interact! == Contributions Effort is made to keep external requirements to a minimum. As such, presently there are no external requirements for development. If you want to contribute, please: * Fork the project. * Make a branch for your contribution if it's more than a simple fix. * Add tests for new functionality. * Send me a pull request on Github == Copyright Copyright (c) 2012 Chris Wuest. See LICENSE for details.
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
expectr-1.1.1 | README.rdoc |
expectr-1.1.0 | README.rdoc |
expectr-1.0.3 | README.rdoc |
expectr-1.0.2 | README.rdoc |
expectr-1.0.1 | README.rdoc |
expectr-1.0.0 | README.rdoc |
expectr-0.9.1 | README.rdoc |