Class: AcquiaToolbelt::CLI::Sites

Inherits:
Thor
  • Object
show all
Defined in:
lib/acquia_toolbelt/cli/site.rb

Constant Summary

Constants inherited from Thor

Thor::AmbiguousTaskError, Thor::DynamicTask, Thor::HELP_MAPPINGS, Thor::HiddenTask, Thor::THOR_RESERVED_WORDS, Thor::UndefinedTaskError, Thor::VERSION

Instance Attribute Summary

Attributes included from Thor::Base

#args, #options, #parent_options

Instance Method Summary collapse

Methods inherited from Thor

check_unknown_options!, check_unknown_options?, command_help, default_command, desc, #help, help, long_desc, map, method_option, method_options, package_name, printable_commands, register, stop_on_unknown_option!, stop_on_unknown_option?, subcommand, subcommands

Methods included from Thor::Base

included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses

Instance Method Details

#listObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/acquia_toolbelt/cli/site.rb', line 8

def list
  sites = AcquiaToolbelt::CLI::API.request 'sites'

  sites.each do |site|
    ui.say
    # Get the individual subscription information.
    site_data = AcquiaToolbelt::CLI::API.request "sites/#{site}"

    ui.say "#{site_data['title']}"
    ui.say "> Username: #{site_data['unix_username']}"
    ui.say "> Subscription: #{site_data['name']}"

    # If the VCS type is SVN, we want it in all uppercase, otherwise just
    # capitilise it.
    if site_data['vcs_type'] == 'svn'
      vcs_name = site_data['vcs_type'].upcase
    else
      vcs_name = site_data['vcs_type'].capitalize
    end

    ui.say "> #{vcs_name} URL: #{site_data['vcs_url']}"
  end
end