qed 2.8.8 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ config :qed do
4
4
  # default configuration
5
5
  end
6
6
 
7
- config :qed, :simplecov do
7
+ config :qed, :profile=>:simplecov, :preset=>true do
8
8
  require 'simplecov'
9
9
  SimpleCov.start do
10
10
  coverage_dir 'log/coverage'
@@ -12,7 +12,7 @@ config :qed, :simplecov do
12
12
  end
13
13
  end
14
14
 
15
- config :qed, :example do
15
+ config :qed, :profile=>:example do
16
16
  puts ("*" * 78)
17
17
  puts
18
18
 
data/.ruby CHANGED
@@ -10,18 +10,30 @@ copyrights:
10
10
  license: BSD-2-Clause
11
11
  requirements:
12
12
  - name: ansi
13
+ - name: brass
13
14
  - name: facets
14
15
  version: 2.8+
15
- - name: brass
16
- - name: confection
17
- - name: detroit
16
+ - name: courtier
18
17
  groups:
19
- - build
18
+ - optional
19
+ development: true
20
+ - name: blankslate
21
+ groups:
22
+ - optional
23
+ - test
20
24
  development: true
21
25
  - name: ae
22
26
  groups:
23
27
  - test
24
28
  development: true
29
+ - name: detroit
30
+ groups:
31
+ - build
32
+ development: true
33
+ - name: fire
34
+ groups:
35
+ - build
36
+ development: true
25
37
  dependencies: []
26
38
  alternatives: []
27
39
  conflicts: []
@@ -30,10 +42,18 @@ repositories:
30
42
  scm: git
31
43
  name: upstream
32
44
  resources:
33
- home: http://rubyworks.github.com/qed
34
- code: http://github.com/rubyworks/qed
35
- mail: http://groups.google.com/groups/rubyworks-mailinglist
36
- bugs: http://github.com/rubyworks/qed/issues
45
+ - uri: http://rubyworks.github.com/qed
46
+ name: home
47
+ type: home
48
+ - uri: http://github.com/rubyworks/qed
49
+ name: code
50
+ type: code
51
+ - uri: http://groups.google.com/groups/rubyworks-mailinglist
52
+ name: mail
53
+ type: mail
54
+ - uri: http://github.com/rubyworks/qed/issues
55
+ name: bugs
56
+ type: bugs
37
57
  extra: {}
38
58
  load_path:
39
59
  - lib
@@ -41,10 +61,10 @@ revision: 0
41
61
  created: '2009-06-16'
42
62
  summary: Quod Erat Demonstrandum
43
63
  title: QED
44
- version: 2.8.8
64
+ version: 2.9.0
45
65
  name: qed
46
66
  webcvs: http://github.com/rubyworks/qed/blob/master/
47
67
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
48
68
 
49
69
  utilizing Literate Programming techniques.'
50
- date: '2012-03-14'
70
+ date: '2012-04-14'
@@ -1,8 +1,27 @@
1
1
  = RELEASE HISTORY
2
2
 
3
- == 2.8.8 | 2012-30-17
3
+ == 2.9.0 | 2012-05-19
4
4
 
5
- Feel like a heel after the last four releases. The simplist solution
5
+ IMPORTANT! The `.qed` configuration file is no longer used for configuration.
6
+ Either use a unified `Config.rb` file or require a special config file via the
7
+ `-r` option, e.g. `qed -r ./config/cov.rb`.
8
+
9
+ Configuration is now handled by the RC library. The only other
10
+ form of configuration supported is that of requiring a special file
11
+ directly via `-r ./path/to/file.rb`. This keeps the code as
12
+ simple as possible without giving-up functionality. Because the old
13
+ `.qed` configuration file is no longer supported, this release has
14
+ a major version bump.
15
+
16
+ Changes:
17
+
18
+ * Utilize the RC configuration management library.
19
+ * Improve hash-arrow assertion notation.
20
+
21
+
22
+ == 2.8.8 | 2012-03-17
23
+
24
+ Feel like a heel after the last four releases. The simplest solution
6
25
  to the configuration issue is to allow traditional configuration
7
26
  trump confection based configuration. If the former is used, then
8
27
  the later will never even load. Problem solved.
@@ -21,13 +40,13 @@ variable `config='legacy'`.
21
40
 
22
41
  Changes:
23
42
 
24
- * Fix bug that prevented deafault demo locations from being used.
43
+ * Fix bug that prevented default demo locations from being used.
25
44
  * Change environment variable to config='legacy' to deactivate Confection.
26
45
 
27
46
 
28
47
  == 2.8.6 | 2012-03-15
29
48
 
30
- This release simply make the configuration more versitile by supporting
49
+ This release simply make the configuration more versatile by supporting
31
50
  Confection, task directory and traditional `.qed` configuration.
32
51
 
33
52
  Changes:
@@ -58,7 +77,7 @@ Changes:
58
77
  == 2.8.3 | 2012-03-14 18:00
59
78
 
60
79
  What a difference a week makes ;) The Confection library has been substantially
61
- improved and if that trend contiunes at all then I think it will be well worth
80
+ improved and if that trend continues at all then I think it will be well worth
62
81
  supporting. So with this release QED will again move configuration handling
63
82
  over to Confection. Jump over to the Confection project to learn how to use it.
64
83
  In short, this release reverts the previous release. Along with this change,
@@ -80,8 +99,8 @@ independent file. The use of the Confection library was a "noble
80
99
  idea", but in the end not one that's likely to gain traction among
81
100
  developers in general, so we have decided to revert back to the
82
101
  more traditional `.qed` config file. However, we also added built-in
83
- support for `task/qed.rb`, which we encourgage so as to promote
84
- clean project structures. Further, QED also suppots the `.map` YAML
102
+ support for `task/qed.rb`, which we encourage so as to promote
103
+ clean project structures. Further, QED also supports the `.map` YAML
85
104
  configuration file which allows you to move the QED config file
86
105
  wherever you might prefer it. Just add a `qed: path/to/config/file`
87
106
  entry.
@@ -413,7 +432,7 @@ Changes:
413
432
 
414
433
  == 1.1.1 | 2009-09-05
415
434
 
416
- This release
435
+ This release needs a description.
417
436
 
418
437
  Changes:
419
438
 
@@ -29,8 +29,8 @@ any level of abstraction, from unit test to systems tests.
29
29
 
30
30
  * Write tests and documentation in the same breath!
31
31
  * Demos can be RDoc, Markdown or any other conforming text format.
32
- * Uses the excellent AE (Assertive Expressive) library for assertions.
33
- * Table macro allows large sets of data to be tested by the same code.
32
+ * Can use any BRASS compliant assertion framework, such as the the excellent AE (Assertive Expressive) library.
33
+ * Data and Table macros allows large sets of data to be tested by the same code.
34
34
  * Documentation tool provides nice output with jQuery-based TOC.
35
35
 
36
36
 
@@ -38,22 +38,25 @@ any level of abstraction, from unit test to systems tests.
38
38
 
39
39
  === Assertion Syntax
40
40
 
41
- QED uses the AE (Assertive Expressive) library to provide an elegant means to
42
- make assertions. To give a quick overview, assertion can be written as:
41
+ QED can use any BRASS compliant assertions framework. Simply require the library in
42
+ ones applique (see below). Traditionally this has been the AE (Assertive Expressive) library,
43
+ which provides an elegant means to make assertions. To give a quick overview, assertion
44
+ can be written as:
43
45
 
44
46
  4.assert == 5
45
47
 
46
48
  In this example, because 4 != 5, this expression will raise an Assertion
47
49
  exception. QED's Runner class is thus just a means of running and capturing
48
- code blocks containing these assertions.
50
+ code blocks containing such assertions.
49
51
 
50
- You can learn more about AE at http://rubyworks.github.com/ae.
52
+ You can learn more about BRASS and AE at http://rubyworks.github.com/brass and
53
+ http://rubyworks.github.com/ae, repectively.
51
54
 
52
55
  === Document Structure
53
56
 
54
- QED documents are simply text files called *demonstrandum*. Because they
55
- largely consist of free-form descriptive text, they are a practice pure
56
- Literate Programming. For example:
57
+ QED documents are simply text files called *demonstrandum* (demos for short).
58
+ Because they largely consist of free-form descriptive text, they are a practice
59
+ pure Literate Programming. For example:
57
60
 
58
61
  = Example
59
62
 
@@ -91,12 +94,15 @@ To run a document through QED, simply use the +qed+ command.
91
94
  The <code>-v</code> option specifies verbatim mode, which outputs the entire
92
95
  document.
93
96
 
94
- Notice we placed the QED document in a <code>demo/</code> directory, this is no
95
- standard place that demonstrations have to go. They can be placed anywhere
96
- in a project that is preferred (lately I've been use qed/). Also notice the
97
- `<code>01_</code>` prefix in front of the name. While this is not strictly
98
- necessary, it helps order the documents nicely in particular when generating
99
- QED documentation ("QEDocs").
97
+ Notice we placed the QED document in a <code>demo/</code> directory, there is
98
+ no standard place that demonstrations have to go. They can be placed anywhere
99
+ in a project that is preferred (lately I've been use `qed/`). However, the
100
+ `qed` command will look for `qed/`, `demo/`, `demos/` and `spec/` in that order
101
+ if no location is specified.
102
+
103
+ Also notice the use of `<code>01_</code>` prefix in front of the file name.
104
+ While this is not strictly necessary, it helps order the documents nicely,
105
+ in particular when generating QED documentation ("QEDocs").
100
106
 
101
107
  === Utilizing Applique
102
108
 
@@ -128,24 +134,28 @@ how you can put the the system to use.
128
134
 
129
135
  === Configuration
130
136
 
131
- QED uses the {Confection}[http://rubyworks.github.com/confection] library to
137
+ QED uses the {RC}[http://rubyworks.github.com/rc] library to
132
138
  handle configuration.
133
139
 
134
140
  Here's a generally useful example of using SimpleCov to generate a test
135
- coverage report when running your QED demos. Add this to your `Confile`:
141
+ coverage report when running your QED demos. Add this to your `Config.rb`
142
+ file:
136
143
 
137
- config :qed, :profile=>:coverage do
144
+ config :qed, :coverage do
138
145
  require 'simplecov'
139
146
  SimpleCov.start do
140
147
  coverage_dir 'log/coverage'
141
148
  end
142
149
  end
143
150
 
144
- Or omit the `config` method and just add the block's code to `task/qed-coverage.rb`.
145
- Either approch makes the `coverage` profile available to the `qed` command.
151
+ You can use the profile via the `-p/--profile` option on the command line:
146
152
 
147
153
  $ qed -p coverage
148
154
 
155
+ Or by setting the `profile` environment variable.
156
+
157
+ $ profile=coverage qed
158
+
149
159
  === Generating Documentation
150
160
 
151
161
  To generate documentation from QED documents, use the +qedoc+ command.
@@ -166,7 +176,7 @@ QED depends on the following external libraries:
166
176
 
167
177
  * {BRASS}[http://rubyworks.github.com/brass] - Assertions System
168
178
  * {ANSI}[http://rubyworks.github.com/ansi] - ANSI Color Codes
169
- * {Confection}[http://rubyworks.github.com/confection] - Project Tool Configuration
179
+ * {RC}[http://rubyworks.github.com/rc] - Runtime Configuration
170
180
  * {Facets}[http://rubyworks.github.com/facets] - Core Extensions
171
181
 
172
182
  These will be automatically installed when installing QED via RubyGems,
@@ -179,13 +189,26 @@ Optional libraries that are generally useful with QED.
179
189
  Install these individually and require them in your applique to use.
180
190
 
181
191
 
192
+ == Development
193
+
194
+ === Testing
195
+
196
+ QED uses itself for testing, which can be a bit tricky. But works fine for
197
+ the most part. In the future we may add some addition tests via another
198
+ test framework to ensure full coverage. But for now QED is proving sufficient.
199
+
200
+ To run the tests, use `qed` command line tool --ideally use `$ ruby -Ilib bin/qed`
201
+ to ensure the current version of QED is being used.
202
+
203
+ For convenience, use `$ fire spec` to run the test specifications. To also
204
+ generate a test coverage report use `$ fire spec:cov`.
205
+
206
+
182
207
  == Copyrights
183
208
 
184
- Q.E.D.
209
+ (BSD 2 Clause license)
185
210
 
186
211
  Copyright (c) 2009 Rubyworks, Thomas Sawyer
187
212
 
188
- BSD 2 Clause License
189
-
190
213
  See COPYING.rdoc for details.
191
214
 
@@ -10,18 +10,30 @@ copyrights:
10
10
  license: BSD-2-Clause
11
11
  requirements:
12
12
  - name: ansi
13
+ - name: brass
13
14
  - name: facets
14
15
  version: 2.8+
15
- - name: brass
16
- - name: confection
17
- - name: detroit
16
+ - name: courtier
18
17
  groups:
19
- - build
18
+ - optional
19
+ development: true
20
+ - name: blankslate
21
+ groups:
22
+ - optional
23
+ - test
20
24
  development: true
21
25
  - name: ae
22
26
  groups:
23
27
  - test
24
28
  development: true
29
+ - name: detroit
30
+ groups:
31
+ - build
32
+ development: true
33
+ - name: fire
34
+ groups:
35
+ - build
36
+ development: true
25
37
  dependencies: []
26
38
  alternatives: []
27
39
  conflicts: []
@@ -30,10 +42,18 @@ repositories:
30
42
  scm: git
31
43
  name: upstream
32
44
  resources:
33
- home: http://rubyworks.github.com/qed
34
- code: http://github.com/rubyworks/qed
35
- mail: http://groups.google.com/groups/rubyworks-mailinglist
36
- bugs: http://github.com/rubyworks/qed/issues
45
+ - uri: http://rubyworks.github.com/qed
46
+ name: home
47
+ type: home
48
+ - uri: http://github.com/rubyworks/qed
49
+ name: code
50
+ type: code
51
+ - uri: http://groups.google.com/groups/rubyworks-mailinglist
52
+ name: mail
53
+ type: mail
54
+ - uri: http://github.com/rubyworks/qed/issues
55
+ name: bugs
56
+ type: bugs
37
57
  extra: {}
38
58
  load_path:
39
59
  - lib
@@ -41,10 +61,10 @@ revision: 0
41
61
  created: '2009-06-16'
42
62
  summary: Quod Erat Demonstrandum
43
63
  title: QED
44
- version: 2.8.8
64
+ version: 2.9.0
45
65
  name: qed
46
66
  webcvs: http://github.com/rubyworks/qed/blob/master/
47
67
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
48
68
 
49
69
  utilizing Literate Programming techniques.'
50
- date: '2012-03-14'
70
+ date: '2012-04-14'
@@ -1,7 +1,11 @@
1
1
  if RUBY_VERSION < '1.9'
2
+ require 'qed/rc' unless ENV['norc']
3
+ require 'qed/configure'
2
4
  require 'qed/cli/qed'
3
5
  require 'qed/cli/qedoc'
4
6
  else
7
+ require_relative 'rc' unless ENV['norc']
8
+ require_relative 'configure'
5
9
  require_relative('cli/qed')
6
10
  require_relative('cli/qedoc')
7
11
  end
@@ -1,7 +1,5 @@
1
1
  module QED
2
2
 
3
- require 'qed/session'
4
-
5
3
  #
6
4
  def self.cli(*argv)
7
5
  Session.cli(*argv)
@@ -12,9 +10,9 @@ module QED
12
10
  #
13
11
  # Session settings are passed to `Session.new`.
14
12
  #
15
- def self.settings
16
- @settings ||= Settings.new
17
- end
13
+ #def self.settings
14
+ # @settings ||= Settings.new
15
+ #end
18
16
 
19
17
  #
20
18
  # Command line interface for running demos.
@@ -23,16 +21,16 @@ module QED
23
21
  require 'optparse'
24
22
  require 'shellwords'
25
23
 
26
- files, options = cli_parse(argv)
24
+ # we are loading this here instead of above so simplecov coverage works better
25
+ # (actually, this is really not a problem anymore, but we'll leave it for now)
26
+ require 'qed/session'
27
27
 
28
- #if files.empty?
29
- # puts "No files."
30
- # exit -1
31
- #end
28
+ # If RC config file is available.
29
+ #RC.commit_configuration
32
30
 
33
- settings.files = files unless files.empty?
31
+ options = cli_parse(argv)
34
32
 
35
- session = Session.new(settings)
33
+ session = Session.new(options)
36
34
  success = session.run
37
35
 
38
36
  exit -1 unless success
@@ -43,7 +41,8 @@ module QED
43
41
  #
44
42
  def self.cli_parse(argv)
45
43
  options = {}
46
- options_parser = OptionParser.new do |opt|
44
+
45
+ parser = OptionParser.new do |opt|
47
46
  opt.banner = "Usage: qed [options] <files...>"
48
47
 
49
48
  opt.separator("Report Formats (pick one):")
@@ -52,10 +51,10 @@ module QED
52
51
  # options[:format] = :dotprogress
53
52
  #end
54
53
  opt.on('--verbatim', '-v', "shortcut for verbatim reporter") do
55
- settings.format = :verbatim
54
+ options[:format] = :verbatim
56
55
  end
57
56
  opt.on('--tapy', '-y', "shortcut for TAP-Y reporter") do
58
- settings.format = :tapy
57
+ options[:format] = :tapy
59
58
  end
60
59
  #opt.on('--bullet', '-b', "use bullet-point reporter") do
61
60
  # options[:format] = :bullet
@@ -67,25 +66,28 @@ module QED
67
66
  # options[:format] = :script # psuedo-reporter
68
67
  #end
69
68
  opt.on('--format', '-f FORMAT', "use custom reporter") do |format|
70
- settings.format = format.to_sym
69
+ options[:format] = format.to_sym
71
70
  end
72
71
 
73
72
  opt.separator("Control Options:")
74
73
 
75
74
  opt.on('-p', '--profile NAME', "load runtime profile") do |name|
76
- settings.profile = name.to_sym
75
+ options[:profile] = name
77
76
  end
78
77
  opt.on('--comment', '-c', "run comment code") do
79
- settings.mode = :comment
78
+ options[:mode] = :comment
80
79
  end
81
80
  opt.on('--loadpath', "-I PATH", "add paths to $LOAD_PATH") do |paths|
82
- settings.loadpath = paths.split(/[:;]/).map{|d| File.expand_path(d)}
81
+ options[:loadpath] = paths.split(/[:;]/).map{|d| File.expand_path(d)}
83
82
  end
84
- opt.on('--require', "-r LIB", "require library") do |paths|
85
- settings.requires = paths.split(/[:;]/)
83
+ opt.on('--require', "-r LIB", "require feature (immediately)") do |paths|
84
+ requires = paths.split(/[:;]/)
85
+ requires.each do |file|
86
+ require file
87
+ end
86
88
  end
87
89
  opt.on('--rooted', '-R', "run from project root instead of temporary directory") do
88
- settings.rooted = true
90
+ options[:rooted] = true
89
91
  end
90
92
  opt.on('--trace', '-t [COUNT]', "number of backtraces for exceptions (0 for all)") do |cnt|
91
93
  #options[:trace] = true
@@ -113,8 +115,8 @@ module QED
113
115
 
114
116
  unless settings.profiles.empty?
115
117
  puts "Available Profiles:"
116
- require 'confection'
117
- settings.profiles.each do |name|
118
+ #require 'confection'
119
+ QED.profiles.each do |name|
118
120
  next if name.strip == ''
119
121
  puts " -p #{name}"
120
122
  end
@@ -124,9 +126,11 @@ module QED
124
126
  end
125
127
  end
126
128
 
127
- options_parser.parse!(argv)
129
+ parser.parse!(argv)
130
+
131
+ options[:files] = argv unless argv.empty?
128
132
 
129
- return argv, options
133
+ return options
130
134
  end
131
135
 
132
136
  end
@@ -0,0 +1,20 @@
1
+ module QED
2
+
3
+ #
4
+ def self.configure(name=nil, &block)
5
+ name = (name || 'default').to_s
6
+ profiles[name] = block if block
7
+ profiles[name]
8
+ end
9
+
10
+ # Alias for configure.
11
+ def self.profile(name=nil, &block)
12
+ configure(name, &block)
13
+ end
14
+
15
+ #
16
+ def self.profiles
17
+ @profiles ||= {}
18
+ end
19
+
20
+ end
@@ -34,7 +34,13 @@ class Object
34
34
  InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
35
35
  end
36
36
  end
37
+ end
37
38
 
39
+ #
40
+ # This is used by the `#=>` notation.
41
+ #
42
+ def must_return(value)
43
+ assert(self == value, "#{self.inspect} #=> #{value.inspect}")
38
44
  end
39
45
 
40
46
  end
@@ -16,7 +16,10 @@ module QED
16
16
  # @param [Demo] demo
17
17
  # The demo to run.
18
18
  #
19
- # @param [Array] observers
19
+ # @option options [Boolean] :applique
20
+ # Is this applique code?
21
+ #
22
+ # @option options [Array] :observers
20
23
  # Objects that respond to observable interface.
21
24
  # Typically this is just a Reporter instance.
22
25
  #
@@ -0,0 +1,12 @@
1
+ require 'qed'
2
+ require 'qed/configure'
3
+
4
+ begin
5
+ require 'rc/api'
6
+ RC.profile_switch 'qed', '-p', '--profile'
7
+ RC.configure 'qed' do |config|
8
+ QED.configure(config.profile, &config)
9
+ end
10
+ rescue LoadError
11
+ end
12
+
@@ -139,6 +139,10 @@ module Reporter
139
139
  #demos << demo
140
140
  end
141
141
 
142
+ #
143
+ def before_import(file)
144
+ end
145
+
142
146
  #
143
147
  def before_step(step)
144
148
  end
@@ -160,6 +164,10 @@ module Reporter
160
164
  def demo(demo)
161
165
  end
162
166
 
167
+ # Right before import.
168
+ def import(file)
169
+ end
170
+
163
171
  # Right before rule section.
164
172
  def rule(step)
165
173
  end
@@ -187,13 +195,17 @@ module Reporter
187
195
 
188
196
  # After running a step that failed.
189
197
  def fail(step, assertion)
190
- #@fail << [step, assertion]
198
+ ## @fail << [step, assertion]
191
199
  end
192
200
 
193
201
  # After running a step that raised an error.
194
202
  def error(step, exception)
195
203
  raise exception if $DEBUG # TODO: do we really want to do it like this?
196
- #@error << [step, exception]
204
+ ## @error << [step, exception]
205
+ end
206
+
207
+ #
208
+ def after_import(file)
197
209
  end
198
210
 
199
211
  #
@@ -19,15 +19,14 @@ module QED
19
19
  attr :settings
20
20
 
21
21
  # New Session
22
- def initialize(settings, options={})
22
+ def initialize(settings={})
23
23
  require_reporters
24
24
 
25
25
  case settings
26
26
  when Settings
27
27
  @settings = settings
28
28
  else
29
- options[:files] = settings
30
- @settings = Settings.new(options)
29
+ @settings = Settings.new(settings)
31
30
  end
32
31
  end
33
32
 
@@ -127,11 +126,11 @@ module QED
127
126
 
128
127
  reset_assertion_counts
129
128
 
129
+ #require_profile # <-- finally runs the profile
130
+
130
131
  prepare_loadpath
131
132
  require_libraries
132
133
 
133
- require_profile # TODO: here or in chdir?
134
-
135
134
  Dir.chdir(directory) do
136
135
  # pre-parse demos
137
136
  demos.each{ |demo| demo.steps }
@@ -173,9 +172,9 @@ module QED
173
172
  end
174
173
 
175
174
  #
176
- def require_profile
177
- settings.load_profile(profile)
178
- end
175
+ #def require_profile
176
+ # settings.load_profile(profile)
177
+ #end
179
178
 
180
179
  # Returns a list of demo files. The files returned depends on the
181
180
  # +files+ attribute and if none given, then the current run mode.
@@ -1,28 +1,36 @@
1
+ require 'qed/configure'
2
+
1
3
  module QED
2
4
 
3
- # Settings ecapsulates setup code for running QED.
5
+ # Settings ecapsulates setup configuration for running QED.
6
+ #
7
+ # When running `qed` on the command line tool, QED can use
8
+ # either a automatic configuration file, via the RC library,
9
+ # or setup configuration via an explicitly required file.
4
10
  #
5
- # QED supports Confection-based configuration, if a Confile is present.
11
+ # Using a master configuraiton file, add a `config :qed` entry.
12
+ # For example:
6
13
  #
7
- # config :qed, :cover do
14
+ # config :qed, :simplecov, :preset=>true do
8
15
  # require 'simplecov'
9
16
  # SimpleCov.start do
10
17
  # coverage_dir 'log/coverage'
11
18
  # end
12
19
  # end
13
20
  #
14
- # QED also supports traditional configuration files placed in either
15
- # toplevel `.qed`, `.qed.rb`, `qed.rb` or these files in the `task/`
16
- # directory or in the form of `task/<name>.qed`. The same example as
17
- # above in one of these files would be:
21
+ # To not use RC, just create a requirable file such as `config/qed-coverage.rb`
18
22
  #
19
- # profile :cover do
23
+ # QED.configure do |qed|
20
24
  # require 'simplecov'
21
25
  # SimpleCov.start do
22
26
  # coverage_dir 'log/coverage'
23
27
  # end
24
28
  # end
25
29
  #
30
+ # Then when running qed use:
31
+ #
32
+ # $ qed -r ./config/qed-coverage.rb
33
+ #
26
34
  class Settings
27
35
 
28
36
  require 'tmpdir'
@@ -35,34 +43,21 @@ module QED
35
43
  # Glob pattern used to search for project's root directory.
36
44
  ROOT_PATTERN = '{.map,.ruby,.git/,.hg/,_darcs/}'
37
45
 
38
- # Glob pattern used to find QED configuration file relative to root directory.
39
- CONFIG_PATTERN = '{.,,task/}qed,qedfile{,.rb}'
40
-
41
46
  # Home directory.
42
47
  HOME = File.expand_path('~')
43
48
 
44
49
  # Directory names to omit from automatic selection.
45
50
  OMIT_PATHS = %w{applique helpers support sample samples fixture fixtures}
46
51
 
47
- # QED support configuration file mapping.
48
- #MAP_FILE = '.map'
49
-
50
- #
51
- # Mast configuration file lookup glob.
52
- #
53
- CONFECTION_GLOB = '{,.}confile{.rb,}'
54
-
55
- #
56
- # Traditional configuration file lookup glob.
57
- #
58
- CONFIG_GLOB = '{,.,task/}qed{,file}{,.rb}'
59
-
60
52
  #
61
53
  # Initialize new Settings instance.
62
54
  #
63
55
  def initialize(options={})
64
56
  initialize_defaults
65
- initialize_configuration
57
+
58
+ @profile = (options.delete(:profile) || default_profile).to_s
59
+
60
+ load_profile
66
61
 
67
62
  options.each do |key, val|
68
63
  send("#{key}=", val) if val
@@ -70,75 +65,23 @@ module QED
70
65
  end
71
66
 
72
67
  #
73
- def initialize_defaults
74
- @files = nil
75
- @format = :dot
76
- @trace = false
77
- @mode = nil
78
- @loadpath = ['lib']
79
- @requires = []
80
- @omit = OMIT_PATHS # TODO: eventually make configurable
81
- @rootless = false
82
-
83
- @profile = ENV['profile'] || :default
84
- end
85
-
86
- #
87
- # QED can use either a maser configuration file, via the Confection
88
- # library, or more traditional toplevel or task directory files. Only
89
- # one of these two approaches can be used and the traditional
90
- # system, if used, will override use of the confection system.
91
- #
92
- # Using a master configuraiton file, add for example:
93
- #
94
- # config :qed, :simplecov do
95
- # require 'simplecov'
96
- # SimpleCov.start do
97
- # coverage_dir 'log/coverage'
98
- # end
99
- # end
68
+ # Initialize default settings.
100
69
  #
101
- # If using a traditional configuration file, which can be either of
102
- # `.qed`, `.qed.rb` or `qed.rb`, case-insensitive, or a `task/<name>.qed`
103
- # located file, use the `#profile` method to define different profiles.
104
- #
105
- # profile :simplecov do
106
- # require 'simplecov'
107
- # SimpleCov.start do
108
- # coverage_dir 'log/coverage'
109
- # end
110
- # end
111
- #
112
- def initialize_configuration
113
- @profiles = {}
114
-
115
- # traditional
116
- Dir.glob(File.join(root, CONFIG_GLOB), File::FNM_CASEFOLD).each do |file|
117
- next unless File.file?(file)
118
- instance_eval(File.read(file), file)
119
- end
120
-
121
- # task directory config files
122
- Dir.glob(File.join(root, 'task/*.qed')).each do |file|
123
- next unless File.file?(file)
124
- instance_eval(File.read(file), file)
125
- end
126
-
127
- # don't use confection gem if other approaches are being used.
128
- return unless @profiles.empty?
129
-
130
- # confection
131
- if confection_file
132
- require 'confection'
133
- Confection.profiles(:qed).each do |name|
134
- @profiles[name.to_s] = lambda{ load_profile_from_confection(name) }
135
- end
136
- end
70
+ def initialize_defaults
71
+ @files = nil #DEFAULT_FILES
72
+ @format = :dot
73
+ @trace = false
74
+ @mode = nil # ?
75
+ @loadpath = ['lib']
76
+ @omit = OMIT_PATHS
77
+ @rootless = false
78
+ @requires = []
79
+ #@profile = :default
137
80
  end
138
81
 
139
- # Lookup Confection config file.
140
- def confection_file
141
- Dir.glob(File.join(root, CONFECTION_GLOB), File::FNM_CASEFOLD).first
82
+ # Profile name can come from `profile` or `p` environment variables.
83
+ def default_profile
84
+ ENV['profile'] || ENV['p'] || 'default'
142
85
  end
143
86
 
144
87
  # Demonstration files (or globs).
@@ -183,8 +126,23 @@ module QED
183
126
  # Operate from system temporary directory?
184
127
  attr_accessor :rootless
185
128
 
186
- # Selected profile.
187
- attr_accessor :profile
129
+ #
130
+ # Load QED configuration profile. The load procedure is stored as
131
+ # a Proc object in a hash b/c different configuration systems
132
+ # can be used.
133
+ #
134
+ def load_profile
135
+ config = QED.profiles[@profile]
136
+ config.call(self) if config
137
+ end
138
+
139
+ #
140
+ # Profiles are collected from the RC library, unless
141
+ # RC is deactivated via the override file.
142
+ #
143
+ def profiles
144
+ QED.profiles.keys
145
+ end
188
146
 
189
147
  #
190
148
  # Operate relative to project root directory, or use system's location.
@@ -234,6 +192,7 @@ module QED
234
192
  FileUtils.mkdir_p(tmpdir)
235
193
  end
236
194
 
195
+ =begin
237
196
  #
238
197
  # Define a profile.
239
198
  #
@@ -251,24 +210,7 @@ module QED
251
210
  return @profile[name.to_s] unless block
252
211
  @profiles[name.to_s] = block
253
212
  end
254
-
255
- #
256
- # Profiles are collected from the Confection library, unless
257
- # confection is deactivated via the override file.
258
- #
259
- def profiles
260
- @profiles.keys
261
- end
262
-
263
- #
264
- # Load QED configuration profile. The load procedure is stored as
265
- # a Proc object in a hash b/c different configuration systems
266
- # can be used.
267
- #
268
- def load_profile(profile)
269
- profile = @profiles[profile.to_s]
270
- profile.call if profile
271
- end
213
+ =end
272
214
 
273
215
  private
274
216
 
@@ -370,20 +312,21 @@ module QED
370
312
  #end
371
313
 
372
314
  #
373
- def load_confection_profile(name)
374
- config = confection(:qed, name.to_sym)
375
- config.exec
376
- end
315
+ #def load_confection_profile(name)
316
+ # config = confection(:qed, name.to_sym)
317
+ # config.exec
318
+ #end
377
319
 
378
320
  #
379
- def load_profile_from_file(file)
380
- if File.exist?(file)
381
- instance_eval(File.read(file), file)
382
- else
383
- # raise "no profile -- #{profile}"
384
- end
385
- end
321
+ #def load_profile_from_file(file)
322
+ # if File.exist?(file)
323
+ # instance_eval(File.read(file), file)
324
+ # else
325
+ # # raise "no profile -- #{profile}"
326
+ # end
327
+ #end
386
328
 
387
329
  end
388
330
 
389
331
  end
332
+
@@ -227,10 +227,13 @@ module QED
227
227
  #
228
228
  def tweak_code
229
229
  code = @example_lines.map{ |lineno, line| line }.join("")
230
- #code.gsub!(/\n\s*\#\ ?\=\>/, '.assert = ')
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})')
230
+
231
+ #code.gsub!(/\n\s*\#\ ?\=\>(.*?)$/, ' == \1 ? assert(true) : assert(false, %{not returned -- \1})') # TODO: what kind of error ?
232
+ #code.gsub!(/\s*\#\ ?\=\>(.*?)$/, ' == \1 ? assert(true) : assert(false, %{not returned -- \1})')
233
+
234
+ code.gsub!(/\n\s*\#\ ?\=\>\s*(.*?)$/, '.must_return(\1)')
235
+ code.gsub!(/\s*\#\ ?\=\>\s*(.*?)$/, '.must_return(\1)')
236
+
234
237
  code
235
238
  end
236
239
 
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.8
4
+ version: 2.9.0
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-03-17 00:00:00.000000000 Z
12
+ date: 2012-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ansi
16
- requirement: &28672460 !ruby/object:Gem::Requirement
16
+ requirement: &25076880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *28672460
24
+ version_requirements: *25076880
25
+ - !ruby/object:Gem::Dependency
26
+ name: brass
27
+ requirement: &25074880 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *25074880
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: facets
27
- requirement: &28671560 !ruby/object:Gem::Requirement
38
+ requirement: &25073040 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,32 +43,43 @@ dependencies:
32
43
  version: '2.8'
33
44
  type: :runtime
34
45
  prerelease: false
35
- version_requirements: *28671560
46
+ version_requirements: *25073040
36
47
  - !ruby/object:Gem::Dependency
37
- name: brass
38
- requirement: &28671020 !ruby/object:Gem::Requirement
48
+ name: courtier
49
+ requirement: &25071080 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
42
53
  - !ruby/object:Gem::Version
43
54
  version: '0'
44
- type: :runtime
55
+ type: :development
45
56
  prerelease: false
46
- version_requirements: *28671020
57
+ version_requirements: *25071080
47
58
  - !ruby/object:Gem::Dependency
48
- name: confection
49
- requirement: &28670240 !ruby/object:Gem::Requirement
59
+ name: blankslate
60
+ requirement: &25068100 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
53
64
  - !ruby/object:Gem::Version
54
65
  version: '0'
55
- type: :runtime
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *25068100
69
+ - !ruby/object:Gem::Dependency
70
+ name: ae
71
+ requirement: &25065100 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
56
78
  prerelease: false
57
- version_requirements: *28670240
79
+ version_requirements: *25065100
58
80
  - !ruby/object:Gem::Dependency
59
81
  name: detroit
60
- requirement: &28669640 !ruby/object:Gem::Requirement
82
+ requirement: &25062600 !ruby/object:Gem::Requirement
61
83
  none: false
62
84
  requirements:
63
85
  - - ! '>='
@@ -65,10 +87,10 @@ dependencies:
65
87
  version: '0'
66
88
  type: :development
67
89
  prerelease: false
68
- version_requirements: *28669640
90
+ version_requirements: *25062600
69
91
  - !ruby/object:Gem::Dependency
70
- name: ae
71
- requirement: &28669100 !ruby/object:Gem::Requirement
92
+ name: fire
93
+ requirement: &25059820 !ruby/object:Gem::Requirement
72
94
  none: false
73
95
  requirements:
74
96
  - - ! '>='
@@ -76,7 +98,7 @@ dependencies:
76
98
  version: '0'
77
99
  type: :development
78
100
  prerelease: false
79
- version_requirements: *28669100
101
+ version_requirements: *25059820
80
102
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
81
103
 
82
104
  utilizing Literate Programming techniques.'
@@ -91,7 +113,7 @@ extra_rdoc_files:
91
113
  - README.rdoc
92
114
  - COPYING.rdoc
93
115
  files:
94
- - .confile.rb
116
+ - .config.rb
95
117
  - .ruby
96
118
  - .yardopts
97
119
  - bin/qed
@@ -100,6 +122,7 @@ files:
100
122
  - lib/qed/cli/qed.rb
101
123
  - lib/qed/cli/qedoc.rb
102
124
  - lib/qed/cli.rb
125
+ - lib/qed/configure.rb
103
126
  - lib/qed/core_ext.rb
104
127
  - lib/qed/demo.rb
105
128
  - lib/qed/document/jquery.js
@@ -111,6 +134,7 @@ files:
111
134
  - lib/qed/helpers/shell_session.rb
112
135
  - lib/qed/parser.rb
113
136
  - lib/qed/qparser.rb
137
+ - lib/qed/rc.rb
114
138
  - lib/qed/reporter/abstract.rb
115
139
  - lib/qed/reporter/dotprogress.rb
116
140
  - lib/qed/reporter/html.rb