dots 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +7 -0
- data/README.rdoc +6 -6
- data/Rakefile +3 -1
- data/dots.gemspec +2 -2
- data/features/dots.feature +1 -1
- data/features/step_definitions/dots_steps.rb +1 -1
- data/lib/dots.rb +10 -11
- data/spec/dots_spec.rb +10 -6
- metadata +2 -2
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
..............F........F.FFFFEEEEEEEEEEFFFFF.F.............................
|
11
11
|
.....................................................................ready!
|
12
12
|
|
13
|
-
Free progress dots for your scripts
|
13
|
+
Free progress dots for your scripts, <tt>Test::Unit</tt>-style.
|
14
14
|
|
15
15
|
http://github.com/stephencelis/dots
|
16
16
|
|
@@ -70,11 +70,11 @@ Oh, and for heavy, non-iterative processing:
|
|
70
70
|
|
71
71
|
(c) 2009-* Stephen Celis, stephen@stephencelis.com.
|
72
72
|
|
73
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
74
|
-
of this software and associated documentation files (the "Software"), to deal
|
75
|
-
in the Software without restriction, including without limitation the rights
|
76
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
77
|
-
copies of the Software, and to permit persons to whom the Software is
|
73
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
74
|
+
of this software and associated documentation files (the "Software"), to deal
|
75
|
+
in the Software without restriction, including without limitation the rights
|
76
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
77
|
+
copies of the Software, and to permit persons to whom the Software is
|
78
78
|
furnished to do so, subject to the following conditions:
|
79
79
|
|
80
80
|
The above copyright notice and this permission notice shall be included in all
|
data/Rakefile
CHANGED
@@ -23,11 +23,13 @@ rescue LoadError
|
|
23
23
|
end
|
24
24
|
|
25
25
|
begin
|
26
|
+
require "cucumber"
|
26
27
|
require "cucumber/rake/task"
|
27
28
|
|
28
29
|
desc "Run all features"
|
29
30
|
Cucumber::Rake::Task.new :features do |t|
|
30
|
-
t.cucumber_opts = "--no-source --format=progress
|
31
|
+
t.cucumber_opts = "features --no-source --format=progress"
|
32
|
+
t.fork = false
|
31
33
|
end
|
32
34
|
|
33
35
|
defaults << :features
|
data/dots.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{dots}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Stephen Celis"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-12-06}
|
10
10
|
s.description = %q{Free progress dots for your scripts.}
|
11
11
|
s.email = ["stephen@stephencelis.com"]
|
12
12
|
s.extra_rdoc_files = ["History.rdoc", "Manifest.txt", "README.rdoc"]
|
data/features/dots.feature
CHANGED
@@ -39,7 +39,7 @@ Then(/^I should see (\d+) "([^\"])" dots?$/) do |dot, number|
|
|
39
39
|
end
|
40
40
|
|
41
41
|
Then(/^I should see how long it took$/) do
|
42
|
-
@content.should match(/Finished in
|
42
|
+
@content.should match(/Finished in .+? seconds/)
|
43
43
|
end
|
44
44
|
|
45
45
|
Then(/^I should see "([^\"]*)" (\d+) times?$/) do |message, number|
|
data/lib/dots.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Dots makes dots.
|
2
2
|
module Dots
|
3
|
-
VERSION = "0.0.
|
3
|
+
VERSION = "0.0.2"
|
4
4
|
|
5
5
|
class InvalidDot < StandardError
|
6
6
|
end
|
@@ -57,7 +57,7 @@ module Dots
|
|
57
57
|
# ?> end
|
58
58
|
# E...F.
|
59
59
|
# Finished in 0.000430 seconds.
|
60
|
-
#
|
60
|
+
#
|
61
61
|
# 1) Error
|
62
62
|
# ZeroDivisionError: divided by 0
|
63
63
|
# with <0>
|
@@ -66,26 +66,25 @@ module Dots
|
|
66
66
|
# (irb):2:in `irb_binding'
|
67
67
|
# /usr/local/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
|
68
68
|
# /usr/local/lib/ruby/1.8/irb/workspace.rb:52
|
69
|
-
#
|
69
|
+
#
|
70
70
|
# 2) Failure
|
71
|
-
# No fours!
|
71
|
+
# No fours!
|
72
72
|
# with <4>
|
73
73
|
# [(irb):4]
|
74
|
+
#
|
75
|
+
# 6 total, 4 passed, 1 failed, 1 erred
|
76
|
+
# => 0..5
|
74
77
|
def each_with_dots(io = $stdout)
|
75
78
|
old_sync, io.sync = io.sync, true
|
76
79
|
exceptions, passed, start = [], 0, Time.now
|
77
|
-
trap("INT") { return io.puts
|
80
|
+
trap("INT") { return io.puts("abort!") }
|
78
81
|
each do |object|
|
79
82
|
begin
|
80
83
|
yield object
|
81
84
|
io.print Dots["."]
|
82
85
|
passed += 1
|
83
86
|
rescue => e
|
84
|
-
|
85
|
-
io.print Dots["F"]
|
86
|
-
else
|
87
|
-
io.print Dots["E"]
|
88
|
-
end
|
87
|
+
io.print Dots[e.is_a?(RuntimeError) ? "F" : "E"]
|
89
88
|
exceptions << [object, e] unless exceptions.nil?
|
90
89
|
end
|
91
90
|
end
|
@@ -115,7 +114,7 @@ module Dots
|
|
115
114
|
# ?> end
|
116
115
|
# .....=> 5
|
117
116
|
def dots(interval = 1, io = $stdout)
|
118
|
-
old_sync, io.sync = io.sync, true
|
117
|
+
old_sync, io.sync = io.sync, true
|
119
118
|
|
120
119
|
thread = Thread.new do
|
121
120
|
dot = lambda do
|
data/spec/dots_spec.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require "spec/mocks"
|
2
2
|
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
|
3
3
|
require "dots"
|
4
|
-
include Enumerable # To bring 1.8.7's Enumerator top-level.
|
5
4
|
|
6
5
|
def enumerator?
|
7
6
|
RUBY_VERSION >= "1.8.7"
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
include Enumerable # To bring 1.8.7's Enumerator top-level.
|
10
|
+
|
11
|
+
describe "Dots" do
|
11
12
|
it 'should be configurable for "."' do
|
12
13
|
Dots["."].should == "."
|
13
14
|
proc { Dots["."] = ":)" }.should_not raise_error
|
@@ -35,19 +36,22 @@ end
|
|
35
36
|
describe "Monkey-patched" do
|
36
37
|
describe "Enumerable.instance_methods" do
|
37
38
|
it do
|
38
|
-
Enumerable.instance_methods.
|
39
|
+
instance_methods = Enumerable.instance_methods.map { |m| m.to_s }
|
40
|
+
instance_methods.should include("each_with_dots")
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
describe "Enumerator.instance_methods" do
|
43
45
|
it do
|
44
|
-
Enumerator.instance_methods.
|
46
|
+
instance_methods = Enumerator.instance_methods.map { |m| m.to_s }
|
47
|
+
instance_methods.should include("with_dots")
|
45
48
|
end
|
46
49
|
end if enumerator?
|
47
50
|
|
48
51
|
describe "Kernel.methods" do
|
49
52
|
it do
|
50
|
-
Kernel.private_instance_methods.
|
53
|
+
instance_methods = Kernel.private_instance_methods.map { |m| m.to_s }
|
54
|
+
instance_methods.should include("dots")
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
@@ -109,7 +113,7 @@ end if enumerator?
|
|
109
113
|
describe "with_dots" do
|
110
114
|
it "should print dots" do
|
111
115
|
Dots.should_receive(:[]).with "."
|
112
|
-
dots(1, StringIO.new) {}
|
116
|
+
dots(1, StringIO.new) { sleep 0.001 }
|
113
117
|
end
|
114
118
|
|
115
119
|
it "should require a block" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dots
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Celis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-06 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|