Skip to content

Commit

Permalink
Some of Simon's changes and a whole bunch of minor bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusQ committed Dec 28, 2008
1 parent c2d3ad6 commit c991002
Show file tree
Hide file tree
Showing 5 changed files with 994 additions and 387 deletions.
83 changes: 83 additions & 0 deletions Rakefile
@@ -0,0 +1,83 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'

#
# Gem specification
#

def gemspec
data = File.read('zaml.gemspec')
spec = nil
Thread.new { spec = eval("$SAFE = 1\n#{data}") }.join
spec
end

Rake::GemPackageTask.new(gemspec) do |pkg|
pkg.need_tar = true
end

desc 'Prints the gemspec manifest.'
task :print_manifest do
# collect files from the gemspec, labeling
# with true or false corresponding to the
# file existing or not
files = gemspec.files.inject({}) do |files, file|
files[File.expand_path(file)] = [File.exists?(file), file]
files
end

# gather non-rdoc/pkg files for the project
# and add to the files list if they are not
# included already (marking by the absence
# of a label)
Dir.glob("**/*").each do |file|
next if file =~ /^(rdoc|pkg)/ || File.directory?(file)

path = File.expand_path(file)
files[path] = ["", file] unless files.has_key?(path)
end

# sort and output the results
files.values.sort_by {|exists, file| file }.each do |entry|
puts "%-5s %s" % entry
end
end

#
# Documentation tasks
#

desc 'Generate documentation.'
Rake::RDocTask.new(:rdoc) do |rdoc|
spec = gemspec

rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ZAML'
rdoc.main = 'README'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include( spec.extra_rdoc_files )
rdoc.rdoc_files.include( spec.files.select {|file| file =~ /^lib.*\.rb$/} )
end

#
# Test tasks
#

desc 'Default: Run tests.'
task :default => :test

desc 'Run tests.'
Rake::TestTask.new(:test) do |t|
t.test_files = Dir.glob( File.join('test', '**/*_test.rb') )
t.verbose = true
t.warning = true
end

desc 'Run benchmarsk.'
Rake::TestTask.new(:bench) do |t|
t.test_files = Dir.glob( File.join('test', '**/*_benchmarks.rb') )
t.verbose = true
t.warning = true
end

0 comments on commit c991002

Please sign in to comment.