password_genie 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/password_genie.rb +13 -21
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb68e0e986cb9bfa681ae90cbc55e3d71fa4152a
4
- data.tar.gz: f066c7385d2483054da1f1e584350b16bbfea610
3
+ metadata.gz: 7375e6bf07aaf97b993d813f7c7514d91247ef9b
4
+ data.tar.gz: e56338fc10a5591589416c6935270f3f8e39dfef
5
5
  SHA512:
6
- metadata.gz: 8c0c5e39bb18c007f81de88cbb6813036600edbdd9b6596bbec538886cb25575c0463c950a470d8b7305ecb61935e9e72e33c67ce69000945c727be9aacb993e
7
- data.tar.gz: b0cb658890474c67ce474152f6320f607d048bb198d10b063a182728fd628f53d449ae7c16286483d1f39b99a8dfe2feb33c7310451c090d63879c3a308e2a51
6
+ metadata.gz: 7b6027b613c34c3d8d8b9c72e20e85ff148d0d7a80d1ae35257e83b713b02e7c31cef784d5ea1ebaf717adffc13c36217e3d80ce404ad16a04edb0eb7ec3373a
7
+ data.tar.gz: 044212e408c397fb5a6534a8635ccb988be07a67bb1dfc117302fd92a8c799f117532a5287ffa1dba6b6311b23cb6769787dc28942c020b734757e55e3faf09c
@@ -24,7 +24,7 @@ class WordBank
24
24
  end
25
25
 
26
26
  def special_chars=(special_chars)
27
- @special_chars=[".",",","$","?","!"]
27
+ @special_chars=[".",",","$"]
28
28
  end
29
29
 
30
30
  def initialize(words,number=8)
@@ -37,34 +37,29 @@ class WordBank
37
37
 
38
38
  def add_special_chars
39
39
  word_bank.concat(@special_chars)
40
- puts "word bak with special chars: #{word_bank}"
41
40
  @word_bank
42
41
  end
43
42
 
44
43
  def add_numbers
45
44
  word_bank.concat(@numbers)
46
- puts "word bank with numbers: #{word_bank}"
47
45
  @word_bank
48
46
  end
49
47
 
50
48
  def create
51
- puts "word bank: #{word_bank}"
52
49
  i = number
53
50
  while i != 0
54
- if i == 2 && word_bank.include?(@special_chars) && @password_ary.include?(@special_chars) == false
51
+ if i == 2 && (@password_ary.include?([@special_chars]) == false && word_bank.include?(@special_chars))
55
52
  @password_ary << @special_chars[rand(1..@special_chars.size)]
56
- end
57
- if i == 1 && word_bank.include?(@numbers) && password_ary.include?(@numbers) == false
53
+ elsif i == 1 && (@password_ary.include?(@numbers) == false && word_bank.include?(@numbers))
58
54
  @password_ary << @numbers[rand(1..@numbers.size)]
59
55
  end
60
- letter = rand(1..word_bank.size-1)
61
- puts word_bank.size
62
- puts "letter: #{letter}"
56
+ letter = rand(1..word_bank.size)
57
+ if letter == nil
58
+ next
59
+ end
60
+ puts "letter: #{word_bank[letter]} and num: #{letter}"
63
61
  @password_ary << word_bank[letter]
64
- puts "letter : #{word_bank[letter]}"
65
62
  word_bank.delete_at(letter)
66
- puts "i #{i}"
67
- puts "else"
68
63
  i -= 1
69
64
  end
70
65
  @password = @password_ary.join()
@@ -73,9 +68,9 @@ class WordBank
73
68
  end
74
69
 
75
70
  def save_info(site,username)
76
- myfile=File.open('site_info.txt','a+') do |data_file|
77
- puts "#{site} | [username: #{username}] password: #{@password}"
78
- data_file.write("#{site} | [username: #{username}] password: #{@password}\n")
71
+ myfile=File.open('site_info.txt','a+') do |f|
72
+ puts "[#{site}] username: #{username} | password: #{@password}"
73
+ f.puts("[#{site}] username: #{username} | password: #{@password}")
79
74
  end
80
75
  end
81
76
  end
@@ -83,7 +78,7 @@ end
83
78
  go = true
84
79
 
85
80
  while go
86
- puts "HELLO. You will now design you custom password!"
81
+ puts "HELLO. You will now design a custom password!"
87
82
  puts "How long do you want your password to be?"
88
83
 
89
84
  number = gets.chomp.to_i
@@ -92,14 +87,11 @@ while go
92
87
  else
93
88
  word_number = "characters"
94
89
  end
95
- puts "your word bank will contain #{number} #{word_number} long."
96
-
90
+ puts "your word bank will contain #{number} #{word_number}."
97
91
 
98
92
  puts "please compile your word bank:"
99
93
  words = gets.chomp
100
94
 
101
- #word_bank= words.split("")
102
- #word_bank.delete(' ')
103
95
  x = WordBank.new(words, number)
104
96
 
105
97
  puts 'do you wish to include special characters such as "." "," and "$"? [y/n]'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_genie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fookh