qed 2.8.1 → 2.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/.ruby +3 -5
  2. data/HISTORY.rdoc +18 -0
  3. data/lib/qed/settings.rb +73 -13
  4. data/lib/qed.yml +3 -5
  5. metadata +12 -23
data/.ruby CHANGED
@@ -8,14 +8,11 @@ copyrights:
8
8
  - holder: Thomas Sawyer, Rubyworks
9
9
  year: '2006'
10
10
  license: BSD-2-Clause
11
- replacements: []
12
- alternatives: []
13
11
  requirements:
14
12
  - name: ansi
15
13
  - name: facets
16
14
  version: 2.8+
17
15
  - name: brass
18
- - name: confection
19
16
  - name: detroit
20
17
  groups:
21
18
  - build
@@ -25,6 +22,7 @@ requirements:
25
22
  - test
26
23
  development: true
27
24
  dependencies: []
25
+ alternatives: []
28
26
  conflicts: []
29
27
  repositories:
30
28
  - uri: git://github.com/rubyworks/qed.git
@@ -42,10 +40,10 @@ revision: 0
42
40
  created: '2009-06-16'
43
41
  summary: Quod Erat Demonstrandum
44
42
  title: QED
45
- version: 2.8.1
43
+ version: 2.8.2
46
44
  scm_uri: http://github.com/rubyworks/qed/blob/master/
47
45
  name: qed
48
46
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
49
47
 
50
48
  utilizing Literate Programming techniques.'
51
- date: '2012-02-01'
49
+ date: '2012-03-07'
data/HISTORY.rdoc CHANGED
@@ -1,5 +1,23 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 2.8.2 | 2012-03-07
4
+
5
+ This release simply reverts the configuration file back to an
6
+ independent file. The use of the Confection library was a "noble
7
+ idea", but in the end not one that's likely to gain traction among
8
+ developers in general, so we have decided to revert back to the
9
+ more traditional `.qed` config file. However, we also added built-in
10
+ support for `task/qed.rb`, which we encourgage so as to promote
11
+ clean project structures. Further, QED also suppots the `.map` YAML
12
+ configuration file which allows you to move the QED config file
13
+ wherever you might prefer it. Just add a `qed: path/to/config/file`
14
+ entry.
15
+
16
+ Changes:
17
+
18
+ * Revert to dedicated configuration file.
19
+
20
+
3
21
  == 2.8.1 | 2012-02-01
4
22
 
5
23
  This release fixes a bug in the parsing of `#=>` notation. It also
data/lib/qed/settings.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  module QED
2
2
 
3
- # Ecapsulate configuration information needed for QED to
4
- # run and set user and project options.
3
+ # Settings ecapsulates setup code for running QED.
4
+ #
5
+ # By convention, configuration for QED is placed in `task/qed.rb`.
6
+ # Configuration may also be placed at project root level in `qed.rb`,
7
+ # or if you're old-school, a `.qed` hidden file can still be used. If you
8
+ # don't like any of these choices, QED supports configuration file mapping
9
+ # via the `.map` file. Just add a `qed: path/to/qed/config/file` entry.
5
10
  #
6
- # Configuration for QED is placed in a `.config.rb` or `config.rb` file.
7
11
  # In this file special configuration setups can be placed to automatically
8
12
  # effect QED execution, in particular optional profiles can be defined.
9
13
  #
10
- # qed do
11
14
  # profile :coverage do
12
15
  # require 'simplecov'
13
16
  # SimpleCov.start do
@@ -18,20 +21,26 @@ module QED
18
21
  # add_group "Revision 0", "lib/dotruby/v0"
19
22
  # end
20
23
  # end
21
- # end
22
- #
24
+ #
23
25
  class Settings
24
26
 
25
27
  require 'tmpdir'
26
28
  require 'fileutils'
27
- require 'confection'
29
+
30
+ # QED support configuration file mapping.
31
+ MAP_FILE = '.map'
28
32
 
29
33
  # Glob pattern used to search for project's root directory.
30
- ROOT_PATTERN = '{.confile,.confile.rb,confile,confile.rb,.ruby,.git/,.hg/,_darcs/}'
34
+ ROOT_PATTERN = '{.map,.ruby,.git/,.hg/,_darcs/,.qed,.qed.rb,qed.rb,task/qed.rb}'
35
+
36
+ # Glob pattern used to find QED configuration file in root directory.
37
+ CONFIG_PATTERN = '{task/qed.rb,qed.rb,.qed,.qed.rb}'
31
38
 
32
39
  # Home directory.
33
40
  HOME = File.expand_path('~')
34
41
 
42
+ #
43
+ #
35
44
  #
36
45
  def initialize(options={})
37
46
  @rootless = options[:rootless]
@@ -42,24 +51,31 @@ module QED
42
51
  # Set global. TODO: find away to not need this ?
43
52
  $ROOT = @root
44
53
 
45
- confection('qed').exec
54
+ if config_file
55
+ instance_eval(File.read(config_file), config_file)
56
+ end
46
57
  end
47
58
 
59
+ #
48
60
  # Operate relative to project root directory, or use system's location.
49
61
  #
50
62
  def rootless?
51
63
  @rootless
52
64
  end
53
65
 
66
+ #
54
67
  # Project's root directory.
55
68
  #
56
69
  def root_directory
57
70
  @root
58
71
  end
59
72
 
73
+ #
60
74
  # Shorthand for `#root_directory`.
75
+ #
61
76
  alias_method :root, :root_directory
62
77
 
78
+ #
63
79
  # Temporary directory. If `#rootless?` return true then this will be
64
80
  # a system's temporary directory (e.g. `/tmp/qed/foo/20111117242323/`).
65
81
  # Otherwise, it will local to the project's root int `tmp/qed/`.
@@ -75,15 +91,20 @@ module QED
75
91
  )
76
92
  end
77
93
 
94
+ #
78
95
  # Shorthand for `#temporary_directory`.
96
+ #
79
97
  alias_method :tmpdir, :temporary_directory
80
98
 
99
+ #
81
100
  # Remove and recreate temporary working directory.
101
+ #
82
102
  def clear_directory
83
103
  FileUtils.rm_r(tmpdir) if File.exist?(tmpdir)
84
104
  FileUtils.mkdir_p(tmpdir)
85
105
  end
86
106
 
107
+ #
87
108
  # Define a profile.
88
109
  #
89
110
  # @param [#to_s] name
@@ -92,11 +113,14 @@ module QED
92
113
  # @yield Procedure to run for profile.
93
114
  #
94
115
  # @return [Proc] The procedure.
116
+ #
95
117
  def profile(name, &block)
96
118
  @profiles[name.to_s] = block
97
119
  end
98
120
 
121
+ #
99
122
  # Keeps a list of defined profiles.
123
+ #
100
124
  attr_accessor :profiles
101
125
 
102
126
  # Profile configurations.
@@ -109,7 +133,9 @@ module QED
109
133
  # )
110
134
  #end
111
135
 
136
+ #
112
137
  # Load QED profile (from -e option).
138
+ #
113
139
  def load_profile(name)
114
140
  if profile = profiles[name.to_s]
115
141
  instance_eval(&profile)
@@ -121,17 +147,18 @@ module QED
121
147
  #end
122
148
  end
123
149
 
150
+ #
124
151
  # Locate project's root directory. This is done by searching upward
125
152
  # in the file heirarchy for the existence of one of the following:
126
153
  #
127
- # .confile
128
- # confile
129
- # .confile.rb
130
- # confile.rb
154
+ # .map
131
155
  # .ruby
132
156
  # .git/
133
157
  # .hg/
134
158
  # _darcs/
159
+ # .qed
160
+ # .qed.rb
161
+ # qed.rb
135
162
  #
136
163
  # Failing to find any of these locations, resort to the fallback:
137
164
  #
@@ -168,6 +195,7 @@ module QED
168
195
 
169
196
  # TODO: Use Dir.ascend from Ruby Facets.
170
197
 
198
+ #
171
199
  # Lookup path +glob+, searching each higher directory
172
200
  # in turn until just before the users home directory
173
201
  # is reached or just before the system's root directory.
@@ -180,6 +208,8 @@ module QED
180
208
  end
181
209
  end
182
210
 
211
+ #
212
+ # System-wide temporary directory for QED executation.
183
213
  #
184
214
  def system_tmpdir
185
215
  @system_tmpdir ||= (
@@ -187,6 +217,36 @@ module QED
187
217
  )
188
218
  end
189
219
 
220
+ #
221
+ # Lookup, cache and return QED config file.
222
+ #
223
+ def config_file
224
+ @config_file ||= (
225
+ glob = file_map['qed'] || CONFIG_PATTERN
226
+ Dir.glob(File.join(root_directory,glob)).first
227
+ )
228
+ end
229
+
230
+ #
231
+ # Return cached file map from a project's `.map` file, if it exists.
232
+ #
233
+ def file_map
234
+ @file_map ||= (
235
+ if File.exist?(map_file)
236
+ YAML.load_file(map_file)
237
+ else
238
+ {}
239
+ end
240
+ )
241
+ end
242
+
243
+ #
244
+ # Lookup, cache and return `.map` map file.
245
+ #
246
+ def map_file
247
+ @_map_file ||= File.join(root_directory,MAP_FILE)
248
+ end
249
+
190
250
  end
191
251
 
192
252
  end
data/lib/qed.yml CHANGED
@@ -8,14 +8,11 @@ copyrights:
8
8
  - holder: Thomas Sawyer, Rubyworks
9
9
  year: '2006'
10
10
  license: BSD-2-Clause
11
- replacements: []
12
- alternatives: []
13
11
  requirements:
14
12
  - name: ansi
15
13
  - name: facets
16
14
  version: 2.8+
17
15
  - name: brass
18
- - name: confection
19
16
  - name: detroit
20
17
  groups:
21
18
  - build
@@ -25,6 +22,7 @@ requirements:
25
22
  - test
26
23
  development: true
27
24
  dependencies: []
25
+ alternatives: []
28
26
  conflicts: []
29
27
  repositories:
30
28
  - uri: git://github.com/rubyworks/qed.git
@@ -42,10 +40,10 @@ revision: 0
42
40
  created: '2009-06-16'
43
41
  summary: Quod Erat Demonstrandum
44
42
  title: QED
45
- version: 2.8.1
43
+ version: 2.8.2
46
44
  scm_uri: http://github.com/rubyworks/qed/blob/master/
47
45
  name: qed
48
46
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
49
47
 
50
48
  utilizing Literate Programming techniques.'
51
- date: '2012-02-01'
49
+ date: '2012-03-07'
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.1
4
+ version: 2.8.2
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-02-01 00:00:00.000000000 Z
12
+ date: 2012-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ansi
16
- requirement: &30707900 !ruby/object:Gem::Requirement
16
+ requirement: &21715680 !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: *30707900
24
+ version_requirements: *21715680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: facets
27
- requirement: &30723160 !ruby/object:Gem::Requirement
27
+ requirement: &21714660 !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: *30723160
35
+ version_requirements: *21714660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: brass
38
- requirement: &30722380 !ruby/object:Gem::Requirement
38
+ requirement: &21736760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,21 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *30722380
47
- - !ruby/object:Gem::Dependency
48
- name: confection
49
- requirement: &30721540 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: *30721540
46
+ version_requirements: *21736760
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: detroit
60
- requirement: &30720900 !ruby/object:Gem::Requirement
49
+ requirement: &21735960 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ! '>='
@@ -65,10 +54,10 @@ dependencies:
65
54
  version: '0'
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *30720900
57
+ version_requirements: *21735960
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: ae
71
- requirement: &30720020 !ruby/object:Gem::Requirement
60
+ requirement: &21734980 !ruby/object:Gem::Requirement
72
61
  none: false
73
62
  requirements:
74
63
  - - ! '>='
@@ -76,7 +65,7 @@ dependencies:
76
65
  version: '0'
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *30720020
68
+ version_requirements: *21734980
80
69
  description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
81
70
 
82
71
  utilizing Literate Programming techniques.'