dnc 0.1.3 → 0.1.4

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: ce7a07e20560758b23924c63fbe5ea5e2b6d7a99
4
- data.tar.gz: e0f2e9fe32098cb804c6446171cfb874482506d5
3
+ metadata.gz: 7b627e690855710dd9b6893edd1d8750bd42f90a
4
+ data.tar.gz: 80fe41a82c2f5a91dd1db3022edc9991c6330ca3
5
5
  SHA512:
6
- metadata.gz: 6cbe4dd30c4667b9b545c068e154c0e640fcdc0260b2b0901bf48dc3782f30b0914b5633fae2a076c4c68d7f16a20e470874e8f1734a99b11363750495af3900
7
- data.tar.gz: 956a5e1d4f1c2391f6a3a1c1de73f4a5ceb1600ea1591d458c0ec747afe66e42bfaf90b7c02939b3f17e462ecd0aa50da085f65bdd09b0b230706773fc1aa4b5
6
+ metadata.gz: 06e2b6e2598f01d00826a6d064dfe1e04b92a0924978bc799746882dcbaf3f95cebc105d3e2b5136a5b0fdcd817e05ae9bfa40fdaaf5e2fc853191d9ea81b1af
7
+ data.tar.gz: b8a3702179c9bed4e5c4b3fcdebf3bcc0fa6ad7951df34fa445807206aaefa127d995bee9759eda3b3d2e5dbbe9ebf2e224155c6087f875994fdd7defd0e87e1
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/dnc.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Steven Haddox"]
10
10
  spec.email = ["steven@haddox.us"]
11
11
  spec.summary = %q{Distinguished Name Converter}
12
- spec.description = %q{Convert multiple X509 DN strings into a consistent(ish) format.}
12
+ spec.description = %q{Convert multiple X509 DN strings into a consistent format.}
13
13
  spec.homepage = "https://github.com/stevenhaddox/dnc"
14
14
  spec.license = "MIT"
15
15
 
data/lib/dnc/dn.rb CHANGED
@@ -171,14 +171,14 @@ class DN
171
171
 
172
172
  # Dynamically define a method to return DN array values as string format
173
173
  def dn_array_to_string(getter_method)
174
- return_string = ''
174
+ tmp_str = ''
175
175
  value = send(getter_method.to_sym)
176
- value.each do |element|
177
- return_string += ',' unless return_string.empty?
178
- return_string += "#{getter_method.to_s.upcase}=#{element}"
176
+ value.each do |el|
177
+ tmp_str += ',' unless tmp_str.empty?
178
+ tmp_str += "#{getter_method.to_s.send(@transformation.to_sym)}=#{el}"
179
179
  end
180
180
 
181
- return_string
181
+ tmp_str
182
182
  end
183
183
 
184
184
  # Dynamically define a method to return DN hash values as string format
data/lib/dnc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dnc
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -0,0 +1,4 @@
1
+ CN=Stusrvich Terrance Edward Testusr,OU=D135,OU=Isle,OU=web,O=L.O.S.T. others,C=us%CN=STUSRVICH TERRANCE EDWARD TESTUSR,OU=D135,OU=ISLE,OU=WEB,O=L.O.S.T. OTHERS,C=US
2
+ CN=DIAGO Desmond d123456,OU=People,OU=PENNY,OU=Not,O=L.O.S.T. OTHERS,C=US%CN=DIAGO DESMOND D123456,OU=PEOPLE,OU=PENNY,OU=NOT,O=L.O.S.T. OTHERS,C=US
3
+ CN=BOB-THORNTON William JAMES wjbob,OU=boat,OU=b047,OU=ISLE,OU=NOT,O=l.o.s.t. others,C=us%CN=BOB-THORNTON WILLIAM JAMES WJBOB,OU=BOAT,OU=B047,OU=ISLE,OU=NOT,O=L.O.S.T. OTHERS,C=US
4
+ CN=NODE RUBY G RGNODE9,OU=JIEDDO,OU=PEOPLE,OU=JCK,OU=JHN,O=L.O.S.T. OTHERS,C=US%CN=NODE RUBY G RGNODE9,OU=JIEDDO,OU=PEOPLE,OU=JCK,OU=JHN,O=L.O.S.T. OTHERS,C=US
data/spec/lib/dn_spec.rb CHANGED
@@ -66,12 +66,23 @@ describe DN do
66
66
  expect(dn.to_s).to eq(customized_string)
67
67
  end
68
68
 
69
- # it "should parse common DN formats into DN objects" do
70
- # File.readlines('spec/fixtures/common_dns.txt').each do |line|
71
- # dn_in = line.rstrip.split('%')[0]
72
- # dn_out = line.rstrip.split('%')[1]
73
- # expect(DN.new(dn_string: dn_in).to_s).to eq(dn_out)
74
- # end
75
- # end
69
+ it "should parse custom DN formats into DN objects" do
70
+ # Sample data sets
71
+ File.readlines('spec/fixtures/custom_sort_dns.txt').each do |line|
72
+ dn_in = line.rstrip.split('%')[0]
73
+ dn_out = line.rstrip.split('%')[1]
74
+ custom_order = %w(cn l st ou o c street dc uid)
75
+ expect(DN.new(dn_string: dn_in, string_order: custom_order).to_s).to eq(dn_out)
76
+ end
77
+ end
78
+
79
+ it "should parse common DN formats into DN objects" do
80
+ pending "Implement common DN test strings"
81
+ File.readlines('spec/fixtures/common_dns.txt').each do |line|
82
+ dn_in = line.rstrip.split('%')[0]
83
+ dn_out = line.rstrip.split('%')[1]
84
+ expect(DN.new(dn_string: dn_in).to_s).to eq(dn_out)
85
+ end
86
+ end
76
87
  end
77
88
  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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Haddox
@@ -30,7 +30,7 @@ cert_chain:
30
30
  42qdwEXvvkODZAD6KAIXPdmbMfBgPbcd+B/4eUA0PyKo+4dgL1NuqX4MPWToevIZ
31
31
  O8EKLF2X7NmC6FY1bOsSj/J8r1SOkx0rxgF+geRvY1P+hfNjDfxTsjU=
32
32
  -----END CERTIFICATE-----
33
- date: 2015-01-15 00:00:00.000000000 Z
33
+ date: 2015-01-22 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: logging
@@ -186,7 +186,7 @@ dependencies:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0.8'
189
- description: Convert multiple X509 DN strings into a consistent(ish) format.
189
+ description: Convert multiple X509 DN strings into a consistent format.
190
190
  email:
191
191
  - steven@haddox.us
192
192
  executables: []
@@ -211,6 +211,7 @@ files:
211
211
  - lib/dnc/string.rb
212
212
  - lib/dnc/version.rb
213
213
  - spec/fixtures/common_dns.txt
214
+ - spec/fixtures/custom_sort_dns.txt
214
215
  - spec/lib/dn_spec.rb
215
216
  - spec/lib/string_spec.rb
216
217
  - spec/spec_helper.rb
@@ -240,6 +241,7 @@ specification_version: 4
240
241
  summary: Distinguished Name Converter
241
242
  test_files:
242
243
  - spec/fixtures/common_dns.txt
244
+ - spec/fixtures/custom_sort_dns.txt
243
245
  - spec/lib/dn_spec.rb
244
246
  - spec/lib/string_spec.rb
245
247
  - spec/spec_helper.rb
metadata.gz.sig CHANGED
Binary file