dnc 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66b1ef34df9cb502c35b85313bc576a3de31e043
4
- data.tar.gz: 691ed00273f98ed06be51cf361b358965a25b00d
3
+ metadata.gz: a396eb196c442711ef2e116e7bc1a999ae5ccceb
4
+ data.tar.gz: d1bfc2c1f2a9ba9b76ae828e5d5d1c43751bcc71
5
5
  SHA512:
6
- metadata.gz: ca789d0f4c60ea6c846debc8765f27f4388842551752eddccaddaef8a8fddbb5603a07899be98d4732bb2d7e442bcd7156fe2c9e8cb09b2c25abe3fc1fd43fcd
7
- data.tar.gz: b338653735df756a52c15bf27c1cc32fce7c5017ace0f1de9f22be8fd6d3f83372ae0218b74b5b92b778039f26f31ed7df8b46126927d80da8b727f8168a2890
6
+ metadata.gz: 5d4f4c56864855d24f42fd8cc10ebe10f0a800e4645dfec23dfc3bb3c397ede886b49f6ec096b086a34567a60318f07711f7c77516cab87b11db175923405d76
7
+ data.tar.gz: 006cab85e2b1e56f9e2eddd4a2ebf8831488f0b468464c8ce37de6766e67ba768fb9086684f71723fd55c7ec9d68299f5d5d0c016f657511fca2db8b4800b0cc
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -3,7 +3,6 @@ cache: bundler
3
3
 
4
4
  rvm:
5
5
  - ruby-head
6
- - jruby-head
7
6
  - 2.1.2
8
7
  - 2.1.1
9
8
  - 2.0.0
data/README.md CHANGED
@@ -1,39 +1,82 @@
1
1
  # Distinguished Name (DN) Converter
2
2
 
3
- TODO: Write a gem description
3
+ Convert multiple X509 DN strings into a consistent format.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- ```ruby
10
- gem 'dnc'
11
- ```
9
+ gem 'dnc'
12
10
 
13
11
  And then execute:
14
12
 
15
13
  $ bundle
16
14
 
17
- Or install it yourself as:
15
+ Or install it yourself with:
18
16
 
19
17
  $ gem install dnc
20
18
 
21
19
  ## Usage
22
20
 
21
+ To create a DN instance:
22
+
23
23
  ```ruby
24
24
  require 'dnc'
25
- dn_string = 'CN=Some Valid, O=DN, OU=string'
26
- dn = DN.new(dn_string: dn_string)
25
+ dn = DN.new(dn_string: '/C=US/OU=string/O=DN/CN=Some Valid')
27
26
  # Or:
28
- dn_string.to_dn
29
- # And:
30
- dn_string.to_dn.to_s
27
+ dn = '/C=US/OU=string/O=DN/CN=Some Valid'.to_dn
28
+ dn = '/C=US/OU=string/O=DN/CN=Some Valid'.to_dn!
29
+ ```
30
+
31
+ To return a consistently formatted string:
32
+
33
+ ```ruby
34
+ dn.to_s
35
+ #=> 'CN=SOME VALID,O=DN,OU=STRING,C=US'
36
+ ```
37
+
38
+ This is what a basic DN object looks like:
39
+
40
+ ```yaml
41
+ puts dn.to_yaml
42
+ #=>
43
+ --- !ruby/object:DN
44
+ dn_string: CN=SOME VALID/O=DN/OU=STRING/C=US
45
+ original_dn: "/C=US/OU=string/O=DN/CN=Some Valid"
46
+ logger: !ruby/object:Logging::Logger
47
+ [... snipped ...]
48
+ transformation: upcase
49
+ delimiter: "/"
50
+ cn: SOME VALID
51
+ o: DN
52
+ ou: STRING
53
+ c: US
54
+ string_order:
55
+ - cn
56
+ - l
57
+ - st
58
+ - o
59
+ - ou
60
+ - c
61
+ - street
62
+ - dc
63
+ - uid
31
64
  ```
32
65
 
66
+ There are multiple parameters you can pass in to modify the DN's formatting:
67
+
68
+ * `dn_string`: **REQUIRED** The DN string you want to parse into a DN object.
69
+ * `transformation`: `upcase`, `downcase`, `to_s` (or any valid String method).
70
+ * `delimiter`: Custom delimiter, DN auto detects if possible, but this forces it.
71
+ * `string_order`: DNC returns RDN elements as per LDAP specs ([RFC4514](http://www.rfc-editor.org/rfc/rfc4514.txt)), but to customize it you can send an array (of strings) to sort your `.to_s` results.
72
+ The default order is: `%w(cn l st o ou c street dc uid)`
73
+ * `logger`: Custom logger, defaults to Rails logger or Logging gem logger.
74
+
33
75
  ## Contributing
34
76
 
35
77
  1. Fork it ( https://github.com/[my-github-username]/dnc/fork )
36
- 2. Create your feature branch (`git checkout -b my-new-feature`)
37
- 3. Commit your changes (`git commit -am 'Add some feature'`)
38
- 4. Push to the branch (`git push origin my-new-feature`)
39
- 5. Create a new Pull Request
78
+ 2. Add specs and make them pass (see 3)
79
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
80
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
81
+ 5. Push to the branch (`git push origin my-new-feature`)
82
+ 6. Create a new Pull Request
@@ -1,3 +1,3 @@
1
1
  module Dnc
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnc
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Haddox
metadata.gz.sig CHANGED
Binary file