Skip to content

Commit

Permalink
Added missing files (hopefully finally?)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbbx6spp committed Nov 4, 2007
1 parent cdf7e81 commit e7e38bc
Show file tree
Hide file tree
Showing 106 changed files with 12,489 additions and 0 deletions.
20 changes: 20 additions & 0 deletions MIT-LICENSE
@@ -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.
24 changes: 24 additions & 0 deletions Rakefile
@@ -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
58 changes: 58 additions & 0 deletions config/rcov_morpher.rb
@@ -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

0 comments on commit e7e38bc

Please sign in to comment.