Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git lib/tasks/mastodon.rake lib/tasks/mastodon.rake
- index 7dd7b5c..cf5b395 100644
- --- lib/tasks/mastodon.rake
- +++ lib/tasks/mastodon.rake
- @@ -10,6 +10,46 @@ namespace :mastodon do
- Rake::Task['mastodon:push:refresh'].invoke
- end
- + desc 'Create local user'
- + task create_user: :environment do
- + print "username: "
- + username = STDIN.gets.chomp
- +
- + print "password: "
- + password = STDIN.noecho(&:gets).chomp
- + puts
- +
- + print "password confirmation: "
- + password_confirmation = STDIN.noecho(&:gets).chomp
- + puts
- +
- + if password != password_confirmation
- + puts "password_confirmation doesn't match password!"
- + exit
- + end
- +
- + print "email: "
- + email = STDIN.gets.chomp
- +
- + user = User.new(email: email, password: password, password_confirmation: password_confirmation)
- + user.build_account(username: username)
- +
- + begin
- + user.save!
- + print "#{user.account.username} has created"
- + rescue => e
- + puts "Something went wrong..."
- + puts e.message
- + abort
- + end
- +
- + print "Confirm manually? (y/N)"
- + if STDIN.gets.chomp == "y"
- + user.update(confirmed_at: Time.now.utc)
- + puts "#{user.account.username} confirmed"
- + end
- + end
- +
- desc 'Turn a user into an admin, identified by the USERNAME environment variable'
- task make_admin: :environment do
- include RoutingHelper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement