Sha256: 3c7f804b45debd5c03806baa13aa442fcd4622ca7ffa5196072c4f29f7679c43

Contents?: true

Size: 974 Bytes

Versions: 9

Compression:

Stored size: 974 Bytes

Contents

namespace :user do
  desc "Add a new user. rake user:create <username>"
  task :create, [:username] do |t, args|
    puts DH.useradd(args[:username])[:key]
  end

  desc "Rename a user. rake user:rename <oldname> <newname>"
  task :rename, [:oldname, :newname] do |t, args|
    user = DH.user(args[:oldname])
    abort("Unknown user #{args[:oldname]}") if user.nil?
    DH.userdel(user[:username])
    DH.useradd(args[:newname], user[:key])
    puts "User #{args[:oldname]} renamed to #{args[:newname]}"
  end

  desc "Delete a user. rake user:delete <username>"
  task :delete, [:username] do |t, args|
    DH.userdel(args[:username])
  end

  desc "Set user key. rake user:setkey <username> <key>"
  task :setkey, [:username, :key] do |t, args|
    user = DH.user(args[:username])
    abort("Unknown user #{args[:username]}") if user.nil?
    puts DH.useradd(args[:username], args[:key])
  end
end

desc "List users"
task :user do
  puts DH.users.keys.sort.join("\n")
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gaptool-server-0.7.4 tasks/user.rb
gaptool-server-0.7.3 tasks/user.rb
gaptool-server-0.7.1 tasks/user.rb
gaptool-server-0.7.0 tasks/user.rb
gaptool-server-0.6.6 tasks/user.rb
gaptool-server-0.6.4 tasks/user.rb
gaptool-server-0.6.3 tasks/user.rb
gaptool-server-0.6.0 tasks/user.rb
gaptool-server-0.6.0.beta1 tasks/user.rb