Class: CfScript::Scope::App

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Includes:
Env, Routes, State, UI, UI::NameTag, Utils
Defined in:
lib/cf_script/scope/app.rb,
lib/cf_script/scope/app.rb

Defined Under Namespace

Modules: Env, Routes, State, Utils

Constant Summary

Constants included from UI

UI::COLORS, UI::EMOJI, UI::TAGS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

symbolize, symbolize_keys

Methods included from Routes

#has_route?, #map_route, #unmap_route

Methods included from Env

#env, #set_env, #unset_env

Methods included from State

#push, #restage, #restart, #restart_instance, #scale, #start, #stop

Methods included from UI::NameTag

#alert, #detail, #error, #info, #progress, #step, #success, #title

Methods included from UI

alert, call_type, debug, detail, emoji, emoji_for, error, info, print_err, print_out, progress, puts_err, puts_out, step, success, tag_char, tag_close, tag_color, tag_format, tag_open, tag_style, title, trace, ui_format, with_color_of

Methods inherited from Base

#finalize, #method_missing, #spec_for

Methods included from Execution

exec_in

Constructor Details

#initialize(name_or_info, current_target) ⇒ App

Returns a new instance of App.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CfScript::Scope::Base

Instance Attribute Details

#app_infoObject (readonly)

Returns the value of attribute app_info.



8
9
10
# File 'lib/cf_script/scope/app.rb', line 8

def app_info
  @app_info
end

#current_targetObject (readonly)

Returns the value of attribute current_target.



9
10
11
# File 'lib/cf_script/scope/app.rb', line 9

def current_target
  @current_target
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/cf_script/scope/app.rb', line 7

def name
  @name
end

Instance Method Details

#current_spaceObject



36
37
38
# File 'lib/cf_script/scope/app.rb', line 36

def current_space
  current_target.space
end

#name_tagObject



44
45
46
# File 'lib/cf_script/scope/app.rb', line 44

def name_tag
  "#{current_target.space}:#{name}"
end

#tag_color(type = nil) ⇒ Object



40
41
42
# File 'lib/cf_script/scope/app.rb', line 40

def tag_color(type = nil)
  started? ? :active : :inactive
end