require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'rake/gempackagetask' PLUGIN = "after_commit" NAME = PLUGIN GEM_VERSION = "0.0.1" AUTHORS = [ 'Eli Miller', 'Joost Hietbrink', 'DeLynn Barry', 'Kane Baccigalupi'] EMAIL = "kane@integralimpressions.com" HOMEPAGE = "http://github.com/integralimpressions/after_commit" SUMMARY = %q{after_commit is an ActiveRecord gem to add an after_commit callback. This can be used to trigger things only after the entire transaction is complete.} windows = (PLATFORM =~ /win32|cygwin/) SUDO = windows ? "" : "sudo" spec = Gem::Specification.new do |s| s.name = NAME s.version = GEM_VERSION s.platform = Gem::Platform::RUBY s.has_rdoc = true s.extra_rdoc_files = [ "LICENSE", "README" ] s.summary = SUMMARY s.description = s.summary s.authors = AUTHORS s.email = EMAIL s.homepage = HOMEPAGE #s.add_dependency("activerecord", ">=1.0") #s.add_dependency("activesupport", ">=1.0") s.require_path = 'lib' s.autorequire = PLUGIN s.files = %w(LICENSE README Rakefile) + Dir.glob("{lib,specs}/**/*") end desc "Build gemspec file" task :build do File.open('after_commit.gemspec', 'w') { |f| f.write spec.to_ruby } end Rake::GemPackageTask.new(spec) do |pkg| pkg.gem_spec = spec end desc "Run :package and install resulting .gem" task :install => [:package] do sh %{#{SUDO} gem install pkg/#{NAME}-#{GEM_VERSION} --no-rdoc --no-ri} end desc 'Generate documentation for the after_commit gem.' Rake::RDocTask.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'AfterCommit' rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include('README') rdoc.rdoc_files.include('lib/**/*.rb') end