Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing files (hopefully finally?)
- Loading branch information
Showing
106 changed files
with
12,489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2006-2007 Susan Potter <me _at_ susanpotter _dot_ net>. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$:.unshift('lib') | ||
|
||
require('rubygems') | ||
gem('rspec', '>=1.0.0') | ||
|
||
require('rake') | ||
require('twitter') | ||
|
||
import('tasks/clean.rake') | ||
import('tasks/doc.rake') | ||
import('tasks/find.rake') | ||
import('tasks/pkg.rake') | ||
import('tasks/rubyforge.rake') | ||
import('tasks/spec.rake') | ||
import('tasks/stats.rake') | ||
import('tasks/web.rake') | ||
|
||
task :default => [:coverage] | ||
|
||
namespace :spec do | ||
task :autotest do | ||
Autotest::Rspec.run | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module RCov; end | ||
|
||
require('erb') | ||
require('tidy') | ||
require('hpricot') | ||
|
||
require(File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')) | ||
|
||
class File #:nodoc: | ||
class << self | ||
# Reads in local file from current directory. | ||
def read_local(file) | ||
self.read(self.join(self.dirname(__FILE__), file)) | ||
end | ||
end | ||
end | ||
|
||
# Follows <tt>Strategy</tt> design pattern | ||
class RCov::OutputMorpher | ||
# transforms given list of <tt>files</tt> based on new template. | ||
def transform(files, output_dir = '../web/rcov/', template = 'templates/rcov.rhtml') | ||
files.each do |file| | ||
data = File.read(file) | ||
fname = File.basename(file) | ||
xml = Tidy.open(:show_warnings => true) do |tidy| | ||
tidy.options.output_xml = true | ||
tidy.clean(data) | ||
end | ||
|
||
rhtml = ERB.new(File.read_local(template), 0) | ||
parser = Hpricot.parse(xml) | ||
legend_content = parser.find_element('pre') | ||
table_content = parser.find_element('table') | ||
code_content = table_content.next_sibling | ||
index = (fname == 'index.html') | ||
version = Twitter::Version.to_version | ||
File.delete(fname) if File.exists?(fname) | ||
File.open("#{output_dir}/#{fname}", 'w') do |f| | ||
f.puts(rhtml.result(binding)) | ||
end | ||
end | ||
end | ||
end | ||
|
||
module RCov | ||
class << self | ||
# returns html files to morph based on tidy configuration file | ||
def configure_morpher(tidy_conf = 'tidy.yml') | ||
overrides = YAML.load(File.read_local('tidy.yml')) | ||
Tidy.path = overrides['path'] || '/usr/lib/libtidy-0.99.so.0' | ||
Dir.glob(overrides['html_glob'] || 'doc/rcov/**/*.html') | ||
end | ||
end | ||
end | ||
|
||
if __FILE__ == $0 | ||
RCov::OutputMorpher.new.transform(RCov.configure_morpher) | ||
end |
Oops, something went wrong.