class CF::Space::Create
Public Instance Methods
create_space()
click to toggle source
# File lib/cf/cli/space/create.rb, line 19 def create_space space = client.space space.organization = org space.name = input[:name] begin with_progress("Creating space #{c(space.name, :name)}") { space.create! } rescue CFoundry::SpaceNameTaken raise unless input[:find_if_exists] space = client.space_by_name(input[:name]) already_exists = true end if input[:manager] with_progress("Adding you as a manager") { space.add_manager client.current_user } end if input[:developer] with_progress("Adding you as a developer") { space.add_developer client.current_user } end if input[:auditor] with_progress("Adding you as an auditor") { space.add_auditor client.current_user } end if input[:target] invoke :target, :organization => org, :space => space else if already_exists line c("Space already exists!", :good) line line "#{b("truck switch-space #{space.name}")} # targets existing space" else line c("Space created!", :good) line line "#{b("truck switch-space #{space.name}")} # targets new space" end end end
Private Instance Methods
ask_name()
click to toggle source
# File lib/cf/cli/space/create.rb, line 61 def ask_name ask("Name") end