class CfScript::Scope::App

Attributes

app_info[R]
current_target[R]
name[R]

Public Class Methods

new(name_or_info, current_target) click to toggle source
# File lib/cf_script/scope/app.rb, line 14
def initialize(name_or_info, current_target)
  @current_target = current_target

  case name_or_info
  when String, Symbol
    @name     = name_or_info
    @app_info = nil
  when CfScript::AppInfo
    @name     = name_or_info.name
    @app_info = name_or_info
  else
    raise "App accepts a name (String or Symbol) or an AppInfo object, " +
          "but a #{name_or_info.class.name} was given"
  end

  cf_self
end

Public Instance Methods

current_space() click to toggle source
# File lib/cf_script/scope/app.rb, line 36
def current_space
  current_target.space
end
name_tag() click to toggle source
# File lib/cf_script/scope/app.rb, line 44
def name_tag
  "#{current_target.space}:#{name}"
end
tag_color(type = nil) click to toggle source
# File lib/cf_script/scope/app.rb, line 40
def tag_color(type = nil)
  started? ? :active : :inactive
end

Private Instance Methods

cf_self() click to toggle source
# File lib/cf_script/scope/app.rb, line 50
def cf_self
  CfScript::Command.app name do |app_info|
    @app_info = app_info if app_info
  end
end