funny_yubikey_generator 0.3.0 → 0.4.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: ee03f537080c0eee30e79ca418b86395103442b5b7212cb862de5065fa5af037
4
- data.tar.gz: b7351abcdaef208798a496a93d9b6529010ea965f1a4f7a3ba507e72ee9421e2
3
+ metadata.gz: aa628988e7878d56e67bdb26d912dc7d21f419f9f0e75fb6ccc845a8937c1a56
4
+ data.tar.gz: 7dbeea9dc0759e3f894fa2893530cf79a041dbc29de99087b9ccbd7ddceb27bc
5
5
  SHA512:
6
- metadata.gz: cea34ab297af170a44379b8123d55def53f2bb4db9de3bd12567fecf1b6ed51c47f99eda0792d7eb6c01738ee48aa1a7d1c38b9fcb31f8e9f9d82e21099838e8
7
- data.tar.gz: f781e1fef15707693c9fb1874e125c9d322916fce9f5658be85d0e91fe62aacc774a56011306da3ff91f212be10be7ca570a1dc024de6b7ec5c80d7979326e6e
6
+ metadata.gz: f91e58a6fc9d03de37625515a93918f33e7e3fc41334f4e1dd0ac982ae2a740cbcd67bff7cb2e422fd4eb21c29c9c3217e5af19084967abda92775f6d12a040e
7
+ data.tar.gz: 1d225d62b4b474bbdaad7edff6ee078194b7ea6a72146f9bc07844666048336c0d0eef4a9d07b9ead94799da7f822babd13ce44a2cd7ab274bd8d57a4f0a7a21
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in yubikey_generator.gemspec
5
+ # Specify your gem's dependencies in funny_yubikey_generator.gemspec
6
6
  gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- funny_yubikey_generator (0.3.0)
4
+ funny_yubikey_generator (0.4.0)
5
5
  colorize (~> 0.8.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # FunnyYubikeyGenerator
2
2
 
3
- [![0.3.0](https://badge.fury.io/rb/funny_yubikey_generator.svg)](https://badge.fury.io/rb/funny_yubikey_generator)
3
+ [![Gem Version](https://badge.fury.io/rb/funny_yubikey_generator.svg)](https://badge.fury.io/rb/funny_yubikey_generator)
4
4
 
5
5
  Generate funny looking [yubikey OTP](https://developers.yubico.com/OTP/OTPs_Explained.html) containing words based on a dictionary.
6
6
 
@@ -37,7 +37,7 @@ dictionary = <<~DICO
37
37
  interbelligerent
38
38
  reinterference
39
39
  DICO
40
- generator = FunnyYubikeyGenerator.from_dictionary(dictionary.split("\n"))
40
+ generator = FunnyYubikeyGenerator.from_dictionary(dictionary)
41
41
  puts generator.generate(colorize: true)
42
42
 
43
43
  generator = FunnyYubikeyGenerator.from_dictionary(File.open("/usr/share/dict/words"))
@@ -48,7 +48,7 @@ puts generator.generate(colorize: false)
48
48
 
49
49
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
50
 
51
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the `spec.version` in [funny_yubikey_generator.gemspec](funny_yubikey_generator.gemspec), and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
52
 
53
53
  ## Contributing
54
54
 
@@ -27,7 +27,7 @@ end.parse!
27
27
 
28
28
  generator = if dictionary
29
29
  raise "Could not find file #{dictionary}" unless File.exist?(dictionary)
30
- FunnyYubikeyGenerator.new(dictionary: File.open(dictionary))
30
+ FunnyYubikeyGenerator.from_dictionary(File.open(dictionary))
31
31
  else
32
32
  FunnyYubikeyGenerator.instance
33
33
  end
@@ -1,15 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/funny_yubikey_generator"
4
-
5
3
  Gem::Specification.new do |spec|
6
4
  spec.name = "funny_yubikey_generator"
7
- spec.version = FunnyYubikeyGenerator::VERSION
5
+ spec.version = "0.4.0"
8
6
  spec.authors = ["Xavier Delamotte"]
9
7
  spec.email = ["git@xade.eu"]
10
8
 
11
- spec.summary = "Generates fun yubikeys"
12
- spec.description = "Generates fun yubikeys"
9
+ spec.summary = "Generate funny looking yubikey OTP containing words based on a dictionary."
10
+ spec.description = "Generate funny looking yubikey OTP containing words based on a dictionary."
13
11
  spec.homepage = "https://github.com/x4d3/funny_yubikey_generator"
14
12
  spec.license = "MIT"
15
13
  spec.required_ruby_version = ">= 2.6.0"
@@ -7,10 +7,9 @@ require "yaml"
7
7
 
8
8
  class FunnyYubikeyGenerator
9
9
  include Singleton
10
- VERSION = "0.3.0"
11
10
  COLORS = %i[red green yellow blue magenta cyan]
12
- LETTERS = "cbdefghijklnrtuv".chars.to_set
13
-
11
+ LETTERS = "cbdefghijklnrtuv"
12
+ WORD_REGEX = /^[#{Regexp.quote(LETTERS)}]+{4,}$/
14
13
  private_constant :COLORS
15
14
  private_constant :LETTERS
16
15
 
@@ -21,9 +20,7 @@ class FunnyYubikeyGenerator
21
20
  end
22
21
 
23
22
  def filter_and_index_words(dictionary)
24
- dictionary.map(&:strip).select { |line|
25
- line.size > 3 && line.chars.all? { |c| LETTERS.include?(c) }
26
- }.group_by(&:length)
23
+ dictionary.scan(WORD_REGEX).group_by(&:length)
27
24
  end
28
25
 
29
26
  def generate(colorize: false)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funny_yubikey_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Delamotte
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.1
27
- description: Generates fun yubikeys
27
+ description: Generate funny looking yubikey OTP containing words based on a dictionary.
28
28
  email:
29
29
  - git@xade.eu
30
30
  executables:
@@ -68,5 +68,5 @@ requirements: []
68
68
  rubygems_version: 3.3.7
69
69
  signing_key:
70
70
  specification_version: 4
71
- summary: Generates fun yubikeys
71
+ summary: Generate funny looking yubikey OTP containing words based on a dictionary.
72
72
  test_files: []