Sha256: 792964937c09988302d316e082d4b56b44d25a45ae616b0c0dd5558cf84df57f

Contents?: true

Size: 993 Bytes

Versions: 12

Compression:

Stored size: 993 Bytes

Contents

username = 'admin'
email = 'admin@example.jp'
password = 'adminpassword'

# Don't edit!

Sunspot.session = Sunspot::Rails::StubSessionProxy.new(Sunspot.session)
#unless solr = Sunspot.commit rescue nil
#  raise "Solr is not running."
#end

#Patron.reindex
#Library.reindex
#Shelf.reindex

system_user = User.new
system_user.username = 'system'
system_user.password = SecureRandom.urlsafe_base64(32)
system_user.email = system_user.email_confirmation = LibraryGroup.first.email
system_user.save!
system_user.role = Role.where(:name => 'Administrator').first
system_user.index

user = User.new
user.username = username
user.email = email
user.email_confirmation = email
user.password = password
user.password_confirmation = password
user.library = Library.real.first
user.locale = I18n.default_locale.to_s
user.user_number = '0'
user.operator = user
user.save!
#user.confirm!
user.role = Role.where(:name => 'Administrator').first
user.index
Sunspot.commit
puts 'Administrator account created.'

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
enju_leaf-1.1.0.rc12 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc11 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc10 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc9 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc8 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc7 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc6 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc5 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc4 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc3 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc1 lib/generators/enju_leaf/setup/templates/db/seeds.rb