zaphod 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8b985fa07e31d0a2e442bfb3f0af08f485c16b71
4
+ data.tar.gz: 4bc888ba21ba077563bda11553ea603386c03724
5
+ SHA512:
6
+ metadata.gz: 765fa47d7730e1890073fd6e0927d49b01a986c1e16750a1d36df8fc62e7c12a4dcc60a0890a10d4572b7283d41ac0c08bfbae96ca714b5f783d0ada78053e97
7
+ data.tar.gz: 969ec8dbfd997dec29bbea65b362448bca2603db4597d29e41ae476ae09492240afbce44af73200e97705a29c701de6ad0b709cea36c5bb13f1aab9833229d1a
data/.bundle/config ADDED
@@ -0,0 +1 @@
1
+ --- {}
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ TAGS
2
+ tmp/*
3
+ *.gem
4
+ *.rbc
5
+ .bundle
6
+ .config
7
+ coverage
8
+ lib/bundler/man
9
+ pkg
10
+ rdoc
11
+ spec/reports
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zaphod (1.0.0)
5
+ grit (~> 2.5)
6
+ simplecov (~> 0.8)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ celluloid (0.15.2)
12
+ timers (~> 1.1.0)
13
+ coderay (1.1.0)
14
+ diff-lcs (1.2.5)
15
+ docile (1.1.2)
16
+ ffi (1.9.3)
17
+ formatador (0.2.4)
18
+ grit (2.5.0)
19
+ diff-lcs (~> 1.1)
20
+ mime-types (~> 1.15)
21
+ posix-spawn (~> 0.3.6)
22
+ guard (2.3.0)
23
+ formatador (>= 0.2.4)
24
+ listen (~> 2.1)
25
+ lumberjack (~> 1.0)
26
+ pry (>= 0.9.12)
27
+ thor (>= 0.18.1)
28
+ guard-bundler (2.0.0)
29
+ bundler (~> 1.0)
30
+ guard (~> 2.2)
31
+ guard-rspec (4.2.4)
32
+ guard (~> 2.1)
33
+ rspec (>= 2.14, < 4.0)
34
+ guard-shell (0.6.1)
35
+ guard (>= 1.1.0)
36
+ listen (2.4.0)
37
+ celluloid (>= 0.15.2)
38
+ rb-fsevent (>= 0.9.3)
39
+ rb-inotify (>= 0.9)
40
+ lumberjack (1.0.4)
41
+ method_source (0.8.2)
42
+ mime-types (1.25.1)
43
+ multi_json (1.8.4)
44
+ posix-spawn (0.3.8)
45
+ pry (0.9.12.4)
46
+ coderay (~> 1.0)
47
+ method_source (~> 0.8)
48
+ slop (~> 3.4)
49
+ rake (10.1.1)
50
+ rb-fsevent (0.9.4)
51
+ rb-inotify (0.9.3)
52
+ ffi (>= 0.5.0)
53
+ rb-readline (0.5.1)
54
+ rr (1.1.2)
55
+ rspec (2.14.1)
56
+ rspec-core (~> 2.14.0)
57
+ rspec-expectations (~> 2.14.0)
58
+ rspec-mocks (~> 2.14.0)
59
+ rspec-core (2.14.7)
60
+ rspec-expectations (2.14.4)
61
+ diff-lcs (>= 1.1.3, < 2.0)
62
+ rspec-mocks (2.14.4)
63
+ simplecov (0.8.2)
64
+ docile (~> 1.1.0)
65
+ multi_json
66
+ simplecov-html (~> 0.8.0)
67
+ simplecov-html (0.8.0)
68
+ slop (3.4.7)
69
+ thor (0.18.1)
70
+ timers (1.1.0)
71
+
72
+ PLATFORMS
73
+ ruby
74
+
75
+ DEPENDENCIES
76
+ guard (~> 2.3)
77
+ guard-bundler
78
+ guard-rspec (~> 4.2)
79
+ guard-shell
80
+ pry
81
+ rake (~> 10.1)
82
+ rb-fsevent
83
+ rb-readline
84
+ rr (~> 1.1)
85
+ rspec (~> 2.14)
86
+ zaphod!
data/Guardfile ADDED
@@ -0,0 +1,20 @@
1
+ # -*- mode: ruby -*-
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :bundler do
5
+ watch 'matron.gemspec'
6
+ watch 'Gemfile'
7
+ end
8
+
9
+ guard 'rspec', :cmd => "bundle exec rspec --color --format documentation" do
10
+ watch( %r{^spec/.+_spec\.rb$} )
11
+ watch( %r{^lib/(.+)\.rb$} ) { |m| "spec/#{m[1]}_spec.rb" }
12
+ watch( 'spec/spec_helper.rb' ) { "spec" }
13
+ end
14
+
15
+ guard 'shell' do
16
+ watch( %r{^lib/.+\.rb$} ) {
17
+ `ctags -R -e lib`
18
+ `emacsclient --eval "(visit-tags-table tags-file-name)"`
19
+ }
20
+ end
data/LICENSE ADDED
@@ -0,0 +1,198 @@
1
+ Eclipse Public License - v 1.0
2
+
3
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
4
+ LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
5
+ CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
6
+
7
+ 1. DEFINITIONS
8
+
9
+ "Contribution" means:
10
+
11
+ a) in the case of the initial Contributor, the initial code and documentation
12
+ distributed under this Agreement, and
13
+ b) in the case of each subsequent Contributor:
14
+ i) changes to the Program, and
15
+ ii) additions to the Program;
16
+
17
+ where such changes and/or additions to the Program originate from and are
18
+ distributed by that particular Contributor. A Contribution 'originates' from
19
+ a Contributor if it was added to the Program by such Contributor itself or
20
+ anyone acting on such Contributor's behalf. Contributions do not include
21
+ additions to the Program which: (i) are separate modules of software
22
+ distributed in conjunction with the Program under their own license
23
+ agreement, and (ii) are not derivative works of the Program.
24
+
25
+ "Contributor" means any person or entity that distributes the Program.
26
+
27
+ "Licensed Patents" mean patent claims licensable by a Contributor which are
28
+ necessarily infringed by the use or sale of its Contribution alone or when
29
+ combined with the Program.
30
+
31
+ "Program" means the Contributions distributed in accordance with this Agreement.
32
+
33
+ "Recipient" means anyone who receives the Program under this Agreement,
34
+ including all Contributors.
35
+
36
+ 2. GRANT OF RIGHTS
37
+ a) Subject to the terms of this Agreement, each Contributor hereby grants
38
+ Recipient a non-exclusive, worldwide, royalty-free copyright license to
39
+ reproduce, prepare derivative works of, publicly display, publicly perform,
40
+ distribute and sublicense the Contribution of such Contributor, if any, and
41
+ such derivative works, in source code and object code form.
42
+ b) Subject to the terms of this Agreement, each Contributor hereby grants
43
+ Recipient a non-exclusive, worldwide, royalty-free patent license under
44
+ Licensed Patents to make, use, sell, offer to sell, import and otherwise
45
+ transfer the Contribution of such Contributor, if any, in source code and
46
+ object code form. This patent license shall apply to the combination of the
47
+ Contribution and the Program if, at the time the Contribution is added by
48
+ the Contributor, such addition of the Contribution causes such combination
49
+ to be covered by the Licensed Patents. The patent license shall not apply
50
+ to any other combinations which include the Contribution. No hardware per
51
+ se is licensed hereunder.
52
+ c) Recipient understands that although each Contributor grants the licenses to
53
+ its Contributions set forth herein, no assurances are provided by any
54
+ Contributor that the Program does not infringe the patent or other
55
+ intellectual property rights of any other entity. Each Contributor
56
+ disclaims any liability to Recipient for claims brought by any other entity
57
+ based on infringement of intellectual property rights or otherwise. As a
58
+ condition to exercising the rights and licenses granted hereunder, each
59
+ Recipient hereby assumes sole responsibility to secure any other
60
+ intellectual property rights needed, if any. For example, if a third party
61
+ patent license is required to allow Recipient to distribute the Program, it
62
+ is Recipient's responsibility to acquire that license before distributing
63
+ the Program.
64
+ d) Each Contributor represents that to its knowledge it has sufficient
65
+ copyright rights in its Contribution, if any, to grant the copyright
66
+ license set forth in this Agreement.
67
+
68
+ 3. REQUIREMENTS
69
+
70
+ A Contributor may choose to distribute the Program in object code form under its
71
+ own license agreement, provided that:
72
+
73
+ a) it complies with the terms and conditions of this Agreement; and
74
+ b) its license agreement:
75
+ i) effectively disclaims on behalf of all Contributors all warranties and
76
+ conditions, express and implied, including warranties or conditions of
77
+ title and non-infringement, and implied warranties or conditions of
78
+ merchantability and fitness for a particular purpose;
79
+ ii) effectively excludes on behalf of all Contributors all liability for
80
+ damages, including direct, indirect, special, incidental and
81
+ consequential damages, such as lost profits;
82
+ iii) states that any provisions which differ from this Agreement are offered
83
+ by that Contributor alone and not by any other party; and
84
+ iv) states that source code for the Program is available from such
85
+ Contributor, and informs licensees how to obtain it in a reasonable
86
+ manner on or through a medium customarily used for software exchange.
87
+
88
+ When the Program is made available in source code form:
89
+
90
+ a) it must be made available under this Agreement; and
91
+ b) a copy of this Agreement must be included with each copy of the Program.
92
+ Contributors may not remove or alter any copyright notices contained within
93
+ the Program.
94
+
95
+ Each Contributor must identify itself as the originator of its Contribution, if
96
+ any, in a manner that reasonably allows subsequent Recipients to identify the
97
+ originator of the Contribution.
98
+
99
+ 4. COMMERCIAL DISTRIBUTION
100
+
101
+ Commercial distributors of software may accept certain responsibilities with
102
+ respect to end users, business partners and the like. While this license is
103
+ intended to facilitate the commercial use of the Program, the Contributor who
104
+ includes the Program in a commercial product offering should do so in a manner
105
+ which does not create potential liability for other Contributors. Therefore, if
106
+ a Contributor includes the Program in a commercial product offering, such
107
+ Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
108
+ every other Contributor ("Indemnified Contributor") against any losses, damages
109
+ and costs (collectively "Losses") arising from claims, lawsuits and other legal
110
+ actions brought by a third party against the Indemnified Contributor to the
111
+ extent caused by the acts or omissions of such Commercial Contributor in
112
+ connection with its distribution of the Program in a commercial product
113
+ offering. The obligations in this section do not apply to any claims or Losses
114
+ relating to any actual or alleged intellectual property infringement. In order
115
+ to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
116
+ Contributor in writing of such claim, and b) allow the Commercial Contributor to
117
+ control, and cooperate with the Commercial Contributor in, the defense and any
118
+ related settlement negotiations. The Indemnified Contributor may participate in
119
+ any such claim at its own expense.
120
+
121
+ For example, a Contributor might include the Program in a commercial product
122
+ offering, Product X. That Contributor is then a Commercial Contributor. If that
123
+ Commercial Contributor then makes performance claims, or offers warranties
124
+ related to Product X, those performance claims and warranties are such
125
+ Commercial Contributor's responsibility alone. Under this section, the
126
+ Commercial Contributor would have to defend claims against the other
127
+ Contributors related to those performance claims and warranties, and if a court
128
+ requires any other Contributor to pay any damages as a result, the Commercial
129
+ Contributor must pay those damages.
130
+
131
+ 5. NO WARRANTY
132
+
133
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
134
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
135
+ IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
136
+ NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
137
+ Recipient is solely responsible for determining the appropriateness of using and
138
+ distributing the Program and assumes all risks associated with its exercise of
139
+ rights under this Agreement , including but not limited to the risks and costs
140
+ of program errors, compliance with applicable laws, damage to or loss of data,
141
+ programs or equipment, and unavailability or interruption of operations.
142
+
143
+ 6. DISCLAIMER OF LIABILITY
144
+
145
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
146
+ CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
147
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
148
+ PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
149
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
150
+ OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
151
+ GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
152
+
153
+ 7. GENERAL
154
+
155
+ If any provision of this Agreement is invalid or unenforceable under applicable
156
+ law, it shall not affect the validity or enforceability of the remainder of the
157
+ terms of this Agreement, and without further action by the parties hereto, such
158
+ provision shall be reformed to the minimum extent necessary to make such
159
+ provision valid and enforceable.
160
+
161
+ If Recipient institutes patent litigation against any entity (including a
162
+ cross-claim or counterclaim in a lawsuit) alleging that the Program itself
163
+ (excluding combinations of the Program with other software or hardware)
164
+ infringes such Recipient's patent(s), then such Recipient's rights granted under
165
+ Section 2(b) shall terminate as of the date such litigation is filed.
166
+
167
+ All Recipient's rights under this Agreement shall terminate if it fails to
168
+ comply with any of the material terms or conditions of this Agreement and does
169
+ not cure such failure in a reasonable period of time after becoming aware of
170
+ such noncompliance. If all Recipient's rights under this Agreement terminate,
171
+ Recipient agrees to cease use and distribution of the Program as soon as
172
+ reasonably practicable. However, Recipient's obligations under this Agreement
173
+ and any licenses granted by Recipient relating to the Program shall continue and
174
+ survive.
175
+
176
+ Everyone is permitted to copy and distribute copies of this Agreement, but in
177
+ order to avoid inconsistency the Agreement is copyrighted and may only be
178
+ modified in the following manner. The Agreement Steward reserves the right to
179
+ publish new versions (including revisions) of this Agreement from time to time.
180
+ No one other than the Agreement Steward has the right to modify this Agreement.
181
+ The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
182
+ may assign the responsibility to serve as the Agreement Steward to a suitable
183
+ separate entity. Each new version of the Agreement will be given a
184
+ distinguishing version number. The Program (including Contributions) may always
185
+ be distributed subject to the version of the Agreement under which it was
186
+ received. In addition, after a new version of the Agreement is published,
187
+ Contributor may elect to distribute the Program (including its Contributions)
188
+ under the new version. Except as expressly stated in Sections 2(a) and 2(b)
189
+ above, Recipient receives no rights or licenses to the intellectual property of
190
+ any Contributor under this Agreement, whether expressly, by implication,
191
+ estoppel or otherwise. All rights in the Program not expressly granted under
192
+ this Agreement are reserved.
193
+
194
+ This Agreement is governed by the laws of the State of New York and the
195
+ intellectual property laws of the United States of America. No party to this
196
+ Agreement will bring a legal action under this Agreement more than one year
197
+ after the cause of action arose. Each party waives its rights to a jury trial in
198
+ any resulting litigation.
data/README.org ADDED
@@ -0,0 +1,59 @@
1
+ * Zaphod
2
+
3
+ “I can understand that. I wouldn't trust myself further than I could spit a rat.”
4
+
5
+ ** You Will Not Commit Untested Code!
6
+
7
+ Catch, and publicly embarrass, untested commits into git.
8
+
9
+ ** Installation
10
+
11
+ *** Simple Installation
12
+
13
+ #+BEGIN_SRC ruby
14
+ require "zaphod"
15
+ Zaphod.setup
16
+ #+END_SRC
17
+
18
+ *** Setup your own SimpleCov Formatters
19
+
20
+ #+BEGIN_SRC ruby
21
+ require "zaphod"
22
+
23
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
24
+ SimpleCov::Formatter::HTMLFormatter, # Optional, I suppose
25
+ SimpleCov::Formatter::ZaphodFormatter
26
+ ]
27
+
28
+ SimpleCov.start
29
+ #+END_SRC
30
+
31
+ ** Configuration
32
+
33
+ #+BEGIN_SRC ruby
34
+ require "pony"
35
+
36
+ Zaphod.setup do |configuration|
37
+ configuration.on_failure do
38
+ Pony.mail(
39
+ to: 'you@example.com',
40
+ subject: "Someone is trying to commit untested code!"
41
+ )
42
+ raise SystemExit.new( -1 )
43
+ end
44
+ end
45
+ #+END_SRC
46
+
47
+ #+BEGIN_SRC ruby
48
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
49
+ SimpleCov::Formatter::HTMLFormatter,
50
+ SimpleCov::Formatter::ZaphodFormatter
51
+ ]
52
+
53
+ Zaphod.configure do |configuration|
54
+ configuration.on_failure do
55
+ $stderr.puts "What would your mother think?"
56
+ end
57
+ end
58
+ SimpleCov.start
59
+ #+END_SRC
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "rake"
2
+ require "rdoc/task"
3
+
4
+ begin
5
+ require 'bundler/setup'
6
+ Bundler::GemHelper.install_tasks
7
+ rescue LoadError
8
+ puts "Bundler not available. Install it with: gem install bundler"
9
+ end
@@ -0,0 +1,40 @@
1
+ require "zaphod/change_set"
2
+
3
+ module SimpleCov
4
+ module Formatter
5
+ # Send a set of File:Line tuples to a Zaphod class that intersects
6
+ # it with a set from the last git commit. Blow up and send an
7
+ # email if the intersection reveals lines in the current commit
8
+ # that are uncovered.
9
+ #
10
+ # Aborting with a non-zero exit code should propagate properly
11
+ # through SimpleCov.
12
+ #
13
+ class ZaphodFormatter
14
+ attr_accessor :source_control
15
+
16
+ def initialize()
17
+ @source_control = Zaphod::SourceControl.git Dir.pwd
18
+ end
19
+
20
+ def format( result )
21
+ uncovered_codeset = uncovered result
22
+ changed_codeset = source_control.changes
23
+
24
+ diff = uncovered_codeset.intersection( changed_codeset )
25
+ unless diff.empty?
26
+ Zaphod.configuration.on_failure.call diff
27
+ end
28
+ end
29
+
30
+ def uncovered( result )
31
+ Zaphod::ChangeSet.new result.files.map { |source_file|
32
+ Zaphod::CodeChange.new(
33
+ source_file.filename,
34
+ source_file.missed_lines.map( &:src )
35
+ )
36
+ }
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ require "forwardable"
2
+ require "set"
3
+
4
+ module Zaphod
5
+ class ChangeSet
6
+ extend Forwardable
7
+ attr_reader :changes
8
+ def_delegators :@changes, :empty?, :each, :map, :first, :length, :intersection
9
+
10
+ def initialize( changes )
11
+ @changes = Set.new changes
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ module Zaphod
2
+ class CodeChange
3
+ attr_reader :path, :source
4
+ def initialize( path, source_lines=[] )
5
+ @path = File.expand_path path
6
+ @source = source_lines
7
+ end
8
+
9
+ def eql?( other )
10
+ return false if source.empty?
11
+ path.eql?( other.path ) &&
12
+ !(source & other.source ).empty?
13
+ end
14
+
15
+ def hash()
16
+ [path, source].hash
17
+ end
18
+
19
+ def inspect()
20
+ "<#{self.class.name} #{path}>\n" + source.join( "\n" )
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module Zaphod
2
+ class Configuration
3
+ def initialize()
4
+ self.on_failure { raise SystemExit.new( -1 ) }
5
+ end
6
+
7
+ def on_failure( &block )
8
+ if block_given?
9
+ @on_failure_action = block
10
+ else
11
+ @on_failure_action
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/zaphod/git.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'grit'
2
+
3
+ module Zaphod
4
+ class Git
5
+ attr_reader :repo
6
+ attr_accessor :diff_against
7
+
8
+ def self.from_path( path )
9
+ new Grit::Repo.new( path )
10
+ end
11
+
12
+ def initialize( repository, diff_against="HEAD" )
13
+ @repo = repository
14
+ @diff_against = diff_against
15
+ end
16
+
17
+ def diff()
18
+ diffs = repo.git.diff_index( { p: true }, diff_against ).
19
+ split( /^diff --git .* b(.*)$/ )
20
+
21
+ as_hash diffs
22
+ end
23
+
24
+ protected
25
+
26
+ def as_hash( diff )
27
+ diffs = diff.drop_while( &:empty? )
28
+ relativize_paths Hash[*diffs]
29
+ end
30
+
31
+ def relativize_paths( patch_map )
32
+ patch_map.dup.each_with_object( map = {}) do |pair, h|
33
+ h[".#{pair.first}"] = pair.last
34
+ end
35
+ map
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,31 @@
1
+ require "zaphod/git"
2
+
3
+ module Zaphod
4
+ class SourceControl
5
+ attr_reader :repo
6
+
7
+ def self.git( path )
8
+ new Git.from_path( path )
9
+ end
10
+
11
+ def initialize( repository )
12
+ @repo = repository
13
+ end
14
+
15
+ def changes()
16
+ ChangeSet.new repo.diff.map { |path, diff|
17
+ CodeChange.new File.expand_path( path ), additions_from( diff.lines )
18
+ }
19
+ end
20
+
21
+ def additions_from( lines )
22
+ lines.
23
+ select { |l| addition? l }.
24
+ map { |l| l.gsub( /^[+]/, "" ) }
25
+ end
26
+
27
+ def addition?( line )
28
+ line =~ /^[+][^+]/
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,7 @@
1
+ module Zaphod
2
+ class Spike
3
+ def initialize()
4
+ @var = "foo"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Zaphod
2
+ VERSION = "1.0.0"
3
+ end
data/lib/zaphod.rb ADDED
@@ -0,0 +1,26 @@
1
+ require "simplecov"
2
+ require 'simplecov/formatter/zaphod_formatter'
3
+ require 'zaphod/code_change'
4
+ require 'zaphod/source_control'
5
+ require 'zaphod/configuration'
6
+
7
+ module Zaphod
8
+ def self.configuration()
9
+ @configuration ||= Configuration.new
10
+ end
11
+
12
+ def self.configure()
13
+ yield configuration
14
+ end
15
+
16
+ def self.setup()
17
+ require "simplecov"
18
+ yield configuration if block_given?
19
+
20
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
21
+ SimpleCov::Formatter::HTMLFormatter,
22
+ SimpleCov::Formatter::ZaphodFormatter
23
+ ]
24
+ SimpleCov.start
25
+ end
26
+ end
data/spec/do_spec.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'zaphod/spike'
3
+
4
+ describe "converage" do
5
+ it "tests something" do
6
+ (1 + 1).should == 2
7
+ end
8
+ end