forked from hallettj/zaml
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some of Simon's changes and a whole bunch of minor bug fixes.
- Loading branch information
Showing
5 changed files
with
994 additions
and
387 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,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 |
Oops, something went wrong.