Module: CfScript::Command

Extended by:
UI
Defined in:
lib/cf_script/command.rb,
lib/cf_script/command/base.rb,
lib/cf_script/command/runner.rb,
lib/cf_script/command/cf/apps.rb,
lib/cf_script/command/registry.rb,
lib/cf_script/command/cf/apps/app.rb,
lib/cf_script/command/cf/apps/env.rb,
lib/cf_script/command/cf/apps/apps.rb,
lib/cf_script/command/cf/apps/push.rb,
lib/cf_script/command/cf/apps/stop.rb,
lib/cf_script/command/cf/apps/scale.rb,
lib/cf_script/command/cf/apps/start.rb,
lib/cf_script/command/cf/apps/delete.rb,
lib/cf_script/command/cf/apps/rename.rb,
lib/cf_script/command/cf/apps/restage.rb,
lib/cf_script/command/cf/apps/restart.rb,
lib/cf_script/command/cf/apps/set_env.rb,
lib/cf_script/command/cf/spaces/space.rb,
lib/cf_script/command/cf/routes/routes.rb,
lib/cf_script/command/cf/spaces/spaces.rb,
lib/cf_script/command/cf/apps/unset_env.rb,
lib/cf_script/command/cf/general/target.rb,
lib/cf_script/command/cf/routes/map_route.rb,
lib/cf_script/command/cf/routes/check_route.rb,
lib/cf_script/command/cf/routes/unmap_route.rb,
lib/cf_script/command/cf/routes/create_route.rb,
lib/cf_script/command/cf/routes/delete_route.rb,
lib/cf_script/command/cf/apps/restart_app_instance.rb

Defined Under Namespace

Modules: Apps, General, Routes, Runner, Spaces Classes: Base, Error, Line, Registry

Constant Summary

Constants included from UI

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

Class Attribute Summary collapse

Class Method Summary collapse

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object (private)



29
30
31
# File 'lib/cf_script/command.rb', line 29

def method_missing(m, *args, &block)
  run(m, *args, &block)
end

Class Attribute Details

._registryObject (readonly)

Returns the value of attribute _registry.



4
5
6
# File 'lib/cf_script/command.rb', line 4

def _registry
  @_registry
end

Class Method Details

.method_missing(m, *args, &block) ⇒ Object



29
30
31
# File 'lib/cf_script/command.rb', line 29

def method_missing(m, *args, &block)
  run(m, *args, &block)
end

.register(command_class) ⇒ Object



15
16
17
# File 'lib/cf_script/command.rb', line 15

def register(command_class)
  registry.add!(command_class)
end

.registryObject



11
12
13
# File 'lib/cf_script/command.rb', line 11

def registry
  @_registry ||= Registry.new
end

.run(command_name, *args, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/cf_script/command.rb', line 19

def run(command_name, *args, &block)
  registry.check!(command_name)

  begin
    registry[command_name].run(*args, &block)
  rescue StandardError => e
    error command_name, e.message
  end
end