require "rake/packagetask" require "rake/contrib/sshpublisher" PKG_NAME = "embrace" PKG_VERSION = File.read("bin/embrace"). match(/^\s*VERSION = \"(.*)\"$/).captures.first task :install do sitelibdir = Config::CONFIG["sitelibdir"] destdir = ENV["DESTDIR"] || "" prefix = ENV["PREFIX"] || "/usr/local" ddir = destdir + prefix + "/bin" FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir) FileUtils::Verbose.install("bin/embrace", ddir, :mode => 0755) ddir = destdir + sitelibdir + "/#{PKG_NAME}" FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir) FileUtils::Verbose.install(Dir["lib/embrace/*.rb"], ddir, :mode => 0644) ddir = destdir + prefix + "/share/#{PKG_NAME}" FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir) FileUtils::Verbose.install(Dir["data/*"], ddir, :mode => 0644) end Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |t| t.need_tar_gz = true t.package_files.include("[A-Z]*", "bin/embrace", "lib/embrace/*.rb", "data/*") end task :publish => [:package] do Rake::SshFilePublisher.new("code-monkey.de", ".", "pkg", "#{PKG_NAME}-#{PKG_VERSION}.tar.gz"). upload end