sonic_pass 0.2.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03e4a2e45c294c05b0f9a731d4b1ea486a682b48ccf88bee3704bd173852980c
4
- data.tar.gz: a584318ca8872d323452cdb483951aa6476fb29b9ddfd15290855fe69ea2763d
3
+ metadata.gz: 2458e31ed5dacfe4ea786518af9263e3f7201e4fa3796defb99f45503f9e61b3
4
+ data.tar.gz: e0d9c54cfead25c7ac837a73cdc3c134a7a1c02d996c1ce9f8096699c440cef4
5
5
  SHA512:
6
- metadata.gz: 4dacbdd5965f0ff8c1058910094392eb38a021c8d52b8da3aed02f24fba1c149628c70314650f31d762e20587df71373a80ce65f3b12751499b8b3d74c8fd2ee
7
- data.tar.gz: 399abfa3c530b420ad42823c6a7ac5a3460c371fe147a441062465333b9816e9013ef294671efa899b52a65fb5f537f46d5a7c9fb05ec9fccc1929a5f68c4927
6
+ metadata.gz: de39af42150ca51471aaef119a60f81bd761add3ba9226bed5590605309f96fed4c32713ba09fc7fb6fcb71481b8b659db9d1f5cd3ba03ab8fc90c402ba63806
7
+ data.tar.gz: 74fcf7d2699ead5d9eb03939093adae22fd4206d5463b8948ae16e7c6c9b8046a7e18bf5f01a4616a002457a3df31d219baf54d77094d30ae078e15efde7aaf4
data/README.md CHANGED
@@ -1,11 +1,14 @@
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)
5
+
1
6
  Table of Contents
2
7
  -----------------
3
8
 
4
9
  * [Overview](#overview)
5
10
  * [Installation](#installation)
6
11
  * [Usage](#usage)
7
- * [Configuration](#configuration)
8
- * [Methods](#methods)
9
12
  * [Contributing](#contributing)
10
13
  * [License](#license)
11
14
 
@@ -40,31 +43,63 @@ require 'sonic_pass'
40
43
  You can then generate a password using the `SonicPass.generate` method:
41
44
 
42
45
  ```ruby
43
- password = SonicPass.generate(length: 12)
46
+ password = SonicPass.generate
44
47
  puts password
48
+ # cpzmh3OV\",C7
45
49
  ```
46
50
 
47
- This will output a strong password of the specified length.
51
+ Or you can generate multiple passwords, using `count > 1` params
48
52
 
49
- ### Configuration
53
+ ```ruby
54
+ passwords = SonicPass.generate(12, 5)
55
+ puts passwords
56
+ # ,Y36.9H-XqS;
57
+ # vRzCyIq.=$W5
58
+ # 1}-'D*'ya$Vg
59
+ # %66db&y$rjhU
60
+ # x';2I7y$<&5f
61
+ ```
50
62
 
51
- The Sonic Pass gem can be configured to use different character sets for password generation. The available character sets are:
63
+ ### How to use CLI command `sonic_pass`
52
64
 
53
- * `ALPHANUMERIC_CHARSETS`: A combination of uppercase letters, lowercase letters, and digits.
54
- * `SPECIAL_CHARSETS`: A set of special characters.
65
+ - Put executable path into `PATH` directly
55
66
 
56
- You can specify the character set to use when generating a password:
67
+ ```bash
68
+ gem_bin_path=$(gem env | grep "EXECUTABLE DIRECTORY" | awk -F ': ' '{print $2}')
69
+ export PATH="$PATH:$gem_bin_path"
70
+ ```
57
71
 
58
- ```ruby
59
- password = SonicPass.generate(length: 12, charset: SonicPass::ALPHANUMERIC_CHARSETS)
60
- puts password
72
+ - Put executable path into `PATH` in the appropriate configuration file
73
+
74
+ Assume executable path is: `/home/user/.asdf/installs/ruby/3.0.0/bin`
75
+
76
+ For bash (usually ~/.bashrc or ~/.bash_profile):
77
+
78
+ ```bash
79
+ echo 'export PATH="$PATH:/home/user/.asdf/installs/ruby/3.0.0/bin"' >> ~/.bashrc
80
+ source ~/.bashrc
61
81
  ```
62
82
 
63
- ### Methods
64
83
 
65
- The Sonic Pass gem provides the following methods:
84
+ For zsh (usually ~/.zshrc):
66
85
 
67
- * `SonicPass.generate(length: 12, charset: SonicPass::ALPHANUMERIC_CHARSETS)`: Generates a strong password of the specified length using the specified character set.
86
+ ```bash
87
+ echo 'export PATH="$PATH:/home/user/.asdf/installs/ruby/3.0.0/bin"' >> ~/.zshrc
88
+ source ~/.zshrc
89
+ ```
90
+
91
+ Verify the change: After updating your configuration file, you can check if the new path has been added by running:
92
+
93
+ ```bash
94
+ echo $PATH
95
+ ```
96
+
97
+ Finally, run CLI command:
98
+
99
+ ```bash
100
+ sonic_pass
101
+ # Password: mM>]3ERLlD5L copied to clipboard
102
+ ```
68
103
 
69
104
  ### Contributing
70
105
 
@@ -72,4 +107,4 @@ Contributions to the Sonic Pass gem are welcome. To contribute, please fork the
72
107
 
73
108
  ### License
74
109
 
75
- The Sonic Pass gem is released under the MIT License. See the LICENSE file for details.
110
+ The Sonic Pass gem is released under the MIT License. See the LICENSE file for details.
data/bin/sonic_pass CHANGED
@@ -11,8 +11,8 @@ passwords = SonicPass.generate(length, count)
11
11
 
12
12
  # Copy the generated password to the clipboard
13
13
  if count == 1
14
- Clipboard.copy(passwords[0])
15
- puts "Password: #{passwords[0]} copied to clipboard"
14
+ Clipboard.copy(passwords)
15
+ puts "Password: #{passwords} copied to clipboard"
16
16
  else
17
17
  puts passwords.join("\n")
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SonicPass
4
- VERSION = '0.2.1'
4
+ VERSION = '1.0.0'
5
5
  end
data/lib/sonic_pass.rb CHANGED
@@ -20,6 +20,8 @@ module SonicPass
20
20
  # @param count [Integer] The number of passwords to generate. Defaults to 1.
21
21
  # @return [Array<String>] An array of strong passwords of the specified length.
22
22
  def self.generate(length = 12, count = 1)
23
- Array.new(count) { (Array.new(length) { CHARSETS.sample }).join }
23
+ passwords = Array.new(count) { (Array.new(length) { CHARSETS.sample }).join }
24
+
25
+ count == 1 ? passwords[0] : passwords
24
26
  end
25
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonic_pass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.0.0
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-20 00:00:00.000000000 Z
11
+ date: 2024-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard