pwm 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +11 -0
- data/README.md +7 -0
- data/lib/pwm.rb +6 -2
- data/lib/pwm/version.rb +1 -1
- data/pwm.gemspec +1 -0
- data/spec/pwm_spec.rb +16 -0
- metadata +20 -3
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.8.7
|
4
|
+
- 1.9.2
|
5
|
+
- 1.9.3
|
6
|
+
- jruby-18mode # JRuby in 1.8 mode
|
7
|
+
- jruby-19mode # JRuby in 1.9 mode
|
8
|
+
- rbx-18mode
|
9
|
+
- rbx-19mode
|
10
|
+
# uncomment this line if your project needs to run something other than `rake`:
|
11
|
+
# script: bundle exec rspec spec
|
data/README.md
CHANGED
@@ -28,3 +28,10 @@ Mark Cornick <mark@markcornick.com>
|
|
28
28
|
|
29
29
|
To the extent possible under law, Mark Cornick has waived all copyright
|
30
30
|
and related or neighboring rights to pwm.
|
31
|
+
|
32
|
+
## Flair
|
33
|
+
|
34
|
+
[![Build Status][travis-image]][travis-link]
|
35
|
+
|
36
|
+
[travis-image]: https://secure.travis-ci.org/markcornick/pwm.png?branch=master
|
37
|
+
[travis-link]: http://travis-ci.org/markcornick/pwm
|
data/lib/pwm.rb
CHANGED
@@ -25,8 +25,12 @@ module Pwm
|
|
25
25
|
#
|
26
26
|
# Returns the generated password as a String.
|
27
27
|
def self.password(length = 16)
|
28
|
-
|
29
|
-
|
28
|
+
password = ''
|
29
|
+
until (password.match(/[A-Z]/) && password.match(/[a-z]/) && password.match(/[0-9]/))
|
30
|
+
password = (0..length - 1).inject('') do |pw, n|
|
31
|
+
pw + characters[rand(characters.length)]
|
32
|
+
end
|
30
33
|
end
|
34
|
+
password
|
31
35
|
end
|
32
36
|
end
|
data/lib/pwm/version.rb
CHANGED
data/pwm.gemspec
CHANGED
data/spec/pwm_spec.rb
CHANGED
@@ -17,6 +17,11 @@ describe Pwm do
|
|
17
17
|
Pwm.characters.should include(letter)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
it 'does not include I, O, l, 0, or 1' do
|
21
|
+
%w(I O l 0 1).each do |letter|
|
22
|
+
Pwm.characters.should_not include(letter)
|
23
|
+
end
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
context 'The password method' do
|
@@ -30,5 +35,16 @@ describe Pwm do
|
|
30
35
|
Pwm.password.length.should == 16
|
31
36
|
end
|
32
37
|
end
|
38
|
+
context 'generates passwords containing' do
|
39
|
+
it 'at least one upper-case letter' do
|
40
|
+
Pwm.password.should match(/[A-Z]/)
|
41
|
+
end
|
42
|
+
it 'at least one lower-case letter' do
|
43
|
+
Pwm.password.should match(/[a-z]/)
|
44
|
+
end
|
45
|
+
it 'at least one number' do
|
46
|
+
Pwm.password.should match(/[2-9]/)
|
47
|
+
end
|
48
|
+
end
|
33
49
|
end
|
34
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: rspec
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -37,6 +53,7 @@ extra_rdoc_files: []
|
|
37
53
|
files:
|
38
54
|
- .gemtest
|
39
55
|
- .gitignore
|
56
|
+
- .travis.yml
|
40
57
|
- Gemfile
|
41
58
|
- README.md
|
42
59
|
- Rakefile
|
@@ -65,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
82
|
version: '0'
|
66
83
|
requirements: []
|
67
84
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.8.
|
85
|
+
rubygems_version: 1.8.23
|
69
86
|
signing_key:
|
70
87
|
specification_version: 3
|
71
88
|
summary: A reasonably secure password maker
|