6 require 'rake/testtask'
7 require 'rake/rdoctask'
8 require 'rake/packagetask'
9 require 'rake/gempackagetask'
10 require 'rake/contrib/sshpublisher'
11 # require 'rake/contrib/rubyforgepublisher'
12 require File.join(File.dirname(__FILE__), 'lib', 'io', 'mixins')
14 PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
15 PKG_NAME = 'io-mixins'
16 PKG_VERSION = IO::MIXINS_VERSION
17 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
18 # PKG_DESTINATION = ENV["PKG_DESTINATION"] || "../#{PKG_NAME}"
20 # RELEASE_NAME = "REL #{PKG_VERSION}"
22 RUBY_FORGE_PROJECT = PKG_NAME
23 RUBY_FORGE_USER = "tpope"
25 desc "Default task: test"
26 task :default => [ :test ]
30 Rake::TestTask.new { |t|
32 t.test_files = Dir['test/*_test.rb'] + Dir['test/test_*.rb']
37 # Generate the RDoc documentation
38 Rake::RDocTask.new { |rdoc|
40 rdoc.rdoc_files.add('lib')
42 rdoc.title = "IO Mixins"
43 rdoc.options << '--inline-source'
44 rdoc.options << '-d' if `which dot` =~ /\/dot/
47 desc "Generate the RDoc documentation for RI"
49 system("rdoc","--ri","lib")
54 # Create compressed packages
55 spec = Gem::Specification.new do |s|
56 s.platform = Gem::Platform::RUBY
58 s.summary = 'Pure Ruby IO Mixins'
59 s.description = 'IO::Readable, IO::Writable, and IO::Seekable'
60 s.version = PKG_VERSION
63 s.email = 'r*by@tpope.in#o'.tr('*#','uf')
64 s.rubyforge_project = RUBY_FORGE_PROJECT
67 # s.requirements << 'none'
68 s.require_path = 'lib'
69 # s.autorequire = 'action_web_service'
71 s.files = [ "Rakefile", "setup.rb" ]
72 s.files = s.files + Dir.glob( "lib/**/*.rb" )
73 s.files = s.files + Dir.glob( "test/**/*" ).reject { |item| item.include?( "\.svn" ) }
76 Rake::GemPackageTask.new(spec) do |p|
84 desc "Publish the gem"
85 task :pgem => [:package] do
86 Rake::SshFilePublisher.new("tpope#{'@'}tpope.us", "public_html/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
87 # `ssh tpope@tpope.us './gemupdate.sh'`
90 # Publish documentation
91 desc "Publish the API documentation"
92 task :pdoc => [:rdoc] do
93 Rake::SshDirPublisher.new("tpope#{'@'}tpope.us", "public_html/#{PKG_NAME}", "doc").upload
96 # desc "Publish the release files to RubyForge."
97 # task :release => [ :package ] do
100 # for ext in %w( gem tgz zip )
101 # release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
102 # puts release_command
103 # system(release_command)
108 require 'rcov/rcovtask'
109 Rcov::RcovTask.new do |t|
110 t.test_files = Dir['test/*_test.rb'] + Dir['test/test_*.rb']
112 # t.rcov_opts << "--text-report"
113 # t.rcov_opts << "--exclude \\\\A/var/lib/gems"
114 t.rcov_opts << "--exclude '/(active_record|active_support)\\b'"