pwm 1.0.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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +6 -0
- data/bin/pwm +4 -0
- data/lib/pwm/version.rb +3 -0
- data/lib/pwm.rb +13 -0
- data/pwm.gemspec +24 -0
- data/spec/pwm_spec.rb +34 -0
- metadata +66 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/pwm
ADDED
data/lib/pwm/version.rb
ADDED
data/lib/pwm.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "pwm/version"
|
2
|
+
|
3
|
+
module Pwm
|
4
|
+
def self.characters
|
5
|
+
[('A'..'Z'),('a'..'z'),('2'..'9')].collect{|r| r.collect{|c| c}}.flatten
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.password(length=16)
|
9
|
+
(0..length-1).inject('') do |pw, n|
|
10
|
+
pw + characters[rand(characters.length)]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/pwm.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "pwm/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "pwm"
|
7
|
+
s.version = Pwm::VERSION
|
8
|
+
s.authors = ["Mark Cornick"]
|
9
|
+
s.email = ["mark@markcornick.com"]
|
10
|
+
s.homepage = "https://github.com/markcornick/pwm"
|
11
|
+
s.summary = %q{A reasonably secure password maker}
|
12
|
+
s.description = %q{A tiny class and command-line tool to generate reasonably secure passwords.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "pwm"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
data/spec/pwm_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'pwm'
|
2
|
+
|
3
|
+
describe Pwm do
|
4
|
+
context 'The default set of characters' do
|
5
|
+
it 'should include all upper-case letters' do
|
6
|
+
('A'..'Z').each do |letter|
|
7
|
+
Pwm.characters.should include(letter)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
it 'should include all lower-case letters' do
|
11
|
+
('a'..'z').each do |letter|
|
12
|
+
Pwm.characters.should include(letter)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
it 'should include all digits 2 through 9' do
|
16
|
+
('2'..'9').each do |letter|
|
17
|
+
Pwm.characters.should include(letter)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'The password method' do
|
23
|
+
context 'when given a length' do
|
24
|
+
it 'should generate a password of that length' do
|
25
|
+
Pwm.password(8).length.should == 8
|
26
|
+
end
|
27
|
+
end
|
28
|
+
context 'when not given a length' do
|
29
|
+
it 'should generate a 16-character password' do
|
30
|
+
Pwm.password.length.should == 16
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pwm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mark Cornick
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &70348764844280 !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: *70348764844280
|
25
|
+
description: A tiny class and command-line tool to generate reasonably secure passwords.
|
26
|
+
email:
|
27
|
+
- mark@markcornick.com
|
28
|
+
executables:
|
29
|
+
- pwm
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- Rakefile
|
36
|
+
- bin/pwm
|
37
|
+
- lib/pwm.rb
|
38
|
+
- lib/pwm/version.rb
|
39
|
+
- pwm.gemspec
|
40
|
+
- spec/pwm_spec.rb
|
41
|
+
homepage: https://github.com/markcornick/pwm
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project: pwm
|
61
|
+
rubygems_version: 1.8.10
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: A reasonably secure password maker
|
65
|
+
test_files:
|
66
|
+
- spec/pwm_spec.rb
|