Rakefile in has_messages-0.1.1 vs Rakefile in has_messages-0.1.2
- old
+ new
@@ -1,67 +1,75 @@
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'rake/contrib/sshpublisher'
-PKG_NAME = 'has_messages'
-PKG_VERSION = '0.1.1'
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-RUBY_FORGE_PROJECT = 'pluginaweek'
-
-desc 'Default: run unit tests.'
+spec = Gem::Specification.new do |s|
+ s.name = 'has_messages'
+ s.version = '0.1.2'
+ s.platform = Gem::Platform::RUBY
+ s.summary = 'Demonstrates a reference implementation for sending messages between users.'
+
+ s.files = FileList['{app,db,lib,test}/**/*'].to_a - FileList['test/app_root/log/*'].to_a + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc)
+ s.require_path = 'lib'
+ s.has_rdoc = true
+ s.test_files = Dir['test/**/*_test.rb']
+ s.add_dependency 'state_machine', '>= 0.2.0'
+
+ s.author = 'Aaron Pfeifer'
+ s.email = 'aaron@pluginaweek.org'
+ s.homepage = 'http://www.pluginaweek.org'
+ s.rubyforge_project = 'pluginaweek'
+end
+
+desc 'Default: run all tests.'
task :default => :test
-desc 'Test the has_messages plugin.'
+desc "Test the #{spec.name} plugin."
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
+ t.test_files = spec.test_files
t.verbose = true
end
-desc 'Generate documentation for the has_messages plugin.'
+begin
+ require 'rcov/rcovtask'
+ namespace :test do
+ desc "Test the #{spec.name} plugin with Rcov."
+ Rcov::RcovTask.new(:rcov) do |t|
+ t.libs << 'lib'
+ t.test_files = spec.test_files
+ t.rcov_opts << '--exclude="^(?!lib/|app/)"'
+ t.verbose = true
+ end
+ end
+rescue LoadError
+end
+
+desc "Generate documentation for the #{spec.name} plugin."
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'HasMessages'
+ rdoc.title = spec.name
rdoc.template = '../rdoc_template.rb'
rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
+ rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'LICENSE', 'lib/**/*.rb', 'app/**/*.rb')
end
-
-spec = Gem::Specification.new do |s|
- s.name = PKG_NAME
- s.version = PKG_VERSION
- s.platform = Gem::Platform::RUBY
- s.summary = 'Demonstrates a reference implementation for sending messages between users.'
- s.files = FileList['{app,db,lib,test}/**/*'].to_a - FileList['test/app_root/log/*'].to_a + %w(CHANGELOG init.rb MIT-LICENSE Rakefile README)
- s.require_path = 'lib'
- s.autorequire = 'has_messages'
- s.has_rdoc = true
- s.test_files = Dir['test/**/*_test.rb']
- s.add_dependency 'state_machine', '>= 0.1.0'
-
- s.author = 'Aaron Pfeifer'
- s.email = 'aaron@pluginaweek.org'
- s.homepage = 'http://www.pluginaweek.org'
-end
-
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
p.need_zip = true
end
-desc 'Publish the beta gem'
+desc 'Publish the beta gem.'
task :pgem => [:package] do
- Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{PKG_FILE_NAME}.gem").upload
+ Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{spec.name}-#{spec.version}.gem").upload
end
-desc 'Publish the API documentation'
+desc 'Publish the API documentation.'
task :pdoc => [:rdoc] do
- Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{PKG_NAME}", 'rdoc').upload
+ Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{spec.name}", 'rdoc').upload
end
desc 'Publish the API docs and gem'
task :publish => [:pgem, :pdoc, :release]
@@ -70,12 +78,12 @@
require 'rubyforge'
ruby_forge = RubyForge.new.configure
ruby_forge.login
- %w( gem tgz zip ).each do |ext|
- file = "pkg/#{PKG_FILE_NAME}.#{ext}"
+ %w(gem tgz zip).each do |ext|
+ file = "pkg/#{spec.name}-#{spec.version}.#{ext}"
puts "Releasing #{File.basename(file)}..."
- ruby_forge.add_release(RUBY_FORGE_PROJECT, PKG_NAME, PKG_VERSION, file)
+ ruby_forge.add_release(spec.rubyforge_project, spec.name, spec.version, file)
end
end