oats 0.0.2 → 0.0.3

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.
data/lib/oats/driver.rb CHANGED
@@ -5,8 +5,6 @@ require 'oats/oats_data'
5
5
  require 'oats/roptions'
6
6
  require 'oats/build_id'
7
7
 
8
- autoload :Spreadsheet, 'spreadsheet'
9
-
10
8
  module Oats
11
9
 
12
10
  module Driver
@@ -45,7 +43,7 @@ module Oats
45
43
  # Returns oats_info object containing execution results
46
44
  def Driver.run(args)
47
45
  unless ENV['HOSTNAME']
48
- if RUBY_PLATFORM =~ /mswin32/
46
+ if RUBY_PLATFORM =~ /(mswin|mingw)/
49
47
  ENV['HOSTNAME'] = ENV['COMPUTERNAME']
50
48
  else
51
49
  ENV['HOSTNAME'] = `hostname`.chomp
@@ -446,6 +444,7 @@ module Oats
446
444
  # Return all the included worksheet lists in XL and place all
447
445
  # their test arrays in $oats_global['xl']
448
446
  def Driver.parse_xl(path,id)
447
+ require 'spreadsheet' unless defined?(Spreadsheet)
449
448
  book = Spreadsheet.open path
450
449
  sheet = book.worksheet 'Main'
451
450
  Oats.assert sheet, "Could not locate worksheet 'Main' in: " + path
@@ -1,5 +1,5 @@
1
1
  # Manages a lock file indicating a OATS session is in process
2
- require 'win32ole' if RUBY_PLATFORM =~ /mswin32/
2
+ require 'win32ole' if RUBY_PLATFORM =~ /(mswin|mingw)/
3
3
  module Oats
4
4
 
5
5
  module OatsLock
@@ -14,7 +14,7 @@ module Oats
14
14
  @@file_handle = File.open(in_progress_file, 'w')
15
15
  my_pid = Process.pid.to_s
16
16
  @@file_handle.puts my_pid
17
- if RUBY_PLATFORM !~ /mswin32/ or ENV['TEMP'] =~ /^\/cygdrive/
17
+ if RUBY_PLATFORM !~ /(mswin|mingw)/ or ENV['TEMP'] =~ /^\/cygdrive/
18
18
  # Leave file handle open for windows to detect and kill associated java, etc.
19
19
  # processes using file handles.
20
20
  @@file_handle.close
@@ -30,7 +30,7 @@ module Oats
30
30
  def OatsLock.locked?(verify = nil)
31
31
  return @@is_locked unless verify
32
32
  @@is_locked = false
33
- if RUBY_PLATFORM !~ /mswin32/ or ENV['TEMP'] =~ /^\/cygdrive/
33
+ if RUBY_PLATFORM !~ /(mswin|mingw)/ or ENV['TEMP'] =~ /^\/cygdrive/
34
34
  if File.exist?(in_progress_file)
35
35
  pids = IO.readlines(in_progress_file)
36
36
  ruby_pid = pids.shift
@@ -140,7 +140,7 @@ module Oats
140
140
 
141
141
  def OatsLock.find_matching_processes(proc_names)
142
142
  matched = []
143
- if RUBY_PLATFORM =~ /mswin32/
143
+ if RUBY_PLATFORM =~ /(mswin|mingw)/
144
144
  processes = WIN32OLE.connect("winmgmts://").ExecQuery("select * from win32_process")
145
145
  # for process in processes do
146
146
  # for property in process.Properties_ do
@@ -222,7 +222,7 @@ module Oats
222
222
  @@file_handle = nil
223
223
  @@is_locked = true
224
224
  else # Doesn't return status properly for non-windows, just resets the lock
225
- if $oats_execution['agent'].nil? and RUBY_PLATFORM !~ /mswin32/ and File.exist?(in_progress_file)
225
+ if $oats_execution['agent'].nil? and RUBY_PLATFORM !~ /(mswin|mingw)/ and File.exist?(in_progress_file)
226
226
  pids = IO.readlines(in_progress_file)
227
227
  current_pid = pids.shift
228
228
  pids.each { |pid| OatsLock.kill_pid(pid.chomp) } # Legacy firefox
@@ -45,13 +45,13 @@ module Oats
45
45
  if browser_type == 'firefox'
46
46
  $oats_global['download_dir'] = $oats['execution']['dir_results'] + '/downloads'
47
47
  elsif Oats.data("selenium.default_downloads")
48
- $oats_global['download_dir'] = File.join(ENV[ RUBY_PLATFORM =~ /mswin32/ ? 'USERPROFILE' : 'HOME'], 'Downloads')
49
- $oats_global['download_dir'].gsub!('\\','/') if RUBY_PLATFORM =~ /mswin32/
48
+ $oats_global['download_dir'] = File.join(ENV[ RUBY_PLATFORM =~ /(mswin|mingw)/ ? 'USERPROFILE' : 'HOME'], 'Downloads')
49
+ $oats_global['download_dir'].gsub!('\\','/') if RUBY_PLATFORM =~ /(mswin|mingw)/
50
50
  end
51
51
  end
52
52
 
53
53
  download_dir = $oats_global['download_dir'].gsub('/','\\\\') if $oats_global['download_dir'] and
54
- RUBY_PLATFORM =~ /mswin32/
54
+ RUBY_PLATFORM =~ /(mswin|mingw)/
55
55
  download_dir ||= $oats_global['download_dir']
56
56
  case browser_type
57
57
  when 'firefox'
@@ -70,7 +70,7 @@ module Oats
70
70
  profile['download.prompt_for_download'] = false
71
71
  profile['download.default_directory'] = download_dir
72
72
  # unless $oats_global['browser_path']
73
- # vpath = File.join($oats['_']['vendor'], ENV['OS'], 'chromedriver' + (RUBY_PLATFORM =~ /mswin32/ ? '.exe' : '') )
73
+ # vpath = File.join($oats['_']['vendor'], ENV['OS'], 'chromedriver' + (RUBY_PLATFORM =~ /(mswin|mingw)/ ? '.exe' : '') )
74
74
  # $oats_global['browser_path'] = vpath if File.exist?(vpath)
75
75
  # end
76
76
  end
@@ -129,7 +129,7 @@ module Oats
129
129
  else
130
130
  file_os = RUBY_PLATFORM
131
131
  end
132
- file_os =~ /mswin32/ ? file.gsub('/','\\') : file
132
+ file_os =~ /(mswin|mingw)/ ? file.gsub('/','\\') : file
133
133
  end
134
134
 
135
135
  def Oselenium.reset
@@ -432,7 +432,7 @@ module Oats
432
432
  out_contents = IO.read(file_out).gsub(/\s/,'')
433
433
  unless ok_contents == out_contents
434
434
  err = "File in out folder did not match out folder in: #{file_ok}"
435
- diff_lines = `diff -b '#{file_ok}' '#{file_out}'` unless RUBY_PLATFORM =~ /mswin32/
435
+ diff_lines = `diff -b '#{file_ok}' '#{file_out}'` unless RUBY_PLATFORM =~ /(mswin|mingw)/
436
436
  end
437
437
  else
438
438
  err = "Extra output [#{file}] missing from: #{test_ok_out}"
@@ -62,7 +62,7 @@ module Oats
62
62
  extn = File.extname(test_file)
63
63
  extn = nil if extn == ''
64
64
  found_file = catch :found_file do
65
- if RUBY_PLATFORM =~ /mswin32/ ? test_file[1] == ?: : test_file[0] == ?/ # absolute path
65
+ if RUBY_PLATFORM =~ /(mswin|mingw)/ ? test_file[1] == ?: : test_file[0] == ?/ # absolute path
66
66
  # Try exact match
67
67
  throw(:found_file, test_file) if File.exist?(test_file) and (is_dir or not FileTest.directory?(test_file))
68
68
 
data/lib/oats/util.rb CHANGED
@@ -1,4 +1,4 @@
1
- autoload :Process, 'win32/process'
1
+ require 'win32/process' if RUBY_PLATFORM =~ /(mswin|mingw)/ and not defined?(Process)
2
2
 
3
3
  module Oats
4
4
  module Util
data/lib/oats/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oats
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/oats.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.add_dependency 'log4r'
30
30
  s.add_dependency 'net-http-persistent' unless RUBY_VERSION =~ /^1.9/ # Speed up 1.8 connections
31
31
 
32
- if RUBY_PLATFORM =~ /mswin32/ # Assume won't use the agent
32
+ if RUBY_PLATFORM =~ /(mswin|mingw)/ # Assume won't use the agent
33
33
  s.add_dependency 'win32-process'
34
34
  else
35
35
  s.add_dependency 'json'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oats
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Levent Atasoy