1- # encoding: UTF-8
1+ # frozen_string_literal: true
22
33desc "Load the seed data from SamfundetAuth's db/seeds.rb"
44namespace :samfundet_auth_engine do
55 namespace :db do
6- task : seed => :environment do
6+ task seed : :environment do
77 if Rake ::Task . task_defined? 'samfundet_domain_engine:db:seed'
88 Rake ::Task [ 'samfundet_domain_engine:db:seed' ] . invoke
99 else
10- raise " SamfundetAuth depends upon SamfundetDomain. Have you forgotten to include it in your Gemfile?"
10+ raise ' SamfundetAuth depends upon SamfundetDomain. Have you forgotten to include it in your Gemfile?'
1111 end
1212
13- print " Deleting existing members and roles, and proceeding with creating new ones.. "
13+ print ' Deleting existing members and roles, and proceeding with creating new ones.. '
1414
1515 tasks = [ ]
1616
1717 [ MembersRole , Member , Role ] . each do |model |
18- tasks << Proc . new do
18+ tasks << proc do
1919 model . delete_all
2020 end
2121 end
2222
2323 Group . all . each do |group |
24- tasks << Proc . new do
24+ tasks << proc do
2525 Role . find_or_create_by ( title : group . group_leader_role . to_s ) do |role |
26- role . name = " Gjensjef"
26+ role . name = ' Gjensjef'
2727 role . description = "Rolle for gjengsjef for #{ group . name } "
2828 role . group = group
2929 end
3030 end
3131
32- tasks << Proc . new do
32+ tasks << proc do
3333 Role . find_or_create_by ( title : group . short_name . parameterize ) do |role |
3434 role . name = group . name ,
35- role . description = "Rolle for alle medlemmer av #{ group . name } ."
35+ role . description = "Rolle for alle medlemmer av #{ group . name } ."
3636 role . group = group
3737 role . role = Role . find_by_title ( group . group_leader_role . to_s )
3838 end
@@ -42,72 +42,35 @@ namespace :samfundet_auth_engine do
4242 # Just to make sure the variable will exist in this scope.
4343 lim_web_role = Role . new
4444
45- tasks << Proc . new do
45+ tasks << proc do
4646 lim_web_role = Role . create! (
47- : title => " lim_web" ,
48- : name => " Superuser" ,
49- : description => " Superrolle for alle i MG::Web."
47+ title : ' lim_web' ,
48+ name : ' Superuser' ,
49+ description : ' Superrolle for alle i MG::Web.'
5050 )
5151 end
5252
5353 members = [
54- { :fornavn => "Sondre" , :etternavn => "Basma" , :mail => "[email protected] " } , 55- { :fornavn => "Andreas" , :etternavn => "Hammar" , :mail => "[email protected] " } , 56- { :fornavn => "Torstein" , :etternavn => "Nicolaysen" , :mail => "[email protected] " } , 57- { :fornavn => "Stig" , :etternavn => "Hornang" , :mail => "[email protected] " } , 58- { :fornavn => "Erik" , :etternavn => "Smistad" , :mail => "[email protected] " } , 59- { :fornavn => "Olav" , :etternavn => "Bjørkøy" , :mail => "[email protected] " } , 60- { :fornavn => "Jonas" , :etternavn => "Amundsen" , :mail => "[email protected] " } , 61- { :fornavn => "Jonas" , :etternavn => "Myrlund" , :mail => "[email protected] " } , 62- { :fornavn => "Stian" , :etternavn => "Møllersen" , :mail => "[email protected] " } , 63- { :fornavn => "Håkon" , :etternavn => "Sandsmark" , :mail => "[email protected] " } , 64- { :fornavn => "Lorents" , :etternavn => "Gravås" , :mail => "[email protected] " } , 65- { :fornavn => "Anders" , :etternavn => "Eldhuset" , :mail => "[email protected] " } , 66- { :fornavn => "Aleksander" , :etternavn => "Burkow" , :mail => "[email protected] " } , 67- { :fornavn => "Rune" , :etternavn => "Holmgren" , :mail => "[email protected] " } , 68- { :fornavn => "Morten" , :etternavn => "Lysgaard" , :mail => "[email protected] " } , 69- { :fornavn => "Dagrun" , :etternavn => "Haugland" , :mail => "[email protected] " } , 70- { :fornavn => "Christoffer" , :etternavn => "Tønnessen" , :mail => "[email protected] " } , 71- { :fornavn => "Trygve" , :etternavn => "Bærland" , :mail => "[email protected] " } , 72- { :fornavn => "Odd" , :etternavn => "Trondrud" , :mail => "[email protected] " } , 73- { :fornavn => "Asbjørn" , :etternavn => "Steinskog" , :mail => "[email protected] " } , 74- { :fornavn => "Simon" , :etternavn => "Randby" , :mail => "[email protected] " } , 75- { :fornavn => "Alf" , :etternavn => "Jonassen" , :mail => "[email protected] " } , 76- { :fornavn => "Glenn" , :etternavn => "Aarøen" , :mail => "[email protected] " } , 77- { :fornavn => "Katrine" , :etternavn => "Jordheim" , :mail => "[email protected] " } , 78- { :fornavn => "Simon" , :etternavn => "Kvannli" , :mail => "[email protected] " } , 79- { :fornavn => "Filip" , :etternavn => "Egge" , :mail => "[email protected] " } , 80- { :fornavn => "Stian" , :etternavn => "Steinbakken" , :mail => "[email protected] " } , 81- { :fornavn => "Anders" , :etternavn => "Sørby" , :mail => "[email protected] " } , 82- { :fornavn => "Erlend" , :etternavn => "Ekern" , :mail => "[email protected] " } , 83- { :fornavn => "Kim Isak" , :etternavn => "Olsen" , :mail => "[email protected] " } , 84- { :fornavn => "Konstantin" , :etternavn => "Mathisen" , :mail => "[email protected] " } , 85- { :fornavn => "Tollef" , :etternavn => "Jørgensen" , :mail => "[email protected] " } , 86- { :fornavn => "Eivind" , :etternavn => "Reime" , :mail => "[email protected] " } , 87- { :fornavn => "Petter" , :etternavn => "Foss" , :mail => "[email protected] " } , 88- { :fornavn => "Kevin" , :etternavn => "Kristiansen" , :mail => "[email protected] " } , 89- { :fornavn => "Eirik" , :etternavn => "Vale Aase" , :mail => "[email protected] " } , 90- { :fornavn => "Daria" , :etternavn => "Barjaktarevic" , :mail => "[email protected] " } 91-
54+ { fornavn :
'Alf' , etternavn :
'Jonassen' , mail :
'[email protected] ' } 9255 ]
9356
9457 members . each do |member |
95- tasks << Proc . new do
96- Member . create! member . merge ( { : passord => " passord" , : telefon => " 22222222" } )
58+ tasks << proc do
59+ Member . create! member . merge ( passord : ' passord' , telefon : ' 22222222' )
9760 end
9861 end
9962
10063 members . each do |member |
101- tasks << Proc . new do
64+ tasks << proc do
10265 Member . find_by ( mail : member [ :mail ] ) . roles << lim_web_role
10366 end
10467 end
10568
106- print " 00%"
69+ print ' 00%'
10770
10871 tasks . each_with_index do |task , index |
10972 task . call
110- print "\b \b \b %02d%%" % ( 100 * ( index . to_f + 1 ) / tasks . length . to_f )
73+ print format ( "\b \b \b %02d%%" , ( 100 * ( index . to_f + 1 ) / tasks . length . to_f ) )
11174 end
11275
11376 print "\n "
0 commit comments