orpg 1.1.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.
- checksums.yaml +7 -0
- data/bin/orpg +38 -0
- data/lib/orpg.rb +33 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4b19956c8ce1feb39f0c61017053b2c28286a098
|
4
|
+
data.tar.gz: cfbcd625a408118cf304e21e8cb115c1aa114a80
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 23dd68cf851f103cebec8cb3e7c796ba08d5b2228b7cc46837fc0622a003ad9086fe3295316fea9a6a72d28d0c8818163bbfee1c92f5d2d1b80cb2a5e9fc0f26
|
7
|
+
data.tar.gz: e2aec5bef3d2a2ecd17288113dc8725cd02ad9c82f54106121a74e9642a44f69aad54bdd2c19ad368524f29592c9cd925f201fb04f957f6ddd38f44836b786f7
|
data/bin/orpg
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'orpg'
|
3
|
+
require 'optionparser'
|
4
|
+
|
5
|
+
puts "Usage:\n\torpg --length length [-n,--number] [-l,--lowercase] [-u,--uppercase-] [-s,--special]" if ARGV.length == 0
|
6
|
+
|
7
|
+
length = 0
|
8
|
+
options =
|
9
|
+
{
|
10
|
+
number: false, lowercase: false, uppercase: false, special: false
|
11
|
+
}
|
12
|
+
|
13
|
+
parser =
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.on('--length length') do |_length|
|
16
|
+
length = Integer _length rescue abort 'Please input a number !'
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on('-n', '--number') do
|
20
|
+
options[:number] = true
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on('-l', '--lowercase') do
|
24
|
+
options[:lowercase] = true
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on('-u', '--uppercase') do
|
28
|
+
options[:uppercase] = true
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on('-s', '--special') do
|
32
|
+
options[:special] = true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
parser.parse!
|
37
|
+
|
38
|
+
puts ORPG::ORPG.generate(length, options)
|
data/lib/orpg.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module ORPG
|
2
|
+
|
3
|
+
class ORPG
|
4
|
+
|
5
|
+
## Array used for generation
|
6
|
+
@@number = ('0' .. '9').to_a
|
7
|
+
@@lowercase = ('a' .. 'z').to_a
|
8
|
+
@@uppercase = ('A' .. 'Z').to_a
|
9
|
+
@@special = '"^$£øµ*:;./§!-+#~&²`\\_-@])[(=<>'.split(//)
|
10
|
+
|
11
|
+
## Return number randomised if no options passed
|
12
|
+
def self.generate(length, options = {})
|
13
|
+
options =
|
14
|
+
{
|
15
|
+
number: false,
|
16
|
+
lowercase: false,
|
17
|
+
uppercase: false,
|
18
|
+
special: false
|
19
|
+
}.merge(options)
|
20
|
+
|
21
|
+
g = Array.new
|
22
|
+
|
23
|
+
(length * 4).times { g << @@number.sample && g.shuffle! } if options[:number]
|
24
|
+
(length * 4).times { g << @@lowercase.sample && g.shuffle! } if options[:lowercase]
|
25
|
+
(length * 4).times { g << @@uppercase.sample && g.shuffle! } if options[:uppercase]
|
26
|
+
(length * 4).times { g << @@special.sample && g.shuffle! } if options[:special]
|
27
|
+
|
28
|
+
g.shuffle![0 ... length].join
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orpg
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ogromny
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Ogromny Random Password Manager
|
14
|
+
email: ogromny@openmailbox.org
|
15
|
+
executables:
|
16
|
+
- orpg
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/orpg
|
21
|
+
- lib/orpg.rb
|
22
|
+
homepage: https://github.com/Ogromny/RPG/
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.5.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: orpg
|
46
|
+
test_files: []
|
47
|
+
has_rdoc:
|