te3270 0.5.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c6e3023273a696bd8616ffc285ec762d8760eb18
4
+ data.tar.gz: 647e9c9e1aea2d1ba2652bffe011f7e10bc595d3
5
+ SHA512:
6
+ metadata.gz: de5d2a54d2d0b64f4687d2dc8ea9657ab3b4ced7f7c697e8c1dd191f6a089fc18d7bc389869465d44137abc3d825b5dce04efb5cd4bd653a254dc878a86d94c3
7
+ data.tar.gz: 2a3915ede79f090e8212f5d144dc49fcaa39d5b9655132651a6aca8c9576da9310808afa11db1f53ef16ae5d585efb3798bb937483268556e536224a9592df3e
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
@@ -0,0 +1,26 @@
1
+ === Version 0.5.1 / 2015/4/19
2
+ * Fixes
3
+ * Created release that will install on Windows platform
4
+
5
+ === Version 0.5.0 / 2015-4-14
6
+ * Enhancements
7
+ * Added X3270 emulator support
8
+
9
+ === Version 0.4.1 / 2014-2-26
10
+ * Fixes
11
+ * Fixed small issue with ordering of events in last release
12
+
13
+ === Version 0.4 / 2014-2-26
14
+ * Enhancements
15
+ * calling super when factory method called with class that is not from TE3270
16
+
17
+ === Version 0.3 / 2014-2-25
18
+ * Enhancements
19
+ * disconnect does not close all open sessions with Extra now - only the one that connect opened
20
+
21
+ === Version 0.2 / 2014-2-9
22
+ * Enhancements
23
+ * Added populate_screen_with method to TE3270 to populate all fields that are included in provided Hash
24
+
25
+ === Version 0.1 / 2014-2-7
26
+ * Initial release with basic functionality for EXTRA X-treme! and Quick3270
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ require 'rbconfig'
4
+
5
+ gem 'rake'
6
+ gem 'fuubar'
7
+ gem 'guard-rspec'
8
+ gem 'wdm', '>= 0.1.0'
9
+ gem 'rb-inotify'
10
+
11
+ gemspec
@@ -0,0 +1,7 @@
1
+
2
+ guard :rspec, :all_on_start => true, :cmd => 'rspec --color --format Fuubar' do
3
+ watch(%r{^spec/*/.+_spec\.rb$})
4
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
7
+
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jeffrey S. Morgan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,110 @@
1
+ # TE3270
2
+
3
+ This gem can be used to drive a 3270 terminal emulator. You have to have a supported emulator installed on the
4
+ machines on which you use the gem. Currently the supported emulators are
5
+ [EXTRA! X-treme](http://www.attachmate.com/Products/Terminal+Emulation/Extra/xtreme/extra-x-treme.htm) by
6
+ Attachmate, [Quick3270](http://www.dn-computing.com/Quick3270.htm) by DN-Computing,
7
+ and [X3270](http://x3270.bgp.nu/).
8
+ The first two are commercial products and need to be purchased.
9
+ X3270 is open source. Support for other
10
+ emulators will be added as time permits.
11
+
12
+ ## Documentation
13
+
14
+ You can view the RDocs for this project [here](http://rdoc.info/gems/te3270/frames).
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ gem 'te3270'
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install te3270
29
+
30
+ ## Usage
31
+
32
+ You can create classes that are similar to page-object classes. In these classes you can define
33
+ the various fields that you wish to interact with on the screen.
34
+
35
+ class MainframeScreen
36
+ include TE3270
37
+
38
+ text_field(:userid, 10, 30, 20)
39
+ text_field(:password, 12, 30, 20)
40
+
41
+ def login(username, password)
42
+ self.userid = username
43
+ self.password = password
44
+ end
45
+ end
46
+
47
+ emulator = TE3270.emulator_for :extra do |platform|
48
+ platform.session_file = 'sessionfile.edp'
49
+ end
50
+ my_screen = MainframeScreen.new(emulator)
51
+ my_screen.userid = 'the_id'
52
+ my_screen.password = 'the_password'
53
+
54
+ If you are using this gem with cucumber then you can register the ScreenFactory module with the
55
+ cucumber World like this:
56
+
57
+ World(TE3270::ScreenFactory)
58
+
59
+ You also need to setup some hooks to start and stop the emulator:
60
+
61
+ Before do
62
+ @emulator = TE3270.emulator_for :extra do |platform|
63
+ platform.session_file = 'sessionfile.edp'
64
+ end
65
+ end
66
+
67
+ After do
68
+ TE3270.disconnect(@emulator)
69
+ end
70
+
71
+ The X3270 emulator supports these hooks:
72
+
73
+ Before do
74
+ @emulator = TE3270.emulator_for :x3270 do |platform|
75
+ platform.executable_command = 'path to the x3270 executable'
76
+ platform.host = 'name of host to connect to'
77
+ platform.max_wait_time = 42 # defaults to 10
78
+ platform.trace = true # turns on trace output from the emulator
79
+ end
80
+ end
81
+
82
+ This allows you to use the `on` method in your step definitions like this:
83
+
84
+ on(MainframeScreen).login('the_user', 'the_password')
85
+
86
+ or you can use the version of `on` that takes a block like this:
87
+
88
+ on(MainframeScreen) do |screen|
89
+ screen.userid = 'the_id'
90
+ screen.password = 'the_password'
91
+ end
92
+
93
+ There is also a way to pass in a `Hash` and have it populate an entire screen. Just simply
94
+ ensure the key for an entry in the `Hash` matches the name you gave a text field and it will
95
+ find and set the value. This allows the gem to easily work with the DataMagic gem.
96
+
97
+ # given this Hash
98
+ my_data = { userid: 'the_id', password: 'the_password' }
99
+
100
+ # you can simply call this method
101
+ on(MainframeScreen).populate_screen_with my_data
102
+
103
+
104
+ ## Contributing
105
+
106
+ 1. Fork it
107
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
108
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
109
+ 4. Push to the branch (`git push origin my-new-feature`)
110
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,17 @@
1
+ require 'rubygems/dependency_installer.rb'
2
+
3
+ installer = Gem::DependencyInstaller.new
4
+ begin
5
+ if RUBY_PLATFORM == 'java'
6
+ installer.install "jruby-win32ole"
7
+ else
8
+ installer.install "win32screenshot"
9
+ end
10
+
11
+ rescue
12
+ exit(1)
13
+ end
14
+
15
+ f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
16
+ f.write("task :default\n")
17
+ f.close
@@ -0,0 +1,166 @@
1
+ require 'te3270/version'
2
+ require 'te3270/accessors'
3
+ require 'te3270/screen_factory'
4
+ require 'te3270/screen_populator'
5
+ require 'te3270/function_keys'
6
+ require 'te3270/emulator_factory'
7
+
8
+ #
9
+ # This gem can be used to drive a 3270 terminal emulator. You have to have a supported emulator installed on the
10
+ # machines on which you use the gem. Currently the only supported emulators are EXTRA! X-treme by Attachmate and
11
+ # Quick3270 by DN-Computing. These are commercial products and you will need to purchase one of them in order to
12
+ # use this gem. We do plan to support other emulators as time permits.
13
+ #
14
+ # This gem has been designed to work very similar to the page-object gem. You will use it to create screen objects
15
+ # for each screen in your application. Here is an example of one and how it can be used:
16
+ #
17
+ # @example Example mainframe page
18
+ # class MainframeScreen
19
+ # include TE3270
20
+ #
21
+ # text_field(:userid, 10, 30, 20, true)
22
+ # text_field(:password, 12, 30, 20, true)
23
+ # end
24
+ #
25
+ # ...
26
+ #
27
+ # emulator = TN3270.emulator_for :extra do |emulator|
28
+ # emulator.session_file = 'path_to_session_file'
29
+ # end
30
+ # my_screen = MainframeScreen.new(emulator)
31
+ # my_screen.userid = 'the_id'
32
+ # my_screen.password = 'the_password'
33
+ #
34
+ # Another option is to mixin the +TE3270::ScreenFactory+ module on use the factory methods to create the screen
35
+ # objects. If you are using Cucumber you can do this by calling the +World+ method in your env.rb file. Then
36
+ # you can use the factory and navigation methods in your step definitions.
37
+ #
38
+ # @example Registering the ScreenFactory with Cucumber World
39
+ # World(TE3270::ScreenFactory)
40
+ #
41
+ # Before do
42
+ # @emulator = TE3270.emulator_for :quick3270 do |emulator|
43
+ # emulator.session_file = 'path_to_session_file'
44
+ # end
45
+ # end
46
+ #
47
+ #
48
+ # @example Using the factory method in a step definition
49
+ # on(MainframeScreen).do_something
50
+ #
51
+ #
52
+ # @see #TE3270::ScreenFactory for more details on using the factory and navigation methods
53
+ #
54
+ module TE3270
55
+ include ScreenPopulator
56
+ extend FunctionKeys
57
+
58
+ def self.included(cls)
59
+ cls.extend TE3270::Accessors
60
+ end
61
+
62
+ #
63
+ # Starts the terminal emulator and makes the connection. This method requires a block
64
+ # that has emulator specific information that is necessary to complete the connection.
65
+ # To know what information you should provide in the block please see the classes in
66
+ # the TE3270::Emulators package.
67
+ #
68
+ #@param platform =[:extra,:quick3270] use :extra for Extra emulator and :quick3270 for quick emulator
69
+ #
70
+ def self.emulator_for(platform, &block)
71
+ platform_class = TE3270::EmulatorFactory.emulator_for(platform)
72
+ @platform = platform_class.new
73
+ @platform.connect &block
74
+ @platform
75
+ end
76
+
77
+ #
78
+ # Disconnects and closes the emulator
79
+ #
80
+ def self.disconnect(emulator)
81
+ emulator.disconnect
82
+ end
83
+
84
+ def initialize(platform)
85
+ @platform = platform
86
+ initialize_screen if respond_to? :initialize_screen
87
+ end
88
+
89
+ #
90
+ # Open a new screen and connect to the host. Platform specific values are set by
91
+ # passing a block to this method. To see the valid platform specific values please
92
+ # read the documentation for your emulator class in the TE3270::Emulators module.
93
+ #
94
+ def connect
95
+ platform.connect
96
+ end
97
+
98
+ #
99
+ # Disconnect from platform (extra or quick)
100
+ #
101
+ def disconnect
102
+ platform.disconnect
103
+ end
104
+
105
+ #
106
+ # Send keys on the emulator
107
+ #
108
+ def send_keys(keys)
109
+ platform.send_keys(keys)
110
+ end
111
+
112
+ #
113
+ # Retrieves the text from the current screen
114
+ #
115
+ def text
116
+ platform.text
117
+ end
118
+
119
+ #
120
+ # Takes screenshot and saves to the filename specified. If you have visibility set to false
121
+ # then this method will first of all make the screen visible, take the screenshot, and then
122
+ # make set visibility to false again.
123
+ #
124
+ # @param [String] filename of the file to be saved.
125
+ #
126
+ def screenshot(filename)
127
+ platform.screenshot(filename)
128
+ end
129
+
130
+ #
131
+ # Waits for the string to appear at the specified location
132
+ #
133
+ # @param [String] String to wait for
134
+ # @param [FixedNum] row number
135
+ # @param [FixedNum] column number
136
+ #
137
+ def wait_for_string(str, row, column)
138
+ platform.wait_for_string(str, row, column)
139
+ end
140
+
141
+ #
142
+ # Waits for the host for specified # of seconds. Default is 5 seconds
143
+ #
144
+ # @param [FixedNum] seconds to wait for
145
+ #
146
+ def wait_for_host(seconds=5)
147
+ platform.wait_for_host(seconds)
148
+ end
149
+
150
+ #
151
+ # Waits for the cursor to appear at the specified location
152
+ #
153
+ # @param [FixedNum] row number
154
+ # @param [FixedNum] column number
155
+ #
156
+ def wait_until_cursor_at(row, column)
157
+ platform.wait_until_cursor_at(row, column)
158
+ end
159
+
160
+ private
161
+
162
+ def platform
163
+ @platform ||= Extra.new
164
+ end
165
+
166
+ end
@@ -0,0 +1,30 @@
1
+
2
+ module TE3270
3
+ module Accessors
4
+
5
+ #
6
+ # adds two methods to the screen object - one to set text in a text field,
7
+ # another to retrieve text from a text field.
8
+ #
9
+ # @example
10
+ # text_field(:first_name, 23,45,20)
11
+ # # will generate 'first_name', 'first_name=' method
12
+ #
13
+ # @param [String] the name used for the generated methods
14
+ # @param [FixedNum] row number of the location
15
+ # @param [FixedNum] column number of the location
16
+ # @param [FixedNum] length of the text field
17
+ # @param [true|false] editable is by default true
18
+ #
19
+ def text_field(name, row, column, length, editable=true)
20
+ define_method(name) do
21
+ platform.get_string(row, column, length)
22
+ end
23
+
24
+ define_method("#{name}=") do |value|
25
+ platform.put_string(value, row, column)
26
+ end if editable
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,23 @@
1
+ require 'te3270/emulators/extra'
2
+ require 'te3270/emulators/quick3270'
3
+ require 'te3270/emulators/x3270'
4
+
5
+ module TE3270
6
+ #
7
+ # Provides a mapping between a key used in the +emulator_for+ method
8
+ # and the class that implements the access to the emulator.
9
+ #
10
+ module EmulatorFactory
11
+
12
+ EMULATORS = {
13
+ extra: TE3270::Emulators::Extra,
14
+ quick3270: TE3270::Emulators::Quick3270,
15
+ x3270: TE3270::Emulators::X3270
16
+ }
17
+
18
+ def self.emulator_for(platform)
19
+ EMULATORS[platform]
20
+ end
21
+
22
+ end
23
+ end