Sha256: 8ae889829bfca5bf26155461e1f8ababb96a5068e87a2d3c79352fdb96b707a5
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
require 'thor' require 'pp' class ArisControl::Thor < Thor desc 'add/update username', 'Adds/Updates an aris user.' method_option :email, type: :string, desc: 'The users email address. Used for web login.' method_option :ssh_key, type: :string, desc: 'The users ssh public key. Used for git access via ssh.' method_option :env_vars, type: :hash, desc: 'The users app env vars. Env vars will be accessible inside the app via ENV[VAR-NAME].' def add(name) opts = Hash.new.tap do |h| h[:email] = options[:email] h[:ssh_key] = options[:ssh_key] if options[:ssh_key] h[:env_vars] = options[:env_vars] if options[:env_vars] end bookkeeper.add(name, **opts) puts "Added/Updated user: #{name}, #{opts}" puts "-----------------------------" print_current_aris_users end desc 'delete name', 'Deletes aris user' def delete(name) bookkeeper.delete(name) puts "Removed user: #{name}" puts "-----------------------------" print_current_aris_users end desc 'list', 'Lists current aris-users' def list print_current_aris_users end desc 'rollout', 'Runs ansible to provision the current users.yml state' def rollout provsioner.rollout print_current_aris_users end private def print_current_aris_users puts "Current aris user database" puts "-----------------------------" pp bookkeeper.list end def bookkeeper @bookkeeper ||= ArisControl::Bookkeeper.new end def provsioner @provsioner ||= ArisControl::Provisioner.new end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aris-control-2.0.0 | lib/aris-control/thor.rb |