Sha256: bc0609ad545e6ca6a7e523113ea562f31064f32d0cef8c204e5e09a98384809e

Contents?: true

Size: 1.16 KB

Versions: 21

Compression:

Stored size: 1.16 KB

Contents

if Rails::VERSION::MAJOR >= 4
  username = 'enjuadmin'
else
  username = 'admin'
end
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.where(name: 'Administrator').first
system_user.save!
system_profile = new_profile
system_profile.user = system_user
system_profile.save!

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
enju_leaf-1.3.2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.3.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.3.0 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.3.0.rc.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.3.0.beta.2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.0 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.0.beta.4 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.0.beta.3 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.0.beta.2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.2.0.beta.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.4 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.3 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.2 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.1 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc22 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc21 lib/generators/enju_leaf/setup/templates/db/seeds.rb
enju_leaf-1.1.0.rc20 lib/generators/enju_leaf/setup/templates/db/seeds.rb