pwqgen.rb 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b0a254ec0160ba29091440eec20fd70719e680b
4
- data.tar.gz: 1661919c80df689c703aa295e2f3e95a0be4e710
3
+ metadata.gz: d175c0aa4bddf1e3fab53fac8f870586063c7b5a
4
+ data.tar.gz: bbdfe9d63c4dba8103a82a36627c8306a34f0510
5
5
  SHA512:
6
- metadata.gz: b114a98c51e746d1e5cf1aeaeddf8d91ea59c7ef69a06ecc6fce2215ab4f98cde6b42012e02055863f906e2119ef5d477b9ea99f7ca8665c57104605767ffbd0
7
- data.tar.gz: 4bd94f6a9fb2e84cc24e6326ef5ece91d20a36a598ac0f01336bd3df26f6c3dddae109976f39bc933c87ef3854a7c7090510c44ca5c1b3f3304298bf59877bfb
6
+ metadata.gz: b6752ea31a2b4b38eb645dc72cc80a67df6d8e6fbb62b2a8408db1359c817b1ead793ef7c4281849999320f11040b99a4190f62f0f17763267ba581be44127f7
7
+ data.tar.gz: e79b9d9b5da4f81585c5b9ee65aec19886c7ff1ae945e954c68ccc7d39afc46c4a5b97a2c89c975b3545264777868318f64106f86f18295ec22e6cde76c47d01
@@ -10,26 +10,45 @@ doc = <<DOCOPT
10
10
  Generate a random pronouncable passphrase.
11
11
 
12
12
  Usage:
13
- #{filename} [LENGTH]
13
+ #{filename} [options] [LENGTH]
14
14
  #{filename} [-h | --help]
15
15
  #{filename} [-v | --version]
16
16
 
17
17
  Arguments:
18
- LENGTH Number of words in the passphrase. [default: 3]
18
+ LENGTH Number of words in the passphrase [default: 3].
19
+ COLS Number of columns to output.
19
20
 
20
21
  Options:
21
- -h, --help show this help message and exit
22
- -v, --version show version and exit
22
+ -C COLS, --columns COLS output passphrases in multiple columns
23
+ -h, --help show this help message and exit
24
+ -v, --version show version and exit
23
25
 
24
26
  DOCOPT
25
27
 
26
28
  begin
27
29
  options = Docopt::docopt(doc, :version => Pwqgen::VERSION)
28
-
29
- if ARGV.length > 0 && ARGV[0].to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) then
30
- puts Pwqgen.generate(ARGV[0].to_i)
30
+ p options
31
+
32
+ if !options["LENGTH"].nil? && options["LENGTH"].to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/)
33
+ opts = options["LENGTH"].to_i
34
+ end
35
+ if options["--columns"].nil?
36
+ if opts
37
+ puts Pwqgen.generate(opts)
38
+ else
39
+ puts Pwqgen.generate
40
+ end
31
41
  else
32
- puts Pwqgen.generate
42
+ for i in 1..(options["--columns"][0].to_i)
43
+ for j in 1..(options["--columns"][0].to_i)
44
+ if opts
45
+ print Pwqgen.generate(opts) + "\t"
46
+ else
47
+ print Pwqgen.generate + "\t"
48
+ end
49
+ end
50
+ puts ""
51
+ end
33
52
  end
34
53
  rescue Docopt::Exit => e
35
54
  puts e.message
@@ -1,5 +1,5 @@
1
1
  require 'pwqgen/wordlist'
2
- require 'securerandom'
2
+ require 'sysrandom/securerandom'
3
3
 
4
4
  # Public: Pwqgen is a Ruby implementation of passwdqc's pwqgen password
5
5
  # generator.
@@ -42,9 +42,10 @@ module Pwqgen
42
42
  end
43
43
 
44
44
  class Generator
45
- def initialize
45
+ def initialize(opts = {})
46
+ opts[:separators] ||= "-_!$&*+=23456789"
46
47
  @@wordlist_size = @@wordlist.length
47
- @@separators = "-_!$&*+=23456789".split(//)
48
+ @@separators = opts[:separators].split(//)
48
49
  @@separators_size = @@separators.length
49
50
  @rand = SecureRandom
50
51
  end
@@ -1,3 +1,3 @@
1
1
  module Pwqgen
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -18,7 +18,8 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.required_ruby_version = '>= 1.8.7'
20
20
  s.required_rubygems_version = ">= 1.3.6"
21
- s.add_runtime_dependency('docopt', "~> 0.5.0")
21
+ s.add_runtime_dependency('docopt', "~> 0.5")
22
+ s.add_runtime_dependency('sysrandom')
22
23
 
23
24
  s.add_development_dependency 'rake'
24
25
  s.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,69 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwqgen.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronald Ip
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-01 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.0
26
+ version: '0.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sysrandom
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '>='
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '>='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '>='
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: aruba
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  description: pwqgen.rb is a Ruby implementation of passwdqc's pwqgen, a random pronouncable
@@ -74,8 +88,8 @@ executables:
74
88
  extensions: []
75
89
  extra_rdoc_files: []
76
90
  files:
77
- - .gitignore
78
- - .travis.yml
91
+ - ".gitignore"
92
+ - ".travis.yml"
79
93
  - ChangeLog
80
94
  - Gemfile
81
95
  - README.md
@@ -139,17 +153,17 @@ require_paths:
139
153
  - lib
140
154
  required_ruby_version: !ruby/object:Gem::Requirement
141
155
  requirements:
142
- - - '>='
156
+ - - ">="
143
157
  - !ruby/object:Gem::Version
144
158
  version: 1.8.7
145
159
  required_rubygems_version: !ruby/object:Gem::Requirement
146
160
  requirements:
147
- - - '>='
161
+ - - ">="
148
162
  - !ruby/object:Gem::Version
149
163
  version: 1.3.6
150
164
  requirements: []
151
165
  rubyforge_project:
152
- rubygems_version: 2.0.3
166
+ rubygems_version: 2.5.1
153
167
  signing_key:
154
168
  specification_version: 4
155
169
  summary: pwqgen in Ruby