battery-staple 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/battery_staple +2 -1
- data/lib/dictionary.txt +14 -14
- data/lib/dictionary_reader.rb +22 -7
- data/lib/random_password.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 560801b8cd89cf0cb4a1f8866325e92391389220
|
4
|
+
data.tar.gz: fd30407a14c577895b0becdf0839d802072e7251
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6068eb81d6be852022c69e8cc66f3ea2054b9fe4b0bf370a54cd0a4b0791af40f48e2075d358266c1d7b7e15810607aea75ef5e24e90e3c2c5307c68152ed647
|
7
|
+
data.tar.gz: 523db2a5cdcda2ab543f3c46a4fa12cc1730d6b91cd0cff0749689950cd455e6e6ab96881ddb65374649cda71f996f62fc61c1e8ecd02a95c494f76441482b27
|
data/bin/battery_staple
CHANGED
@@ -8,6 +8,7 @@ require 'random_password'
|
|
8
8
|
require 'colorize'
|
9
9
|
|
10
10
|
num_words = ARGV[0] ? ARGV[0].to_i : 4
|
11
|
+
clean = ARGV[1].to_s == '--clean'
|
11
12
|
|
12
13
|
if num_words == 0
|
13
14
|
puts "
|
@@ -15,6 +16,6 @@ if num_words == 0
|
|
15
16
|
".colorize(:red)
|
16
17
|
else
|
17
18
|
puts "
|
18
|
-
Your new password is: \"#{RandomPassword.generate(num_words).colorize(:green)}\"
|
19
|
+
Your new password is: \"#{RandomPassword.generate(num_words, clean).colorize(:green)}\"
|
19
20
|
"
|
20
21
|
end
|
data/lib/dictionary.txt
CHANGED
@@ -12241,7 +12241,7 @@ assizement
|
|
12241
12241
|
assizer
|
12242
12242
|
assizes
|
12243
12243
|
asslike
|
12244
|
-
assman
|
12244
|
+
assman:profane
|
12245
12245
|
assmanship
|
12246
12246
|
associability
|
12247
12247
|
associable
|
@@ -19536,7 +19536,7 @@ bitangential
|
|
19536
19536
|
bitanhol
|
19537
19537
|
bitartrate
|
19538
19538
|
bitbrace
|
19539
|
-
bitch
|
19539
|
+
bitch:profane
|
19540
19540
|
bite
|
19541
19541
|
bitemporal
|
19542
19542
|
bitentaculate
|
@@ -38787,7 +38787,7 @@ cranny
|
|
38787
38787
|
cranreuch
|
38788
38788
|
crantara
|
38789
38789
|
crants
|
38790
|
-
crap
|
38790
|
+
crap:profane
|
38791
38791
|
crapaud
|
38792
38792
|
crapaudine
|
38793
38793
|
crape
|
@@ -41661,17 +41661,17 @@ dammar
|
|
41661
41661
|
damme
|
41662
41662
|
dammer
|
41663
41663
|
dammish
|
41664
|
-
damn
|
41665
|
-
damnability
|
41666
|
-
damnable
|
41667
|
-
damnableness
|
41668
|
-
damnably
|
41669
|
-
damnation
|
41670
|
-
damnatory
|
41671
|
-
damned
|
41672
|
-
damner
|
41673
|
-
damnification
|
41674
|
-
damnify
|
41664
|
+
damn:profane
|
41665
|
+
damnability:profane
|
41666
|
+
damnable:profane
|
41667
|
+
damnableness:profane
|
41668
|
+
damnably:profane
|
41669
|
+
damnation:profane
|
41670
|
+
damnatory:profane
|
41671
|
+
damned:profane
|
41672
|
+
damner:profane
|
41673
|
+
damnification:profane
|
41674
|
+
damnify:profane
|
41675
41675
|
damning
|
41676
41676
|
damningly
|
41677
41677
|
damningness
|
data/lib/dictionary_reader.rb
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
class DictionaryReader
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
class << self
|
3
|
+
|
4
|
+
def read(clean = false)
|
5
|
+
lines = File.readlines("#{File.dirname(__FILE__)}/dictionary.txt").reject do |line|
|
6
|
+
word = get_word(line, clean)
|
7
|
+
word.size < 4 || uppercase?(word) || profane?(line, clean)
|
8
|
+
end
|
9
|
+
lines.map { |line| get_word(line, clean) }
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def profane?(line, clean)
|
15
|
+
line.strip.end_with?(":profane") && clean
|
16
|
+
end
|
17
|
+
|
18
|
+
def uppercase?(word)
|
19
|
+
word[0].downcase != word[0]
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_word(line, clean)
|
23
|
+
line.strip.gsub(/:profane/, '')
|
5
24
|
end
|
6
|
-
words.map { |word| word.strip }
|
7
|
-
end
|
8
25
|
|
9
|
-
def self.uppercase?(word)
|
10
|
-
word[0].downcase != word[0]
|
11
26
|
end
|
12
27
|
end
|
data/lib/random_password.rb
CHANGED
@@ -14,8 +14,8 @@ class RandomPassword
|
|
14
14
|
end.strip
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.generate(num_words)
|
18
|
-
dictionary = DictionaryReader.read
|
17
|
+
def self.generate(num_words, clean = false)
|
18
|
+
dictionary = DictionaryReader.read(clean)
|
19
19
|
RandomPassword.new.generate(dictionary, num_words)
|
20
20
|
end
|
21
21
|
end
|