appium_lib 0.6.0 → 0.6.1

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.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Appium
3
3
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
4
- VERSION = '0.6.0' unless defined? ::Appium::VERSION
4
+ VERSION = '0.6.1' unless defined? ::Appium::VERSION
5
5
  DATE = '2013-08-05' unless defined? ::Appium::DATE
6
6
  end
@@ -115,6 +115,44 @@ module Appium
115
115
  require 'android/element/generic'
116
116
  require 'android/element/textfield'
117
117
 
118
+ ##
119
+ # Promote appium methods to class instance methods
120
+ #
121
+ # @param class_array [Array<Class>] An array of classes
122
+ #
123
+ # To promote methods to all classes:
124
+ #
125
+ # ```ruby
126
+ # Appium.promote_appium_methods Object
127
+ # ```
128
+
129
+ def self.promote_appium_methods class_array
130
+ raise 'Driver is nil' if $driver.nil?
131
+ # Wrap single class into an array
132
+ class_array = [class_array] unless class_array.class == Array
133
+ # Promote Appium driver methods to class instance methods.
134
+ class_array.each do |klass|
135
+ $driver.public_methods(false).each do |m|
136
+ klass.class_eval do
137
+ define_method m do |*args, &block|
138
+ begin
139
+ # Prefer existing method.
140
+ # super will invoke method missing on driver
141
+ super(*args, &block)
142
+ # minitest also defines a name method,
143
+ # so rescue argument error
144
+ # and call the name method on $driver
145
+ rescue NoMethodError, ArgumentError
146
+ # puts "[Object.class_eval] '#{m}' not on super"
147
+ $driver.send m, *args, &block if $driver.respond_to?(m)
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end
153
+ nil # return nil
154
+ end
155
+
118
156
  class Driver
119
157
  @@loaded = false
120
158
 
@@ -220,26 +258,8 @@ module Appium
220
258
  # Subsequent drivers do not trigger promotion.
221
259
  unless @@loaded
222
260
  @@loaded = true
223
- # Promote Appium driver methods to Object instance methods.
224
- $driver.public_methods(false).each do | m |
225
- # not MiniTest::Spec
226
- ::Minitest::Spec.class_eval do
227
- define_method m do | *args, &block |
228
- begin
229
- # puts "[Object.class_eval] Calling super for '#{m}'"
230
- # prefer existing method.
231
- # super will invoke method missing on driver
232
- super(*args, &block)
233
- # minitest also defines a name method,
234
- # so rescue argument error
235
- # and call the name method on $driver
236
- rescue NoMethodError, ArgumentError
237
- # puts "[Object.class_eval] '#{m}' not on super"
238
- $driver.send m, *args, &block if $driver.respond_to?(m)
239
- end
240
- end
241
- end
242
- end
261
+ # Promote only on Minitest::Spec (minitest 5) by default
262
+ Appium.promote_appium_methods ::Minitest::Spec
243
263
  end
244
264
 
245
265
  self # return newly created driver
@@ -1,3 +1,15 @@
1
+ #### v0.6.0 2013-08-05
2
+
3
+ - [09aa23d](https://github.com/appium/ruby_lib/commit/09aa23d8c1b769b054c7d0e24ec86cf55d6bc027) Release 0.6.0
4
+ - [cbaf19d](https://github.com/appium/ruby_lib/commit/cbaf19d9d607b00dde89aca3829f17808780c2f3) Add keyboard send_keys documentation
5
+ - [25333d6](https://github.com/appium/ruby_lib/commit/25333d6d2871ba5009dcf4050185dbdf1d324ce9) Fix for Minitest 5
6
+ - [1e047b0](https://github.com/appium/ruby_lib/commit/1e047b092740703083ed9e452f9e77d6086f8372) Minitest 5 only
7
+ - [7ef93e9](https://github.com/appium/ruby_lib/commit/7ef93e99fbc373a6d4f2a75f1abc81a12a9688fa) Update usage example
8
+ - [47f53f9](https://github.com/appium/ruby_lib/commit/47f53f9706d3aa302a431c2b91592ee8c72ba399) Device is now required
9
+ - [62d5f2a](https://github.com/appium/ruby_lib/commit/62d5f2a258e927ee56e042466503c023c9138f6c) Patch only MiniTest
10
+ - [6ce29df](https://github.com/appium/ruby_lib/commit/6ce29df7b9d7b144a750579faab9629741f64593) Fix release notes
11
+
12
+
1
13
  #### v0.5.16 2013-07-26
2
14
 
3
15
  - [bd71fb4](https://github.com/appium/ruby_lib/commit/bd71fb4e430608d32923c583c8d4d592f11a96fc) Release 0.5.16
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com