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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2458e31ed5dacfe4ea786518af9263e3f7201e4fa3796defb99f45503f9e61b3
4
- data.tar.gz: e0d9c54cfead25c7ac837a73cdc3c134a7a1c02d996c1ce9f8096699c440cef4
3
+ metadata.gz: a1c4a6286b2d93f78db52e719f7f28f702751c9240b30ec4a2ecad442d0d68f6
4
+ data.tar.gz: '089e15a109f23d546ed21716560df086e99af335bf3cc292ad6d6eb0e252d300'
5
5
  SHA512:
6
- metadata.gz: de39af42150ca51471aaef119a60f81bd761add3ba9226bed5590605309f96fed4c32713ba09fc7fb6fcb71481b8b659db9d1f5cd3ba03ab8fc90c402ba63806
7
- data.tar.gz: 74fcf7d2699ead5d9eb03939093adae22fd4206d5463b8948ae16e7c6c9b8046a7e18bf5f01a4616a002457a3df31d219baf54d77094d30ae078e15efde7aaf4
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
- TargetRubyVersion: 3.x
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
- ![Gem](https://img.shields.io/gem/v/sonic_pass?color=%25234cc61f&label=Gem%20version&logo=ruby&logoColor=red&link=https%3A%2F%2Frubygems.org%2Fgems%2Fsonic_pass)
2
- ![Gem](https://img.shields.io/gem/dt/sonic_pass?color=%2330c754&label=Downloads&logo=rubygems&logoColor=red&link=https%3A%2F%2Frubygems.org%2Fgems%2Fsonic_pass)
3
- ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/papakvy/sonic_pass/main.yml?branch=master&logo=rubocop&logoColor=red&label=Rubocop%20Lint)
4
- ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/papakvy/sonic_pass/main.yml?branch=master&logo=rubocop&logoColor=red&label=Tests%20%F0%9F%A7%AA)
1
+ ![Ruby version](https://img.shields.io/badge/ruby-%3E%3D2.4.0-brightgreen?logo=ruby&logoColor=red)
2
+ ![RubyGem version](https://img.shields.io/gem/v/sonic_pass?color=%25234cc61f&label=Gem%20version&logo=rubygems&logoColor=red&link=https%3A%2F%2Frubygems.org%2Fgems%2Fsonic_pass)
3
+ ![RubyGem download](https://img.shields.io/gem/dt/sonic_pass?color=%2330c754&label=Downloads&logo=rubygems&logoColor=red&link=https%3A%2F%2Frubygems.org%2Fgems%2Fsonic_pass)
4
+ ![Rubocop](https://img.shields.io/github/actions/workflow/status/papakvy/sonic_pass/main.yml?branch=master&logo=rubocop&logoColor=red&label=Rubocop%20Lint)
5
+ ![Test](https://img.shields.io/github/actions/workflow/status/papakvy/sonic_pass/main.yml?branch=master&logo=rubocop&logoColor=red&label=Tests%20%F0%9F%A7%AA)
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
- password = SonicPass.generate
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
- puts passwords.join("\n")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SonicPass
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
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.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-21 00:00:00.000000000 Z
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: 3.0.0
80
+ version: 2.4.0
66
81
  required_rubygems_version: !ruby/object:Gem::Requirement
67
82
  requirements:
68
83
  - - ">="