sonic_pass 1.0.0 → 1.0.1
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 +4 -4
- data/.rubocop.yml +4 -7
- data/README.md +11 -6
- data/bin/sonic_pass +7 -2
- data/cli_ext/base.rb +24 -0
- data/lib/sonic_pass/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1c4a6286b2d93f78db52e719f7f28f702751c9240b30ec4a2ecad442d0d68f6
|
4
|
+
data.tar.gz: '089e15a109f23d546ed21716560df086e99af335bf3cc292ad6d6eb0e252d300'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4250bd1b0bad9e1303767162a0dcc11abd2f3ca2c8cb83840cdfae30194389ecfdc7312c5172797d698dceaeb6299df14aed2d10f79ea62c65235cbd06db9008
|
7
|
+
data.tar.gz: aff82dfb93cefa920c3b852aab3b797398e6c067e245d85d643e7af541e16d27f8368d760ebe5a52221f3d04a737c3feaac2ea43636fe87096186030826ce590
|
data/.rubocop.yml
CHANGED
@@ -8,12 +8,9 @@ inherit_gem:
|
|
8
8
|
rubocop-rake:
|
9
9
|
- config/default.yml
|
10
10
|
|
11
|
+
# Rake:
|
12
|
+
# Enabled: true
|
13
|
+
|
11
14
|
AllCops:
|
12
|
-
|
15
|
+
DisabledByDefault: true
|
13
16
|
NewCops: enable
|
14
|
-
|
15
|
-
# Style/StringLiterals:
|
16
|
-
# EnforcedStyle: double_quotes
|
17
|
-
|
18
|
-
# Style/StringLiteralsInInterpolation:
|
19
|
-
# EnforcedStyle: double_quotes
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-

|
2
|
+

|
3
|
+

|
4
|
+

|
5
|
+

|
5
6
|
|
6
7
|
Table of Contents
|
7
8
|
-----------------
|
@@ -43,8 +44,10 @@ require 'sonic_pass'
|
|
43
44
|
You can then generate a password using the `SonicPass.generate` method:
|
44
45
|
|
45
46
|
```ruby
|
46
|
-
|
47
|
+
# Default `length = 12`
|
48
|
+
password = SonicPass.generate # equals `SonicPass.generate(12)`
|
47
49
|
puts password
|
50
|
+
|
48
51
|
# cpzmh3OV\",C7
|
49
52
|
```
|
50
53
|
|
@@ -53,6 +56,7 @@ Or you can generate multiple passwords, using `count > 1` params
|
|
53
56
|
```ruby
|
54
57
|
passwords = SonicPass.generate(12, 5)
|
55
58
|
puts passwords
|
59
|
+
|
56
60
|
# ,Y36.9H-XqS;
|
57
61
|
# vRzCyIq.=$W5
|
58
62
|
# 1}-'D*'ya$Vg
|
@@ -97,7 +101,8 @@ echo $PATH
|
|
97
101
|
Finally, run CLI command:
|
98
102
|
|
99
103
|
```bash
|
100
|
-
sonic_pass
|
104
|
+
$ sonic_pass
|
105
|
+
|
101
106
|
# Password: mM>]3ERLlD5L copied to clipboard
|
102
107
|
```
|
103
108
|
|
data/bin/sonic_pass
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require_relative '../lib/sonic_pass'
|
5
|
+
require_relative '../cli_ext/base'
|
5
6
|
require 'clipboard'
|
6
7
|
|
7
8
|
length = ARGV[0] ? ARGV[0].to_i : 12
|
@@ -9,10 +10,14 @@ count = ARGV[1] ? ARGV[1].to_i : 1
|
|
9
10
|
|
10
11
|
passwords = SonicPass.generate(length, count)
|
11
12
|
|
12
|
-
# Copy the generated password to the clipboard
|
13
13
|
if count == 1
|
14
14
|
Clipboard.copy(passwords)
|
15
15
|
puts "Password: #{passwords} copied to clipboard"
|
16
16
|
else
|
17
|
-
|
17
|
+
begin
|
18
|
+
# puts "#{count} passwords generated:"
|
19
|
+
SonicPass::CLI.call(passwords)
|
20
|
+
rescue StandardError => _e
|
21
|
+
puts passwords.join("\n")
|
22
|
+
end
|
18
23
|
end
|
data/cli_ext/base.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'terminal-table'
|
2
|
+
|
3
|
+
module SonicPass
|
4
|
+
class CLI
|
5
|
+
|
6
|
+
def initialize(pwds)
|
7
|
+
@pwds = pwds
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.call(*args, &block)
|
11
|
+
new(*args, &block).print
|
12
|
+
end
|
13
|
+
|
14
|
+
def print
|
15
|
+
rows = @pwds.each_with_index.map { |value, index| [index.next, value] }
|
16
|
+
|
17
|
+
table = Terminal::Table.new :title => "Passwords generated", :rows => rows
|
18
|
+
table.align_column(1, :center)
|
19
|
+
table.align_column(2, :center)
|
20
|
+
|
21
|
+
puts table
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/sonic_pass/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonic_pass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- papakvy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: terminal-table
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
@@ -43,6 +57,7 @@ files:
|
|
43
57
|
- bin/console
|
44
58
|
- bin/setup
|
45
59
|
- bin/sonic_pass
|
60
|
+
- cli_ext/base.rb
|
46
61
|
- lib/sonic_pass.rb
|
47
62
|
- lib/sonic_pass/version.rb
|
48
63
|
- sig/sonic_pass.rbs
|
@@ -62,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
77
|
requirements:
|
63
78
|
- - ">="
|
64
79
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
80
|
+
version: 2.4.0
|
66
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
82
|
requirements:
|
68
83
|
- - ">="
|