Skip to content

Commit

Permalink
* README.txt: fix document.
Browse files Browse the repository at this point in the history
* .gitignore: ignore cov directory.

* spec/runner.rb: added.
  • Loading branch information
mame committed Jul 30, 2009
1 parent b97e5f5 commit 8e2688b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
TODO
cov
tools
public/chkbuild
14 changes: 11 additions & 3 deletions README.txt
Expand Up @@ -17,9 +17,10 @@ demo: http://dame.dyndns.org:7001/
== REQUIREMENTS:

* ruby 1.9.1p129 or later
* ramaze / innate (> 2009.06.12)
* sequel (3.1.0)
* amalgalite
* ramaze / innate (>= 2009.07)
* sequel (>= 3.1.0)
* amalgalite (>= 0.10.0)
* git (>= 1.6.0.2)

* thin (optional)

Expand Down Expand Up @@ -61,6 +62,13 @@ demo: http://dame.dyndns.org:7001/

* view http://server:7000/ by your browser

* if you can read Japanese, see also the following entry for details:
http://d.hatena.ne.jp/ku-ma-me/20090729/p1

* run tests if you want

$ ruby19 spec/runner.rb

== LICENSE:

Copyright (c) 2009 Yusuke Endoh <mame@tsg.ne.jp>, Nayuko Watanabe
30 changes: 30 additions & 0 deletions spec/runner.rb
@@ -0,0 +1,30 @@
#!/usr/bin/env ruby19

require "coverage"
require "pathname"

base_dir = Pathname(__FILE__).dirname.dirname.expand_path
$LOAD_PATH.unshift(base_dir.to_s)

specs = ARGV.empty? ? Dir.glob(base_dir.to_s + "/spec/**/*.rb") : ARGV
specs = specs.map {|spec| Pathname(spec).expand_path }
specs = specs.reject {|spec| spec == Pathname(__FILE__).expand_path }

Coverage.start
specs.each do |spec|
Dir.chdir(base_dir)
load(spec)
end
Dir.chdir(base_dir)
Coverage.result.each do |src, counts|
src = Pathname(src).relative_path_from(base_dir)
next if src.each_filename.first == ".."
dest = Pathname("cov") + src.dirname + (src.basename.to_s + "cov")
dest.dirname.mkpath
dest.open("w") do |file|
src.each_line.with_index.zip(counts) do |(line, idx), count|
count = count ? count > 0 ? count.to_s : "#####" : ""
file.puts "%8s:%4d:%s" % [count, idx + 1, line]
end
end
end

0 comments on commit 8e2688b

Please sign in to comment.