battery-staple 0.0.4 → 0.1.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
  SHA1:
3
- metadata.gz: 560801b8cd89cf0cb4a1f8866325e92391389220
4
- data.tar.gz: fd30407a14c577895b0becdf0839d802072e7251
3
+ metadata.gz: b82cb83e1d033fa4410ca055ca2a38ddce796718
4
+ data.tar.gz: 20cdef0d78aec7b4a8fc4e475281e3b56f134f05
5
5
  SHA512:
6
- metadata.gz: 6068eb81d6be852022c69e8cc66f3ea2054b9fe4b0bf370a54cd0a4b0791af40f48e2075d358266c1d7b7e15810607aea75ef5e24e90e3c2c5307c68152ed647
7
- data.tar.gz: 523db2a5cdcda2ab543f3c46a4fa12cc1730d6b91cd0cff0749689950cd455e6e6ab96881ddb65374649cda71f996f62fc61c1e8ecd02a95c494f76441482b27
6
+ metadata.gz: 37b04bd379c2a8cf8fb289f8ca0a27f215ba68eeeff667f19ce0bb9ea4948d13c8076a5ba4879e8702d9b4d860f7654f6597dd87e8768f1d080033cb375c5a8b
7
+ data.tar.gz: 0f400bd0c559e99e7a07678aab32a36a98f7cf126af07c94165dff809974b4bb42186b599e12eef1d0ed4dbe3de7206426d69604d8c9b48508d94fa513c6ac57
@@ -4,11 +4,21 @@
4
4
  $: << path
5
5
  end
6
6
 
7
- require 'random_password'
7
+ require 'battery_staple'
8
8
  require 'colorize'
9
+ require 'optparse'
9
10
 
10
- num_words = ARGV[0] ? ARGV[0].to_i : 4
11
- clean = ARGV[1].to_s == '--clean'
11
+ options = { clean: false }
12
+
13
+ OptionParser.new do |opts|
14
+ opts.banner = "Usage: battery_staple --clean"
15
+
16
+ opts.on("-c", "--clean", "Filter out those dirty words...") do |clean|
17
+ options[:clean] = clean
18
+ end
19
+ end.parse!
20
+
21
+ num_words = ARGV.first ? ARGV.first.to_i : 4
12
22
 
13
23
  if num_words == 0
14
24
  puts "
@@ -16,6 +26,6 @@ if num_words == 0
16
26
  ".colorize(:red)
17
27
  else
18
28
  puts "
19
- Your new password is: \"#{RandomPassword.generate(num_words, clean).colorize(:green)}\"
29
+ Your new password is: \"#{BatteryStaple.generate(num_words, options[:clean]).colorize(:green)}\"
20
30
  "
21
31
  end
@@ -0,0 +1,9 @@
1
+ require 'random_password'
2
+ require 'dictionary_reader'
3
+
4
+ class BatteryStaple
5
+ def self.generate(num_words, clean = false)
6
+ dictionary = DictionaryReader.read(clean)
7
+ RandomPassword.new.generate(dictionary, num_words)
8
+ end
9
+ end
@@ -13,9 +13,4 @@ class RandomPassword
13
13
  "#{password} #{dictionary[key]}"
14
14
  end.strip
15
15
  end
16
-
17
- def self.generate(num_words, clean = false)
18
- dictionary = DictionaryReader.read(clean)
19
- RandomPassword.new.generate(dictionary, num_words)
20
- end
21
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battery-staple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Liddle
@@ -60,6 +60,7 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - lib/battery_staple.rb
63
64
  - lib/dictionary_reader.rb
64
65
  - lib/random_password.rb
65
66
  - lib/randomizer.rb