PageRenderTime 56ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/cache/ruby/2.7.0/gems/pg-1.2.3/Rakefile

https://gitlab.com/gitnyasha/zimcreative
Rakefile | 217 lines | 152 code | 44 blank | 21 comment | 5 complexity | 482d73a762f2e97e465f824c5481f548 MD5 | raw file
  1. # -*- rake -*-
  2. require 'rbconfig'
  3. require 'pathname'
  4. require 'tmpdir'
  5. begin
  6. require 'rake/extensiontask'
  7. rescue LoadError
  8. abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
  9. end
  10. begin
  11. require 'hoe'
  12. rescue LoadError
  13. abort "This Rakefile requires hoe (gem install hoe)"
  14. end
  15. require 'rake/clean'
  16. # Build directory constants
  17. BASEDIR = Pathname( __FILE__ ).dirname
  18. SPECDIR = BASEDIR + 'spec'
  19. LIBDIR = BASEDIR + 'lib'
  20. EXTDIR = BASEDIR + 'ext'
  21. PKGDIR = BASEDIR + 'pkg'
  22. TMPDIR = BASEDIR + 'tmp'
  23. DLEXT = RbConfig::CONFIG['DLEXT']
  24. EXT = LIBDIR + "pg_ext.#{DLEXT}"
  25. GEMSPEC = 'pg.gemspec'
  26. TEST_DIRECTORY = BASEDIR + "tmp_test_specs"
  27. CLOBBER.include( TEST_DIRECTORY.to_s )
  28. CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
  29. CLEAN.include "lib/*/libpq.dll"
  30. CLEAN.include "lib/pg_ext.*"
  31. # Set up Hoe plugins
  32. Hoe.plugin :mercurial
  33. Hoe.plugin :signing
  34. Hoe.plugin :deveiate
  35. Hoe.plugin :bundler
  36. Hoe.plugins.delete :rubyforge
  37. Hoe.plugins.delete :compiler
  38. load 'Rakefile.cross'
  39. # Hoe specification
  40. $hoespec = Hoe.spec 'pg' do
  41. self.readme_file = 'README.rdoc'
  42. self.history_file = 'History.rdoc'
  43. self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
  44. self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
  45. self.extra_rdoc_files.include( 'ext/*.c' )
  46. self.license 'BSD-2-Clause'
  47. self.developer 'Michael Granger', 'ged@FaerieMUD.org'
  48. self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
  49. self.dependency 'rake-compiler', '~> 1.0', :developer
  50. self.dependency 'rake-compiler-dock', ['~> 1.0'], :developer
  51. self.dependency 'hoe-deveiate', '~> 0.9', :developer
  52. self.dependency 'hoe-bundler', '~> 1.0', :developer
  53. self.dependency 'rspec', '~> 3.5', :developer
  54. self.dependency 'rdoc', '~> 5.1', :developer
  55. self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
  56. self.require_ruby_version( '>= 2.2' )
  57. self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
  58. self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
  59. self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
  60. end
  61. ENV['VERSION'] ||= $hoespec.spec.version.to_s
  62. # Tests should pass before checking in
  63. task 'hg:precheckin' => [ :check_history, :check_manifest, :spec, :gemspec ]
  64. # Support for 'rvm specs'
  65. task :specs => :spec
  66. # Compile before testing
  67. task :spec => :compile
  68. # gem-testers support
  69. task :test do
  70. # rake-compiler always wants to copy the compiled extension into lib/, but
  71. # we don't want testers to have to re-compile, especially since that
  72. # often fails because they can't (and shouldn't have to) write to tmp/ in
  73. # the installed gem dir. So we clear the task rake-compiler set up
  74. # to break the dependency between :spec and :compile when running under
  75. # rubygems-test, and then run :spec.
  76. Rake::Task[ EXT.to_s ].clear if File.exist?(EXT.to_s)
  77. Rake::Task[ :spec ].execute
  78. end
  79. desc "Turn on warnings and debugging in the build."
  80. task :maint do
  81. ENV['MAINTAINER_MODE'] = 'yes'
  82. end
  83. # Rake-compiler task
  84. Rake::ExtensionTask.new do |ext|
  85. ext.name = 'pg_ext'
  86. ext.gem_spec = $hoespec.spec
  87. ext.ext_dir = 'ext'
  88. ext.lib_dir = 'lib'
  89. ext.source_pattern = "*.{c,h}"
  90. ext.cross_compile = true
  91. ext.cross_platform = CrossLibraries.map(&:for_platform)
  92. ext.cross_config_options += CrossLibraries.map do |lib|
  93. {
  94. lib.for_platform => [
  95. "--enable-windows-cross",
  96. "--with-pg-include=#{lib.static_postgresql_incdir}",
  97. "--with-pg-lib=#{lib.static_postgresql_libdir}",
  98. # libpq-fe.h resides in src/interfaces/libpq/ before make install
  99. "--with-opt-include=#{lib.static_postgresql_libdir}",
  100. ]
  101. }
  102. end
  103. # Add libpq.dll to windows binary gemspec
  104. ext.cross_compiling do |spec|
  105. spec.files << "lib/#{spec.platform}/libpq.dll"
  106. end
  107. end
  108. # Use the fivefish formatter for docs generated from development checkout
  109. if File.directory?( '.hg' )
  110. require 'rdoc/task'
  111. Rake::Task[ 'docs' ].clear
  112. RDoc::Task.new( 'docs' ) do |rdoc|
  113. rdoc.main = "README.rdoc"
  114. rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb", 'ext/**/*.{c,h}' )
  115. rdoc.generator = :fivefish
  116. rdoc.title = "PG: The Ruby PostgreSQL Driver"
  117. rdoc.rdoc_dir = 'doc'
  118. end
  119. end
  120. # Make the ChangeLog update if the repo has changed since it was last built
  121. file '.hg/branch' do
  122. warn "WARNING: You need the Mercurial repo to update the ChangeLog"
  123. end
  124. Rake::Task["ChangeLog"].clear
  125. file 'ChangeLog' do |task|
  126. if File.exist?('.hg/branch')
  127. $stderr.puts "Updating the changelog..."
  128. begin
  129. include Hoe::MercurialHelpers
  130. content = make_changelog()
  131. rescue NameError
  132. abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
  133. end
  134. File.open( task.name, 'w', 0644 ) do |fh|
  135. fh.print( content )
  136. end
  137. else
  138. touch 'ChangeLog'
  139. end
  140. end
  141. # Rebuild the ChangeLog immediately before release
  142. task :prerelease => 'ChangeLog'
  143. desc "Stop any Postmaster instances that remain after testing."
  144. task :cleanup_testing_dbs do
  145. require 'spec/lib/helpers'
  146. PgTestingHelpers.stop_existing_postmasters()
  147. Rake::Task[:clean].invoke
  148. end
  149. desc "Update list of server error codes"
  150. task :update_error_codes do
  151. URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_12_0"
  152. ERRORCODES_TXT = "ext/errorcodes.txt"
  153. sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
  154. ruby 'ext/errorcodes.rb', 'ext/errorcodes.txt', 'ext/errorcodes.def'
  155. end
  156. file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
  157. # trigger compilation of changed errorcodes.def
  158. touch 'ext/pg_errors.c'
  159. end
  160. task :gemspec => GEMSPEC
  161. file GEMSPEC => __FILE__
  162. task GEMSPEC do |task|
  163. spec = $hoespec.spec
  164. spec.files.delete( '.gemtest' )
  165. spec.signing_key = nil
  166. spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
  167. spec.cert_chain = [ 'certs/ged.pem' ]
  168. File.open( task.name, 'w' ) do |fh|
  169. fh.write( spec.to_ruby )
  170. end
  171. end
  172. CLOBBER.include( '*.gemspec' )
  173. task :default => :gemspec