#!/usr/bin/env rake
require "pathname"
require "rake/testtask"
require "rake/rdoctask"
require "rake/gempackagetask"
require "rubygems"
require "rubyforge"
SA_DIR = Pathname.new(File.dirname(__FILE__))
SA_VERSION = (
SA_DIR + "lib" + "scout_agent.rb"
).read[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
SA_SPEC = Gem::Specification.new do |spec|
spec.name = "scout_agent"
spec.version = SA_VERSION
spec.platform = Gem::Platform::RUBY
spec.summary = "Scout makes monitoring and reporting on your servers " +
"as flexible and simple as possible."
spec.test_files = %w[test/ts_all.rb]
spec.files = Dir.glob("{bin,lib,test}/**/*.rb") +
%w[ Rakefile setup.rb data/cacert.pem
data/gpl-2.0.txt data/lgpl-2.1.txt ]
spec.executables = %w[scout_agent]
spec.has_rdoc = true
spec.extra_rdoc_files = %w[ AUTHORS COPYING README INSTALL
TODO CHANGELOG LICENSE ]
spec.rdoc_options << "--title" << "Scout Agent Documentation" <<
"--main" << "README"
spec.require_path = "lib"
spec.add_dependency("arrayfields", "=4.7.3") # fix Amalgalite's results
spec.add_dependency("amalgalite", "=0.10.0")
spec.add_dependency("rest-client", "=1.0")
spec.add_dependency("json", "=1.1.7")
spec.add_dependency("xmpp4r", "=0.4")
spec.add_dependency("elif", "=0.1.0") # used by some plugins
spec.authors = [ "James Edward Gray II",
"Derek Haynes",
"Andre Lewis",
"Matt Todd" ]
spec.email = "support@highgroove.com"
spec.rubyforge_project = "scout"
spec.homepage = "http://scoutapp.com"
spec.description = <<END_DESC
Scout is a full server monitoring solution. You can install standard plugins
to get started with basic monitoring right away, or build your own plugins to
address your specific needs. Scout can be tied into any monitoring strategy,
providing you data collection, trend analysis, email notifications and more.
END_DESC
spec.post_install_message = <<END_INSTALL
Installing Scout's agent...
If this is your first time installing the agent, you need to give it your
identity to use when connecting to the server. You can do that with the
following command:
sudo scout_agent identify
If you are just upgrading, you can start the newly installed agent with:
sudo scout_agent start
END_INSTALL
end
task :default => [:test]
Rake::TestTask.new do |test|
test.libs << "test"
test.test_files = %w[test/ts_all.rb]
test.verbose = true
end
Rake::RDocTask.new do |rdoc|
rdoc.main = "README"
rdoc.rdoc_dir = "doc"
rdoc.title = "Scout Agent Documentation"
rdoc.rdoc_files.include( *%w[ README INSTALL TODO CHANGELOG
AUTHORS COPYING LICENSE lib/ ] )
end
Rake::GemPackageTask.new(SA_SPEC) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
desc "Publishes the agent gem to RubyForge"
task :publish_rubyforge => :package do
puts "Publishing on RubyForge"
forge = RubyForge.new
forge.configure
puts "Logging in"
forge.login
release = forge.userconfig
release["release_changes"] = (SA_DIR + "CHANGELOG").read
release["preformatted"] = true
package = "pkg/#{SA_SPEC.name}-#{SA_VERSION}"
files = %W[#{package}.tgz #{package}.zip #{package}.gem].compact
puts "Releasing #{SA_SPEC.name}-#{SA_VERSION}"
forge.add_release(SA_SPEC.rubyforge_project, SA_SPEC.name, SA_VERSION, *files)
end
desc "Upload current documentation RubyForge"
task :upload_docs => :rdoc do
config = YAML.load(
File.read(File.expand_path("~/.rubyforge/user-config.yml"))
)
host = "#{config['username']}@rubyforge.org"
remote_dir = "/var/www/gforge-projects/#{SA_SPEC.rubyforge_project}"
local_dir = "doc"
sh "rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}"
end