Class: Webbynode::Commands::Webbies

Inherits:
Webbynode::Command show all
Defined in:
lib/webbynode/commands/webbies.rb

Constant Summary

Constants inherited from Webbynode::Command

Webbynode::Command::Aliases, Webbynode::Command::CommandError, Webbynode::Command::InvalidCommand, Webbynode::Command::InvalidOption, Webbynode::Command::Settings

Instance Method Summary collapse

Methods inherited from Webbynode::Command

add_alias, #api, class_for, command, command_class_name, description, for, #gemfile, #git, help, inherited, #initialize, #io, #no?, #notify, option, #option, #options, options_help, #param, #param_values, parameter, #params, #params_hash, params_help, #pushand, #remote_executor, requires_initialization!, requires_options!, requires_pushed_application!, #run, #server, setting, #settings, summary, summary_help, usage, #validate_initialization, #validate_options, #yes?

Constructor Details

This class inherits a constructor from Webbynode::Command

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/webbynode/commands/webbies.rb', line 6

def execute
  puts "Fetching list of your Webbies..."
  puts ""
  
  header =  "  "
  header << "Webbies".ljust(15).color(:white).bright.underline
  header << " "
  header << "IP".ljust(15).color(:white).bright.underline
  header << " "
  header << "Node".ljust(11).color(:white).bright.underline
  header << " "
  header << "Plan".ljust(15).color(:white).bright.underline
  header << " "
  header << "Status".ljust(14).color(:white).bright.underline
  header << " "
  
  puts header

  webbies = spinner { api.webbies }
  
  webbies.each_pair do |name, webby|
    str = "  "
    str << name.ljust(16).color(:yellow).bright
    str << webby['ip'].ljust(16).color(:cyan).bright
    str << webby['node'].ljust(12).color(:cyan).bright
    str << webby['plan'].ljust(16).color(:cyan).bright
    str << (webby['status'] == 'on' ? "on".color(:cyan).bright : "off")

    puts str
  end
end