class Sem::CLI::Teams
Constants
- ALLOWED_PERMISSIONS
Public Instance Methods
create(team_name)
click to toggle source
# File lib/sem/cli/teams.rb, line 73 def create(team_name) permission = options[:permission] unless ALLOWED_PERMISSIONS.include?(permission) abort "Permission must be one of [#{ALLOWED_PERMISSIONS.join(", ")}]" end team = Sem::API::Team.create!(team_name, :permission => permission) Sem::Views::Teams.info(team) end
delete(team_name)
click to toggle source
# File lib/sem/cli/teams.rb, line 145 def delete(team_name) team = Sem::API::Team.find!(team_name) team.delete! puts "Team #{team_name} deleted." end
info(team_name)
click to toggle source
# File lib/sem/cli/teams.rb, line 36 def info(team_name) team = Sem::API::Team.find!(team_name) Sem::Views::Teams.info(team) end
list()
click to toggle source
# File lib/sem/cli/teams.rb, line 14 def list teams = Sem::API::Team.all if !teams.empty? Sem::Views::Teams.list(teams) else Sem::Views::Teams.create_first_team end end
rename(old_team_name, new_team_name)
click to toggle source
# File lib/sem/cli/teams.rb, line 97 def rename(old_team_name, new_team_name) old_org_name, _old_name = Sem::SRN.parse_team(old_team_name) new_org_name, new_name = Sem::SRN.parse_team(new_team_name) abort "Team can't change its organization" unless new_org_name == old_org_name team = Sem::API::Team.find!(old_team_name) team = team.update!(:name => new_name) Sem::Views::Teams.info(team) end
set_permission(team_name)
click to toggle source
# File lib/sem/cli/teams.rb, line 125 def set_permission(team_name) # rubocop:disable Style/AccessorMethodName permission = options[:permission] unless ALLOWED_PERMISSIONS.include?(permission) abort "Permission must be one of [#{ALLOWED_PERMISSIONS.join(", ")}]" end team = Sem::API::Team.find!(team_name) team = team.update!(:permission => permission) Sem::Views::Teams.info(team) end