fudge 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,11 +11,11 @@ module Fudge
11
11
  if File.exists?(path)
12
12
  puts "Fudgefile already exists."
13
13
  else
14
- contents = <<RUBY
15
- build :default do
16
- task :rspec
17
- end
18
- RUBY
14
+ contents = ""
15
+ contents << "build :default do\n"
16
+ contents << " task :rspec\n"
17
+ contents << "end"
18
+
19
19
  File.open(path, 'w') { |f| f.write(contents) }
20
20
  puts "Fudgefile created."
21
21
  end
@@ -8,6 +8,17 @@ module Fudge
8
8
 
9
9
  private
10
10
 
11
+ # Preconditions to check for coverage, that if not met make the test pass
12
+ # for example, if no tests exist, no need to fail
13
+ def pre_conditions_regex
14
+ /(0 examples, 0 failures)/ # no tests exist
15
+ end
16
+
17
+ # Expression to check for coverage
18
+ def coverage_regex
19
+ /((\d+\.\d+)%\) covered)/
20
+ end
21
+
11
22
  def cmd(options={})
12
23
  self.arguments = 'spec/' if arguments.blank?
13
24
  bundle_cmd("rspec#{tty_options} #{arguments}", options)
@@ -19,14 +30,36 @@ module Fudge
19
30
 
20
31
  def check_for
21
32
  if coverage
22
- [/(\d+\.\d+)%\) covered/, method(:coverage_checker)]
33
+ rs1 = coverage_regex.source
34
+ rs2 = pre_conditions_regex.source
35
+ regex = Regexp.new(rs1 + '|' + rs2)
36
+
37
+ [regex, method(:coverage_checker)]
23
38
  else
24
39
  super
25
40
  end
26
41
  end
27
42
 
43
+ # will check if the expected coverage is met,
44
+ # but first will test for pre conditions to pass
28
45
  def coverage_checker(matches)
29
- matches[1].to_f >= coverage ? true : 'Insufficient Coverage.'
46
+ matches = matches.to_s
47
+ if matches.match(pre_conditions_regex)
48
+ true
49
+ else
50
+ test_coverage_threshold(matches)
51
+ end
52
+ end
53
+
54
+ # checks the matched string from the console output,
55
+ # to see if the number for the coverage is greater or
56
+ # equal than the expected coverage
57
+ def test_coverage_threshold(matches)
58
+ if matches.to_f >= coverage
59
+ true
60
+ else
61
+ 'Insufficient Coverage.'
62
+ end
30
63
  end
31
64
  end
32
65
 
@@ -1,4 +1,4 @@
1
1
  module Fudge
2
2
  # Define gem version
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
@@ -59,7 +59,7 @@ describe Fudge::Cli do
59
59
  subject.init
60
60
 
61
61
  File.open('Fudgefile', 'r') do |f|
62
- f.read.should include "build :default do\n task :rspec\nend"
62
+ f.read.should eql "build :default do\n task :rspec\nend"
63
63
  end
64
64
  end
65
65
 
@@ -33,5 +33,6 @@ describe Fudge::Tasks::Rspec do
33
33
  it { should_not succeed_with_output '0.00%) covered' }
34
34
  it { should succeed_with_output '99.99999%) covered' }
35
35
  it { should succeed_with_output '100.0%) covered' }
36
+ it { should succeed_with_output '0 examples, 0 failures'}
36
37
  end
37
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fudge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-25 00:00:00.000000000 Z
12
+ date: 2013-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rb-fsevent
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: yard
112
128
  requirement: !ruby/object:Gem::Requirement
@@ -242,51 +258,52 @@ executables:
242
258
  extensions: []
243
259
  extra_rdoc_files: []
244
260
  files:
245
- - lib/fudge.rb
261
+ - lib/fudge/task_dsl.rb
246
262
  - lib/fudge/tasks.rb
247
- - lib/fudge/helpers/bundle_aware.rb
248
- - lib/fudge/cli.rb
249
- - lib/fudge/parser.rb
250
- - lib/fudge/version.rb
251
263
  - lib/fudge/exceptions.rb
252
- - lib/fudge/helpers.rb
253
- - lib/fudge/tasks/each_directory.rb
254
- - lib/fudge/tasks/clean_bundler_env.rb
264
+ - lib/fudge/runner.rb
265
+ - lib/fudge/helpers/bundle_aware.rb
266
+ - lib/fudge/description.rb
267
+ - lib/fudge/tasks/task.rb
255
268
  - lib/fudge/tasks/yard.rb
269
+ - lib/fudge/tasks/clean_bundler_env.rb
270
+ - lib/fudge/tasks/shell.rb
271
+ - lib/fudge/tasks/each_directory.rb
256
272
  - lib/fudge/tasks/rspec.rb
257
- - lib/fudge/tasks/in_directory.rb
273
+ - lib/fudge/tasks/rake.rb
258
274
  - lib/fudge/tasks/cane.rb
275
+ - lib/fudge/tasks/in_directory.rb
259
276
  - lib/fudge/tasks/composite_task.rb
260
- - lib/fudge/tasks/shell.rb
261
- - lib/fudge/tasks/rake.rb
262
- - lib/fudge/tasks/task.rb
263
- - lib/fudge/runner.rb
264
277
  - lib/fudge/build.rb
265
- - lib/fudge/description.rb
266
- - lib/fudge/task_dsl.rb
267
- - spec/lib/fudge/description_spec.rb
268
- - spec/lib/fudge/build_spec.rb
278
+ - lib/fudge/cli.rb
279
+ - lib/fudge/parser.rb
280
+ - lib/fudge/helpers.rb
281
+ - lib/fudge/version.rb
282
+ - lib/fudge.rb
283
+ - spec/support/dummy_task.rb
284
+ - spec/support/tmpdir.rb
285
+ - spec/support/output.rb
286
+ - spec/support/matchers.rb
269
287
  - spec/lib/fudge/parser_spec.rb
270
288
  - spec/lib/fudge/tasks_spec.rb
271
- - spec/lib/fudge/runner_spec.rb
272
- - spec/lib/fudge/tasks/composite_task_spec.rb
289
+ - spec/lib/fudge/description_spec.rb
290
+ - spec/lib/fudge/tasks/bundler_spec.rb
273
291
  - spec/lib/fudge/tasks/rake_spec.rb
292
+ - spec/lib/fudge/tasks/in_directory_spec.rb
293
+ - spec/lib/fudge/tasks/rspec_spec.rb
274
294
  - spec/lib/fudge/tasks/each_directory_spec.rb
295
+ - spec/lib/fudge/tasks/composite_task_spec.rb
275
296
  - spec/lib/fudge/tasks/yard_spec.rb
276
- - spec/lib/fudge/tasks/in_directory_spec.rb
277
- - spec/lib/fudge/tasks/cane_spec.rb
278
297
  - spec/lib/fudge/tasks/task_spec.rb
279
- - spec/lib/fudge/tasks/rspec_spec.rb
280
- - spec/lib/fudge/tasks/bundler_spec.rb
298
+ - spec/lib/fudge/tasks/cane_spec.rb
281
299
  - spec/lib/fudge/tasks/shell_spec.rb
282
- - spec/lib/fudge/cli_spec.rb
283
300
  - spec/lib/fudge/exceptions_spec.rb
284
- - spec/support/output.rb
285
- - spec/support/dummy_task.rb
286
- - spec/support/matchers.rb
287
- - spec/support/tmpdir.rb
301
+ - spec/lib/fudge/runner_spec.rb
302
+ - spec/lib/fudge/cli_spec.rb
303
+ - spec/lib/fudge/build_spec.rb
288
304
  - spec/spec_helper.rb
289
- - bin/fudge
305
+ - !binary |-
306
+ YmluL2Z1ZGdl
290
307
  homepage: http://github.com/Sage/fudge
291
308
  licenses: []
292
309
  post_install_message:
@@ -299,12 +316,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
299
316
  - - ! '>='
300
317
  - !ruby/object:Gem::Version
301
318
  version: '0'
319
+ segments:
320
+ - 0
321
+ hash: 2094964922924473820
302
322
  required_rubygems_version: !ruby/object:Gem::Requirement
303
323
  none: false
304
324
  requirements:
305
325
  - - ! '>='
306
326
  - !ruby/object:Gem::Version
307
327
  version: '0'
328
+ segments:
329
+ - 0
330
+ hash: 2094964922924473820
308
331
  requirements: []
309
332
  rubyforge_project: fudge
310
333
  rubygems_version: 1.8.24
@@ -312,26 +335,26 @@ signing_key:
312
335
  specification_version: 3
313
336
  summary: Fudge CI Server
314
337
  test_files:
315
- - spec/lib/fudge/description_spec.rb
316
- - spec/lib/fudge/build_spec.rb
338
+ - spec/support/dummy_task.rb
339
+ - spec/support/tmpdir.rb
340
+ - spec/support/output.rb
341
+ - spec/support/matchers.rb
317
342
  - spec/lib/fudge/parser_spec.rb
318
343
  - spec/lib/fudge/tasks_spec.rb
319
- - spec/lib/fudge/runner_spec.rb
320
- - spec/lib/fudge/tasks/composite_task_spec.rb
344
+ - spec/lib/fudge/description_spec.rb
345
+ - spec/lib/fudge/tasks/bundler_spec.rb
321
346
  - spec/lib/fudge/tasks/rake_spec.rb
347
+ - spec/lib/fudge/tasks/in_directory_spec.rb
348
+ - spec/lib/fudge/tasks/rspec_spec.rb
322
349
  - spec/lib/fudge/tasks/each_directory_spec.rb
350
+ - spec/lib/fudge/tasks/composite_task_spec.rb
323
351
  - spec/lib/fudge/tasks/yard_spec.rb
324
- - spec/lib/fudge/tasks/in_directory_spec.rb
325
- - spec/lib/fudge/tasks/cane_spec.rb
326
352
  - spec/lib/fudge/tasks/task_spec.rb
327
- - spec/lib/fudge/tasks/rspec_spec.rb
328
- - spec/lib/fudge/tasks/bundler_spec.rb
353
+ - spec/lib/fudge/tasks/cane_spec.rb
329
354
  - spec/lib/fudge/tasks/shell_spec.rb
330
- - spec/lib/fudge/cli_spec.rb
331
355
  - spec/lib/fudge/exceptions_spec.rb
332
- - spec/support/output.rb
333
- - spec/support/dummy_task.rb
334
- - spec/support/matchers.rb
335
- - spec/support/tmpdir.rb
356
+ - spec/lib/fudge/runner_spec.rb
357
+ - spec/lib/fudge/cli_spec.rb
358
+ - spec/lib/fudge/build_spec.rb
336
359
  - spec/spec_helper.rb
337
360
  has_rdoc: