Class: RHC::Commands::Team

Inherits:
Base show all
Defined in:
lib/rhc/commands/team.rb

Constant Summary

Constants included from Helpers

Helpers::BOUND_WARNING, Helpers::PREFIX, Helpers::ROLES

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from RHC::ContextHelpers

#find_app, #find_domain, #find_membership_container, #find_team, #from_local_git, included, #namespace_context, #server_context

Methods included from GitHelpers

#git_clone_application, #git_clone_deploy_hooks, #git_clone_repo, #git_cmd, #git_config_get, #git_config_set, #git_remote_add, #git_version, #has_git?

Methods included from Helpers

#agree, #certificate_file, #client_from_options, #collect_env_vars, #color, #confirm_action, #date, #datetime_rfc3339, #debug, #debug?, #debug_error, #decode_json, #deprecated, #deprecated_command, #disable_deprecated?, #distance_of_time_in_words, #env_var_regex_pattern, #error, #exec, #host_exists?, #hosts_file_contains?, #human_size, #info, #interactive?, #jruby?, #mac?, #openshift_online_server?, #openshift_rest_endpoint, #openshift_server, #openshift_url, #pluralize, #results, #role_name, #run_with_tee, #ssh_string, #ssh_string_parts, #ssl_options, #success, #system_path, #table_heading, #to_host, #to_uri, #token_for_user, #unix?, #user_agent, #warn, #windows?, #with_tolerant_encoding

Methods included from OutputHelpers

#default_display_env_var, #display_app, #display_app_configurations, #display_authorization, #display_cart, #display_cart_storage_info, #display_cart_storage_list, #display_deployment, #display_deployment_list, #display_domain, #display_env_var_list, #display_key, #display_team, #format_cart_gears, #format_cart_header, #format_gear_info, #format_key_header, #format_scaling_info, #format_usage_message

Constructor Details

This class inherits a constructor from RHC::Commands::Base

Instance Method Details

#create(name) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/rhc/commands/team.rb', line 36

def create(name)
  say "Creating team '#{name}' ... "
  rest_client.add_team(name)
  success "done"

  info "You may now add team members using the 'app add-member' command"

  0
end

#delete(_) ⇒ Object



79
80
81
82
83
84
85
86
87
# File 'lib/rhc/commands/team.rb', line 79

def delete(_)
  team = find_team(:owned => true)

  say "Deleting team '#{team.name}' ... "
  team.destroy
  success "deleted"

  0
end

#leave(_) ⇒ Object



92
93
94
95
96
97
98
99
100
101
# File 'lib/rhc/commands/team.rb', line 92

def leave(_)
  team = find_team

  say "Leaving team ... "
  result = team.leave
  success "done"
  result.messages.each{ |s| paragraph{ say s } }

  0
end

#listObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rhc/commands/team.rb', line 60

def list
  teams = rest_client.send(options.mine ? :owned_teams : :teams, {:include => "members"})

  teams.each do |t|
    display_team(t, true)
  end

  if options.mine
    success "You have #{pluralize(teams.length, 'team')}."
  else
    success "You are a member of #{pluralize(teams.length, 'team')}."
  end

  0
end

#show(_) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/rhc/commands/team.rb', line 49

def show(_)
  team = find_team

  display_team(team, true)

  0
end