memorable_password 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 686845e65ae03624537db038c6133f0cb0b54991
4
+ data.tar.gz: acfd8e343a1d894562d1f9cb9caaa5a72bc099b1
5
+ SHA512:
6
+ metadata.gz: e4be232c515c9e4b9d213bc3db017330ad4966f47e69f6f572b9737a56d262d76688c74b97c90c8498c1547072bc88f9fc4ba272166642a5e96f45bb697b0d67
7
+ data.tar.gz: 75503ce89c289cd5b269067768a76be3f51882490d0d88e4137ff86245ef36f8606db322b69187a54aea0c4a3030d2006668d7892cddf9bc40557cf04ff66954
@@ -30,8 +30,7 @@ require 'memorable_password/sample'
30
30
  #
31
31
  class MemorablePassword
32
32
  MAX_WORD_LENGTH = 7
33
- DIGITS = %w[0 1 2 3 4 5 6 7 8 9].freeze
34
- NON_WORD_DIGITS = (DIGITS - %w(2 4 8)).freeze
33
+ DEFAULT_DIGITS = %w[0 1 2 3 4 5 6 7 8 9].freeze
35
34
  CHARACTERS = %w[! @ $ ? -].freeze
36
35
 
37
36
  # The default paths to the various dictionary flat files
@@ -47,7 +46,7 @@ class MemorablePassword
47
46
  }
48
47
 
49
48
  attr_reader :dictionary, :blacklist, :ban_list,
50
- :dictionary_paths, :blacklist_paths
49
+ :dictionary_paths, :blacklist_paths, :digits, :non_word_digits
51
50
 
52
51
  def initialize(options={})
53
52
  # TODO implement these lists as Sets to get Hash lookup and uniqueness for free -- matt.dressel 20120328
@@ -58,6 +57,9 @@ class MemorablePassword
58
57
  @dictionary_paths = options.fetch(:dictionary_paths, DEFAULT_DICTIONARY_PATHS)
59
58
  @blacklist_paths = options.fetch(:blacklist_paths, DEFAULT_BLACKLIST_PATHS)
60
59
 
60
+ @digits = options.fetch(:digits, DEFAULT_DIGITS).freeze
61
+ @non_word_digits = (@digits - %w(2 4 8)).freeze
62
+
61
63
  @dictionary = {}
62
64
  @blacklist = []
63
65
 
@@ -168,12 +170,12 @@ class MemorablePassword
168
170
 
169
171
  # Returns a random digit
170
172
  def digit
171
- DIGITS.sample
173
+ @digits.sample
172
174
  end
173
175
 
174
176
  # Returns a random, non-ambiguous digit (0..9 without 2, 4 and 8)
175
177
  def non_word_digit
176
- NON_WORD_DIGITS.sample
178
+ @non_word_digits.sample
177
179
  end
178
180
 
179
181
  # Ensures that the word is valid:
@@ -1,3 +1,3 @@
1
1
  class MemorablePassword
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -6,7 +6,8 @@ describe MemorablePassword do
6
6
  default_path = "#{File.dirname(__FILE__)}/config"
7
7
  @memorable_password ||= MemorablePassword.new(
8
8
  :dictionary_paths => ["#{default_path}/custom_dictionary.txt"],
9
- :blacklist_paths => ["#{default_path}/custom_blacklist.txt"])
9
+ :blacklist_paths => ["#{default_path}/custom_blacklist.txt"],
10
+ :digits => %w[2 3 4 5 6 7 8 9])
10
11
  end
11
12
 
12
13
  subject {memorable_password}
@@ -29,6 +30,11 @@ describe MemorablePassword do
29
30
  it "should support configurable blacklist paths" do
30
31
  subject.blacklist.should include 'blcklst'
31
32
  end
33
+
34
+ it "should support configurable digits" do
35
+ subject.digits.should eq(%w[2 3 4 5 6 7 8 9])
36
+ subject.non_word_digits.should eq(%w[3 5 6 7 9])
37
+ end
32
38
  end
33
39
 
34
40
  describe "#to_s" do
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memorable_password
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.1.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kevin McPhillips
@@ -10,30 +9,36 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-08-01 00:00:00.000000000 Z
12
+ date: 2015-06-23 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
- requirement: &83405870 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: 2.6.0
23
21
  type: :development
24
22
  prerelease: false
25
- version_requirements: *83405870
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 2.6.0
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: yard
28
- requirement: &83405510 !ruby/object:Gem::Requirement
29
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ! '>='
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
- version_requirements: *83405510
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
37
42
  description: This simple gem generates a random password that is easy to read and
38
43
  remember. It uses dictionary words as well as a list of proper names mixed in with
39
44
  numbers and special characters.
@@ -44,9 +49,9 @@ executables: []
44
49
  extensions: []
45
50
  extra_rdoc_files: []
46
51
  files:
47
- - .gitignore
48
- - .rspec
49
- - .rvmrc
52
+ - ".gitignore"
53
+ - ".rspec"
54
+ - ".rvmrc"
50
55
  - Gemfile
51
56
  - README.markdown
52
57
  - Rakefile
@@ -64,27 +69,32 @@ files:
64
69
  - spec/support/match_any_matcher.rb
65
70
  homepage: http://github.com/kmcphillips/memorable_password
66
71
  licenses: []
72
+ metadata: {}
67
73
  post_install_message:
68
74
  rdoc_options: []
69
75
  require_paths:
70
76
  - lib
71
77
  required_ruby_version: !ruby/object:Gem::Requirement
72
- none: false
73
78
  requirements:
74
- - - ! '>='
79
+ - - ">="
75
80
  - !ruby/object:Gem::Version
76
81
  version: '0'
77
82
  required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
83
  requirements:
80
- - - ! '>='
84
+ - - ">="
81
85
  - !ruby/object:Gem::Version
82
86
  version: '0'
83
87
  requirements: []
84
88
  rubyforge_project: memorable_password
85
- rubygems_version: 1.8.15
89
+ rubygems_version: 2.2.2
86
90
  signing_key:
87
- specification_version: 3
91
+ specification_version: 4
88
92
  summary: Generate human readable and easy to remember passwords
89
- test_files: []
93
+ test_files:
94
+ - spec/lib/config/custom_blacklist.txt
95
+ - spec/lib/config/custom_dictionary.txt
96
+ - spec/lib/config/short_dictionary.txt
97
+ - spec/lib/memorable_password_spec.rb
98
+ - spec/spec_helper.rb
99
+ - spec/support/match_any_matcher.rb
90
100
  has_rdoc: