jenkins2 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +0,0 @@
1
- module Jenkins2
2
- module URI
3
- PATH = "a-zA-Z0-9\\-\\.\\_\\~\\!\\?\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=\\:\\@\\/"
4
- def self.escape( s )
5
- s.gsub( /[^#{PATH}]/ ) do |char|
6
- char.unpack( 'C*' ).map{|c| ("%%%02x" % c).upcase }.join
7
- end
8
- end
9
- end
10
- end
@@ -1,29 +0,0 @@
1
- require 'net/http'
2
-
3
- require_relative 'log'
4
-
5
- module Jenkins2
6
- module Wait
7
- # Waits for a block to return +truthful+ value. Useful, for example, when you set a node tenporarily
8
- # offline, and then wait for it to become idle.
9
- # +max_wait_minutes+:: Maximum wait time in minutes.
10
- # +&block+:: Run this block until it returs true, max_wait_minutes pass or block throws some
11
- # kind of exception.
12
- #
13
- # Returns the result of a block, if it eventually succeeded or nil in case of timeout.
14
- #
15
- # Note that this is both a method of module Wait, so you can <tt>include Jenkins::Wait</tt>
16
- # into your classes so they have a #wait method, as well as a module method, so you can call it
17
- # directly as ::wait().
18
- def wait( max_wait_minutes: 60, &block )
19
- [3, 5, 7, 15, 30, [60] * (max_wait_minutes - 1)].flatten.each do |sec|
20
- result = yield
21
- return result if result
22
- sleep sec
23
- end
24
- nil
25
- end
26
-
27
- module_function :wait
28
- end
29
- end