Sha256: 080093dc5699168eee10e3ad8a86f1dcd615f13c0c37189fe8f5f26fd1f25b53

Contents?: true

Size: 1.31 KB

Versions: 40

Compression:

Stored size: 1.31 KB

Contents

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
[
  Releaf::Permissions::User,
  Releaf::Permissions::Role,
  Releaf::Permissions::Permission,
  Releaf::I18nDatabase::I18nEntry,
  Releaf::I18nDatabase::I18nEntryTranslation
].each do |descendant|
  descendant.unscoped.delete_all
end

# Role {{{

puts "Creating roles"
role = Releaf::Permissions::Role.new(name: "super admin", default_controller: "releaf/permissions/users")
Releaf.application.config.available_controllers.each do|controller|
  role.permissions.build(permission: "controller.#{controller}")
end

role.save!

# }}}
# User {{{

puts "Creating users"
Releaf::Permissions::User.create!(
  name: 'Admin',
  surname: 'User',
  password: 'password',
  password_confirmation: 'password',
  locale: "en",
  email: 'admin@example.com',
  role: role,
)



# }}}
# Translations {{{

puts "Importing translations"
import_file_path = File.join(Gem.loaded_specs["releaf-i18n_database"].full_gem_path, "misc", "translations.xlsx")
translations = Releaf::I18nDatabase::ParseSpreadsheetTranslations.call(file_path: import_file_path, extension: "xlsx")
translations.each{|translation| translation.save! }

# }}}

# vim: set fdm=marker:

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
releaf-core-1.1.14 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.13 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.12 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.11 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.10 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.9 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.8 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.7 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.6 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.5 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.4 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.3 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.2 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.1 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.1.0 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.0.10 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.0.9 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.0.8 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.0.7 lib/generators/releaf/templates/seeds/seeds.rb
releaf-core-1.0.6 lib/generators/releaf/templates/seeds/seeds.rb