# -*- encoding: utf-8 -*- -*- ruby -*-
# load all optional developer libraries
require 'rubygems/package_task'
require 'rdoc/task'
require 'rdoc/rdoc'
begin
require 'rubyforge'
rescue LoadError
end
require 'fileutils'
require 'rake/clean'
require 'rake/testtask'
require 'rake/packagetask'
$:.unshift('lib')
require 'webgen/version'
# End user tasks ###############################################################
task :default => :test
desc "Install using setup.rb"
task :install do
ruby "setup.rb config"
ruby "setup.rb setup"
ruby "setup.rb install"
end
task :clobber do
ruby "setup.rb clean"
end
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'webgen'
rdoc.main = 'API.rdoc'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('lib', 'API.rdoc')
end
Rake::TestTask.new do |test|
test.test_files = FileList['test/**/test_*.rb']
end
# Release tasks and development tasks ############################################
namespace :dev do
SUMMARY = 'webgen is a fast, powerful, and extensible static website generator.'
DESCRIPTION = <
* The mailing list archive at
* The webgen Wiki at
Have a look at for a list of changes!
Have fun!
EOF
#### Dependencies, requirements and files
s.required_ruby_version = '>= 1.9.3'
s.add_dependency('cmdparse', '>= 2.0.5')
s.add_dependency('systemu', '>= 2.5.0')
s.add_dependency('kramdown', '~> 1.0')
s.add_development_dependency('rake', '>= 0.8.3')
s.add_development_dependency('minitest', '>= 5.0.0')
s.add_development_dependency('diff-lcs', '>= 1.1.0')
s.add_development_dependency('rubyforge', '>= 2.0.2')
s.add_development_dependency('maruku', '>= 0.6.0')
s.add_development_dependency('RedCloth', '>= 4.1.9')
s.add_development_dependency('haml', '>= 3.1.0')
s.add_development_dependency('sass', '>= 3.2.0')
s.add_development_dependency('builder', '>= 2.1.0')
s.add_development_dependency('rdoc', '>= 4.0')
s.add_development_dependency('coderay', '>= 1.0.0')
s.add_development_dependency('erubis', '>= 2.6.5')
s.add_development_dependency('rdiscount', '>= 1.3.5')
s.add_development_dependency('archive-tar-minitar', '>= 0.5.2')
s.files = PKG_FILES.to_a
s.require_path = 'lib'
s.executables = ['webgen']
s.default_executable = 'webgen'
#### Documentation
s.has_rdoc = true
s.rdoc_options = ['--line-numbers', '--main', 'API.rdoc']
s.extra_rdoc_files = ['API.rdoc']
#### Author and project details
s.author = 'Thomas Leitner'
s.email = 't_leitner@gmx.at'
s.homepage = "http://webgen.rubyforge.org"
s.rubyforge_project = 'webgen'
end
Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
desc 'Release webgen version ' + Webgen::VERSION
task :release => [:clobber, :package, :publish_files, :post_news]
if defined? RubyForge
desc "Upload the release to Rubyforge"
task :publish_files => [:package] do
print 'Uploading files to Rubyforge...'
$stdout.flush
rf = RubyForge.new
rf.configure
rf.login
rf.userconfig["release_notes"] = ""
rf.userconfig["release_changes"] = ""
rf.userconfig["preformatted"] = false
files = %w[.gem .tgz .zip].collect {|ext| "pkg/webgen-#{Webgen::VERSION}" + ext}
rf.add_release('webgen', 'webgen', Webgen::VERSION, *files)
sh "gem push pkg/webgen-#{Webgen::VERSION}.gem"
puts 'done'
end
desc 'Post announcement to rubyforge.'
task :post_news do
print 'Posting announcement to Rubyforge ...'
$stdout.flush
rf = RubyForge.new
rf.configure
rf.login
text = "Have a look at http://webgen.rubyforge.org/news.html for the release details!"
rf.post_news('webgen', "webgen #{Webgen::VERSION} released", text)
puts "done"
end
end
desc "Run the tests one by one to check for missing deps"
task :test_isolated do
files = Dir['test/webgen/**/test_*']
puts "Checking #{files.length} tests"
failed = files.select do |file|
okay = system("ruby -Ilib #{file} 2>&1 >/dev/null")
print(okay ? '.' : 'E')
!okay
end
puts
failed.each {|file| puts "Problem with" + file.rjust(60) }
end
EXCLUDED_FOR_TESTS=FileList.new(['lib/webgen/bundle/**/*',
'lib/webgen/context/*',
'lib/webgen/cli/*',
'lib/webgen/test_helper',
'lib/webgen/path_handler/directory.rb',
'lib/webgen/version.rb',
])
EXCLUDED_FOR_DOCU=FileList.new(['lib/webgen/cli{*,**/*}',
'lib/webgen/*/base.rb',
'lib/webgen/context/*',
'lib/webgen/context.rb'
])
desc "Checks for missing test/docu"
task :check_missing do
puts 'Files for which no test exists:'
Dir['lib/webgen/**/*'].each do |path|
next if File.directory?(path) || EXCLUDED_FOR_TESTS.include?(path)
test_path = 'test/' + path.gsub(/lib\/(.*)\/(.*).rb/, '\1/test_\2.rb')
puts ' '*4 + path unless File.exists?(test_path)
end
=begin
puts
puts 'Files for which no docu exists:'
Dir['lib/webgen/*/*'].each do |path|
next if EXCLUDED_FOR_DOCU.include?(path)
docu_path = 'doc/' + path.gsub(/lib\/webgen\//, "").gsub(/\.rb$/, '.page')
puts ' '*4 + path unless File.exists?(docu_path)
end
=end
end
end
task :clobber => ['dev:clobber']
# Helper methods ###################################################################