Sha256: a3c50f77b23dacffe352946db9ae99742328812ff650dc29521e31d8080776f4

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

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

# Don't edit the following lines!

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

def new_profile
  profile = Profile.new
  profile.user_group = UserGroup.first
  profile.library = Library.real.first
  profile.locale = I18n.default_locale.to_s
  profile
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 = 'root@library.example.jp'
system_user.role = Role.find_by(name: 'Administrator')
profile = new_profile
profile.save!
system_user.profile = profile
system_user.save!
LibraryGroup.first.update!(user: system_user)

user = User.new
user.username = username
user.email = email
user.password = password
user.password_confirmation = password
#user.confirm!
user.role = Role.find_by(name: 'Administrator')
profile = new_profile
profile.user_number = '0'
profile.save!
user.profile = profile
user.save!
puts 'Administrator account created.'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enju_leaf-1.3.4.rc.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-2.0.0.beta.2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-2.0.0.beta.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.3.3.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.3.3 lib/generators/enju_leaf/setup/templates/db/seeds.rb