appium_lib 5.0.1 → 6.0.0

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.
@@ -90,7 +90,7 @@ def patch_webdriver_bridge
90
90
  path_match = path.match /.*\h{8}-?\h{4}-?\h{4}-?\h{4}-?\h{12}/
91
91
  path_str = path.sub(path_match[0], '') unless path_match.nil?
92
92
 
93
- puts "#{verb} #{path_str}"
93
+ Appium::Logger.info "#{verb} #{path_str}"
94
94
 
95
95
  # must check to see if command_hash is a hash. sometimes it's not.
96
96
  if command_hash.is_a?(Hash) && !command_hash.empty?
@@ -103,18 +103,18 @@ def patch_webdriver_bridge
103
103
  print_command[:value] = value.length == 1 ? value[0] : value
104
104
 
105
105
  # avoid backslash escape quotes in strings. "\"a\"" => "a"
106
- puts print_command.ai.gsub('\"', '"')
106
+ Appium::Logger.info print_command.ai.gsub('\"', '"')
107
107
  else
108
- ap print_command
108
+ Appium::Logger.ap_info print_command
109
109
  end
110
110
  else # non-standard command hash
111
111
  # It's important to output this for debugging problems.
112
112
  # for example invalid JSON will not be a Hash
113
- ap command_hash if command_hash
113
+ Appium::Logger.ap_info command_hash if command_hash
114
114
  end
115
115
  delay = $driver.global_webdriver_http_sleep
116
116
  sleep delay if !delay.nil? && delay > 0
117
- # puts "verb: #{verb}, path #{path}, command_hash #{command_hash.to_json}"
117
+ # Appium::Logger.info "verb: #{verb}, path #{path}, command_hash #{command_hash.to_json}"
118
118
  http.call verb, path, command_hash
119
119
  end # def
120
120
  end # class
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '5.0.1' unless defined? ::Appium::VERSION
4
- DATE = '2014-12-30' unless defined? ::Appium::DATE
3
+ VERSION = '6.0.0' unless defined? ::Appium::VERSION
4
+ DATE = '2015-01-26' unless defined? ::Appium::DATE
5
5
  end
@@ -76,20 +76,20 @@ module Appium
76
76
 
77
77
  parent_dir = File.dirname file
78
78
  toml = File.expand_path File.join parent_dir, 'appium.txt'
79
- puts "appium.txt path: #{toml}" if verbose
79
+ Appium::Logger.info "appium.txt path: #{toml}" if verbose
80
80
 
81
81
  toml_exists = File.exists? toml
82
- puts "Exists? #{toml_exists}" if verbose
82
+ Appium::Logger.info "Exists? #{toml_exists}" if verbose
83
83
 
84
84
  raise "toml doesn't exist #{toml}" unless toml_exists
85
85
  require 'toml'
86
- puts "Loading #{toml}" if verbose
86
+ Appium::Logger.info "Loading #{toml}" if verbose
87
87
 
88
88
  data = File.read toml
89
89
  data = TOML::Parser.new(data).parsed
90
90
  # TOML creates string keys. must symbolize
91
91
  data = Appium::symbolize_keys data
92
- ap data unless data.empty? if verbose
92
+ Appium::Logger.ap_info data unless data.empty? if verbose
93
93
 
94
94
  if data && data[:caps] && data[:caps][:app] && !data[:caps][:app].empty?
95
95
  data[:caps][:app] = Appium::Driver.absolute_app_path data
@@ -319,9 +319,9 @@ module Appium
319
319
  @appium_debug = appium_lib_opts.fetch :debug, !!defined?(Pry)
320
320
 
321
321
  if @appium_debug
322
- ap opts unless opts.empty?
323
- puts "Debug is: #{@appium_debug}"
324
- puts "Device is: #{@appium_device}"
322
+ Appium::Logger.ap_debug opts unless opts.empty?
323
+ Appium::Logger.debug "Debug is: #{@appium_debug}"
324
+ Appium::Logger.debug "Device is: #{@appium_device}"
325
325
  patch_webdriver_bridge
326
326
  end
327
327
 
@@ -512,14 +512,14 @@ module Appium
512
512
  # @return [void]
513
513
  def set_wait timeout=nil
514
514
  if timeout.nil?
515
- # puts "timeout = @default_wait = @last_wait"
516
- # puts "timeout = @default_wait = #{@last_waits}"
515
+ # Appium::Logger.info "timeout = @default_wait = @last_wait"
516
+ # Appium::Logger.info "timeout = @default_wait = #{@last_waits}"
517
517
  timeout = @default_wait = @last_waits.first
518
518
  else
519
519
  @default_wait = timeout
520
- # puts "last waits before: #{@last_waits}"
520
+ # Appium::Logger.info "last waits before: #{@last_waits}"
521
521
  @last_waits = [@last_waits.last, @default_wait]
522
- # puts "last waits after: #{@last_waits}"
522
+ # Appium::Logger.info "last waits after: #{@last_waits}"
523
523
  end
524
524
 
525
525
  @driver.manage.timeouts.implicit_wait = timeout
@@ -1,12 +1,24 @@
1
+ require 'logger'
2
+
1
3
  module Appium
2
4
  module Logger
3
5
  class << self
4
6
  extend Forwardable
5
- def_delegators :@logger, :warn, :error, :info
7
+ def_delegators :logger, :ap, :fatal, :error, :warn, :info, :debug, :level, :level=, :formatter, :formatter=
8
+
9
+ [:fatal, :error, :warn, :info, :debug].each do |level|
10
+ define_method("ap_#{level}") {|obj| logger.ap(obj, level) }
11
+ end
6
12
 
7
- # @private
13
+ private
14
+
8
15
  def logger
9
- @logger ||= Logger.new
16
+ @logger ||= begin
17
+ logger = ::Logger.new($stdout)
18
+ logger.level = ::Logger::WARN
19
+ logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" } # do no special formatting
20
+ logger
21
+ end
10
22
  end
11
23
  end # class << self
12
24
  end # module Logger
data/readme.md CHANGED
@@ -46,3 +46,11 @@ gem install --no-rdoc --no-ri appium_lib
46
46
  - [Ruby Android methods](https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md)
47
47
  - [Ruby iOS methods](https://github.com/appium/ruby_lib/blob/master/docs/ios_docs.md)
48
48
  - [Appium Server docs](https://github.com/appium/appium/tree/master/docs)
49
+
50
+ #### Logging
51
+
52
+ [Log level](https://github.com/appium/ruby_lib/blob/1673a694121d2ae24ffd1530eb71b7015d44dc52/lib/appium_lib/logger.rb) can be adjusted. The default level is `Logger::WARN`
53
+
54
+ ```ruby
55
+ Appium::Logger.level = Logger::INFO
56
+ ```
@@ -1,3 +1,12 @@
1
+ #### v6.0.0 2015-01-26
2
+
3
+ - [ea11190](https://github.com/appium/ruby_lib/commit/ea11190b9ab36e34226d988f85fe612af6f769de) Release 6.0.0
4
+ - [d15371d](https://github.com/appium/ruby_lib/commit/d15371deb2bbb0e6a441c7b38cabdc83b3e36256) Update readme.md
5
+ - [4f99dd3](https://github.com/appium/ruby_lib/commit/4f99dd31ad0a1976214858195b5911e79a42c3a1) Merge pull request #302 from whoward/use-logger
6
+ - [1673a69](https://github.com/appium/ruby_lib/commit/1673a694121d2ae24ffd1530eb71b7015d44dc52) Use the logger object for outputting debug information
7
+ - [4573473](https://github.com/appium/ruby_lib/commit/457347379f26804af143269e896f45869e2860e1) Create index_paths.md
8
+
9
+
1
10
  #### v5.0.1 2014-12-30
2
11
 
3
12
  - [9b15701](https://github.com/appium/ruby_lib/commit/9b157011965442e6f021dcfeef588450277f1c6a) Release 5.0.1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-30 00:00:00.000000000 Z
11
+ date: 2015-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -247,6 +247,7 @@ files:
247
247
  - docs/android_docs.md
248
248
  - docs/api_19_webview.md
249
249
  - docs/docs.md
250
+ - docs/index_paths.md
250
251
  - docs/ios_docs.md
251
252
  - docs/migration.md
252
253
  - docs_gen/docs_from_js.md