Commit 308c6539 authored by Alec Leamas's avatar Alec Leamas

Cleaning up db:first_user patch.

Removing duplicated reset task (what happened?). Hate long lines.
Let user.rb handle all error checks. Clean up.
parent c3356af8
......@@ -5,9 +5,13 @@
# Add a parameterized user to database.
#
#
#
config_path = File.join (File.dirname(__FILE__), '..', '..', 'config')
require File.join(config_path, 'environment')
require File.join(config_path, 'initializers', '_load_app_config.rb')
require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
require File.join(File.dirname(__FILE__), '..', '..','config', 'initializers', '_load_app_config.rb')
require 'yaml'
def read_password
......@@ -18,10 +22,6 @@ def read_password
printf 'Enter password: '
pw1 = $stdin.gets.chomp
puts
if pw1.length < 6
puts "Too short (minimum 6 characters)"
next
end
printf 'Again: '
pw2 = $stdin.gets.chomp
puts
......@@ -44,25 +44,19 @@ else
email = ARGS[:email]
end
if ARGS[:password] == nil
password = read_password
else
password = ARGS[:password]
end
#printf "Building: %s, %s, '%s'\n", username, email, password
password = (ARGS[:password] == nil ? read_password : ARGS[:password])
user = User.build( :email => email,
:username => username,
:password => password,
:password_confirmation => password,
:person => {
:profile => {
:first_name => username,
:last_name => "Unknown",
:image_url => "/images/user/default.png"
}
}
user = User.build( :email => email,
:username => username,
:password => password,
:password_confirmation => password,
:person => {
:profile => {
:first_name => username,
:last_name => "Unknown",
:image_url => "/images/user/default.png"
}
}
)
errors = user.errors
......
......@@ -59,13 +59,6 @@ namespace :db do
puts "you did it!"
end
task :reset do
puts "making a new base user"
Rake::Task['db:purge'].invoke
Rake::Task['db:seed:dev'].invoke
puts "you did it!"
end
desc 'Purge database, add a new user'
task :first_user, :username, :password do |t, args|
puts "Purging database and adding a new user"
......@@ -75,8 +68,6 @@ namespace :db do
Rake::Task['db:seed:first_user'].invoke(username, password)
end
task :fix_diaspora_handle do
puts "fixing the people in this seed"
require File.dirname(__FILE__) + '/../../config/environment'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment