passfaker 0.1.0 → 0.2.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: d5dbc2744afd963a430ce445023b62de8c11379a057cd5c10ab3fdbdeb590c0f
4
- data.tar.gz: 9cbcb3be0a595de96b62fa34ceeaddcf7d75c184e3634097b6877dce442e8453
3
+ metadata.gz: 7b97e5098b35a8aa838f12cf1826da241fdc6881cd08182c0321d8545074c043
4
+ data.tar.gz: 53c9a13533d00d65e9b09f0f418854b1d1e539aedca4bba89ade5d7d36071cd7
5
5
  SHA512:
6
- metadata.gz: 3d777cd905392215be6eee774e8a68cfe000f013c7725f227a6d7f9f270446a4c70f3d201b3300a6d4e310be1d8df4cd8fa314aa349862bd89834bc40983d8a2
7
- data.tar.gz: 8a5026f1b03beb90e46ce5889fdf88e07aa7382d78330292c69118d26b1f89eb3f0e469f50eb37d4b8c0527d951ffa691dd677fa275b1448327df24fea304f9a
6
+ metadata.gz: c50aa68aaba906a9472be3633e007028aca1ad5b0321a382178f86d8503a234f10c65c3cd39a61053ab210daf1b8ffb6eddaf880612982024dbae2b10c8794d2
7
+ data.tar.gz: b46fc885a9329573e98cc09597d12f27d20a5da97631b6307dd5980e6c5b94666560b7a3ccc8b80a03e0eac262e0b52b7acb5a7da38afcc550415fb8edbd379d
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Ruby](https://github.com/jacoyutorius/passfaker/actions/workflows/main.yml/badge.svg)](https://github.com/jacoyutorius/passfaker/actions/workflows/main.yml)
2
+
1
3
  # Passfaker
2
4
 
3
5
  ## 使い方
@@ -12,17 +12,30 @@ module Passfaker
12
12
  -> { Faker::Creature::Animal.name },
13
13
  -> { Faker::Food.ingredient },
14
14
  -> { Faker::Games::Pokemon.name },
15
- -> { Faker::Music.instrument }
15
+ -> { Faker::Music.instrument },
16
+ -> { Faker::Superhero.name },
17
+ -> { Faker::Music.genre }
16
18
  ].freeze
17
19
 
18
20
  def self.generate(word_count:, separator:, include_number:)
19
21
  words = word_count.times.map do
20
22
  generator = CATEGORIES[SecureRandom.random_number(CATEGORIES.size)]
21
- generator.call.downcase.gsub(/\s+/, "-")
23
+ word = generator.call.downcase.gsub(/\s+/, "")
24
+ random_char_upcase(word)
22
25
  end
23
26
 
24
27
  words << ::SecureRandom.random_number(100).to_s if include_number
25
- words.join(separator)
28
+ words.shuffle.join(separator)
29
+ end
30
+
31
+ # ランダムな文字を大文字に変換する
32
+ def self.random_char_upcase(word)
33
+ return word if word.empty?
34
+
35
+ chars = word.chars
36
+ index = SecureRandom.random_number(chars.size)
37
+ chars[index] = chars[index].upcase
38
+ chars.join
26
39
  end
27
40
  end
28
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Passfaker
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/passfaker.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["jacoyutorius@gmail.com"]
10
10
 
11
11
  spec.summary = "複数の単語を組み合わせたパスフレーズを生成するRubyGem。"
12
- spec.description = "Passfakerは、Fakerを使用して複数の単語を組み合わせたパスフレーズを生成するRubyGemです。パスワードの強度を向上させるために、ランダムな単語とオプションで数字を含めることができます。"
12
+ spec.description = "Passfakerは、Fakerを使用して複数の単語を組み合わせたパスフレーズを生成するRubyGemです。パスワードの強度を向上させるために、ランダムな単語とオプションで数字を含めることができます。" # rubocop:disable Layout/LineLength
13
13
  spec.homepage = "https://github.com/jacoyutorius/passfaker"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 3.1.0"
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- gemspec = File.basename(__FILE__)
25
+ File.basename(__FILE__)
26
26
  spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
27
27
  ls.readlines("\x0", chomp: true).reject do |f|
28
28
  # (f == gemspec) ||
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passfaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jacoyutorius
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-06-16 00:00:00.000000000 Z
10
+ date: 2025-06-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faker