locksmith 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/locksmith.rb +5 -1
- data/locksmith.gemspec +3 -4
- data/spec/locksmith_spec.rb +16 -0
- metadata +5 -29
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/locksmith.rb
CHANGED
@@ -3,7 +3,7 @@ require 'tuwaga'
|
|
3
3
|
require 'digest/md5'
|
4
4
|
|
5
5
|
class Locksmith
|
6
|
-
attr_accessor :private_password, :domain, :username
|
6
|
+
attr_accessor :private_password, :domain, :username, :max_length
|
7
7
|
attr_reader :errors
|
8
8
|
|
9
9
|
@@alpha_hex = Tuwaga.new(16, 'abcdefghijklmnop')
|
@@ -95,6 +95,10 @@ class Locksmith
|
|
95
95
|
base_x = Tuwaga.new(base_x_symbols.length, base_x_symbols)
|
96
96
|
result += base_x.convert_from(hex_string, @@hex)
|
97
97
|
|
98
|
+
if @max_length
|
99
|
+
result = result[0,@max_length]
|
100
|
+
end
|
101
|
+
|
98
102
|
result
|
99
103
|
else
|
100
104
|
raise('Can not generate password: ' + @errors.join(', '))
|
data/locksmith.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{locksmith}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Yehezkiel Syamsuhadi"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-05-09}
|
13
13
|
s.description = %q{Given a private password, domain name and optionally username, this library will generate a new password using a combination of alphabets, numbers and symbols.}
|
14
14
|
s.email = %q{yehezkielbs@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = %q{http://github.com/yehezkielbs/locksmith}
|
34
34
|
s.licenses = ["MIT"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.
|
36
|
+
s.rubygems_version = %q{1.6.2}
|
37
37
|
s.summary = %q{Given a private password, domain name and optionally username, this library will generate a new password using a combination of alphabets, numbers and symbols.}
|
38
38
|
s.test_files = [
|
39
39
|
"spec/locksmith_spec.rb",
|
@@ -41,7 +41,6 @@ Gem::Specification.new do |s|
|
|
41
41
|
]
|
42
42
|
|
43
43
|
if s.respond_to? :specification_version then
|
44
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
44
|
s.specification_version = 3
|
46
45
|
|
47
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/spec/locksmith_spec.rb
CHANGED
@@ -141,5 +141,21 @@ describe 'Locksmith' do
|
|
141
141
|
@locksmith.use_symbol = true
|
142
142
|
@locksmith.generated_password.should match /^[~!@#\$%^&*()_+-={}|\[\]\\;':"<>?,.\/]+$/
|
143
143
|
end
|
144
|
+
|
145
|
+
it 'should be able to limit the generated password length' do
|
146
|
+
generated_password = @locksmith.generated_password
|
147
|
+
|
148
|
+
@locksmith.max_length = 6
|
149
|
+
@locksmith.generated_password.should == generated_password[0,6]
|
150
|
+
|
151
|
+
@locksmith.max_length = 1000
|
152
|
+
@locksmith.generated_password.should == generated_password
|
153
|
+
|
154
|
+
@locksmith.max_length = 0
|
155
|
+
@locksmith.generated_password.should == ''
|
156
|
+
|
157
|
+
@locksmith.max_length = nil
|
158
|
+
@locksmith.generated_password.should == generated_password
|
159
|
+
end
|
144
160
|
end
|
145
161
|
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locksmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
version: 0.0.2
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Yehezkiel Syamsuhadi
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-05-09 00:00:00 +10:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,10 +20,6 @@ dependencies:
|
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
- 0
|
30
|
-
- 3
|
31
23
|
version: 0.0.3
|
32
24
|
type: :runtime
|
33
25
|
prerelease: false
|
@@ -39,10 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ~>
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 2
|
44
|
-
- 3
|
45
|
-
- 0
|
46
34
|
version: 2.3.0
|
47
35
|
type: :development
|
48
36
|
prerelease: false
|
@@ -54,10 +42,6 @@ dependencies:
|
|
54
42
|
requirements:
|
55
43
|
- - ~>
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 1
|
59
|
-
- 0
|
60
|
-
- 0
|
61
45
|
version: 1.0.0
|
62
46
|
type: :development
|
63
47
|
prerelease: false
|
@@ -69,10 +53,6 @@ dependencies:
|
|
69
53
|
requirements:
|
70
54
|
- - ~>
|
71
55
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 1
|
74
|
-
- 5
|
75
|
-
- 2
|
76
56
|
version: 1.5.2
|
77
57
|
type: :development
|
78
58
|
prerelease: false
|
@@ -84,8 +64,6 @@ dependencies:
|
|
84
64
|
requirements:
|
85
65
|
- - ">="
|
86
66
|
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 0
|
89
67
|
version: "0"
|
90
68
|
type: :development
|
91
69
|
prerelease: false
|
@@ -126,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
104
|
requirements:
|
127
105
|
- - ">="
|
128
106
|
- !ruby/object:Gem::Version
|
129
|
-
hash:
|
107
|
+
hash: 2172219786960532592
|
130
108
|
segments:
|
131
109
|
- 0
|
132
110
|
version: "0"
|
@@ -135,13 +113,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
113
|
requirements:
|
136
114
|
- - ">="
|
137
115
|
- !ruby/object:Gem::Version
|
138
|
-
segments:
|
139
|
-
- 0
|
140
116
|
version: "0"
|
141
117
|
requirements: []
|
142
118
|
|
143
119
|
rubyforge_project:
|
144
|
-
rubygems_version: 1.
|
120
|
+
rubygems_version: 1.6.2
|
145
121
|
signing_key:
|
146
122
|
specification_version: 3
|
147
123
|
summary: Given a private password, domain name and optionally username, this library will generate a new password using a combination of alphabets, numbers and symbols.
|