dnc 0.1.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -4
- data/.travis.yml +6 -6
- data/dnc.gemspec +2 -2
- data/lib/dnc/dn.rb +4 -10
- data/lib/dnc/version.rb +1 -1
- data/spec/lib/dn_spec.rb +17 -0
- data/spec/spec_helper.rb +1 -1
- metadata +15 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d37b1c0078b4583fc1393d1c15386e506394e71b
|
4
|
+
data.tar.gz: fa1d24afce792778abc8a789f0023733d8bc0f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9798c22332c4d4530e964e330d39f0147397188ce636181d1da0f172261ef3d7bada372ddf7cfd5544653939065187cb20439a986a77987306544b49ff6d107
|
7
|
+
data.tar.gz: 0e0f7b52d36e62135d3a05205d21002ec630a29213354ab7b74c44ca69f9b1bf76b445aa21112239f2e6825d6885472370ba594710f85774f0fb33a51754b5b6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,4 +1 @@
|
|
1
|
-
|
2
|
-
�Ss�G��7�3SE�i��!<����ҭ���5"�K�5���-��ס���&B�����,�35X�x�qj��w��xCe;�e\��r��
|
3
|
-
`G~�sd�Xe����ò���|w�fb�1�`O�`(%@hyU����̤TQ�C�%[B��jӧ��X��=�b� �0�;����� 2��o��_���<b/��~
|
4
|
-
%h�Z�2�B �k��|��21��d
|
1
|
+
QR���R*@�*'�G�{8s�=cn?}����81tpK�H��ز����c��,نY||��?���c;�n�r�n����@���*����6�Zy�N\���{����$J��tZ7�[����������ipE�,��o�?�?��ۼ=�Sk]�bN��p���h��Q����rW+�˯�lc��o|�.��f�.^�\����i;x��+2�1��������4~%�k�Aj'�'���O��4L�4
|
data/.travis.yml
CHANGED
@@ -2,13 +2,13 @@ language: ruby
|
|
2
2
|
cache: bundler
|
3
3
|
|
4
4
|
rvm:
|
5
|
-
-
|
6
|
-
- 2.3
|
7
|
-
- 2.
|
8
|
-
- 2.0.0
|
9
|
-
- 1.9.3
|
5
|
+
- ruby-head
|
6
|
+
- 2.2.3
|
7
|
+
- 2.1.6
|
8
|
+
- 2.0.0
|
9
|
+
- 1.9.3
|
10
10
|
|
11
11
|
before_install:
|
12
12
|
- gem install bundler
|
13
13
|
|
14
|
-
script: 'bundle exec rake
|
14
|
+
script: 'bundle exec rake'
|
data/dnc.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
22
|
-
spec.add_dependency 'logging'
|
22
|
+
spec.add_dependency 'logging', '>= 1.8', '< 3.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'rack', '~> 1.5'
|
28
28
|
spec.add_development_dependency 'rack-test', '~> 0.6'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
-
spec.add_development_dependency 'rubocop', '
|
30
|
+
spec.add_development_dependency 'rubocop', '= 0.41.2'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
32
32
|
spec.add_development_dependency 'yard', '~> 0.8'
|
33
33
|
|
data/lib/dnc/dn.rb
CHANGED
@@ -54,7 +54,7 @@ class DN
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
return_string
|
57
|
+
return_string
|
58
58
|
end
|
59
59
|
|
60
60
|
# Split passed DN by identified delimiter
|
@@ -129,13 +129,7 @@ class DN
|
|
129
129
|
|
130
130
|
# Verify DN starts with 'CN='
|
131
131
|
def dn_begins_properly?(dn_str)
|
132
|
-
|
133
|
-
false
|
134
|
-
else
|
135
|
-
with_delim = "#{delimiter}/CN=".send(@transformation.to_sym)
|
136
|
-
without_delim = 'CN='.send(@transformation.to_sym)
|
137
|
-
dn_str.start_with?(without_delim, with_delim)
|
138
|
-
end
|
132
|
+
dn_str.nil? ? false : /^#{Regexp.escape(delimiter)}?CN/i.match(dn_str)
|
139
133
|
end
|
140
134
|
|
141
135
|
# Regex to match the DN delimiter by getting the 2nd key non-word predecessor
|
@@ -179,7 +173,7 @@ class DN
|
|
179
173
|
value = send(getter_method.to_sym)
|
180
174
|
value.each do |el|
|
181
175
|
tmp_str += ',' unless tmp_str.empty?
|
182
|
-
tmp_str += "#{getter_method.to_s.
|
176
|
+
tmp_str += "#{getter_method.to_s.upcase}=#{el}"
|
183
177
|
end
|
184
178
|
|
185
179
|
tmp_str
|
@@ -191,7 +185,7 @@ class DN
|
|
191
185
|
value = send(getter_method.to_sym)
|
192
186
|
value.each do |key, string|
|
193
187
|
return_string += '+' unless return_string.empty?
|
194
|
-
return_string += "#{key}=#{string}"
|
188
|
+
return_string += "#{key.upcase}=#{string}"
|
195
189
|
end
|
196
190
|
|
197
191
|
return_string
|
data/lib/dnc/version.rb
CHANGED
data/spec/lib/dn_spec.rb
CHANGED
@@ -84,5 +84,22 @@ describe DN do
|
|
84
84
|
expect(DN.new(dn_string: dn_in).to_s).to eq(dn_out)
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
88
|
+
it "should support simple string transformation" do
|
89
|
+
dn_string = 'CN=Last First M (initial),O=rb,OU=people,C=us,DC=org,DC=example'
|
90
|
+
expect(DN.new(dn_string: dn_string, transformation: 'to_s').to_s).to eq(dn_string)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should support different case cn" do
|
94
|
+
dn_string = 'cn=Last First M (initial),O=rb,OU=people,C=us,DC=org,DC=example'
|
95
|
+
dn_out = dn_string.gsub(/([^,]*)=/) { |i| i.upcase }
|
96
|
+
expect(DN.new(dn_string: dn_string, transformation: 'to_s').to_s).to eq(dn_out)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should support not just idempotent transformation functions" do
|
100
|
+
dn_string = 'CN=Last First M (initial),O=rb,OU=people,C=us,DC=org,DC=example'
|
101
|
+
dn_out = dn_string.swapcase.gsub(/([^,]*)=/) { |i| i.upcase }
|
102
|
+
expect(DN.new(dn_string: dn_string, transformation: 'swapcase').to_s).to eq(dn_out)
|
103
|
+
end
|
87
104
|
end
|
88
105
|
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Haddox
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
NwdGc+LFuu/Xv5FBDYMFyfLSPhncqwXHSzF4OKSqEckawuqN+5eA/C0MsGDplVF4
|
31
31
|
eksh9s9/x2f0t0J05xQBWzmmSR6dJRi21G6VUquyVOWHggfRqs3UAZg=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2017-06-
|
33
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: logging
|
@@ -38,14 +38,20 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '1.8'
|
42
|
+
- - "<"
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3.0'
|
42
45
|
type: :runtime
|
43
46
|
prerelease: false
|
44
47
|
version_requirements: !ruby/object:Gem::Requirement
|
45
48
|
requirements:
|
46
49
|
- - ">="
|
47
50
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
51
|
+
version: '1.8'
|
52
|
+
- - "<"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
49
55
|
- !ruby/object:Gem::Dependency
|
50
56
|
name: awesome_print
|
51
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,16 +140,16 @@ dependencies:
|
|
134
140
|
name: rubocop
|
135
141
|
requirement: !ruby/object:Gem::Requirement
|
136
142
|
requirements:
|
137
|
-
- -
|
143
|
+
- - '='
|
138
144
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
145
|
+
version: 0.41.2
|
140
146
|
type: :development
|
141
147
|
prerelease: false
|
142
148
|
version_requirements: !ruby/object:Gem::Requirement
|
143
149
|
requirements:
|
144
|
-
- -
|
150
|
+
- - '='
|
145
151
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
152
|
+
version: 0.41.2
|
147
153
|
- !ruby/object:Gem::Dependency
|
148
154
|
name: rspec
|
149
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
229
|
version: '0'
|
224
230
|
requirements: []
|
225
231
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.6.11
|
227
233
|
signing_key:
|
228
234
|
specification_version: 4
|
229
235
|
summary: Distinguished Name Converter
|
metadata.gz.sig
CHANGED
Binary file
|