qed 2.8.7 → 2.8.8

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.
Files changed (5) hide show
  1. data/.ruby +1 -1
  2. data/HISTORY.rdoc +12 -0
  3. data/lib/qed.yml +1 -1
  4. data/lib/qed/settings.rb +77 -41
  5. metadata +14 -14
data/.ruby CHANGED
@@ -41,7 +41,7 @@ revision: 0
41
41
  created: '2009-06-16'
42
42
  summary: Quod Erat Demonstrandum
43
43
  title: QED
44
- version: 2.8.7
44
+ version: 2.8.8
45
45
  name: qed
46
46
  webcvs: http://github.com/rubyworks/qed/blob/master/
47
47
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
@@ -1,5 +1,17 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 2.8.8 | 2012-30-17
4
+
5
+ Feel like a heel after the last four releases. The simplist solution
6
+ to the configuration issue is to allow traditional configuration
7
+ trump confection based configuration. If the former is used, then
8
+ the later will never even load. Problem solved.
9
+
10
+ Changes:
11
+
12
+ * Traditional configuration trump Confection configuration.
13
+
14
+
3
15
  == 2.8.7 | 2012-03-16
4
16
 
5
17
  Release fixes a bug that prevented default demo locations from being
@@ -41,7 +41,7 @@ revision: 0
41
41
  created: '2009-06-16'
42
42
  summary: Quod Erat Demonstrandum
43
43
  title: QED
44
- version: 2.8.7
44
+ version: 2.8.8
45
45
  name: qed
46
46
  webcvs: http://github.com/rubyworks/qed/blob/master/
47
47
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
@@ -2,26 +2,24 @@ module QED
2
2
 
3
3
  # Settings ecapsulates setup code for running QED.
4
4
  #
5
- # QED can use Confection-based configuration, if a Confile is present.
5
+ # QED supports Confection-based configuration, if a Confile is present.
6
6
  #
7
- # QED also supports configuration files placed in `task/<profile>.qed`.
8
- #
9
- # Configuration may also be placed at project root level in `qed.rb`,
10
- # or if you're old-school, a `.qed` hidden file can still be used. If you
11
- # don't like any of these choices, QED supports configuration file mapping
12
- # via the `.map` file. Just add a `qed: path/to/qed/config/file` entry.
7
+ # config :qed, :cover do
8
+ # require 'simplecov'
9
+ # SimpleCov.start do
10
+ # coverage_dir 'log/coverage'
11
+ # end
12
+ # end
13
13
  #
14
- # In this file special configuration setups can be placed to automatically
15
- # effect QED execution, in particular optional profiles can be defined.
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:
16
18
  #
17
- # if ENV['cover']
19
+ # profile :cover do
18
20
  # require 'simplecov'
19
21
  # SimpleCov.start do
20
22
  # coverage_dir 'log/coverage'
21
- # add_group "Shared" do |src_file|
22
- # /lib\/dotruby\/v(\d+)(.*?)$/ !~ src_file.filename
23
- # end
24
- # add_group "Revision 0", "lib/dotruby/v0"
25
23
  # end
26
24
  # end
27
25
  #
@@ -34,9 +32,6 @@ module QED
34
32
  # will be searched.
35
33
  DEFAULT_FILES = ['qed', 'demo', 'spec']
36
34
 
37
- # QED support configuration file mapping.
38
- #MAP_FILE = '.map'
39
-
40
35
  # Glob pattern used to search for project's root directory.
41
36
  ROOT_PATTERN = '{.map,.ruby,.git/,.hg/,_darcs/}'
42
37
 
@@ -49,6 +44,19 @@ module QED
49
44
  # Directory names to omit from automatic selection.
50
45
  OMIT_PATHS = %w{applique helpers support sample samples fixture fixtures}
51
46
 
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
+
52
60
  #
53
61
  # Initialize new Settings instance.
54
62
  #
@@ -67,45 +75,70 @@ module QED
67
75
  @format = :dot
68
76
  @trace = false
69
77
  @mode = nil
70
- @profile = ENV['profile'] || :default
71
78
  @loadpath = ['lib']
72
79
  @requires = []
73
80
  @omit = OMIT_PATHS # TODO: eventually make configurable
74
81
  @rootless = false
82
+
83
+ @profile = ENV['profile'] || :default
75
84
  end
76
85
 
77
86
  #
78
- # QED can use either the Confection library for configuration,
79
- # task-style configuration files in the form of `task/<profile>.qed`,
80
- # or a traditional master `.qed` file.
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
100
+ #
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.
81
104
  #
82
- # Note, that setting `ENV['config']='legacy'` will force Confection
83
- # not to be used. This is used by the Confection library so it can
84
- # run QED demos too.
105
+ # profile :simplecov do
106
+ # require 'simplecov'
107
+ # SimpleCov.start do
108
+ # coverage_dir 'log/coverage'
109
+ # end
110
+ # end
85
111
  #
86
112
  def initialize_configuration
87
113
  @profiles = {}
88
114
 
89
- if confection_file && !ENV['config']=='legacy'
90
- require 'confection'
91
- Confection.profiles(:qed).each do |name|
92
- @profiles[name.to_s] = lambda{ load_profile_from_confection(name) }
93
- end
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)
94
119
  end
95
120
 
96
- Dir.glob(File.join(root, 'task/*.qed')).map do |file|
97
- name = File.basename(file).chomp('.qed')
98
- @profiles[name.to_s] = lambda{ load_profile_from_file(file) }
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)
99
125
  end
100
126
 
101
- Dir.glob(File.join(root, '{.qed,.qed.rb,qed.rb,Qedfile}')).map do |file|
102
- @profiles[nil] = lambda{ load_profile_from_file(file) }
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
103
136
  end
104
137
  end
105
138
 
106
139
  # Lookup Confection config file.
107
140
  def confection_file
108
- Dir.glob(File.join(root, '{,.}confile{.rb,}'), File::FNM_CASEFOLD).first
141
+ Dir.glob(File.join(root, CONFECTION_GLOB), File::FNM_CASEFOLD).first
109
142
  end
110
143
 
111
144
  # Demonstration files (or globs).
@@ -213,10 +246,11 @@ module QED
213
246
  #
214
247
  # @return [Proc] The procedure.
215
248
  #
216
- #def profile(name, &block)
217
- # raise "The #profile method is deprecated."
218
- # #@profiles[name.to_s] = block
219
- #end
249
+ def profile(name=nil, &block)
250
+ return @profile unless name
251
+ return @profile[name.to_s] unless block
252
+ @profiles[name.to_s] = block
253
+ end
220
254
 
221
255
  #
222
256
  # Profiles are collected from the Confection library, unless
@@ -238,7 +272,7 @@ module QED
238
272
 
239
273
  private
240
274
 
241
- # TODO: find away to not need $ROOT global.
275
+ # TODO: find a way to not need $ROOT global.
242
276
 
243
277
  #
244
278
  # Locate project's root directory. This is done by searching upward
@@ -289,7 +323,7 @@ module QED
289
323
  # "Please add one of them to your project to proceed."
290
324
  end
291
325
 
292
- # TODO: Use Dir.ascend from Ruby Facets.
326
+ # TODO: Use Dir.ascend from Ruby Facets ?
293
327
 
294
328
  #
295
329
  # Lookup path +glob+, searching each higher directory
@@ -313,6 +347,8 @@ module QED
313
347
  )
314
348
  end
315
349
 
350
+ # TODO: Support .map in future ?
351
+
316
352
  ##
317
353
  ## Return cached file map from a project's `.map` file, if it exists.
318
354
  ##
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.7
4
+ version: 2.8.8
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-16 00:00:00.000000000 Z
12
+ date: 2012-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ansi
16
- requirement: &17320540 !ruby/object:Gem::Requirement
16
+ requirement: &28672460 !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: *17320540
24
+ version_requirements: *28672460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: facets
27
- requirement: &17317040 !ruby/object:Gem::Requirement
27
+ requirement: &28671560 !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: *17317040
35
+ version_requirements: *28671560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: brass
38
- requirement: &17314320 !ruby/object:Gem::Requirement
38
+ requirement: &28671020 !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: *17314320
46
+ version_requirements: *28671020
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: confection
49
- requirement: &17311080 !ruby/object:Gem::Requirement
49
+ requirement: &28670240 !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: *17311080
57
+ version_requirements: *28670240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: detroit
60
- requirement: &17306960 !ruby/object:Gem::Requirement
60
+ requirement: &28669640 !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: *17306960
68
+ version_requirements: *28669640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ae
71
- requirement: &17303640 !ruby/object:Gem::Requirement
71
+ requirement: &28669100 !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: *17303640
79
+ version_requirements: *28669100
80
80
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
81
81
 
82
82
  utilizing Literate Programming techniques.'