Sha256: 22c2ba4fdd6f7f46232bc68a4296f4a8aa467be2d212445c5964d37d7ba9fc77

Contents?: true

Size: 1.96 KB

Versions: 21

Compression:

Stored size: 1.96 KB

Contents

# # HACK - need to add all sample users to the 'user' role (can't do this in sample fixtures because user role is seed data)
# user_role = Spree::Role.find_by_name "user"
# if user_role
#   User.all.each { |u| u.roles << user_role unless u.has_role?("user") }
# end
#
# # see last line where we create an admin if there is none, asking for email and password
#
# def prompt_for_admin_password
#   password = ask('Password [spree]: ', String) do |q|
#     q.echo = false
#     q.validate = /^(|.{5,40})$/
#     q.responses[:not_valid] = "Invalid password. Must be at least 5 characters long."
#     q.whitespace = :strip
#   end
#   password = "spree" if password.blank?
#   password
# end
#
# def prompt_for_admin_email
#   email = ask('Email [spree@example.com]: ', String) do |q|
#     q.echo = true
#     q.whitespace = :strip
#   end
#   email = "spree@example.com" if email.blank?
#   email
# end
#
# def create_admin_user
#   if ENV['AUTO_ACCEPT']
#     password =  "spree"
#     email =  "spree@example.com"
#   else
#     require 'highline/import'
#     puts "Create the admin user (press enter for defaults)."
#     #name = prompt_for_admin_name unless name
#     email = prompt_for_admin_email
#     password = prompt_for_admin_password
#   end
#   attributes = {
#     :password => password,
#     :password_confirmation => password,
#     :email => email,
#     :login => email
#   }
#
#   load 'user.rb'
#
#   if User.find_by_login(email)
#     say "\nWARNING: There is already a user with the email: #{email}, so no account changes were made.  If you wish to create an additional admin user, please run rake db:admin:create again with a different email.\n\n"
#   else
#     admin = User.create(attributes)
#     # create an admin role and and assign the admin user to that role
#     role = Spree::Role.find_or_create_by_name "admin"
#     admin.roles << role
#     admin.save
#   end
# end
#
# create_admin_user unless User.first(:include => :roles, :conditions => ["roles.name = 'admin'"])
#

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
spree_core-1.1.6 db/sample/users.rb
spree_core-1.1.5 db/sample/users.rb
spree_core-1.0.7 db/sample/users.rb
spree_core-1.1.4 db/sample/users.rb
spree_core-1.1.3 db/sample/users.rb
spree_core-1.0.6 db/sample/users.rb
spree_core-1.1.2 db/sample/users.rb
spree_core-1.1.2.rc1 db/sample/users.rb
spree_core-1.1.1 db/sample/users.rb
spree_core-1.1.0 db/sample/users.rb
spree_core-1.0.4 db/sample/users.rb
spree_core-1.1.0.rc2 db/sample/users.rb
spree_core-1.1.0.rc1 db/sample/users.rb
spree_core-1.0.3 db/sample/users.rb
spree_core-1.0.2 db/sample/users.rb
spree_core-1.0.1 db/sample/users.rb
spree_core-1.0.0 db/sample/users.rb
spree_core-1.0.0.rc4 db/sample/users.rb
spree_core-1.0.0.rc3 db/sample/users.rb
spree_core-1.0.0.rc2 db/sample/users.rb