exemplor 3000.1.0 → 3000.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -1
- data/Rakefile +4 -5
- data/VERSION +1 -1
- data/exemplor.gemspec +106 -0
- data/lib/result_printer.rb +16 -15
- metadata +10 -4
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
task :default => [:
|
1
|
+
task :default => [:examples]
|
2
|
+
task :test => :examples
|
2
3
|
|
3
4
|
begin
|
4
5
|
require 'jeweler'
|
@@ -21,7 +22,5 @@ end
|
|
21
22
|
|
22
23
|
desc "runs the examples with the development version (i.e. the one in this dir) of exemplor"
|
23
24
|
task :dev, [:filter] do |_,args|
|
24
|
-
ruby '-
|
25
|
-
end
|
26
|
-
|
27
|
-
task :test => :examples
|
25
|
+
ruby '-I', 'lib', 'examples.rb', (args.filter || '')
|
26
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3000.
|
1
|
+
3000.2.0
|
data/exemplor.gemspec
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{exemplor}
|
8
|
+
s.version = "3000.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Myles Byrne"]
|
12
|
+
s.date = %q{2010-05-30}
|
13
|
+
s.email = %q{myles@myles.id.au}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"README.md",
|
16
|
+
"TODO"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.md",
|
21
|
+
"Rakefile",
|
22
|
+
"TODO",
|
23
|
+
"VERSION",
|
24
|
+
"examples.rb",
|
25
|
+
"examples/an_error.rb",
|
26
|
+
"examples/assertion_failure.rb",
|
27
|
+
"examples/assertion_success.rb",
|
28
|
+
"examples/assertion_success_and_failure.rb",
|
29
|
+
"examples/assertion_success_and_info.rb",
|
30
|
+
"examples/check_parsing.rb",
|
31
|
+
"examples/checking_nil.rb",
|
32
|
+
"examples/failure_halts_execution.rb",
|
33
|
+
"examples/foobar.rb",
|
34
|
+
"examples/helpers.rb",
|
35
|
+
"examples/multi_show.rb",
|
36
|
+
"examples/no_checks.rb",
|
37
|
+
"examples/no_checks_non_string.rb",
|
38
|
+
"examples/oneliner.rb",
|
39
|
+
"examples/show_with_disambiguation.rb",
|
40
|
+
"examples/showing_classes.rb",
|
41
|
+
"examples/simple_show.rb",
|
42
|
+
"examples/ten_percent_failures.rb",
|
43
|
+
"examples/with_setup.rb",
|
44
|
+
"exemplor.gemspec",
|
45
|
+
"lib/checker.rb",
|
46
|
+
"lib/command.rb",
|
47
|
+
"lib/environment.rb",
|
48
|
+
"lib/examples.rb",
|
49
|
+
"lib/exemplor.rb",
|
50
|
+
"lib/ext.rb",
|
51
|
+
"lib/result_printer.rb",
|
52
|
+
"vendor/orderedhash-0.0.6/gemspec.rb",
|
53
|
+
"vendor/orderedhash-0.0.6/install.rb",
|
54
|
+
"vendor/orderedhash-0.0.6/lib/orderedautohash.rb",
|
55
|
+
"vendor/orderedhash-0.0.6/lib/orderedhash.rb",
|
56
|
+
"vendor/term-ansicolor-1.0.5/CHANGES",
|
57
|
+
"vendor/term-ansicolor-1.0.5/COPYING",
|
58
|
+
"vendor/term-ansicolor-1.0.5/README",
|
59
|
+
"vendor/term-ansicolor-1.0.5/Rakefile",
|
60
|
+
"vendor/term-ansicolor-1.0.5/VERSION",
|
61
|
+
"vendor/term-ansicolor-1.0.5/bin/cdiff",
|
62
|
+
"vendor/term-ansicolor-1.0.5/bin/decolor",
|
63
|
+
"vendor/term-ansicolor-1.0.5/examples/example.rb",
|
64
|
+
"vendor/term-ansicolor-1.0.5/install.rb",
|
65
|
+
"vendor/term-ansicolor-1.0.5/lib/term/ansicolor.rb",
|
66
|
+
"vendor/term-ansicolor-1.0.5/lib/term/ansicolor/version.rb",
|
67
|
+
"vendor/term-ansicolor-1.0.5/tests/ansicolor_test.rb"
|
68
|
+
]
|
69
|
+
s.homepage = %q{http://github.com/quackingduck/exemplor}
|
70
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
71
|
+
s.require_paths = ["lib"]
|
72
|
+
s.rubygems_version = %q{1.3.7}
|
73
|
+
s.summary = %q{A light-weight, low-fi way to provide executable usage examples of your code.}
|
74
|
+
s.test_files = [
|
75
|
+
"examples/an_error.rb",
|
76
|
+
"examples/assertion_failure.rb",
|
77
|
+
"examples/assertion_success.rb",
|
78
|
+
"examples/assertion_success_and_failure.rb",
|
79
|
+
"examples/assertion_success_and_info.rb",
|
80
|
+
"examples/check_parsing.rb",
|
81
|
+
"examples/checking_nil.rb",
|
82
|
+
"examples/failure_halts_execution.rb",
|
83
|
+
"examples/foobar.rb",
|
84
|
+
"examples/helpers.rb",
|
85
|
+
"examples/multi_show.rb",
|
86
|
+
"examples/no_checks.rb",
|
87
|
+
"examples/no_checks_non_string.rb",
|
88
|
+
"examples/oneliner.rb",
|
89
|
+
"examples/show_with_disambiguation.rb",
|
90
|
+
"examples/showing_classes.rb",
|
91
|
+
"examples/simple_show.rb",
|
92
|
+
"examples/ten_percent_failures.rb",
|
93
|
+
"examples/with_setup.rb"
|
94
|
+
]
|
95
|
+
|
96
|
+
if s.respond_to? :specification_version then
|
97
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
98
|
+
s.specification_version = 3
|
99
|
+
|
100
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
101
|
+
else
|
102
|
+
end
|
103
|
+
else
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
data/lib/result_printer.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
module Exemplor
|
2
3
|
|
3
4
|
# todo: remove this dependency at some point
|
@@ -24,8 +25,8 @@ module Exemplor
|
|
24
25
|
hsh = OrderedHash do |o|
|
25
26
|
o['name'] = self.name
|
26
27
|
o['status'] = case status = self.status
|
27
|
-
when :info
|
28
|
-
when :infos
|
28
|
+
when :info then 'info (no checks)'
|
29
|
+
when :infos then 'info (with checks)'
|
29
30
|
else ; status.to_s
|
30
31
|
end
|
31
32
|
o['result'] = self.result
|
@@ -36,10 +37,10 @@ module Exemplor
|
|
36
37
|
def fancy
|
37
38
|
Exemplor.load_ansicolor
|
38
39
|
case status
|
39
|
-
when :info
|
40
|
-
when :success
|
41
|
-
when :infos
|
42
|
-
when :failure
|
40
|
+
when :info then blue format_info(name, result)
|
41
|
+
when :success then green icon(status) + ' ' + name
|
42
|
+
when :infos then blue icon(status) + ' ' + name + "\n" + fancy_result(result).indent
|
43
|
+
when :failure then red icon(status) + ' ' + name + "\n" + fancy_result(result).indent
|
43
44
|
when :error
|
44
45
|
class_and_message = "#{result['class']} - #{result['message']}"
|
45
46
|
backtrace = result['backtrace'].join("\n")
|
@@ -51,9 +52,9 @@ module Exemplor
|
|
51
52
|
result.map do |r|
|
52
53
|
status, name, result = r['status'].to_sym, r['name'], r['result']
|
53
54
|
case status
|
54
|
-
when :success
|
55
|
-
when :failure
|
56
|
-
when :info
|
55
|
+
when :success then green icon(status) + ' ' + name
|
56
|
+
when :failure then red icon(status) + ' ' + name
|
57
|
+
when :info then blue format_info(name, result)
|
57
58
|
end
|
58
59
|
end.join("\n")
|
59
60
|
end
|
@@ -61,11 +62,11 @@ module Exemplor
|
|
61
62
|
def icon(status)
|
62
63
|
case status.to_sym
|
63
64
|
# in some font faces, the big dot is little and the little dot is big. sadness
|
64
|
-
when :info
|
65
|
-
when :infos
|
66
|
-
when :failure
|
67
|
-
when :success
|
68
|
-
when :error
|
65
|
+
when :info then '•'
|
66
|
+
when :infos then '∙'
|
67
|
+
when :failure then '✗'
|
68
|
+
when :success then '✓'
|
69
|
+
when :error then '☠' # skull and crossbone, aww yeah
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
@@ -83,4 +84,4 @@ module Exemplor
|
|
83
84
|
end
|
84
85
|
|
85
86
|
end
|
86
|
-
end
|
87
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exemplor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 24023
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 3000
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 3000.
|
10
|
+
version: 3000.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Myles Byrne
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-05-30 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -53,6 +54,7 @@ files:
|
|
53
54
|
- examples/simple_show.rb
|
54
55
|
- examples/ten_percent_failures.rb
|
55
56
|
- examples/with_setup.rb
|
57
|
+
- exemplor.gemspec
|
56
58
|
- lib/checker.rb
|
57
59
|
- lib/command.rb
|
58
60
|
- lib/environment.rb
|
@@ -86,23 +88,27 @@ rdoc_options:
|
|
86
88
|
require_paths:
|
87
89
|
- lib
|
88
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
89
92
|
requirements:
|
90
93
|
- - ">="
|
91
94
|
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
92
96
|
segments:
|
93
97
|
- 0
|
94
98
|
version: "0"
|
95
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
96
101
|
requirements:
|
97
102
|
- - ">="
|
98
103
|
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
99
105
|
segments:
|
100
106
|
- 0
|
101
107
|
version: "0"
|
102
108
|
requirements: []
|
103
109
|
|
104
110
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.3.
|
111
|
+
rubygems_version: 1.3.7
|
106
112
|
signing_key:
|
107
113
|
specification_version: 3
|
108
114
|
summary: A light-weight, low-fi way to provide executable usage examples of your code.
|