require 'rubygems' require 'rake' require 'rake/clean' require 'rake/gempackagetask' require 'tools/rakehelp' require 'spec/rake/spectask' GEM_VERSION="0.2.2" setup_extension('clamav', 'clamav') desc "Compile native extension" task :compile => [:clamav] task :default => [:compile, :spec] Spec::Rake::SpecTask.new do |task| task.libs << 'spec' task.spec_files = Dir.glob( 'spec/**/*_spec.rb' ) task.verbose = true end gemspec = Gem::Specification.new do |gemspec| gemspec.name = "clamav" gemspec.version = GEM_VERSION gemspec.author = "Alexander Oryol" gemspec.email = "eagle.alex@gmail.com" gemspec.summary = "ClamAV Ruby binding" gemspec.description = <<-EOF ClamAV Ruby binding. Based on project clamavr-0.2.0 http://raa.ruby-lang.org/project/clamavr/ Thanks to MoonWoolf EOF gemspec.files = %w( rakefile README ChangeLog ) + Dir.glob( 'lib/*.rb' ) + Dir.glob( 'spec/*.rb' ) + Dir.glob( 'spec/unit/*.rb' ) + Dir.glob( 'ext/**/*.{c,rb}' ) + Dir.glob( 'tools/*.rb' ) gemspec.autorequire = 'clamav' gemspec.require_path = 'lib' # gemspec.add_dependency('builder') if RUBY_PLATFORM.match("win32") gemspec.platform = Gem::Platform::WIN32 gemspec.files += [] else gemspec.platform = Gem::Platform::RUBY gemspec.extensions = Dir.glob( 'ext/**/extconf.rb' ) end end task :package => [:clean, :compile, :spec] Rake::GemPackageTask.new( gemspec ) do |task| task.gem_spec = gemspec task.need_tar = true end setup_clean ["ext/clamav/*.{so,o}", "ext/clamav/Makefile", "lib/clamav.so", "pkg", "*.gem"] task :install => [:default, :package] do sh %{ sudo gem install pkg/clamav-#{GEM_VERSION}.gem } end task :uninstall do sh %{ sudo gem uninstall clamav } end