Skip to content

Commit

Permalink
Replace Hoe by Bundler
Browse files Browse the repository at this point in the history
Fixes #383
  • Loading branch information
larskanis committed Jun 28, 2021
1 parent 8ff5235 commit eb25f07
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 179 deletions.
2 changes: 0 additions & 2 deletions .hoerc

This file was deleted.

22 changes: 9 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# -*- ruby -*-

# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
# Specify your gem's runtime dependencies in pg.gemspec
gemspec

source "https://rubygems.org/"


gem "hoe-mercurial", "~>1.4", :group => [:development, :test]
gem "hoe-deveiate", "~>0.9", :group => [:development, :test]
gem "hoe-highline", "~>0.2", :group => [:development, :test]
gem "rake-compiler", "1.1.1", :group => [:development, :test]
gem "rake-compiler-dock", "~>1.0", :group => [:development, :test]
gem "hoe-bundler", "~>1.0", :group => [:development, :test]
gem "rspec", "~>3.5", :group => [:development, :test]
gem "rdoc", "~>5.1", :group => [:development, :test]
gem "hoe", "~>3.22", :group => [:development, :test]

# vim: syntax=ruby
group :development, :test do
gem "bundler", ">= 1.16", "< 3.0"
gem "rake-compiler", "~> 1.0"
gem "rake-compiler-dock", "~> 1.0"
gem "rdoc", "~> 5.1"
gem "rspec", "~> 3.5"
end
136 changes: 24 additions & 112 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,12 @@
require 'rbconfig'
require 'pathname'
require 'tmpdir'

begin
require 'rake/extensiontask'
require_relative 'misc/rake-compiler-make-install-patch'
rescue LoadError
abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
end

begin
require 'hoe'
rescue LoadError
abort "This Rakefile requires hoe (gem install hoe)"
end

require 'rake/extensiontask'
require_relative 'misc/rake-compiler-make-install-patch'
require 'rake/clean'
require 'rspec/core/rake_task'
require 'bundler'
require 'bundler/gem_helper'

# Build directory constants
BASEDIR = Pathname( __FILE__ ).dirname
Expand All @@ -33,76 +24,16 @@ EXT = LIBDIR + "pg_ext.#{DLEXT}"

GEMSPEC = 'pg.gemspec'


CLOBBER.include( TESTDIR.to_s )
CLEAN.include( PKGDIR.to_s, TMPDIR.to_s )
CLEAN.include "lib/*/libpq.dll"
CLEAN.include "lib/pg_ext.*"
CLEAN.include "lib/pg/postgresql_lib_path.rb"

# Set up Hoe plugins
Hoe.plugin :mercurial
Hoe.plugin :signing
Hoe.plugin :deveiate
Hoe.plugin :bundler

Hoe.plugins.delete :rubyforge
Hoe.plugins.delete :compiler

load 'Rakefile.cross'


# Hoe specification
$hoespec = Hoe.spec 'pg' do
self.readme_file = 'README.rdoc'
self.history_file = 'History.rdoc'
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
self.extra_rdoc_files.include( 'ext/*.c' )
self.license 'BSD-2-Clause'

self.developer 'Michael Granger', 'ged@FaerieMUD.org'
self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'

self.dependency 'rake-compiler', '1.1.1', :developer
self.dependency 'rake-compiler-dock', ['~> 1.0'], :developer
self.dependency 'hoe-deveiate', '~> 0.9', :developer
self.dependency 'hoe-bundler', '~> 1.0', :developer
self.dependency 'rspec', '~> 3.5', :developer
self.dependency 'rdoc', '~> 5.1', :developer

self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]

self.require_ruby_version( '>= 2.2' )

self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )

self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
end

ENV['VERSION'] ||= $hoespec.spec.version.to_s

# Tests should pass before checking in
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec, :gemspec ]

# Support for 'rvm specs'
task :specs => :spec

# Compile before testing
task :spec => :compile

# gem-testers support
task :test do
# rake-compiler always wants to copy the compiled extension into lib/, but
# we don't want testers to have to re-compile, especially since that
# often fails because they can't (and shouldn't have to) write to tmp/ in
# the installed gem dir. So we clear the task rake-compiler set up
# to break the dependency between :spec and :compile when running under
# rubygems-test, and then run :spec.
Rake::Task[ EXT.to_s ].clear if File.exist?(EXT.to_s)
Rake::Task[ :spec ].execute
end
Bundler::GemHelper.install_tasks
$gem_spec = Bundler.load_gemspec(GEMSPEC)

desc "Turn on warnings and debugging in the build."
task :maint do
Expand All @@ -112,7 +43,7 @@ end
# Rake-compiler task
Rake::ExtensionTask.new do |ext|
ext.name = 'pg_ext'
ext.gem_spec = $hoespec.spec
ext.gem_spec = $gem_spec
ext.ext_dir = 'ext'
ext.lib_dir = 'lib'
ext.source_pattern = "*.{c,h}"
Expand All @@ -137,29 +68,27 @@ Rake::ExtensionTask.new do |ext|
end
end

RSpec::Core::RakeTask.new(:spec)
task :test => :spec

# Use the fivefish formatter for docs generated from development checkout
if File.directory?( '.hg' )
require 'rdoc/task'

Rake::Task[ 'docs' ].clear
RDoc::Task.new( 'docs' ) do |rdoc|
rdoc.main = "README.rdoc"
rdoc.rdoc_files.include( "*.rdoc", "lib/**/*.rb", 'ext/**/*.{c,h}' )
rdoc.generator = :fivefish
rdoc.title = "PG: The Ruby PostgreSQL Driver"
rdoc.rdoc_dir = 'doc'
end
require 'rdoc/task'

RDoc::Task.new( 'docs' ) do |rdoc|
rdoc.main = "README.rdoc"
rdoc.rdoc_files.include( "*.rdoc", "lib/**/*.rb", 'ext/**/*.{c,h}' )
rdoc.generator = :fivefish
rdoc.title = "PG: The Ruby PostgreSQL Driver"
rdoc.rdoc_dir = 'doc'
end

task :prerelease

desc "Build the source gem #{$gem_spec.full_name}.gem into the pkg directory"
task :gem => :build

desc "Stop any Postmaster instances that remain after testing."
task :cleanup_testing_dbs do
require_relative 'spec/helpers'
PG::TestingHelpers.stop_existing_postmasters()
Rake::Task[:clobber].invoke
task :clobber do
puts "Stop any Postmaster instances that remain after testing."
require_relative 'spec/helpers'
PG::TestingHelpers.stop_existing_postmasters()
end

desc "Update list of server error codes"
Expand All @@ -176,20 +105,3 @@ file 'ext/pg_errors.c' => ['ext/errorcodes.def'] do
# trigger compilation of changed errorcodes.def
touch 'ext/pg_errors.c'
end

task :gemspec => GEMSPEC
file GEMSPEC => __FILE__
task GEMSPEC do |task|
spec = $hoespec.spec
spec.files.delete( '.gemtest' )
spec.signing_key = nil
spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
spec.cert_chain = [ 'certs/ged.pem' ]
File.open( task.name, 'w' ) do |fh|
fh.write( spec.to_ruby )
end
end

CLOBBER.include( '*.gemspec' )
task :default => :gemspec

2 changes: 1 addition & 1 deletion Rakefile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ CrossLibraries.each do |xlib|
RakeCompilerDock.sh <<-EOT, platform: platform
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
bundle install --local &&
rake native:#{platform} pkg/#{$hoespec.spec.full_name}-#{platform}.gem MAKE="make -j`nproc`"
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKE="make -j`nproc`"
EOT
end
desc "Build the windows binary gems"
Expand Down
7 changes: 1 addition & 6 deletions lib/pg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ module PG
end


# Library version
VERSION = '1.2.3'

# VCS revision
REVISION = %q$Revision: 6f611e78845a $

class NotAllCopyDataRetrieved < PG::Error
end

Expand Down Expand Up @@ -85,5 +79,6 @@ def self::connect( *args )
require 'pg/connection'
require 'pg/result'
require 'pg/tuple'
require 'pg/version'

end # module PG
4 changes: 4 additions & 0 deletions lib/pg/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module PG
# Library version
VERSION = '1.2.3'
end
70 changes: 25 additions & 45 deletions pg.gemspec
Original file line number Diff line number Diff line change
@@ -1,52 +1,32 @@
# frozen_string_literal: true
# -*- encoding: utf-8 -*-
# stub: pg 1.3.0.pre20210319181010 ruby lib
# stub: ext/extconf.rb

Gem::Specification.new do |s|
s.name = "pg".freeze
s.version = "1.3.0.pre20210319181010"
require_relative 'lib/pg/version'

s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "changelog_uri" => "https://github.com/ged/ruby-pg/blob/master/History.rdoc", "documentation_uri" => "http://deveiate.org/code/pg", "homepage_uri" => "https://github.com/ged/ruby-pg" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Michael Granger".freeze, "Lars Kanis".freeze]
s.cert_chain = ["certs/ged.pem".freeze]
s.date = "2021-03-19"
s.description = "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].\n\nIt works with {PostgreSQL 9.2 and later}[http://www.postgresql.org/support/versioning/].\n\nA small example usage:\n\n #!/usr/bin/env ruby\n\n require 'pg'\n\n # Output a table of current connections to the DB\n conn = PG.connect( dbname: 'sales' )\n conn.exec( \"SELECT * FROM pg_stat_activity\" ) do |result|\n puts \" PID | User | Query\"\n result.each do |row|\n puts \" %7d | %-16s | %s \" %\n row.values_at('pid', 'usename', 'query')\n end\n end".freeze
s.email = ["ged@FaerieMUD.org".freeze, "lars@greiz-reinsdorf.de".freeze]
s.extensions = ["ext/extconf.rb".freeze]
s.extra_rdoc_files = ["Contributors.rdoc".freeze, "History.rdoc".freeze, "Manifest.txt".freeze, "README-OS_X.rdoc".freeze, "README-Windows.rdoc".freeze, "README.ja.rdoc".freeze, "README.rdoc".freeze, "ext/errorcodes.txt".freeze, "Contributors.rdoc".freeze, "History.rdoc".freeze, "README-OS_X.rdoc".freeze, "README-Windows.rdoc".freeze, "README.ja.rdoc".freeze, "README.rdoc".freeze, "POSTGRES".freeze, "LICENSE".freeze, "ext/gvl_wrappers.c".freeze, "ext/pg.c".freeze, "ext/pg_binary_decoder.c".freeze, "ext/pg_binary_encoder.c".freeze, "ext/pg_coder.c".freeze, "ext/pg_connection.c".freeze, "ext/pg_copy_coder.c".freeze, "ext/pg_errors.c".freeze, "ext/pg_record_coder.c".freeze, "ext/pg_result.c".freeze, "ext/pg_text_decoder.c".freeze, "ext/pg_text_encoder.c".freeze, "ext/pg_tuple.c".freeze, "ext/pg_type_map.c".freeze, "ext/pg_type_map_all_strings.c".freeze, "ext/pg_type_map_by_class.c".freeze, "ext/pg_type_map_by_column.c".freeze, "ext/pg_type_map_by_mri_type.c".freeze, "ext/pg_type_map_by_oid.c".freeze, "ext/pg_type_map_in_ruby.c".freeze, "ext/pg_util.c".freeze]
s.files = ["BSDL".freeze, "Contributors.rdoc".freeze, "History.rdoc".freeze, "LICENSE".freeze, "Manifest.txt".freeze, "POSTGRES".freeze, "README-OS_X.rdoc".freeze, "README-Windows.rdoc".freeze, "README.ja.rdoc".freeze, "README.rdoc".freeze, "Rakefile".freeze, "Rakefile.cross".freeze, "ext/errorcodes.def".freeze, "ext/errorcodes.rb".freeze, "ext/errorcodes.txt".freeze, "ext/extconf.rb".freeze, "ext/gvl_wrappers.c".freeze, "ext/gvl_wrappers.h".freeze, "ext/pg.c".freeze, "ext/pg.h".freeze, "ext/pg_binary_decoder.c".freeze, "ext/pg_binary_encoder.c".freeze, "ext/pg_coder.c".freeze, "ext/pg_connection.c".freeze, "ext/pg_copy_coder.c".freeze, "ext/pg_errors.c".freeze, "ext/pg_record_coder.c".freeze, "ext/pg_result.c".freeze, "ext/pg_text_decoder.c".freeze, "ext/pg_text_encoder.c".freeze, "ext/pg_tuple.c".freeze, "ext/pg_type_map.c".freeze, "ext/pg_type_map_all_strings.c".freeze, "ext/pg_type_map_by_class.c".freeze, "ext/pg_type_map_by_column.c".freeze, "ext/pg_type_map_by_mri_type.c".freeze, "ext/pg_type_map_by_oid.c".freeze, "ext/pg_type_map_in_ruby.c".freeze, "ext/pg_util.c".freeze, "ext/pg_util.h".freeze, "ext/vc/pg.sln".freeze, "ext/vc/pg_18/pg.vcproj".freeze, "ext/vc/pg_19/pg_19.vcproj".freeze, "lib/pg.rb".freeze, "lib/pg/basic_type_mapping.rb".freeze, "lib/pg/binary_decoder.rb".freeze, "lib/pg/coder.rb".freeze, "lib/pg/connection.rb".freeze, "lib/pg/constants.rb".freeze, "lib/pg/exceptions.rb".freeze, "lib/pg/result.rb".freeze, "lib/pg/text_decoder.rb".freeze, "lib/pg/text_encoder.rb".freeze, "lib/pg/tuple.rb".freeze, "lib/pg/type_map_by_column.rb".freeze, "spec/data/expected_trace.out".freeze, "spec/data/random_binary_data".freeze, "spec/helpers.rb".freeze, "spec/pg/basic_type_mapping_spec.rb".freeze, "spec/pg/connection_spec.rb".freeze, "spec/pg/connection_sync_spec.rb".freeze, "spec/pg/result_spec.rb".freeze, "spec/pg/tuple_spec.rb".freeze, "spec/pg/type_map_by_class_spec.rb".freeze, "spec/pg/type_map_by_column_spec.rb".freeze, "spec/pg/type_map_by_mri_type_spec.rb".freeze, "spec/pg/type_map_by_oid_spec.rb".freeze, "spec/pg/type_map_in_ruby_spec.rb".freeze, "spec/pg/type_map_spec.rb".freeze, "spec/pg/type_spec.rb".freeze, "spec/pg_spec.rb".freeze]
s.homepage = "https://github.com/ged/ruby-pg".freeze
s.licenses = ["BSD-2-Clause".freeze]
s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
s.required_ruby_version = Gem::Requirement.new(">= 2.2".freeze)
s.rubygems_version = "3.2.3".freeze
s.summary = "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]".freeze
Gem::Specification.new do |spec|
spec.name = "pg"
spec.version = PG::VERSION
spec.authors = ["Michael Granger", "Lars Kanis"]
spec.email = ["ged@FaerieMUD.org", "lars@greiz-reinsdorf.de"]

if s.respond_to? :specification_version then
s.specification_version = 4
end
spec.summary = "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/]"
spec.description = "Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].\n\nIt works with {PostgreSQL 9.2 and later}[http://www.postgresql.org/support/versioning/].\n\nA small example usage:\n\n #!/usr/bin/env ruby\n\n require 'pg'\n\n # Output a table of current connections to the DB\n conn = PG.connect( dbname: 'sales' )\n conn.exec( \"SELECT * FROM pg_stat_activity\" ) do |result|\n puts \" PID | User | Query\"\n result.each do |row|\n puts \" %7d | %-16s | %s \" %\n row.values_at('pid', 'usename', 'query')\n end\n end"
spec.homepage = "https://github.com/ged/ruby-pg"
spec.license = "BSD-2-Clause"
spec.required_ruby_version = ">= 2.2"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/ged/ruby-pg"
spec.metadata["changelog_uri"] = "https://github.com/ged/ruby-pg/blob/master/History.rdoc"
spec.metadata["documentation_uri"] = "http://deveiate.org/code/pg"

if s.respond_to? :add_runtime_dependency then
s.add_development_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
s.add_development_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
s.add_development_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
s.add_development_dependency(%q<rake-compiler>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<rake-compiler-dock>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-bundler>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5"])
s.add_development_dependency(%q<rdoc>.freeze, ["~> 5.1"])
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.22"])
else
s.add_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
s.add_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
s.add_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
s.add_dependency(%q<rake-compiler>.freeze, ["~> 1.0"])
s.add_dependency(%q<rake-compiler-dock>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-bundler>.freeze, ["~> 1.0"])
s.add_dependency(%q<rspec>.freeze, ["~> 3.5"])
s.add_dependency(%q<rdoc>.freeze, ["~> 5.1"])
s.add_dependency(%q<hoe>.freeze, ["~> 3.22"])
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
end
spec.extensions = ["ext/extconf.rb"]
spec.require_paths = ["lib"]
spec.cert_chain = ["certs/ged.pem"]
spec.rdoc_options = ["--main", "README.rdoc"]
end

0 comments on commit eb25f07

Please sign in to comment.