Created
December 7, 2015 17:14
-
-
Save xkrsz/a6e2be2b6f7513185b97 to your computer and use it in GitHub Desktop.
Generator userów do rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
puts "Elo, chcesz zrobic [u]czniow czy [a]dministratorow?" | |
type = gets.chomp | |
case type | |
when "u" | |
puts "Ok, ilu uczniow chcesz zrobic?" | |
number = gets.chomp.to_i | |
file = File.open("uczniowie.qtaz", 'w') | |
for i in 1..number | |
file.write("user = User.create! :email => 'uczen#{i}@test.pl', :password => 'password#{i}', :password_confirmation => 'password#{i}'\n") | |
end | |
when "n" | |
puts "Ok, ilu nauczycieli chcesz zrobic?" | |
number = gets.chomp.to_i | |
file = File.open("nauczyciele.qtaz", 'w') | |
for i in 1..number | |
file.write("user = Admin.create! :email => 'nauczyciel#{i}@test.pl', :password => 'password#{i}', :password_confirmation => 'password#{i}'\n") | |
end | |
else | |
puts "wpisz u albo n" | |
end | |
puts "Plik zostal stworzony w aktualnej lokalizacji" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment