duvet 0.2.1 → 0.2.2

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.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # duvet
1
+ # Duvet
2
2
 
3
3
  Install with
4
4
 
@@ -16,15 +16,10 @@ You can change the defaults by passing an options hash to Duvet.start, eg
16
16
  `:dir` is the directory to write the coverage to.
17
17
  `:filter` allows you to display only coverage for files that include the string.
18
18
 
19
- ## Note on Patches/Pull Requests
20
-
21
- * Fork the project.
22
- * Make your feature addition or bug fix.
23
- * Add tests for it. This is important so I don't break it in a
24
- future version unintentionally.
25
- * Commit, do not mess with rakefile, version, or history.
26
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
27
- * Send me a pull request. Bonus points for topic branches.
19
+
20
+ ## Credits
21
+
22
+ This gem was created because I read this blog post http://engineering.attinteractive.com/2010/08/code-coverage-in-ruby-1-9/.
28
23
 
29
24
  ## Copyright
30
25
 
data/Rakefile CHANGED
@@ -1,24 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "duvet"
8
- gem.summary = %Q{Duvet a simple code coverage tool for ruby 1.9}
9
- gem.description = %Q{Duvet a simple code coverage tool for ruby 1.9}
10
- gem.email = "m@hawx.me"
11
- gem.homepage = "http://github.com/hawx/duvet"
12
- gem.authors = ["Joshua Hawxwell"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- gem.add_development_dependency "yard", ">= 0"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
- end
21
-
22
4
  require 'rake/testtask'
23
5
  Rake::TestTask.new(:test) do |test|
24
6
  test.libs << 'lib' << 'test'
@@ -26,19 +8,6 @@ Rake::TestTask.new(:test) do |test|
26
8
  test.verbose = true
27
9
  end
28
10
 
29
- begin
30
- require 'rcov/rcovtask'
31
- Rcov::RcovTask.new do |test|
32
- test.libs << 'test'
33
- test.pattern = 'test/**/test_*.rb'
34
- test.verbose = true
35
- end
36
- rescue LoadError
37
- task :rcov do
38
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
- end
40
- end
41
-
42
11
  task :test => :check_dependencies
43
12
 
44
13
  task :default => :test
data/lib/duvet.rb CHANGED
@@ -7,7 +7,6 @@ $: << File.join(File.dirname(__FILE__), '..')
7
7
  #
8
8
  require 'coverage'
9
9
  require 'ostruct'
10
- require 'erubis'
11
10
  require 'pathname'
12
11
  require 'haml'
13
12
  require 'sass'
@@ -15,6 +14,7 @@ require 'sass'
15
14
  require 'duvet/ext'
16
15
  require 'duvet/covs'
17
16
  require 'duvet/cov'
17
+ require 'duvet/version'
18
18
 
19
19
 
20
20
  module Duvet
@@ -66,18 +66,11 @@ module Duvet
66
66
  @running
67
67
  end
68
68
 
69
- # Reads the current version from VERSION
70
- #
71
- # @return [String] current version
72
- def self.version
73
- File.read( File.join(File.dirname(__FILE__), '..', 'VERSION') )
74
- end
75
-
76
69
  # @return [Hash] hash to merge for templating
77
70
  def self.template_hash
78
71
  {
79
72
  'time' => Time.now,
80
- 'version' => self.version,
73
+ 'version' => VERSION,
81
74
  'name' => 'duvet'
82
75
  }
83
76
  end
@@ -0,0 +1,3 @@
1
+ module Duvet
2
+ VERSION = '0.2.2'
3
+ end
@@ -41,26 +41,21 @@
41
41
  %tr{:class => "excluded"}
42
42
  %td{:class => "no"}= i
43
43
  %td
44
- %pre
45
- %code= line.gsub("\n", "")
44
+ %pre
45
+ %code
46
+ #{line}
46
47
 
47
- - elsif count.zero?
48
- %tr{:class => "unran"}
49
- %td{:class => "no"}= i
50
- %td
51
- %pre
52
- %code= line.gsub("\n", "")
53
- %td
54
- %span{:class => "count"}= count
55
-
56
48
  - else
57
- %tr{:class => "ran"}
49
+ %tr{:class => (count.zero? ? "unran" : "ran") }
50
+
58
51
  %td{:class => "no"}= i
59
52
  %td
60
53
  %pre
61
- %code= line.gsub("\n", "")
62
- %td
63
- %span{:class => "count"}= count
54
+ %code
55
+ #{line}
56
+
57
+ %td
58
+ %span{:class => "count"}= count
64
59
 
65
60
 
66
61
 
metadata CHANGED
@@ -1,69 +1,54 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: duvet
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Joshua Hawxwell
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-11-27 00:00:00 +00:00
18
- default_executable: duvet
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: thoughtbot-shoulda
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-04-16 00:00:00.000000000 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: haml
17
+ requirement: &2153122340 !ruby/object:Gem::Requirement
24
18
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
31
- type: :development
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: yard
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.25
23
+ type: :runtime
35
24
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2153122340
26
+ - !ruby/object:Gem::Dependency
27
+ name: thoughtbot-shoulda
28
+ requirement: &2153121880 !ruby/object:Gem::Requirement
37
29
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
44
34
  type: :development
45
- version_requirements: *id002
46
- description: Duvet a simple code coverage tool for ruby 1.9
35
+ prerelease: false
36
+ version_requirements: *2153121880
37
+ description: ! " A simple code coverage tool for Ruby 1.9. Add 'Duvet.start' to
38
+ the top\n of your test helper, to have it write code coverage stuff to 'cov/'.\n"
47
39
  email: m@hawx.me
48
- executables:
49
- - duvet
40
+ executables: []
50
41
  extensions: []
51
-
52
- extra_rdoc_files:
53
- - LICENSE
54
- - README.md
55
- files:
56
- - .document
57
- - LICENSE
42
+ extra_rdoc_files: []
43
+ files:
58
44
  - README.md
59
45
  - Rakefile
60
- - VERSION
61
- - bin/duvet
62
- - duvet.gemspec
63
- - lib/duvet.rb
46
+ - LICENSE
64
47
  - lib/duvet/cov.rb
65
48
  - lib/duvet/covs.rb
66
49
  - lib/duvet/ext.rb
50
+ - lib/duvet/version.rb
51
+ - lib/duvet.rb
67
52
  - templates/css/dark.sass
68
53
  - templates/css/light.sass
69
54
  - templates/css/rcov.sass
@@ -72,43 +57,29 @@ files:
72
57
  - templates/js/jquery.js
73
58
  - templates/js/main.js
74
59
  - templates/js/plugins.js
75
- - test/helper.rb
76
- - test/test_duvet.rb
77
- - test_duvet/lib/klass.rb
78
- - test_duvet/lib/run.rb
79
- - test_duvet/test/test_all.rb
80
- has_rdoc: true
60
+ has_rdoc: false
81
61
  homepage: http://github.com/hawx/duvet
82
62
  licenses: []
83
-
84
63
  post_install_message:
85
64
  rdoc_options: []
86
-
87
- require_paths:
65
+ require_paths:
88
66
  - lib
89
- required_ruby_version: !ruby/object:Gem::Requirement
67
+ required_ruby_version: !ruby/object:Gem::Requirement
90
68
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- segments:
95
- - 0
96
- version: "0"
97
- required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '1.9'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
74
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- segments:
103
- - 0
104
- version: "0"
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
105
79
  requirements: []
106
-
107
80
  rubyforge_project:
108
- rubygems_version: 1.3.7
81
+ rubygems_version: 1.6.2
109
82
  signing_key:
110
83
  specification_version: 3
111
- summary: Duvet a simple code coverage tool for ruby 1.9
112
- test_files:
113
- - test/helper.rb
114
- - test/test_duvet.rb
84
+ summary: Duvet a simple code coverage tool for Ruby 1.9.
85
+ test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.1
data/bin/duvet DELETED
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # A command line tool for coverage testing, I'm not sure if this
4
- # will even work but it is worth a try!
5
- #
6
- # Example:
7
- # duvet test/test_class.rb
8
- #
9
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
10
-
11
- require 'clive'
12
- require 'duvet'
13
-
14
- opts = {:dir => 'cov', :style => 'rcov'}
15
- c = Clive.new do
16
-
17
- header "Usage: duvet [options] [paths]"
18
-
19
- flag(:css, "PATH", "Use custom css file") do |i|
20
- opts[:css] = i
21
- end
22
-
23
- flag(:s, :style, "ARG", "Choose style") do |i|
24
- opts[:style] = i
25
- end
26
-
27
- flag(:d, :dir, "PATH", "Directory to write coverage results") do |i|
28
- opts[:dir] = i
29
- end
30
-
31
- flag(:f, :filter, "FILTER", "Use a filter to see only needed results") do |i|
32
- opts[:filter] = i
33
- end
34
-
35
- end
36
-
37
- # Start coverage, then require paths
38
- def run(paths, opts)
39
- Duvet.start(opts)
40
- paths.each do |p|
41
- require p
42
- end
43
- end
44
-
45
- args = c.parse(ARGV)
46
- run(args, opts)
data/duvet.gemspec DELETED
@@ -1,72 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{duvet}
8
- s.version = "0.2.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Joshua Hawxwell"]
12
- s.date = %q{2010-11-27}
13
- s.default_executable = %q{duvet}
14
- s.description = %q{Duvet a simple code coverage tool for ruby 1.9}
15
- s.email = %q{m@hawx.me}
16
- s.executables = ["duvet"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".document",
23
- "LICENSE",
24
- "README.md",
25
- "Rakefile",
26
- "VERSION",
27
- "bin/duvet",
28
- "duvet.gemspec",
29
- "lib/duvet.rb",
30
- "lib/duvet/cov.rb",
31
- "lib/duvet/covs.rb",
32
- "lib/duvet/ext.rb",
33
- "templates/css/dark.sass",
34
- "templates/css/light.sass",
35
- "templates/css/rcov.sass",
36
- "templates/html/file.haml",
37
- "templates/html/index.haml",
38
- "templates/js/jquery.js",
39
- "templates/js/main.js",
40
- "templates/js/plugins.js",
41
- "test/helper.rb",
42
- "test/test_duvet.rb",
43
- "test_duvet/lib/klass.rb",
44
- "test_duvet/lib/run.rb",
45
- "test_duvet/test/test_all.rb"
46
- ]
47
- s.homepage = %q{http://github.com/hawx/duvet}
48
- s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.7}
50
- s.summary = %q{Duvet a simple code coverage tool for ruby 1.9}
51
- s.test_files = [
52
- "test/helper.rb",
53
- "test/test_duvet.rb"
54
- ]
55
-
56
- if s.respond_to? :specification_version then
57
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
58
- s.specification_version = 3
59
-
60
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
61
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
62
- s.add_development_dependency(%q<yard>, [">= 0"])
63
- else
64
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
65
- s.add_dependency(%q<yard>, [">= 0"])
66
- end
67
- else
68
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
69
- s.add_dependency(%q<yard>, [">= 0"])
70
- end
71
- end
72
-
data/test/helper.rb DELETED
@@ -1,10 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'duvet'
4
-
5
- require 'rubygems'
6
- require 'test/unit'
7
- require 'shoulda'
8
-
9
- class Test::Unit::TestCase
10
- end
data/test/test_duvet.rb DELETED
@@ -1,5 +0,0 @@
1
- require File.join(File.dirname(__FILE__) ,'helper')
2
-
3
- class TestDuvet < Test::Unit::TestCase
4
-
5
- end
@@ -1,25 +0,0 @@
1
- class Klass
2
-
3
- attr_accessor :help
4
-
5
- def initialize
6
- @help = false
7
- end
8
-
9
- def alert!
10
- @help = true
11
- end
12
-
13
- def shout!
14
- if help?
15
- "I NEED HELP!"
16
- else
17
- "EVERYTHING IS OK!"
18
- end
19
- end
20
-
21
- def help?
22
- @help
23
- end
24
-
25
- end
@@ -1,21 +0,0 @@
1
- class Run
2
-
3
- def run_it
4
- run('it')
5
- end
6
-
7
- def run_here
8
- run('here')
9
- end
10
-
11
- def run_there
12
- run('there')
13
- end
14
-
15
-
16
- def run(word)
17
- return "run #{word}"
18
- "Hey guess what I will never ever run."
19
- end
20
-
21
- end
@@ -1,59 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
2
- require 'duvet'
3
- Duvet.start({:dir => 'test_duvet/cov', :filter => 'test_duvet/lib/'})
4
-
5
-
6
- require 'rubygems'
7
- require 'test/unit'
8
- require 'shoulda'
9
-
10
-
11
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
12
- $LOAD_PATH.unshift(File.dirname(__FILE__))
13
- require 'klass'
14
- require 'run'
15
-
16
- class Test::Unit::TestCase
17
- end
18
-
19
- # This should run every line
20
- class TestKlass < Test::Unit::TestCase
21
-
22
- should "start out ok" do
23
- k = Klass.new
24
- assert_equal "EVERYTHING IS OK!", k.shout!
25
- end
26
-
27
- should "need help when alerted" do
28
- k = Klass.new
29
- k.alert!
30
- assert_equal true, k.help?
31
- end
32
-
33
- should "now shout for help" do
34
- k = Klass.new
35
- k.alert!
36
- assert_equal "I NEED HELP!", k.shout!
37
- end
38
-
39
- end
40
-
41
- # This one should not run every line
42
- class TestRun < Test::Unit::TestCase
43
-
44
- # should "run it" do
45
- # me = Run.new
46
- # assert_equal "run it", me.run_it
47
- # end
48
-
49
- # should "run here" do
50
- # me = Run.new
51
- # assert_equal "run here", me.run_here
52
- # end
53
-
54
- should "run there" do
55
- me = Run.new
56
- assert_equal "run there", me.run_there
57
- end
58
-
59
- end