cipher_bureau 0.2.1
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/MIT-LICENSE +20 -0
- data/README.md +160 -0
- data/Rakefile +38 -0
- data/db/seeds/norwegian/wordloader.rb +47 -0
- data/lib/cipher_bureau.rb +59 -0
- data/lib/cipher_bureau/data_loader.rb +65 -0
- data/lib/cipher_bureau/dictionary.rb +63 -0
- data/lib/cipher_bureau/exceptions.rb +25 -0
- data/lib/cipher_bureau/password.rb +114 -0
- data/lib/cipher_bureau/password_meter.rb +183 -0
- data/lib/cipher_bureau/statistic.rb +48 -0
- data/lib/cipher_bureau/version.rb +3 -0
- data/lib/generators/cipher_bureau/create_migration_generator.rb +40 -0
- data/lib/generators/cipher_bureau/load_data_generator.rb +36 -0
- data/lib/generators/templates/create_cipher_bureau_dictionaries.rb +41 -0
- data/lib/generators/templates/create_cipher_bureau_statistics.rb +39 -0
- data/lib/tasks/cipher_bureau_tasks.rake +40 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/migrate/201301290819401_create_cipher_bureau_dictionaries.rb +19 -0
- data/test/dummy/db/migrate/201301290819402_create_cipher_bureau_statistics.rb +17 -0
- data/test/dummy/db/schema.rb +46 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/fixtures/cipher_bureau_dictionaries.yml +704 -0
- data/test/fixtures/cipher_bureau_statistics.yml +40 -0
- data/test/test_helper.rb +15 -0
- data/test/units/cipher_bureau/dictionary_test.rb +74 -0
- data/test/units/cipher_bureau/password_meter_test.rb +128 -0
- data/test/units/cipher_bureau/password_test.rb +188 -0
- data/test/units/cipher_bureau/statistic_test.rb +78 -0
- data/test/units/cipher_bureau_test.rb +45 -0
- metadata +197 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright (c) 2013 Dynamic Project Management AS
|
2
|
+
# Copyright (c) 2013 Knut I. Stenmark
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
# encoding: utf-8
|
24
|
+
require 'test_helper'
|
25
|
+
|
26
|
+
class CipherBureau::StatisticTest < ActiveSupport::TestCase
|
27
|
+
|
28
|
+
fixtures :cipher_bureau_statistics
|
29
|
+
|
30
|
+
context 'validation' do
|
31
|
+
should validate_presence_of :country_code
|
32
|
+
should validate_presence_of :grammar
|
33
|
+
should validate_presence_of :length
|
34
|
+
end
|
35
|
+
context 'statistic' do
|
36
|
+
setup do
|
37
|
+
@word = CipherBureau::Dictionary.new :word => 'gurba', :grammar => 'bullshit', :country_code => '999'
|
38
|
+
end
|
39
|
+
should 'create counter if it does not exist' do
|
40
|
+
assert_difference 'CipherBureau::Statistic.count' do
|
41
|
+
CipherBureau::Statistic.register @word
|
42
|
+
end
|
43
|
+
end
|
44
|
+
should 'set initial counter to 1' do
|
45
|
+
stat = CipherBureau::Statistic.register @word
|
46
|
+
assert_equal 1, stat.word_count
|
47
|
+
end
|
48
|
+
should 'increase counter if it exists' do
|
49
|
+
stat1 = stat2 = nil
|
50
|
+
assert_difference 'CipherBureau::Statistic.count' do
|
51
|
+
stat1 = CipherBureau::Statistic.register @word
|
52
|
+
end
|
53
|
+
assert_no_difference 'CipherBureau::Statistic.count' do
|
54
|
+
stat2 = CipherBureau::Statistic.register @word
|
55
|
+
end
|
56
|
+
assert_equal stat1, stat2
|
57
|
+
assert_equal 2, stat2.word_count
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
context 'class method' do
|
63
|
+
context 'word_count' do
|
64
|
+
should 'sum across records' do
|
65
|
+
assert_equal 100, CipherBureau::Statistic.word_count
|
66
|
+
end
|
67
|
+
should 'accepot where clause' do
|
68
|
+
assert_equal 40, CipherBureau::Statistic.word_count( :length => 4)
|
69
|
+
assert_equal 20, CipherBureau::Statistic.word_count( :length => 4, :ascii => true)
|
70
|
+
end
|
71
|
+
should 'accept optional length' do
|
72
|
+
assert_equal 60, CipherBureau::Statistic.word_count(5, :ascii => false)
|
73
|
+
assert_equal 60, CipherBureau::Statistic.word_count(5, :ascii => false)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Copyright (c) 2013 Dynamic Project Management AS
|
2
|
+
# Copyright (c) 2013 Knut I. Stenmark
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'test_helper'
|
24
|
+
|
25
|
+
class CipherBureauTest < ActiveSupport::TestCase
|
26
|
+
test "truth" do
|
27
|
+
assert_kind_of Module, CipherBureau
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'configuration' do
|
31
|
+
should 'include default_memorable_options' do
|
32
|
+
CipherBureau.configure do |config|
|
33
|
+
config.default_memorable_options = {
|
34
|
+
:country_code => 47
|
35
|
+
}
|
36
|
+
end
|
37
|
+
assert_equal ({:country_code => 47}), CipherBureau.default_memorable_options
|
38
|
+
end
|
39
|
+
should 'include default lenght' do
|
40
|
+
assert_nothing_raised do
|
41
|
+
CipherBureau.password_length = 12
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cipher_bureau
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Knut I. Stenmark
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: unicode_utils
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.3.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.3.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sqlite3
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: ! "Sometimes you need to generate passwords in your application.\n This
|
63
|
+
gem does exactly that. It also has the ability to measure the strength of passwords.\n
|
64
|
+
\ In addition it contains a dictionary for creating memorable passwords. \n Currently
|
65
|
+
the dictionary is only in Norwegian, but you can easily load dictionaries yourself."
|
66
|
+
email:
|
67
|
+
- knut.stenmark@gmail.com
|
68
|
+
executables: []
|
69
|
+
extensions: []
|
70
|
+
extra_rdoc_files: []
|
71
|
+
files:
|
72
|
+
- db/seeds/norwegian/wordloader.rb
|
73
|
+
- lib/cipher_bureau/data_loader.rb
|
74
|
+
- lib/cipher_bureau/dictionary.rb
|
75
|
+
- lib/cipher_bureau/exceptions.rb
|
76
|
+
- lib/cipher_bureau/password.rb
|
77
|
+
- lib/cipher_bureau/password_meter.rb
|
78
|
+
- lib/cipher_bureau/statistic.rb
|
79
|
+
- lib/cipher_bureau/version.rb
|
80
|
+
- lib/cipher_bureau.rb
|
81
|
+
- lib/generators/cipher_bureau/create_migration_generator.rb
|
82
|
+
- lib/generators/cipher_bureau/load_data_generator.rb
|
83
|
+
- lib/generators/templates/create_cipher_bureau_dictionaries.rb
|
84
|
+
- lib/generators/templates/create_cipher_bureau_statistics.rb
|
85
|
+
- lib/tasks/cipher_bureau_tasks.rake
|
86
|
+
- MIT-LICENSE
|
87
|
+
- Rakefile
|
88
|
+
- README.md
|
89
|
+
- test/dummy/app/assets/javascripts/application.js
|
90
|
+
- test/dummy/app/assets/stylesheets/application.css
|
91
|
+
- test/dummy/app/controllers/application_controller.rb
|
92
|
+
- test/dummy/app/helpers/application_helper.rb
|
93
|
+
- test/dummy/app/views/layouts/application.html.erb
|
94
|
+
- test/dummy/config/application.rb
|
95
|
+
- test/dummy/config/boot.rb
|
96
|
+
- test/dummy/config/database.yml
|
97
|
+
- test/dummy/config/environment.rb
|
98
|
+
- test/dummy/config/environments/development.rb
|
99
|
+
- test/dummy/config/environments/production.rb
|
100
|
+
- test/dummy/config/environments/test.rb
|
101
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
102
|
+
- test/dummy/config/initializers/inflections.rb
|
103
|
+
- test/dummy/config/initializers/mime_types.rb
|
104
|
+
- test/dummy/config/initializers/secret_token.rb
|
105
|
+
- test/dummy/config/initializers/session_store.rb
|
106
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
107
|
+
- test/dummy/config/locales/en.yml
|
108
|
+
- test/dummy/config/routes.rb
|
109
|
+
- test/dummy/config.ru
|
110
|
+
- test/dummy/db/migrate/201301290819401_create_cipher_bureau_dictionaries.rb
|
111
|
+
- test/dummy/db/migrate/201301290819402_create_cipher_bureau_statistics.rb
|
112
|
+
- test/dummy/db/schema.rb
|
113
|
+
- test/dummy/public/404.html
|
114
|
+
- test/dummy/public/422.html
|
115
|
+
- test/dummy/public/500.html
|
116
|
+
- test/dummy/public/favicon.ico
|
117
|
+
- test/dummy/Rakefile
|
118
|
+
- test/dummy/README.rdoc
|
119
|
+
- test/dummy/script/rails
|
120
|
+
- test/fixtures/cipher_bureau_dictionaries.yml
|
121
|
+
- test/fixtures/cipher_bureau_statistics.yml
|
122
|
+
- test/test_helper.rb
|
123
|
+
- test/units/cipher_bureau/dictionary_test.rb
|
124
|
+
- test/units/cipher_bureau/password_meter_test.rb
|
125
|
+
- test/units/cipher_bureau/password_test.rb
|
126
|
+
- test/units/cipher_bureau/statistic_test.rb
|
127
|
+
- test/units/cipher_bureau_test.rb
|
128
|
+
homepage: https://github.com/stonefield/cipher_bureau
|
129
|
+
licenses: []
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
segments:
|
141
|
+
- 0
|
142
|
+
hash: -2494357684159840119
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ! '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
hash: -2494357684159840119
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 1.8.24
|
155
|
+
signing_key:
|
156
|
+
specification_version: 3
|
157
|
+
summary: CipherBureau is a simple gem for password generation
|
158
|
+
test_files:
|
159
|
+
- test/dummy/app/assets/javascripts/application.js
|
160
|
+
- test/dummy/app/assets/stylesheets/application.css
|
161
|
+
- test/dummy/app/controllers/application_controller.rb
|
162
|
+
- test/dummy/app/helpers/application_helper.rb
|
163
|
+
- test/dummy/app/views/layouts/application.html.erb
|
164
|
+
- test/dummy/config/application.rb
|
165
|
+
- test/dummy/config/boot.rb
|
166
|
+
- test/dummy/config/database.yml
|
167
|
+
- test/dummy/config/environment.rb
|
168
|
+
- test/dummy/config/environments/development.rb
|
169
|
+
- test/dummy/config/environments/production.rb
|
170
|
+
- test/dummy/config/environments/test.rb
|
171
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
172
|
+
- test/dummy/config/initializers/inflections.rb
|
173
|
+
- test/dummy/config/initializers/mime_types.rb
|
174
|
+
- test/dummy/config/initializers/secret_token.rb
|
175
|
+
- test/dummy/config/initializers/session_store.rb
|
176
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
177
|
+
- test/dummy/config/locales/en.yml
|
178
|
+
- test/dummy/config/routes.rb
|
179
|
+
- test/dummy/config.ru
|
180
|
+
- test/dummy/db/migrate/201301290819401_create_cipher_bureau_dictionaries.rb
|
181
|
+
- test/dummy/db/migrate/201301290819402_create_cipher_bureau_statistics.rb
|
182
|
+
- test/dummy/db/schema.rb
|
183
|
+
- test/dummy/public/404.html
|
184
|
+
- test/dummy/public/422.html
|
185
|
+
- test/dummy/public/500.html
|
186
|
+
- test/dummy/public/favicon.ico
|
187
|
+
- test/dummy/Rakefile
|
188
|
+
- test/dummy/README.rdoc
|
189
|
+
- test/dummy/script/rails
|
190
|
+
- test/fixtures/cipher_bureau_dictionaries.yml
|
191
|
+
- test/fixtures/cipher_bureau_statistics.yml
|
192
|
+
- test/test_helper.rb
|
193
|
+
- test/units/cipher_bureau/dictionary_test.rb
|
194
|
+
- test/units/cipher_bureau/password_meter_test.rb
|
195
|
+
- test/units/cipher_bureau/password_test.rb
|
196
|
+
- test/units/cipher_bureau/statistic_test.rb
|
197
|
+
- test/units/cipher_bureau_test.rb
|