wait_for 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
File without changes
@@ -0,0 +1,8 @@
1
+ === 0.1.1 / 2011-08-30
2
+ * Fix typos in README
3
+ === 0.1.0 / 2011-07-13
4
+
5
+ * 1 major enhancement
6
+
7
+ * Birthday!
8
+
@@ -0,0 +1,7 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ lib/wait_for.rb
7
+ test/test_wait_for.rb
@@ -0,0 +1,23 @@
1
+ = wait_for
2
+
3
+ * http://cyberconnect.biz
4
+
5
+ == DESCRIPTION:
6
+
7
+ Means for waiting till a condition has been met or until a timeout reached.
8
+
9
+ == SYNOPSIS:
10
+
11
+ wait_for(timeout in seconds) { some ruby block which evaluates to true when a condition is met }
12
+
13
+ Ex: wait_for(2) { rand(100) == 50 }
14
+ In this case if rand(100) is called repedativly and if the value == 50 before 2 seconds is reached true
15
+ is returned else false.
16
+
17
+ == INSTALL:
18
+
19
+ * gem install wait_for
20
+
21
+ == LICENSE:
22
+
23
+ GPLv3: http://www.gnu.org/licenses/gpl.html
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'hoe'
3
+
4
+ # Hoe.plugin :compiler
5
+ # Hoe.plugin :gem_prelude_sucks
6
+ # Hoe.plugin :inline
7
+ # Hoe.plugin :racc
8
+ # Hoe.plugin :rubyforge
9
+
10
+ Hoe.spec 'wait_for' do
11
+ # HEY! If you fill these out in ~/.hoe_template/Rakefile.erb then
12
+ # you'll never have to touch them again!
13
+ # (delete this comment too, of course)
14
+
15
+ # developer('FIX', 'FIX@example.com')
16
+
17
+ # self.rubyforge_name = 'wait_forx' # if different than 'wait_for'
18
+ developer('', 'cliff.cyphers@gmail.com')
19
+ end
20
+
21
+ # vim: syntax=ruby
@@ -0,0 +1,36 @@
1
+ # Authod: Cliff Cyphers
2
+ # Published as part of the cyberconnect's platform mainly used
3
+ # in hosting rails applications.
4
+ # Licesnse: GPLv3: http://www.gnu.org/licenses/gpl.html
5
+
6
+
7
+ class WaitFor
8
+ VERSION = '0.1.1'
9
+ end
10
+
11
+ require 'timeout'
12
+ def wait_for(timeout=45, &blk)
13
+ if block_given?
14
+ begin
15
+ Timeout.timeout(timeout) {
16
+ while true
17
+ begin
18
+ res=blk.call
19
+ res = res.call if res.respond_to?(:call)
20
+ sleep 0.2
21
+ rescue => e
22
+ puts "EEEEEEE: #{e.inspect}"
23
+ res=false
24
+ #break
25
+ end
26
+ break if res
27
+ end
28
+ return true
29
+ }
30
+ rescue Timeout::Error => e
31
+ return false
32
+ end
33
+ else
34
+ raise StandardError, "Provide a block which returns true | false"
35
+ end
36
+ end
@@ -0,0 +1,13 @@
1
+ # Authod: Cliff Cyphers
2
+ # Published as part of the cyberconnect's platform mainly used
3
+ # in hosting rails applications.
4
+ # Licesnse: GPLv3: http://www.gnu.org/licenses/gpl.html
5
+
6
+
7
+ require "test/unit"
8
+ require "wait_for"
9
+
10
+ class TestWaitFor < Test::Unit::TestCase
11
+ def test_sanity
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wait_for
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.1
6
+ platform: ruby
7
+ authors:
8
+ - ""
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-08-30 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: "2.12"
24
+ type: :development
25
+ version_requirements: *id001
26
+ description: Means for waiting till a condition has been met or until a timeout reached.
27
+ email:
28
+ - cliff.cyphers@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files:
34
+ - History.txt
35
+ - Manifest.txt
36
+ - README.txt
37
+ files:
38
+ - .autotest
39
+ - History.txt
40
+ - Manifest.txt
41
+ - README.txt
42
+ - Rakefile
43
+ - lib/wait_for.rb
44
+ - test/test_wait_for.rb
45
+ - .gemtest
46
+ homepage: http://cyberconnect.biz
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options:
51
+ - --main
52
+ - README.txt
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ requirements: []
68
+
69
+ rubyforge_project: wait_for
70
+ rubygems_version: 1.8.10
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Means for waiting till a condition has been met or until a timeout reached.
74
+ test_files:
75
+ - test/test_wait_for.rb