butler-mainframe 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 707011c7063ddf39ff8cfa148f2b91ddaa8a555b
4
- data.tar.gz: 3b42e4a7fe6b12d18c746801b3f79bf714c9bd4b
3
+ metadata.gz: c4002cfeff0a68711d48ded02dabdcfb246dfd8f
4
+ data.tar.gz: d48bb6bd6986aa9b12cb2fe1695de8a73639ccbc
5
5
  SHA512:
6
- metadata.gz: 31fef2374924d2681e5b68c2e87cde56cc5aeb5038609b7c6bb107ad8bcc7224121d3e1bdbe0515ff71ab2f31af7df022d80b2ec2c97d352b4f376115e75e805
7
- data.tar.gz: 4fd2d8220c14bc1edcbca590757d3b9956dcb8de0ef317b54ad6ee18f5368c0d41e5ba150c76b2c320807e49c8cfd9fbcae0f8736c941dc48bf8b6def90efcfc
6
+ metadata.gz: efbafb8fc1ae9f9416294f4f2b8dfd9e863d49f2651d6b16771ed9bf593466a4688f673d888a679c298f4b3c0e62b8e28ab520be9d99f54b28a8f0db44cf3d0d
7
+ data.tar.gz: 5e4043550886c4bfc8540c8044da940f326e98fe3c3f7160f415d180bdca608c0fb80e12146f584f5f27cadd7e380b6598af7ea723ef9eb5cc43ccd98aa83ce3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
- 0.0.1 October 5th, 2015
1
+ 0.0.6 [☰](https://github.com/marcomd/butler-mainframe/compare/v0.0.5...v0.0.6) October 12th, 2015
2
2
  ------------------------------
3
- * First release
3
+ * Added a simple rake test
4
+ * Improved documentation
5
+ * Several little improvements
6
+
7
+ 0.0.5 October 7th, 2015
8
+ ------------------------------
9
+ * First working release
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  #gem "docile"
4
- gem "i18n"
4
+ # gem "i18n"
5
5
  gem "butler-mainframe", path: "."
data/README.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # Butler-mainframe
2
2
 
3
3
  [![Version ](http://img.shields.io/gem/v/butler-mainframe.svg) ](https://rubygems.org/gems/butler-mainframe)
4
- [![Travis CI ](http://img.shields.io/travis/marcomd/butler-mainframe/master.svg) ](https://travis-ci.org/marcomd/butler-mainframe)
5
4
  [![Quality ](http://img.shields.io/codeclimate/github/marcomd/butler-mainframe.svg)](https://codeclimate.com/github/marcomd/butler-mainframe)
6
5
 
7
6
  This gem provides a virtual butler which can perform your custom tasks on a 3270 emulator.
8
- You just have to choose your emulator and configure your task.
7
+ You just have to choose your emulator and configure your tasks.
9
8
 
10
9
  ## Compatibility
11
10
 
12
- At the moment it works only on windows plaftorms.
13
- Check on travis badge
11
+ Developed on a windows plaftorm.
14
12
 
15
13
 
16
14
  ## Install
@@ -47,7 +45,7 @@ now session is ready to use:
47
45
 
48
46
  host.scan_page
49
47
 
50
- should return you what you see on your terminal
48
+ should return what you see on your terminal
51
49
 
52
50
  ## Commands
53
51
 
@@ -105,6 +103,7 @@ My advice is to use navigate method for generic navigation and use a specific mo
105
103
 
106
104
  ## With Rails
107
105
 
106
+ __In development...__
108
107
  This module can be use on rails project.
109
108
  Add in your gemfile
110
109
 
@@ -120,13 +119,27 @@ run generator to copy configuration files
120
119
 
121
120
  ```ruby
122
121
  Class Invoice
123
- ... your code
122
+ # ... your code
124
123
 
125
124
  def host3270
126
- host = ButlerMainframe::Host.new
127
- host.navigate :my_starting_position
128
- host.write 'Hello world'
129
- host.close_session
125
+ @host = ButlerMainframe::Host.new
126
+ @host.navigate :my_starting_position
127
+
128
+ # Always check whether we are positioned on the screen that we expect
129
+ raise 'Screen not expected' unless self.my_function_start_screen?
130
+
131
+ # We develop the function.
132
+ # In this simple case we put a number in a map cics and press Enter
133
+ @host.write self.invoice_number
134
+ @host.do_enter
135
+
136
+ # to read the confirmation message
137
+ raise 'Message not expected' unless /SUCCESSFUL/ === self.catch_message
138
+
139
+ @host.close_session
140
+ rescue
141
+ host.screenshot :error
142
+ # Manage the invoice status etc.
130
143
  end
131
144
  end
132
145
  ```
@@ -137,6 +150,19 @@ rails generate screen hook_id:integer 'hook_type:string{30}' 'screen_type:intege
137
150
  In the model to be related to screen we insert:
138
151
  has_many :screens, :as => :hook, :dependent => :destroy
139
152
 
153
+
154
+ ## Test with rake
155
+
156
+ Simple embedded tests
157
+
158
+ bundle install
159
+ bundle exec rake butler:mainframe:test
160
+
161
+ For more informations:
162
+
163
+ bundle exec rake -T
164
+
165
+
140
166
  ## License
141
167
 
142
168
  The GNU Lesser General Public License, version 3.0 (LGPL-3.0)
@@ -1,38 +1,6 @@
1
1
  module ButlerMainframe
2
2
  module Base
3
3
  protected
4
- # def authorization_file
5
- # "app/models/ability.rb"
6
- # end
7
- # def authorization?
8
- # File.exists? authorization_file
9
- # end
10
- # def authentication_file auth_class="User"
11
- # "app/models/#{auth_class.downcase}.rb"
12
- # end
13
- # def authentication? auth_class="User"
14
- # return true if File.exists? authentication_file(auth_class)
15
- # File.exists? "config/initializers/devise.rb"
16
- # end
17
- # def activeadmin_file
18
- # "config/initializers/active_admin.rb"
19
- # end
20
- # def activeadmin?
21
- # File.exists? activeadmin_file
22
- # end
23
- # def auth_class
24
- # return unless options[:auth_class]
25
- # options[:auth_class].classify
26
- # end
27
- #def formtastic?
28
- # return false unless options.formtastic?
29
- # File.exists? "config/initializers/formtastic.rb"
30
- #end
31
- #def jquery_ui?
32
- # File.exists? "vendor/assets/javascripts/jquery-ui"
33
- #end
34
- #def pagination?
35
- # File.exists? "config/initializers/kaminari_config.rb"
36
- #end
4
+ # Generator's common methods
37
5
  end
38
6
  end
@@ -8,7 +8,7 @@ module Host3270
8
8
  # In the model to be related to screen we insert:
9
9
  # has_many :screens, :as => :hook, :dependent => :destroy
10
10
  module ActiveRecord
11
- # screen_type: error, alert, notice...
11
+ # screen_type: error, notice, warning...
12
12
  def screenshot screen_type, options={}
13
13
  options = {
14
14
  :message => nil,
@@ -16,7 +16,11 @@ module Host3270
16
16
  :rails_model => Screen
17
17
  }.merge(options)
18
18
  screen = options[:rails_model].new
19
- screen.screen_type = screen_type
19
+ screen.screen_type = case screen_type
20
+ when :notice then 1
21
+ when :warning then 2
22
+ else 0 #error
23
+ end
20
24
  screen.message = options[:message] || catch_message
21
25
  screen.video = options[:video] || scan(:y1 => 1, :x1 => 1, :y2 => 22, :x2 => 80)
22
26
  screen.cursor_y, screen.cursor_x = get_cursor_axes
@@ -50,7 +50,6 @@ module ButlerMainframe
50
50
  puts "Session not closed because it was already existing" if @debug
51
51
  end
52
52
  end
53
- @action = nil
54
53
  end
55
54
 
56
55
  # Sleep time between operations
@@ -31,6 +31,7 @@ module ButlerMainframe
31
31
  def sub_close_session
32
32
  @action.Sessions(@session).Close
33
33
  @action.Quit
34
+ @action = nil
34
35
  end
35
36
 
36
37
  #Execute keyboard command like PF1 or PA2 or ENTER ...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: butler-mainframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Mastrodonato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem provides a virtual butler which can perform your custom tasks
14
14
  on a 3270 emulator. You just have to choose your emulator (atm only one choice)