waitforit 0.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc ADDED
@@ -0,0 +1,3 @@
1
+ rvm --create use 1.9.2@waitforit
2
+ RVMRC_PATH="$( cd "$( dirname "$0" )" && pwd )"
3
+ export PATH=$RVMRC_PATH/bin:$PATH
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source :rubygems
2
+
3
+ group :development do
4
+ gem "jeweler", "1.5.2", :require => 'jeweler'
5
+ gem "rspec", :require => ['rspec', 'rspec/core/rake_task']
6
+ end
@@ -0,0 +1,25 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.5.2)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rake (0.9.2)
11
+ rspec (2.6.0)
12
+ rspec-core (~> 2.6.0)
13
+ rspec-expectations (~> 2.6.0)
14
+ rspec-mocks (~> 2.6.0)
15
+ rspec-core (2.6.4)
16
+ rspec-expectations (2.6.0)
17
+ diff-lcs (~> 1.1.2)
18
+ rspec-mocks (2.6.0)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ jeweler (= 1.5.2)
25
+ rspec
data/README ADDED
File without changes
@@ -0,0 +1,12 @@
1
+ Bundler.require(:default, :development)
2
+ RSpec::Core::RakeTask.new('default')
3
+ Jeweler::RubygemsDotOrgTasks.new
4
+
5
+ Jeweler::Tasks.new do |gem|
6
+ gem.name = "waitforit"
7
+ gem.license = "MIT"
8
+ gem.summary = "Tired of sleeping when something is supposed to happen? use this to waitforit instead :)"
9
+ gem.description = "Tired of sleeping when something is supposed to happen? use this to waitforit instead :)"
10
+ gem.email = "leon_a_d@yahoo.com"
11
+ gem.authors = ["lashd"]
12
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0.pre6
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'autospec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'autospec')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'htmldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'htmldiff')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'jeweler' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('jeweler', 'jeweler')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'ldiff')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,22 @@
1
+ module TimeIncrements
2
+ def seconds
3
+ self * 1
4
+ end
5
+ alias_method :second, :seconds
6
+ end
7
+ class Float
8
+ include TimeIncrements
9
+ end
10
+ class Fixnum
11
+ include TimeIncrements
12
+ end
13
+
14
+ def wait_until opts={}
15
+ opts = {:timeout_after => 5.seconds,:retry_every => 0.1.seconds}.merge(opts)
16
+ start_time = Time.now
17
+ until Time.now > start_time + opts[:timeout_after]
18
+ return if yield == true
19
+ sleep opts[:retry_every]
20
+ end
21
+ raise RuntimeError, "Action took to long"
22
+ end
@@ -0,0 +1,37 @@
1
+ require 'rspec'
2
+ require "#{File.dirname(__FILE__)}/../lib/waitforit"
3
+
4
+ describe 'waitforit' do
5
+ it 'should wait until the prescribed thing has happened' do
6
+ end_time = Time.now + 1
7
+ wait_until do
8
+ end_time < Time.now
9
+ end
10
+ end_time.should be < Time.now
11
+ end
12
+
13
+ it 'should throw an exception if when the prescribed action does not happen in time' do
14
+ expect { wait_until(:timeout_after => 1.second) { false } }.to raise_error RuntimeError
15
+ end
16
+
17
+ it 'should keep trying for a specified period' do
18
+ start_time = Time.now
19
+ wait_time = 1.second
20
+
21
+ lambda { wait_until(:timeout_after => wait_time) { false } }
22
+
23
+ (start_time + wait_time).should be >= Time.now
24
+ end
25
+
26
+ it 'should be possible for user to supply the retry time' do
27
+ count = 0
28
+
29
+ begin
30
+ wait_until(:timeout_after => 1.second, :retry_every => 0.5.seconds) do
31
+ count += 1
32
+ end
33
+ rescue
34
+ count.should == 2
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{waitforit}
8
+ s.version = "0.0.0.pre6"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["lashd"]
12
+ s.date = %q{2011-08-21}
13
+ s.description = %q{Tired of sleeping when something is supposed to happen? use this to waitforit instead :)}
14
+ s.email = %q{leon_a_d@yahoo.com}
15
+ s.executables = ["autospec", "htmldiff", "jeweler", "ldiff", "rake", "rspec"]
16
+ s.extra_rdoc_files = [
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".rvmrc",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bin/autospec",
27
+ "bin/htmldiff",
28
+ "bin/jeweler",
29
+ "bin/ldiff",
30
+ "bin/rake",
31
+ "bin/rspec",
32
+ "lib/waitforit.rb",
33
+ "spec/waitforit_spec.rb",
34
+ "waitforit.gemspec"
35
+ ]
36
+ s.licenses = ["MIT"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.6.1}
39
+ s.summary = %q{Tired of sleeping when something is supposed to happen? use this to waitforit instead :)}
40
+ s.test_files = [
41
+ "spec/waitforit_spec.rb"
42
+ ]
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_development_dependency(%q<jeweler>, ["= 1.5.2"])
49
+ s.add_development_dependency(%q<rspec>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<jeweler>, ["= 1.5.2"])
52
+ s.add_dependency(%q<rspec>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<jeweler>, ["= 1.5.2"])
56
+ s.add_dependency(%q<rspec>, [">= 0"])
57
+ end
58
+ end
59
+
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: waitforit
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: 6
5
+ version: 0.0.0.pre6
6
+ platform: ruby
7
+ authors:
8
+ - lashd
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-08-21 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: jeweler
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.5.2
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ description: Tired of sleeping when something is supposed to happen? use this to waitforit instead :)
39
+ email: leon_a_d@yahoo.com
40
+ executables:
41
+ - autospec
42
+ - htmldiff
43
+ - jeweler
44
+ - ldiff
45
+ - rake
46
+ - rspec
47
+ extensions: []
48
+
49
+ extra_rdoc_files:
50
+ - README
51
+ files:
52
+ - .rvmrc
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - README
56
+ - Rakefile
57
+ - VERSION
58
+ - bin/autospec
59
+ - bin/htmldiff
60
+ - bin/jeweler
61
+ - bin/ldiff
62
+ - bin/rake
63
+ - bin/rspec
64
+ - lib/waitforit.rb
65
+ - spec/waitforit_spec.rb
66
+ - waitforit.gemspec
67
+ has_rdoc: true
68
+ homepage:
69
+ licenses:
70
+ - MIT
71
+ post_install_message:
72
+ rdoc_options: []
73
+
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 140276702136187881
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">"
89
+ - !ruby/object:Gem::Version
90
+ version: 1.3.1
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.6.1
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: Tired of sleeping when something is supposed to happen? use this to waitforit instead :)
98
+ test_files:
99
+ - spec/waitforit_spec.rb