Sha256: e216b6fb68047ec3243a69986ff7100ab969eb4e5a3873def927d299377fe4d2

Contents?: true

Size: 1.25 KB

Versions: 15

Compression:

Stored size: 1.25 KB

Contents

# create system account if not there
system_login = Rails.configuration.marty.system_account || 'marty'
unless Marty::User.find_by_login(system_login)
  user           = Marty::User.new
  user.login     = system_login
  user.firstname = system_login
  user.lastname  = system_login
  user.active    = true
  user.save!
end

# FIXME: hacky -- globally changes whodunnit
Mcfly.whodunnit = Marty::User.find_by_login(system_login)

# Create all Marty roles from configuration
(Rails.configuration.marty.roles || []).each do |role|
  Marty::Role.create(name: role.to_s)
end

# Give system account all roles
Marty::Role.all.map { |role|
  ur = Marty::UserRole.new
  ur.user = Mcfly.whodunnit
  ur.role = role
  ur.save
}

# Create default PostingType from configuration
default_p_type =  Rails.configuration.marty.default_posting_type

Marty::PostingType.create(name: default_p_type)

# Create NOW posting
unless Marty::Posting.find_by_name('NOW')
  sn                 = Marty::Posting.new
  sn.posting_type_id = Marty::PostingType[default_p_type].id
  sn.comment         = '---'
  sn.created_dt      = 'infinity'
  sn.save!
end

# Create DEV tag
unless Marty::Tag.find_by_name('DEV')
  tag            = Marty::Tag.new
  tag.comment    = '---'
  tag.created_dt = 'infinity'
  tag.save!
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
marty-1.0.12 db/seeds.rb
marty-1.0.11 db/seeds.rb
marty-1.0.10 db/seeds.rb
marty-1.0.9 db/seeds.rb
marty-1.0.8 db/seeds.rb
marty-1.0.7 db/seeds.rb
marty-1.0.6 db/seeds.rb
marty-1.0.5 db/seeds.rb
marty-1.0.4 db/seeds.rb
marty-1.0.3 db/seeds.rb
marty-1.0.1 db/seeds.rb
marty-1.0.0 db/seeds.rb
marty-0.5.41 db/seeds.rb
marty-0.5.40 db/seeds.rb
marty-0.5.39 db/seeds.rb