require 'rake/extensiontask' $:.push File.expand_path("../lib", __FILE__) require 'P4/version' GEM_SPEC = Gem::Specification.new { |t| t.name = 'p4ruby' t.version = P4::VERSION t.summary = 'Ruby extensions to the C++ Perforce API' t.description = t.summary + '.' t.author = 'Perforce Software, Inc.' t.email = 'support@perforce.com' t.homepage = 'http://www.perforce.com/product/components/apis' t.extensions = ['ext/P4/extconf.rb'] t.licenses = ['MIT'] # We have a strict dependency here due to a linux build issue launching rake t.add_development_dependency 'rake', '10.3.2' t.add_development_dependency 'rake-compiler', '~> 0.9' t.add_development_dependency 'test-unit', '~> 3.0' t.files = %w( LICENSE.txt p4-doc/user/p4rubynotes.txt ) t.files += Dir.glob('ext/**/*.cpp') t.files += Dir.glob('ext/**/*.h') t.files += Dir.glob('lib/**/*.rb') } Rake::ExtensionTask.new('P4', GEM_SPEC) Gem::PackageTask.new(GEM_SPEC) do |pkg| pkg.need_tar = false pkg.need_zip = false end 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' 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 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' CLEAN.include('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 # Remove output of 'rake compile' command CLEAN.include('lib/P4.bundle') CLEAN.include('lib/P4.so') CLEAN.include('pkg')