selenium-webdriver 2.53.4 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CHANGES +24 -18
  2. data/README.md +2 -3
  3. data/lib/selenium/server.rb +64 -68
  4. data/lib/selenium/webdriver.rb +5 -9
  5. data/lib/selenium/webdriver/chrome.rb +18 -3
  6. data/lib/selenium/webdriver/chrome/bridge.rb +13 -16
  7. data/lib/selenium/webdriver/chrome/profile.rb +7 -9
  8. data/lib/selenium/webdriver/chrome/service.rb +8 -84
  9. data/lib/selenium/webdriver/common.rb +1 -2
  10. data/lib/selenium/webdriver/common/action_builder.rb +28 -38
  11. data/lib/selenium/webdriver/common/alert.rb +7 -10
  12. data/lib/selenium/webdriver/common/bridge_helper.rb +10 -15
  13. data/lib/selenium/webdriver/common/driver.rb +19 -28
  14. data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +0 -3
  15. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +4 -6
  16. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -5
  17. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -2
  18. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -2
  19. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -2
  20. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -3
  21. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -6
  22. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -5
  23. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -5
  24. data/lib/selenium/webdriver/common/element.rb +27 -29
  25. data/lib/selenium/webdriver/common/error.rb +17 -20
  26. data/lib/selenium/webdriver/common/file_reaper.rb +3 -9
  27. data/lib/selenium/webdriver/common/html5/local_storage.rb +6 -8
  28. data/lib/selenium/webdriver/common/html5/session_storage.rb +6 -8
  29. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +6 -15
  30. data/lib/selenium/webdriver/common/keyboard.rb +7 -12
  31. data/lib/selenium/webdriver/common/keys.rb +67 -69
  32. data/lib/selenium/webdriver/common/log_entry.rb +3 -4
  33. data/lib/selenium/webdriver/common/logs.rb +2 -4
  34. data/lib/selenium/webdriver/common/mouse.rb +9 -12
  35. data/lib/selenium/webdriver/common/navigation.rb +2 -4
  36. data/lib/selenium/webdriver/common/options.rb +16 -19
  37. data/lib/selenium/webdriver/common/platform.rb +61 -90
  38. data/lib/selenium/webdriver/common/port_prober.rb +1 -2
  39. data/lib/selenium/webdriver/common/profile_helper.rb +5 -8
  40. data/lib/selenium/webdriver/common/proxy.rb +58 -70
  41. data/lib/selenium/webdriver/common/search_context.rb +15 -19
  42. data/lib/selenium/webdriver/common/service.rb +127 -0
  43. data/lib/selenium/webdriver/common/socket_lock.rb +5 -11
  44. data/lib/selenium/webdriver/common/socket_poller.rb +4 -9
  45. data/lib/selenium/webdriver/common/target_locator.rb +11 -13
  46. data/lib/selenium/webdriver/common/timeouts.rb +4 -6
  47. data/lib/selenium/webdriver/common/touch_action_builder.rb +2 -4
  48. data/lib/selenium/webdriver/common/touch_screen.rb +15 -18
  49. data/lib/selenium/webdriver/common/w3c_error.rb +3 -6
  50. data/lib/selenium/webdriver/common/wait.rb +6 -11
  51. data/lib/selenium/webdriver/common/window.rb +12 -15
  52. data/lib/selenium/webdriver/common/zipper.rb +6 -8
  53. data/lib/selenium/webdriver/edge.rb +18 -3
  54. data/lib/selenium/webdriver/edge/bridge.rb +11 -16
  55. data/lib/selenium/webdriver/edge/legacy_support.rb +38 -39
  56. data/lib/selenium/webdriver/edge/service.rb +8 -82
  57. data/lib/selenium/webdriver/firefox.rb +25 -6
  58. data/lib/selenium/webdriver/firefox/binary.rb +37 -53
  59. data/lib/selenium/webdriver/firefox/bridge.rb +3 -6
  60. data/lib/selenium/webdriver/firefox/extension.rb +4 -6
  61. data/lib/selenium/webdriver/firefox/extension/prefs.json +1 -10
  62. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  63. data/lib/selenium/webdriver/firefox/launcher.rb +8 -11
  64. data/lib/selenium/webdriver/firefox/profile.rb +40 -42
  65. data/lib/selenium/webdriver/firefox/profiles_ini.rb +8 -15
  66. data/lib/selenium/webdriver/firefox/service.rb +23 -79
  67. data/lib/selenium/webdriver/firefox/util.rb +0 -2
  68. data/lib/selenium/webdriver/firefox/w3c_bridge.rb +2 -4
  69. data/lib/selenium/webdriver/ie.rb +16 -7
  70. data/lib/selenium/webdriver/ie/bridge.rb +16 -23
  71. data/lib/selenium/webdriver/{iphone.rb → ie/service.rb} +26 -4
  72. data/lib/selenium/webdriver/phantomjs.rb +8 -3
  73. data/lib/selenium/webdriver/phantomjs/bridge.rb +9 -11
  74. data/lib/selenium/webdriver/phantomjs/service.rb +17 -81
  75. data/lib/selenium/webdriver/remote.rb +0 -2
  76. data/lib/selenium/webdriver/remote/bridge.rb +193 -191
  77. data/lib/selenium/webdriver/remote/capabilities.rb +60 -90
  78. data/lib/selenium/webdriver/remote/commands.rb +197 -192
  79. data/lib/selenium/webdriver/remote/http/common.rb +15 -13
  80. data/lib/selenium/webdriver/remote/http/curb.rb +5 -9
  81. data/lib/selenium/webdriver/remote/http/default.rb +32 -37
  82. data/lib/selenium/webdriver/remote/http/persistent.rb +4 -6
  83. data/lib/selenium/webdriver/remote/response.rb +13 -21
  84. data/lib/selenium/webdriver/remote/server_error.rb +1 -3
  85. data/lib/selenium/webdriver/remote/w3c_bridge.rb +200 -195
  86. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +38 -46
  87. data/lib/selenium/webdriver/remote/w3c_commands.rb +116 -113
  88. data/lib/selenium/webdriver/safari.rb +23 -7
  89. data/lib/selenium/{client/javascript_frameworks/jquery.rb → webdriver/safari/apple_bridge.rb} +28 -9
  90. data/lib/selenium/webdriver/safari/browser.rb +0 -2
  91. data/lib/selenium/webdriver/safari/{bridge.rb → legacy_bridge.rb} +12 -9
  92. data/lib/selenium/webdriver/safari/options.rb +3 -4
  93. data/lib/selenium/webdriver/safari/resources/client.js +56 -7255
  94. data/lib/selenium/webdriver/safari/server.rb +18 -24
  95. data/lib/selenium/{client/javascript_frameworks/prototype.rb → webdriver/safari/service.rb} +27 -9
  96. data/lib/selenium/webdriver/support.rb +1 -0
  97. data/lib/selenium/webdriver/support/abstract_event_listener.rb +17 -2
  98. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -3
  99. data/lib/selenium/webdriver/support/color.rb +55 -38
  100. data/lib/selenium/webdriver/{android.rb → support/escaper.rb} +19 -4
  101. data/lib/selenium/webdriver/support/event_firing_bridge.rb +36 -38
  102. data/lib/selenium/webdriver/support/select.rb +33 -84
  103. data/selenium-webdriver.gemspec +23 -23
  104. metadata +19 -30
  105. data/lib/selenium-client.rb +0 -21
  106. data/lib/selenium/client.rb +0 -57
  107. data/lib/selenium/client/base.rb +0 -151
  108. data/lib/selenium/client/driver.rb +0 -29
  109. data/lib/selenium/client/errors.rb +0 -28
  110. data/lib/selenium/client/extensions.rb +0 -132
  111. data/lib/selenium/client/idiomatic.rb +0 -507
  112. data/lib/selenium/client/javascript_expression_builder.rb +0 -135
  113. data/lib/selenium/client/legacy_driver.rb +0 -1722
  114. data/lib/selenium/client/protocol.rb +0 -123
  115. data/lib/selenium/client/selenium_helper.rb +0 -49
  116. data/lib/selenium/rake/server_task.rb +0 -176
  117. data/lib/selenium/webdriver/android/bridge.rb +0 -68
  118. data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
  119. data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
  120. data/lib/selenium/webdriver/common/html5/location.rb +0 -19
  121. data/lib/selenium/webdriver/ie/server.rb +0 -133
  122. data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
@@ -1,123 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module Client
22
-
23
- HTTP_HEADERS = { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8' }
24
-
25
- # Module in charge of handling Selenium over-the-wire HTTP protocol
26
- module Protocol
27
- attr_reader :session_id
28
-
29
- def remote_control_command(verb, args=[])
30
- timeout(@default_timeout_in_seconds) do
31
- status, response = http_post(http_request_for(verb, args))
32
- raise CommandError, response unless status == "OK"
33
- response[3..-1] # strip "OK," from response
34
- end
35
- end
36
-
37
- def string_command(verb, args=[])
38
- remote_control_command(verb, args)
39
- end
40
-
41
- def string_array_command(verb, args=[])
42
- csv = string_command(verb, args)
43
- token = ""
44
- tokens = []
45
- escape = false
46
- csv.split(//).each do |letter|
47
- if escape
48
- token += letter
49
- escape = false
50
- next
51
- end
52
- case letter
53
- when '\\'
54
- escape = true
55
- when ','
56
- tokens << token
57
- token = ""
58
- else
59
- token += letter
60
- end
61
- end
62
- tokens << token
63
- return tokens
64
- end
65
-
66
- def number_command(verb, args)
67
- string_command verb, args
68
- end
69
-
70
- def number_array_command(verb, args)
71
- string_array_command verb, args
72
- end
73
-
74
- def boolean_command(verb, args=[])
75
- parse_boolean_value string_command(verb, args)
76
- end
77
-
78
- def boolean_array_command(verb, args)
79
- string_array_command(verb, args).collect {|value| parse_boolean_value(value)}
80
- end
81
-
82
- protected
83
-
84
- def parse_boolean_value(value)
85
- if ("true" == value)
86
- return true
87
- elsif ("false" == value)
88
- return false
89
- end
90
- raise ProtocolError, "Invalid Selenese boolean value that is neither 'true' nor 'false': got '#{value}'"
91
- end
92
-
93
- def http_request_for(verb, args)
94
- data = "cmd=#{CGI::escape(verb)}"
95
- args.each_with_index do |arg, index|
96
- data << "&#{index.succ}=#{CGI::escape(arg.to_s)}"
97
- end
98
- data << "&sessionId=#{session_id}" unless session_id.nil?
99
- data
100
- end
101
-
102
- def http_post(data)
103
- start = Time.now
104
- called_from = caller.detect{|line| line !~ /(selenium-client|vendor|usr\/lib\/ruby|\(eval\))/i}
105
- http = Net::HTTP.new(@host, @port)
106
- http.open_timeout = default_timeout_in_seconds
107
- http.read_timeout = default_timeout_in_seconds
108
- response = http.post('/selenium-server/driver/', data, HTTP_HEADERS)
109
- if response.body !~ /^OK/
110
- puts "#{start} selenium-client received failure from selenium server:"
111
- puts "requested:"
112
- puts "\t" + CGI::unescape(data.split('&').join("\n\t"))
113
- puts "received:"
114
- puts "\t#{response.body.inspect}"
115
- puts "\tcalled from #{called_from}"
116
- end
117
- [ response.body[0..1], response.body ]
118
- end
119
-
120
- end
121
-
122
- end
123
- end
@@ -1,49 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module Client
22
-
23
- module SeleniumHelper
24
-
25
- # Overrides default open method to actually delegates to @selenium
26
- def open(url)
27
- @selenium.open url
28
- end
29
-
30
- # Overrides default type method to actually delegates to @selenium
31
- def type(locator, value)
32
- @selenium.type locator, value
33
- end
34
-
35
- # Overrides default select method to actually delegates to @selenium
36
- def select(input_locator, option_locator)
37
- @selenium.select input_locator, option_locator
38
- end
39
-
40
- # Delegates to @selenium on method missing
41
- def method_missing(method_name, *args)
42
- return super unless @selenium.respond_to?(method_name)
43
-
44
- @selenium.send(method_name, *args)
45
- end
46
- end
47
-
48
- end
49
- end
@@ -1,176 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- require 'selenium/server'
21
- require 'rake'
22
-
23
- module Selenium
24
- module Rake
25
-
26
- class MissingJarFileError < StandardError
27
- end
28
-
29
- #
30
- # Defines rake tasks for starting, stopping and restarting the Selenium server.
31
- #
32
- # Usage:
33
- #
34
- # require 'selenium/rake/server_task'
35
- #
36
- # Selenium::Rake::ServerTask.new do |t|
37
- # t.jar = "/path/to/selenium-server-standalone.jar"
38
- # t.port = 4444
39
- # t.opts = %w[-some options]
40
- # end
41
- #
42
- # Alternatively, you can have the task download a specific version of the server:
43
- #
44
- # Selenium::Rake::ServerTask.new(:server) do |t|
45
- # t.version = '2.6.0'
46
- # end
47
- #
48
- # or the latest version
49
- #
50
- # Selenium::Rake::ServerTask.new(:server) do |t|
51
- # t.version = :latest
52
- # end
53
- #
54
- #
55
- # Tasks defined:
56
- #
57
- # rake selenium:server:start
58
- # rake selenium:server:stop
59
- # rake selenium:server:restart
60
- #
61
-
62
- class ServerTask
63
- include ::Rake::DSL if defined?(::Rake::DSL)
64
-
65
- #
66
- # Path to the selenium server jar
67
- #
68
-
69
- attr_accessor :jar
70
-
71
- #
72
- # Port to use for the server.
73
- # Default: 4444
74
- #
75
- #
76
-
77
- attr_accessor :port
78
-
79
- #
80
- # Timeout in seconds for the server to start/stop.
81
- # Default: 30
82
- #
83
-
84
- attr_accessor :timeout
85
-
86
- #
87
- # Whether we should detach from the server process.
88
- # Default: true
89
- #
90
-
91
- attr_accessor :background
92
- alias_method :background?, :background
93
-
94
- #
95
- # Configure logging. Pass a log file path or a boolean.
96
- # Default: true
97
- #
98
- # true - log to stdout/stderr
99
- # false - no logging
100
- # String - log to the specified file
101
- #
102
-
103
- attr_accessor :log
104
-
105
- #
106
- # Add additional options passed to the server jar.
107
- #
108
-
109
- attr_accessor :opts
110
-
111
- #
112
- # Specify the version of the server jar to download
113
- #
114
-
115
- attr_accessor :version
116
-
117
-
118
- def initialize(prefix = "selenium:server")
119
- @jar = nil
120
- @prefix = prefix
121
- @port = 4444
122
- @timeout = 30
123
- @background = true
124
- @log = true
125
- @opts = []
126
- @version = nil
127
-
128
- yield self if block_given?
129
-
130
- if @version
131
- @jar = Selenium::Server.download(@version)
132
- end
133
-
134
- unless @jar
135
- raise MissingJarFileError, "must provide path to the selenium server jar"
136
- end
137
-
138
- @server = Selenium::Server.new(@jar, :port => @port,
139
- :timeout => @timeout,
140
- :background => @background,
141
- :log => @log )
142
-
143
- @server << @opts
144
-
145
- define_start_task
146
- define_stop_task
147
- define_restart_task
148
- end
149
-
150
- private
151
-
152
- def define_start_task
153
- desc "Start the Selenium server"
154
- task "#{@prefix}:start" do
155
- @server.start
156
- end
157
- end
158
-
159
- def define_stop_task
160
- desc 'Stop the Selenium server'
161
- task "#{@prefix}:stop" do
162
- @server.stop
163
- end
164
- end
165
-
166
- def define_restart_task
167
- desc 'Restart the Selenium server'
168
- task "#{@prefix}:restart" do
169
- @server.stop
170
- @server.start
171
- end
172
- end
173
-
174
- end # ServerTask
175
- end # Rake
176
- end # Selenium
@@ -1,68 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Android
23
-
24
- #
25
- # @api private
26
- #
27
-
28
- class Bridge < Remote::Bridge
29
-
30
- DEFAULT_URL = "http://#{Platform.localhost}:8080/wd/hub/"
31
-
32
- def initialize(opts = {})
33
- warn 'The Android driver is deprecated - please use either http://selendroid.io or http://appium.io instead.'
34
-
35
- remote_opts = {
36
- :url => opts.fetch(:url, DEFAULT_URL),
37
- :desired_capabilities => opts.fetch(:desired_capabilities, capabilities),
38
- }
39
-
40
- remote_opts[:http_client] = opts[:http_client] if opts.has_key?(:http_client)
41
-
42
- super remote_opts
43
- end
44
-
45
- def browser
46
- :android
47
- end
48
-
49
- def driver_extensions
50
- [
51
- DriverExtensions::TakesScreenshot,
52
- DriverExtensions::Rotatable,
53
- DriverExtensions::HasInputDevices,
54
- DriverExtensions::HasWebStorage,
55
- DriverExtensions::HasLocation,
56
- DriverExtensions::HasNetworkConnection,
57
- DriverExtensions::HasTouchScreen
58
- ]
59
- end
60
-
61
- def capabilities
62
- @capabilities ||= Remote::Capabilities.android
63
- end
64
-
65
- end # Bridge
66
- end # Android
67
- end # WebDriver
68
- end # Selenium
@@ -1,28 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- require 'base64'
21
-
22
- module Base64
23
-
24
- def self.strict_encode64(str)
25
- encode64(str).gsub(/\n/, '')
26
- end unless respond_to?(:strict_encode64) # added in 1.9
27
-
28
- end
@@ -1,61 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- class Dir
21
- # @api private
22
- def self.mktmpdir(prefix_suffix=nil, tmpdir=nil)
23
- case prefix_suffix
24
- when nil
25
- prefix = "d"
26
- suffix = ""
27
- when String
28
- prefix = prefix_suffix
29
- suffix = ""
30
- when Array
31
- prefix = prefix_suffix[0]
32
- suffix = prefix_suffix[1]
33
- else
34
- raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
35
- end
36
- tmpdir ||= Dir.tmpdir
37
- t = Time.now.strftime("%Y%m%d")
38
- n = nil
39
- begin
40
- path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
41
- path << "-#{n}" if n
42
- path << suffix
43
- Dir.mkdir(path, 0700)
44
- rescue Errno::EEXIST
45
- n ||= 0
46
- n += 1
47
- retry
48
- end
49
-
50
- if block_given?
51
- begin
52
- yield path
53
- ensure
54
- FileUtils.remove_entry_secure path
55
- end
56
- else
57
- path
58
- end
59
- end unless respond_to? :mktmpdir # > 1.8.7
60
- end
61
-