qed 2.8.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby CHANGED
@@ -42,10 +42,10 @@ revision: 0
42
42
  created: '2009-06-16'
43
43
  summary: Quod Erat Demonstrandum
44
44
  title: QED
45
- version: 2.8.0
45
+ version: 2.8.1
46
46
  scm_uri: http://github.com/rubyworks/qed/blob/master/
47
47
  name: qed
48
48
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
49
49
 
50
50
  utilizing Literate Programming techniques.'
51
- date: '2012-01-25'
51
+ date: '2012-02-01'
@@ -0,0 +1,31 @@
1
+ = COPYRIGHT NOTICES
2
+
3
+ == QED
4
+
5
+ Copyright:: (c) 2009 Rubyworks, Thomas Sawyer
6
+ License:: BSD-2-Clause
7
+ Website:: http://rubyworks.github.com/qed
8
+
9
+ Copyright 2009 Rubyworks. All rights reserved.
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ * Redistributions of source code must retain the above copyright notice,
15
+ this list of conditions and the following disclaimer.
16
+
17
+ * Redistributions in binary form must reproduce the above copyright notice,
18
+ this list of conditions and the following disclaimer in the documentation
19
+ and/or other materials provided with the distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY Thomas Sawyer ``AS IS'' AND ANY EXPRESS
22
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24
+ NO EVENT SHALL Thomas Sawyer OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
@@ -1,5 +1,17 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 2.8.1 | 2012-02-01
4
+
5
+ This release fixes a bug in the parsing of `#=>` notation. It also
6
+ adds syntax highlighting to qedoc generated documentation. It does
7
+ this with highlight.js.
8
+
9
+ Changes:
10
+
11
+ * Fix parsing of `#=>`.
12
+ * Add highlight.js to qedocs.
13
+
14
+
3
15
  == 2.8.0 | 2012-01-19
4
16
 
5
17
  IMPORTANT: READ THIS RELEASE NOTICE! This release makes a minor
@@ -42,10 +42,10 @@ revision: 0
42
42
  created: '2009-06-16'
43
43
  summary: Quod Erat Demonstrandum
44
44
  title: QED
45
- version: 2.8.0
45
+ version: 2.8.1
46
46
  scm_uri: http://github.com/rubyworks/qed/blob/master/
47
47
  name: qed
48
48
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
49
49
 
50
50
  utilizing Literate Programming techniques.'
51
- date: '2012-01-25'
51
+ date: '2012-02-01'
@@ -156,6 +156,9 @@ module QED
156
156
  end
157
157
  end
158
158
 
159
+ # TODO: Use Nokogiri to find all <pre>'s with preceeding <p>'s that have text ending in `:`, and
160
+ # add the class `no-highlight`. If no preceeding `:` add class ruby.
161
+
159
162
  out << "#{text}\n"
160
163
  end
161
164
 
@@ -100,8 +100,6 @@
100
100
  .wikistyle pre.console code{padding:0!important;font-size:100%!important;background-color:black!important;border:none!important;color:white!important;}
101
101
  .wikistyle pre.console span{color:#888!important;}
102
102
  .wikistyle pre.console span.command{color:yellow!important;}
103
-
104
- .title { font-size: 2em; }
105
103
  </style>
106
104
 
107
105
  <% if css %>
@@ -111,6 +109,16 @@
111
109
  <!-- JQuery is needed -->
112
110
  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript" language="javascript"></script>
113
111
 
112
+ <!-- Highlight.js -->
113
+ <script src="http://yandex.st/highlightjs/6.1/highlight.min.js"></script>
114
+ <link rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/github.min.css">
115
+
116
+ <script>
117
+ $(document).ready(function() {
118
+ $('pre').each(function(i, e) {hljs.highlightBlock(e)});
119
+ });
120
+ </script>
121
+
114
122
  </head>
115
123
 
116
124
  <body class="wikistyle">
@@ -131,7 +139,7 @@
131
139
  <!-- TODO: find a preminatn image on web to use -->
132
140
  <!-- <img src="http://www.cdnjs.com/images/poweredbycloudflare.png" align="left" style="padding-right: 10px;" alt=""/> -->
133
141
 
134
- <div class="title"><%= title %></div>
142
+ <div style="font-size: 2em"><%= title %></div>
135
143
 
136
144
  <h1>Table of Contents</h1>
137
145
 
@@ -0,0 +1,41 @@
1
+ module QED
2
+
3
+ # Expiremntal quick parser.
4
+ #
5
+ # NOT USED YET!
6
+ #
7
+ class QuickParser #:nodoc:
8
+
9
+ #
10
+ def initialize(demo)
11
+ @lines = demo.lines
12
+ end
13
+
14
+ #
15
+ def parse
16
+ flush = true
17
+ script = []
18
+
19
+ @lines.each do |line|
20
+ case line
21
+ when /^\s/
22
+ if flush
23
+ script << "Test do\n"
24
+ end
25
+ script << line
26
+ flush = false
27
+ else
28
+ if !flush
29
+ script << "end"
30
+ end
31
+ script << "# " + line
32
+ flush = true
33
+ end
34
+ end
35
+
36
+ script.join()
37
+ end
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,132 @@
1
+ module QED
2
+ module Reporter #:nodoc:
3
+
4
+ require 'ansi/terminal'
5
+ require 'qed/reporter/abstract'
6
+
7
+ # Linear reporter limits each step to a single line.
8
+ #
9
+ class Linear < Abstract
10
+
11
+ #
12
+ def before_session(session)
13
+ @width = ANSI::Terminal.terminal_width - 12
14
+ @start_time = Time.now
15
+ puts "[INFO] Session @ #{Time.now}".ansi(:bold)
16
+ end
17
+
18
+ #
19
+ def before_demo(demo)
20
+ file = localize_file(demo.file)
21
+ puts "[DEMO] #{file}".ansi(:bold)
22
+ end
23
+
24
+ #
25
+ def before_applique(step)
26
+ super(step)
27
+ #post
28
+ str = "[NOTE] #{step.explain.gsub(/\s+/,' ')} "[0,@width]
29
+ pad = @width - str.size + 1
30
+ print str + (' ' * pad)
31
+ puts "[#{timestamp}]"
32
+ end
33
+
34
+ #
35
+ def pass(step)
36
+ super(step)
37
+
38
+ print_step(step, 'PASS', :green)
39
+
40
+ #s = []
41
+ #s << "PASS".ansi(:green)
42
+ #puts s.join("\n")
43
+ end
44
+
45
+ #
46
+ def fail(step, assertion)
47
+ super(step, assertion)
48
+
49
+ print_step(step, 'FAIL', :red)
50
+
51
+ #puts "FAIL".ansi(:red)
52
+
53
+ s = []
54
+ s << assertion.class.name
55
+ s << assertion.message
56
+
57
+ backtrace = sane_backtrace(assertion)
58
+ backtrace.each do |bt|
59
+ s << bt
60
+ s << code_snippet(bt)
61
+ end
62
+
63
+ puts s.join("\n").tabto(8)
64
+ end
65
+
66
+ #
67
+ def error(step, exception)
68
+ super(step, exception)
69
+
70
+ print_step(step, 'ERRO', :red)
71
+
72
+ #puts "ERROR".ansi(:red)
73
+
74
+ s = []
75
+ s << assertion.class.name
76
+ s << assertion.message
77
+
78
+ backtrace = sane_backtrace(assertion)
79
+ backtrace.each do |bt|
80
+ s << bt
81
+ s << code_snippet(bt)
82
+ end
83
+
84
+ puts s.join("\n").tabto(8)
85
+ end
86
+
87
+ #
88
+ def after_session(session)
89
+ puts "[INFO] %s demos, %s steps: %s failures, %s errors (%s/%s assertions)" % get_tally
90
+ puts "[INFO] Finished in %.5f seconds." % [Time.now - @start_time]
91
+ puts "[INFO] End Session @ #{Time.now}".ansi(:bold)
92
+ end
93
+
94
+ private
95
+
96
+ def timestamp
97
+ (Time.now - @start_time).to_s[0,8]
98
+ end
99
+
100
+ #
101
+ def print(str)
102
+ @appendable = true
103
+ io.print str
104
+ end
105
+
106
+ #
107
+ def puts(str)
108
+ @appendable = false
109
+ io.puts str
110
+ end
111
+
112
+ #
113
+ def post
114
+ io.puts if @appendable
115
+ @appendable = false
116
+ end
117
+
118
+ #
119
+ def print_step(step, stat, *color)
120
+ desc = step.explain.gsub(/\s+/,' ')
121
+ if desc.start_with?('=') or desc.start_with?('#')
122
+ desc = desc.ansi(:magenta)
123
+ end
124
+ str = "[#{stat}] #{desc} "[0,@width]
125
+ pad = @width - str.unansi.size + 1
126
+ print (str + (' ' * pad)).ansi(*color)
127
+ puts "[#{timestamp}]"
128
+ end
129
+ end
130
+
131
+ end#module Reporter
132
+ end#module QED
@@ -229,8 +229,8 @@ module QED
229
229
  code = @example_lines.map{ |lineno, line| line }.join("")
230
230
  #code.gsub!(/\n\s*\#\ ?\=\>/, '.assert = ')
231
231
  #code.gsub!(/\s*\#\ ?\=\>/, '.assert = ')
232
- code.gsub!(/\n\s*\#\ ?\=\>(.*?)$/, ' == \1 ? assert(true) : assert(false, "not returned -- \1")') # TODO: what kind of error ?
233
- code.gsub!(/\s*\#\ ?\=\>(.*?)$/, ' == \1 ? assert(true) : assert(false, "not returned -- \1")')
232
+ code.gsub!(/\n\s*\#\ ?\=\>(.*?)$/, ' == \1 ? assert(true) : assert(false, %{not returned -- \1})') # TODO: what kind of error ?
233
+ code.gsub!(/\s*\#\ ?\=\>(.*?)$/, ' == \1 ? assert(true) : assert(false, %{not returned -- \1})')
234
234
  code
235
235
  end
236
236
 
@@ -0,0 +1 @@
1
+ require 'ae'
@@ -0,0 +1,8 @@
1
+ == Applique: Quote
2
+
3
+ This applique simply provide support to `quote.rdoc` demo.
4
+
5
+ When "we want to make an example out of the following text" do |text|
6
+ @quote_text = text
7
+ end
8
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-25 00:00:00.000000000 Z
12
+ date: 2012-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ansi
16
- requirement: &25621900 !ruby/object:Gem::Requirement
16
+ requirement: &30707900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *25621900
24
+ version_requirements: *30707900
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: facets
27
- requirement: &25620880 !ruby/object:Gem::Requirement
27
+ requirement: &30723160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.8'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *25620880
35
+ version_requirements: *30723160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: brass
38
- requirement: &25620240 !ruby/object:Gem::Requirement
38
+ requirement: &30722380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *25620240
46
+ version_requirements: *30722380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: confection
49
- requirement: &25619480 !ruby/object:Gem::Requirement
49
+ requirement: &30721540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *25619480
57
+ version_requirements: *30721540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: detroit
60
- requirement: &25618820 !ruby/object:Gem::Requirement
60
+ requirement: &30720900 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *25618820
68
+ version_requirements: *30720900
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ae
71
- requirement: &25616480 !ruby/object:Gem::Requirement
71
+ requirement: &30720020 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *25616480
79
+ version_requirements: *30720020
80
80
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
81
81
 
82
82
  utilizing Literate Programming techniques.'
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files:
90
90
  - HISTORY.rdoc
91
91
  - README.rdoc
92
+ - COPYING.rdoc
92
93
  files:
93
94
  - .ruby
94
95
  - .yardopts
@@ -108,9 +109,11 @@ files:
108
109
  - lib/qed/helpers/file_fixtures.rb
109
110
  - lib/qed/helpers/shell_session.rb
110
111
  - lib/qed/parser.rb
112
+ - lib/qed/qparser.rb
111
113
  - lib/qed/reporter/abstract.rb
112
114
  - lib/qed/reporter/dotprogress.rb
113
115
  - lib/qed/reporter/html.rb
116
+ - lib/qed/reporter/linear.rb
114
117
  - lib/qed/reporter/tapy.rb
115
118
  - lib/qed/reporter/verbatim.rb
116
119
  - lib/qed/scope.rb
@@ -130,10 +133,12 @@ files:
130
133
  - qed/10_constant_lookup.rdoc
131
134
  - qed/11_embedded_rules.rdoc
132
135
  - qed/99_issues/02_topcode.rdoc
136
+ - qed/applique/ae.rb
133
137
  - qed/applique/constant.rb
134
138
  - qed/applique/env.rb
135
139
  - qed/applique/fileutils.rb
136
140
  - qed/applique/markup.rb
141
+ - qed/applique/quote.rdoc
137
142
  - qed/applique/toplevel.rb
138
143
  - qed/helpers/advice.rb
139
144
  - qed/helpers/toplevel.rb
@@ -141,6 +146,7 @@ files:
141
146
  - qed/samples/table.yml
142
147
  - HISTORY.rdoc
143
148
  - README.rdoc
149
+ - COPYING.rdoc
144
150
  homepage: http://rubyworks.github.com/qed
145
151
  licenses:
146
152
  - BSD-2-Clause
@@ -162,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
168
  version: '0'
163
169
  requirements: []
164
170
  rubyforge_project:
165
- rubygems_version: 1.8.10
171
+ rubygems_version: 1.8.11
166
172
  signing_key:
167
173
  specification_version: 3
168
174
  summary: Quod Erat Demonstrandum