expectr 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,13 +1,2 @@
1
- source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
-
6
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
8
- group :development do
9
- gem "bundler", ">= 1.0.0"
10
- gem "shoulda", ">= 0"
11
- gem "rdoc", "~> 3.12"
12
- gem "jeweler", "~> 1.8.3"
13
- end
1
+ source :rubygems
2
+ gemspec
File without changes
data/README.rdoc CHANGED
@@ -1,19 +1,51 @@
1
- = expectr
1
+ = Expectr
2
2
 
3
- Expect (see http://expect.nist.gov/) implementation in Ruby. This version differs from the included Expect module by providing a more granular method of managing process, output, and implementing Expect's "interact" command.
3
+ Expectr is an API to the functionality of Expect (see http://expect.nist.gov/)
4
+ implemented in ruby.
4
5
 
5
- == Contributing to expectr
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
6
+ == Using Expectr
14
7
 
15
- == Copyright
8
+ Effort is taken to make implementation as simple as possible.
9
+
10
+ === Automation
11
+
12
+ Implementation of task automation should be relatively straightforward. A
13
+ lightweight application might look similar to the following:
14
+
15
+ # myapp.rb
16
+ require 'expectr'
17
+
18
+ exp = Expectr.new( '/bin/bash', flush_buffer: false )
19
+ exp.send( "ls\n" )
20
+ match = exp.expect( %r{bash} ) # => MatchData
21
+ match = exp.expect( "this shouldn't match anything" ) # raises Timeout::Error
22
+
23
+ === Interaction
24
+
25
+ It is possible to allow a user to interact directly with an Expectr object
26
+ as with the Expect functionality in TCL
16
27
 
17
- Copyright (c) 2012 Chris Wuest. See LICENSE.txt for
18
- further details.
28
+ # logmein.rb
29
+ require 'expectr'
30
+
31
+ ssh = { host: 'example.com', user: 'example', pass: 'password' }
32
+ exp = Expectr.new( "ssh #{ssh[:user]}@#{ssh[:host]}" )
33
+ exp.expect( %r{#{ssh[:user]}@#{ssh[:host]}'s password:} )
34
+ ssh.send( ssh[:pass] + "\n" )
35
+
36
+ ssh.interact!
37
+
38
+ == Contributions
39
+
40
+ Effort is made to keep external requirements to a minimum. As such, presently
41
+ there are no external requirements for development. If you want to
42
+ contribute, please:
43
+
44
+ * Fork the project.
45
+ * Make a branch for your contribution if it's more than a simple fix.
46
+ * Add tests for new functionality.
47
+ * Send me a pull request on Github
48
+
49
+ == Copyright
19
50
 
51
+ Copyright (c) 2012 Chris Wuest. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,45 +1,18 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- gem.name = "expectr"
17
- gem.homepage = "http://github.com/cwuest/expectr"
18
- gem.license = "MIT"
19
- gem.summary = %Q{Expect for Ruby}
20
- gem.description = %Q{Implementation of functionality from NIST Expect in Ruby, with an emphasis on control and extensibility}
21
- gem.email = "chris@chriswuest.com"
22
- gem.authors = ["Chris Wuest"]
23
- # dependencies defined in Gemfile
24
- end
25
- Jeweler::RubygemsDotOrgTasks.new
26
-
27
1
  require 'rake/testtask'
28
- Rake::TestTask.new(:test) do |test|
29
- test.libs << 'lib' << 'test'
30
- test.test_files = Dir.glob('test/**/test_*.rb')
31
- #test.pattern = 'test/**/test_*.rb'
32
- test.verbose = true
33
- end
2
+ require 'rdoc/task'
34
3
 
35
- task :default => :test
4
+ task default: :test
36
5
 
37
- require 'rdoc/task'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs.unshift File.expand_path('../test', __FILE__)
8
+ t.test_files = Dir.glob('test/**/test_*.rb')
9
+ t.ruby_opts = ['-rubygems'] if defined? Gem
10
+ t.ruby_opts << '-I./lib'
11
+ end
40
12
 
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "expectr #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
13
+ RDoc::Task.new(:doc) do |rdoc|
14
+ rdoc.rdoc_dir = 'doc'
15
+ rdoc.main = 'README.rdoc'
16
+ rdoc.rdoc_files.include('README.rdoc', 'lib/*.rb')
17
+ rdoc.options = %w[--inline-source --line-numbers --title Expectr --encoding=UTF-8 --main README.rdoc]
45
18
  end
data/expectr.gemspec CHANGED
@@ -1,58 +1,18 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
+ require 'expectr/version'
5
3
 
6
4
  Gem::Specification.new do |s|
7
5
  s.name = "expectr"
8
- s.version = "0.9.0"
6
+ s.version = Expectr::VERSION
9
7
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.description = "Expectr is an interface to the functionality of Expect in Ruby"
9
+ s.summary = "Expect for Ruby"
11
10
  s.authors = ["Chris Wuest"]
12
- s.date = "2012-06-11"
13
- s.description = "Implementation of functionality from NIST Expect in Ruby, with an emphasis on control and extensibility"
14
11
  s.email = "chris@chriswuest.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "LICENSE.txt",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "expectr.gemspec",
27
- "lib/expectr.rb",
28
- "test/helper.rb",
29
- "test/test_expectr.rb"
30
- ]
31
12
  s.homepage = "http://github.com/cwuest/expectr"
32
- s.licenses = ["MIT"]
33
- s.require_paths = ["lib"]
34
- s.rubygems_version = "1.8.24"
35
- s.summary = "Expect for Ruby"
36
13
 
37
- if s.respond_to? :specification_version then
38
- s.specification_version = 3
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = s.files.select { |f| f =~ /^test\/test_/ }
39
16
 
40
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
- s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
42
- s.add_development_dependency(%q<shoulda>, [">= 0"])
43
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
44
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
45
- else
46
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
47
- s.add_dependency(%q<shoulda>, [">= 0"])
48
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
49
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
50
- end
51
- else
52
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
53
- s.add_dependency(%q<shoulda>, [">= 0"])
54
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
56
- end
17
+ s.license = 'MIT'
57
18
  end
58
-
@@ -0,0 +1,3 @@
1
+ class Expectr
2
+ VERSION = '0.9.1'
3
+ end
data/lib/expectr.rb CHANGED
@@ -213,6 +213,7 @@ class Expectr
213
213
  `stty #{old_tty}`
214
214
  return nil
215
215
  end
216
+ alias :interact! :interact
216
217
 
217
218
  #
218
219
  # Send +str+ to application
data/test/helper.rb CHANGED
@@ -1,18 +1,4 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
1
  require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
2
  require 'expectr'
16
3
 
17
- class Test::Unit::TestCase
18
- end
4
+ $LOAD_PATH.unshift File.dirname(__FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expectr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,89 +9,21 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-11 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 1.0.0
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 1.0.0
30
- - !ruby/object:Gem::Dependency
31
- name: shoulda
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rdoc
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: '3.12'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '3.12'
62
- - !ruby/object:Gem::Dependency
63
- name: jeweler
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: 1.8.3
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 1.8.3
78
- description: Implementation of functionality from NIST Expect in Ruby, with an emphasis
79
- on control and extensibility
12
+ date: 2012-09-19 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Expectr is an interface to the functionality of Expect in Ruby
80
15
  email: chris@chriswuest.com
81
16
  executables: []
82
17
  extensions: []
83
- extra_rdoc_files:
84
- - LICENSE.txt
85
- - README.rdoc
18
+ extra_rdoc_files: []
86
19
  files:
87
- - .document
88
20
  - Gemfile
89
- - LICENSE.txt
21
+ - LICENSE
90
22
  - README.rdoc
91
23
  - Rakefile
92
- - VERSION
93
24
  - expectr.gemspec
94
25
  - lib/expectr.rb
26
+ - lib/expectr/version.rb
95
27
  - test/helper.rb
96
28
  - test/test_expectr.rb
97
29
  homepage: http://github.com/cwuest/expectr
@@ -107,9 +39,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
39
  - - ! '>='
108
40
  - !ruby/object:Gem::Version
109
41
  version: '0'
110
- segments:
111
- - 0
112
- hash: 3612453504837545327
113
42
  required_rubygems_version: !ruby/object:Gem::Requirement
114
43
  none: false
115
44
  requirements:
@@ -122,4 +51,5 @@ rubygems_version: 1.8.24
122
51
  signing_key:
123
52
  specification_version: 3
124
53
  summary: Expect for Ruby
125
- test_files: []
54
+ test_files:
55
+ - test/test_expectr.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.9.0