distinguished_name 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,11 @@
1
- require File.join(File.dirname(__FILE__), '..', 'distinguished_name')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'distinguished_name'))
2
2
 
3
3
  class DistinguishedName::Canonicalize
4
4
 
5
5
  class << self
6
6
 
7
7
  def reverse(dn, order=['CN','OU','O','C'])
8
+ STDERR.puts "Warning! DistinguishedName::Canonicalize is deprecated. Use DistinguishedName::Transform instead."
8
9
  @dn = dn
9
10
  @order = []
10
11
  order.each {|o| @order << o + '='}
@@ -52,11 +52,18 @@ private
52
52
  def parse_dn(dn_string)
53
53
  begin
54
54
  OpenSSL::X509::Name.parse(dn_string)
55
- rescue Java::JavaLang::NullPointerException #MRI can throw a TypeError
55
+ rescue parse_exception
56
56
  raise OpenSSL::X509::NameError
57
57
  end
58
58
  end
59
59
 
60
- end
60
+ def parse_exception
61
+ if defined?(JRUBY_VERSION)
62
+ JRUBY_VERSION >= "1.7.1" ? TypeError : Java::JavaLang::NullPointerException
63
+ else
64
+ TypeError
65
+ end
66
+ end
61
67
 
68
+ end
62
69
  end
@@ -1,3 +1,3 @@
1
1
  module DistinguishedName
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
data/test/test_helper.rb CHANGED
@@ -3,5 +3,5 @@ require 'test/unit'
3
3
  if Kernel.respond_to?(:require_relative)
4
4
  require_relative "../lib/distinguished_name"
5
5
  else
6
- require File.join(File.dirname(caller[0]), "../lib/distinguished_name")
6
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "distinguished_name"))
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distinguished_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: