attempt 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.1.2 - 1-Aug-2009
2
+ * License changed to Artistic 2.0.
3
+ * Added test-unit as a development dependency.
4
+ * Test file renamed to more closely follow Ruby style.
5
+ * Gemspec updates, including addition of license.
6
+
1
7
  == 0.1.1 - 31-Jul-2007
2
8
  * Added a Rakefile with tasks for testing and installation.
3
9
  * Removed the install.rb file, since installation is now handled by the Rakefile.
data/MANIFEST CHANGED
@@ -4,4 +4,4 @@
4
4
  * Rakefile
5
5
  * attempt.gemspec
6
6
  * lib/attempt.rb
7
- * test/tc_attempt.rb
7
+ * test/test_attempt.rb
data/README CHANGED
@@ -37,8 +37,8 @@
37
37
  project page at http://www.rubyforge.org/projects/shards.
38
38
 
39
39
  == Notes From the Author
40
- Use with caution. Specifically, make sure you aren't inadvertantly
41
- wrapping code that already performs sleep + retry. Otherwise, you'll
40
+ Use with caution. Specifically, make sure you aren't inadvertantly
41
+ wrapping code that already performs sleep + retry. Otherwise, you'll
42
42
  end up with a series of nested retry's that could take much longer to
43
43
  work than you expect.
44
44
 
@@ -51,10 +51,10 @@
51
51
  warranties of merchantability and fitness for a particular purpose.
52
52
 
53
53
  == License
54
- Ruby's
54
+ Artistic 2.0
55
55
 
56
56
  == Copyright
57
- (C) 2006-2007, Daniel J. Berger
57
+ (C) 2006-2009, Daniel J. Berger
58
58
  All Rights Reserved
59
59
 
60
60
  == Author
data/lib/attempt.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'timeout'
2
2
 
3
3
  class Attempt
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
 
6
6
  # Number of attempts to make before failing. The default is 3.
7
7
  attr_accessor :tries
@@ -1,15 +1,21 @@
1
1
  #####################################################################
2
- # tc_attempt.rb
2
+ # test_attempt.rb
3
3
  #
4
- # Test case for the attempt package. You should run this test case
4
+ # Test case for the attempt library. You should run this test case
5
5
  # via the 'rake test' Rakefile task.
6
6
  #####################################################################
7
- require 'attempt'
8
- require 'test/unit'
7
+ require 'rubygems'
8
+ gem 'test-unit'
9
9
 
10
- print "\n== You will see a warning or two when running these tests ==\n\n"
10
+ require 'test/unit'
11
+ require 'attempt'
12
+ require 'stringio'
11
13
 
12
14
  class TC_Attempt < Test::Unit::TestCase
15
+ def self.startup
16
+ $stderr = StringIO.new
17
+ end
18
+
13
19
  def setup
14
20
  @tries = 2
15
21
  @interval = 0.1
@@ -17,7 +23,7 @@ class TC_Attempt < Test::Unit::TestCase
17
23
  end
18
24
 
19
25
  def test_version
20
- assert_equal('0.1.1', Attempt::VERSION)
26
+ assert_equal('0.1.2', Attempt::VERSION)
21
27
  end
22
28
 
23
29
  def test_attempt_basic
@@ -26,10 +32,10 @@ class TC_Attempt < Test::Unit::TestCase
26
32
  assert_nothing_raised{ attempt(@tries, @interval){ 2 + 2 } }
27
33
  assert_nothing_raised{ attempt(@tries, @interval, @timeout){ 2 + 2 } }
28
34
  end
29
-
35
+
30
36
  def test_attempt_expected_errors
31
37
  assert_raises(Timeout::Error){ attempt(1, 1, @timeout){ sleep 5 } }
32
- assert_raises(RuntimeError){ attempt(2,2){ raise } }
38
+ assert_raises(RuntimeError){ attempt(2, 2){ raise } }
33
39
  end
34
40
 
35
41
  def teardown
@@ -37,4 +43,8 @@ class TC_Attempt < Test::Unit::TestCase
37
43
  @interval = nil
38
44
  @timeout = nil
39
45
  end
46
+
47
+ def self.shutdown
48
+ $stderr = STDERR
49
+ end
40
50
  end
metadata CHANGED
@@ -1,53 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: attempt
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2007-07-31 00:00:00 -06:00
8
- summary: A thin wrapper for begin + rescue + sleep + retry
9
- require_paths:
10
- - lib
11
- email: djberg96@gmail.com
12
- homepage: http://www.rubyforge.org/projects/shards
13
- rubyforge_project:
14
- description: A thin wrapper for begin + rescue + sleep + retry
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.1.2
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Daniel J. Berger
31
- files:
32
- - lib/attempt.rb
33
- - CHANGES
34
- - MANIFEST
35
- - README
36
- - Rakefile
37
- - test/tc_attempt.rb
38
- test_files:
39
- - test/tc_attempt.rb
40
- rdoc_options: []
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-01 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: test-unit
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.3
24
+ version:
25
+ description: " The attempt library provides a thin wrapper for the typical\n begin/rescue/sleep/retry dance. This is used by programmers to robustly\n handle flaky connections where it's often better to try again rather\n than fail immediately.\n"
26
+ email: djberg96@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
41
30
 
42
31
  extra_rdoc_files:
43
32
  - README
44
33
  - CHANGES
45
34
  - MANIFEST
46
- executables: []
47
-
48
- extensions: []
35
+ files:
36
+ - lib/attempt.rb
37
+ - test/test_attempt.rb
38
+ - README
39
+ - CHANGES
40
+ - MANIFEST
41
+ has_rdoc: true
42
+ homepage: http://www.rubyforge.org/projects/shards
43
+ licenses:
44
+ - Artistic 2.0
45
+ post_install_message:
46
+ rdoc_options: []
49
47
 
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
50
62
  requirements: []
51
63
 
52
- dependencies: []
53
-
64
+ rubyforge_project: shards
65
+ rubygems_version: 1.3.5
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: A thin wrapper for begin + rescue + sleep + retry
69
+ test_files:
70
+ - test/test_attempt.rb
data/Rakefile DELETED
@@ -1,20 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
-
4
- desc "Install the attempt package (non-gem)"
5
- task :install do
6
- cp 'lib/attempt.rb', Config::CONFIG['sitelibdir'], :verbose => true
7
- end
8
-
9
- desc "Install the attempt package as a gem"
10
- task :install_gem do
11
- ruby 'attempt.gemspec'
12
- file = Dir["*.gem"].first
13
- sh "gem install #{file}"
14
- end
15
-
16
- Rake::TestTask.new do |t|
17
- t.libs << 'lib'
18
- t.warning = true
19
- t.test_files = FileList['test/tc*']
20
- end