require 'rake/extensiontask' Rake::ExtensionTask.new('P4') require 'rake/testtask' Rake::TestTask.new do |t| t.libs << '.' t.libs << 'test' t.warning = true t.verbose = true t.test_files = FileList[ 'test/testlib.rb', 'test/*_test.rb'] end require 'rake/packagetask' $:.push File.expand_path("../lib", __FILE__) require 'P4/version' package_task = Rake::PackageTask.new('p4api', P4::VERSION) do |p| p.need_tar = true p.need_zip = true p.package_files.include %w( Gemfile LICENSE.txt p4ruby.gemspec Rakefile README ) p.package_files.include 'ext/**/*.cpp' p.package_files.include 'ext/**/*.h' p.package_files.include 'lib/**/*.rb' p.package_files.include 'test/**/*.rb' p.package_files.include 'doc' end desc 'Create README from p4rubynotes.txt' file 'README' => 'p4-doc/user/p4rubynotes.txt' do cp 'p4-doc/user/p4rubynotes.txt', 'README' end task :package => 'README' desc 'Create doc directory from docbook files (requires ant)' directory 'doc' => 'docbook' do puts 'Executing docbook' sh 'cd docbook && ant publicsite -Ddoc.build.path=../p4-doc/manuals/_build && cd ..' doc_files = FileList['doc/**/*'] package_task.package_files += doc_files end task :package => 'doc' desc 'Create build.properties, used to share version numbers in Jenkins tasks' file 'build.properties' do props = <<-END.gsub(/^ {4}/, '') P4RUBY_VERSION=#{P4::VERSION} END IO.write('build.properties', props) end