From 611abf1594cca8e49e34c302dbb35af4e1ef1c95 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Tue, 6 Feb 2018 21:56:53 +0100 Subject: [PATCH] Move from Hoe to Bundler This adds a gemspec and a Gemfile to the repository. --- .gitignore | 10 ++++++++++ Gemfile | 7 +++++++ LICENSE.txt | 21 +++++++++++++++++++++ README.rdoc | 25 ++----------------------- Rakefile | 21 +++++++-------------- {bin => exe}/pg_ldap_sync | 3 +-- lib/pg_ldap_sync.rb | 5 ++--- lib/pg_ldap_sync/version.rb | 3 +++ pg-ldap-sync.gemspec | 28 ++++++++++++++++++++++++++++ test/test_pg_ldap_sync.rb | 8 +++----- 10 files changed, 84 insertions(+), 47 deletions(-) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 LICENSE.txt rename {bin => exe}/pg_ldap_sync (50%) create mode 100644 lib/pg_ldap_sync/version.rb create mode 100644 pg-ldap-sync.gemspec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e7660e --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ +/temp/ +Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0988ac2 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +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/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..1e3ea4d --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Lars Kanis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.rdoc b/README.rdoc index 8852905..06affce 100644 --- a/README.rdoc +++ b/README.rdoc @@ -85,27 +85,6 @@ commands are in the PATH. Then: based on individual attributes in LDAP (expiration date etc.) -== LICENSE: +== License -(The MIT License) - -Copyright (c) 2011 FIX - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/Rakefile b/Rakefile index c43d774..aa6e7af 100644 --- a/Rakefile +++ b/Rakefile @@ -1,18 +1,11 @@ # -*- ruby -*- +require "bundler/gem_tasks" +require "rake/testtask" -require 'rubygems' -require 'hoe' - -Hoe.spec 'pg-ldap-sync' do - developer('Lars Kanis', 'kanis@comcard.de') - - extra_deps << ['net-ldap', '>= 0.2'] - extra_deps << ['kwalify', '>= 0.7'] - extra_dev_deps << ['ruby-ldapserver', '>= 0.3'] - - self.readme_file = 'README.rdoc' - spec_extras[:rdoc_options] = ['--main', readme_file, "--charset=UTF-8"] - self.extra_rdoc_files << self.readme_file +Rake::TestTask.new(:test) do |t| + t.libs << "test" + t.libs << "lib" + t.test_files = FileList["test/**/test_*.rb"] end -# vim: syntax=ruby +task :gem => :build diff --git a/bin/pg_ldap_sync b/exe/pg_ldap_sync similarity index 50% rename from bin/pg_ldap_sync rename to exe/pg_ldap_sync index 5946086..fa15f3d 100755 --- a/bin/pg_ldap_sync +++ b/exe/pg_ldap_sync @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -require 'rubygems' -require 'pg_ldap_sync/application' +require 'pg_ldap_sync' PgLdapSync::Application.run(ARGV) diff --git a/lib/pg_ldap_sync.rb b/lib/pg_ldap_sync.rb index 205344d..fa4887a 100644 --- a/lib/pg_ldap_sync.rb +++ b/lib/pg_ldap_sync.rb @@ -1,3 +1,2 @@ -module PgLdapSync - VERSION = '0.1.1' -end +require "pg_ldap_sync/application" +require "pg_ldap_sync/version" diff --git a/lib/pg_ldap_sync/version.rb b/lib/pg_ldap_sync/version.rb new file mode 100644 index 0000000..74c011a --- /dev/null +++ b/lib/pg_ldap_sync/version.rb @@ -0,0 +1,3 @@ +module PgLdapSync + VERSION = "0.2.0" +end diff --git a/pg-ldap-sync.gemspec b/pg-ldap-sync.gemspec new file mode 100644 index 0000000..9538086 --- /dev/null +++ b/pg-ldap-sync.gemspec @@ -0,0 +1,28 @@ +lib = File.expand_path("../lib", __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require "pg_ldap_sync/version" + +Gem::Specification.new do |spec| + spec.name = "pg-ldap-sync" + spec.version = PgLdapSync::VERSION + spec.authors = ["Lars Kanis"] + spec.email = ["lars@greiz-reinsdorf.de"] + + spec.summary = %q{Use LDAP permissions in PostgreSQL} + spec.homepage = "https://github.com/larskanis/pg-ldap-sync" + spec.license = "MIT" + + spec.files = `git ls-files -z`.split("\x0").reject do |f| + f.match(%r{^(test|spec|features)/}) + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_runtime_dependency "net-ldap", "~> 0.2" + spec.add_runtime_dependency "kwalify", "~> 0.7" + spec.add_development_dependency "ruby-ldapserver", "~> 0.3" + spec.add_development_dependency "minitest", "~> 5.0" + spec.add_development_dependency "bundler", "~> 1.16" + spec.add_development_dependency "rake", "~> 10.0" +end diff --git a/test/test_pg_ldap_sync.rb b/test/test_pg_ldap_sync.rb index 4f41448..7a96d23 100644 --- a/test/test_pg_ldap_sync.rb +++ b/test/test_pg_ldap_sync.rb @@ -1,12 +1,10 @@ -#!/usr/bin/env ruby - -require "test/unit" +require "minitest/autorun" require "pg_ldap_sync/application" require 'yaml' -require 'test/ldap_server' require 'fileutils' +require_relative 'ldap_server' -class TestPgLdapSync < Test::Unit::TestCase +class TestPgLdapSync < Minitest::Test def log_and_run( *cmd ) puts cmd.join(' ') system( *cmd )