diff --git a/Gemfile b/Gemfile index 0988ac2..dfa2a95 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,3 @@ source "https://rubygems.org" # Specify your gem's dependencies in pg_ldap_sync.gemspec gemspec - -gem "pg", require: false -gem "postgres-pr", require: false diff --git a/README.rdoc b/README.rdoc index 06affce..006b8d0 100644 --- a/README.rdoc +++ b/README.rdoc @@ -32,28 +32,24 @@ It is meant to be started as a cron job. == REQUIREMENTS: -* Ruby-1.8.7, Ruby-1.9.2, JRuby-1.2, Rubinius-1.2 or better -* Rubygems-1.3.5+ +* Ruby-2.0+, JRuby-1.2, Rubinius-1.2 or better * LDAP-v3 server -* PostgreSQL-server v8.1+ +* PostgreSQL-server v9.0+ == INSTALL: -Install Ruby and rubygems: +Install Ruby: * on Windows: http://rubyinstaller.org -* on Debian/Ubuntu: apt-get install ruby rubygems +* on Debian/Ubuntu: apt-get install ruby libpq-dev -Install pg-ldap-sync and a database connector for PostgreSQL: - gem install pg-ldap-sync pg -You may also use the pure ruby postgres-connector which is less mature, -but doesn't need compilation: - gem install pg-ldap-sync postgres-pr +Install pg-ldap-sync and required dependencies: + gem install pg-ldap-sync === Install from Git: git clone https://github.com/larskanis/pg-ldap-sync.git cd pg-ldap-sync - gem install hoe - rake install_gem + bundle + rake install == USAGE: diff --git a/lib/pg_ldap_sync/application.rb b/lib/pg_ldap_sync/application.rb index 053815c..a8a7d7a 100644 --- a/lib/pg_ldap_sync/application.rb +++ b/lib/pg_ldap_sync/application.rb @@ -6,29 +6,7 @@ require 'optparse' require 'yaml' require 'logger' require 'kwalify' - -begin - require 'pg' -rescue LoadError => e - begin - require 'postgres' - class PG - alias initialize_before_hash_change initialize - def initialize(*args) - arg = args.first - if args.length==1 && arg.kind_of?(Hash) - initialize_before_hash_change(arg[:host], arg[:port], nil, nil, arg[:dbname], arg[:user], arg[:password]) - else - initialize_before_hash_change(*args) - end - end - end - rescue LoadError - raise e - end -end - -require 'pg_ldap_sync' +require 'pg' module PgLdapSync class Application diff --git a/pg-ldap-sync.gemspec b/pg-ldap-sync.gemspec index 9538086..4a245b0 100644 --- a/pg-ldap-sync.gemspec +++ b/pg-ldap-sync.gemspec @@ -21,6 +21,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "net-ldap", "~> 0.2" spec.add_runtime_dependency "kwalify", "~> 0.7" + spec.add_runtime_dependency "pg", ">= 0.14", "< 2.0" spec.add_development_dependency "ruby-ldapserver", "~> 0.3" spec.add_development_dependency "minitest", "~> 5.0" spec.add_development_dependency "bundler", "~> 1.16"