Module: Morpheus::Cli

Defined in:
lib/morpheus/cli.rb,
lib/morpheus/cli/version.rb,
lib/morpheus/cli/cli_command.rb,
lib/morpheus/cli/credentials.rb,
lib/morpheus/cli/cli_registry.rb,
lib/morpheus/cli/option_types.rb,
lib/morpheus/cli/option_parser.rb

Defined Under Namespace

Modules: AccountsHelper, CliCommand, ExpressionParser, InfrastructureHelper, LibraryHelper, MonitoringHelper, OptionTypes, PrintHelper, ProcessesHelper, ProvisioningHelper, WhoamiHelper Classes: AccessTokenCommand, AccountGroupsCommand, Accounts, AliasCommand, Apps, ArchivesCommand, AuthCommand, BenchmarkCommand, BlueprintsCommand, BootScriptsCommand, CatCommand, ChangePasswordCommand, CliRegistry, CloudDatastoresCommand, CloudFoldersCommand, CloudResourcePoolsCommand, Clouds, Clusters, ColoringCommand, CommandError, ContainersCommand, Credentials, CurlCommand, CypherCommand, DashboardCommand, DebugCommand, Deployments, Deploys, DotFile, Echo, EditProfileCommand, EditRcCommand, EnvironmentsCommand, ErrorHandler, ExecuteSchedulesCommand, ExecutionRequestCommand, ExitCommand, FileCopyRequestCommand, GetPromptCommand, Groups, HistoryCommand, Hosts, ImageBuilderCommand, InstanceTypes, Instances, KeyPairs, LibraryContainerScriptsCommand, LibraryContainerTemplatesCommand, LibraryContainerTypesCommand, LibraryInstanceTypesCommand, LibraryLayoutsCommand, LibraryOptionListsCommand, LibraryOptionTypesCommand, LibraryUpgradesCommand, License, LoadBalancers, LogLevelCommand, Login, Logout, ManCommand, MonitoringAppsCommand, MonitoringChecksCommand, MonitoringContactsCommand, MonitoringGroupsCommand, MonitoringIncidentsCommand, NetworkDomainsCommand, NetworkGroupsCommand, NetworkPoolServersCommand, NetworkPoolsCommand, NetworkProxiesCommand, NetworkServicesCommand, NetworksCommand, OldCypherCommand, OptionParser, PackagesCommand, PoliciesCommand, PowerSchedulesCommand, PreseedScriptsCommand, Processes, RecentActivityCommand, Remote, RemoveFileCommand, ReportsCommand, Roles, SecurityGroupRules, SecurityGroups, SetPromptCommand, Shell, Sleep, SourceCommand, SslVerificationCommand, StorageProvidersCommand, Tasks, TeeCommand, TenantsCommand, UserGroupsCommand, UserSettingsCommand, UserSourcesCommand, Users, VersionCommand, VirtualImages, Whoami, WikiCommand, Workflows

Constant Summary collapse

VERSION =
"4.1.2"

Class Method Summary collapse

Class Method Details

.home_directoryObject



18
19
20
21
22
23
24
25
26
# File 'lib/morpheus/cli.rb', line 18

def self.home_directory
  if @@home_directory
    @@home_directory
  elsif ENV['MORPHEUS_CLI_HOME']
    @@home_directory = ENV['MORPHEUS_CLI_HOME']
  else
    @@home_directory = File.join(Dir.home, ".morpheus")
  end
end

.home_directory=(fn) ⇒ Object

the home directory, where morpheus-cli stores things



14
15
16
# File 'lib/morpheus/cli.rb', line 14

def self.home_directory=(fn)
  @@home_directory = fn
end

.load!Object

load all the well known commands and utilties they need



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/morpheus/cli.rb', line 44

def self.load!()
  # load interfaces
  require 'morpheus/api/api_client.rb'
  Dir[File.dirname(__FILE__)  + "/api/**/*.rb"].each {|file| load file }

  # load mixins
  Dir[File.dirname(__FILE__)  + "/cli/mixins/*.rb"].each {|file| load file }

  # load commands
  # Dir[File.dirname(__FILE__)  + "/cli/*.rb"].each {|file| load file }

  # utilites
  require 'morpheus/cli/cli_registry.rb'
  require 'morpheus/cli/expression_parser.rb'
  require 'morpheus/cli/dot_file.rb'
  require 'morpheus/cli/command_error'

  load 'morpheus/cli/cli_command.rb'
  load 'morpheus/cli/option_types.rb'
  load 'morpheus/cli/credentials.rb'
  
  # all standard commands
  Dir[File.dirname(__FILE__)  + "/cli/commands/standard/**/*.rb"].each {|file| load file }

  # shell scripting commands

  # all the known commands
  load 'morpheus/cli/remote.rb'
  load 'morpheus/cli/login.rb'
  load 'morpheus/cli/logout.rb'
  load 'morpheus/cli/whoami.rb'
  # load 'morpheus/cli/auth_command.rb'
  load 'morpheus/cli/access_token_command.rb'
  load 'morpheus/cli/user_settings_command.rb'
  load 'morpheus/cli/dashboard_command.rb'
  load 'morpheus/cli/power_schedules_command.rb'
  load 'morpheus/cli/execute_schedules_command.rb'
  load 'morpheus/cli/recent_activity_command.rb'
  load 'morpheus/cli/groups.rb'
  load 'morpheus/cli/clouds.rb'
  load 'morpheus/cli/cloud_datastores_command.rb'
  load 'morpheus/cli/cloud_resource_pools_command.rb'
  load 'morpheus/cli/cloud_folders_command.rb'
  load 'morpheus/cli/hosts.rb'
  load 'morpheus/cli/load_balancers.rb'
  load 'morpheus/cli/shell.rb'
  load 'morpheus/cli/tasks.rb'
  load 'morpheus/cli/workflows.rb'
  load 'morpheus/cli/deployments.rb'
  load 'morpheus/cli/instances.rb'
  load 'morpheus/cli/containers_command.rb'
  load 'morpheus/cli/apps.rb'
  load 'morpheus/cli/blueprints_command.rb'
  load 'morpheus/cli/deploys.rb'
  load 'morpheus/cli/license.rb'
  load 'morpheus/cli/instance_types.rb'
  load 'morpheus/cli/security_groups.rb'
  load 'morpheus/cli/security_group_rules.rb'
  load 'morpheus/cli/clusters.rb'
  load 'morpheus/cli/tenants_command.rb'
  load 'morpheus/cli/accounts.rb'
  load 'morpheus/cli/account_groups_command.rb'
  load 'morpheus/cli/users.rb'
  load 'morpheus/cli/change_password_command.rb'
  load 'morpheus/cli/user_groups_command.rb'
  load 'morpheus/cli/user_sources_command.rb'
  load 'morpheus/cli/roles.rb'
  load 'morpheus/cli/key_pairs.rb'
  load 'morpheus/cli/virtual_images.rb'
  # load 'morpheus/cli/library.rb' # gone until we collapse these again
  load 'morpheus/cli/library_instance_types_command.rb'
  load 'morpheus/cli/library_layouts_command.rb'
  load 'morpheus/cli/library_upgrades_command.rb'
  load 'morpheus/cli/library_container_types_command.rb'
  load 'morpheus/cli/library_container_scripts_command.rb'
  load 'morpheus/cli/library_container_templates_command.rb'
  load 'morpheus/cli/library_option_types_command.rb'
  load 'morpheus/cli/library_option_lists_command.rb'
  load 'morpheus/cli/monitoring_incidents_command.rb'
  load 'morpheus/cli/monitoring_checks_command.rb'
  load 'morpheus/cli/monitoring_contacts_command.rb'
  load 'morpheus/cli/monitoring_groups_command.rb'
  load 'morpheus/cli/monitoring_apps_command.rb'
  load 'morpheus/cli/policies_command.rb'
  load 'morpheus/cli/networks_command.rb'
  load 'morpheus/cli/network_groups_command.rb'
  load 'morpheus/cli/network_pools_command.rb'
  load 'morpheus/cli/network_services_command.rb'
  load 'morpheus/cli/network_pool_servers_command.rb'
  load 'morpheus/cli/network_domains_command.rb'
  load 'morpheus/cli/network_proxies_command.rb'
  load 'morpheus/cli/cypher_command.rb'
  load 'morpheus/cli/old_cypher_command.rb'
  load 'morpheus/cli/image_builder_command.rb'
  load 'morpheus/cli/preseed_scripts_command.rb'
  load 'morpheus/cli/boot_scripts_command.rb'
  load 'morpheus/cli/archives_command.rb'
  load 'morpheus/cli/storage_providers_command.rb'
  load 'morpheus/cli/execution_request_command.rb'
  load 'morpheus/cli/file_copy_request_command.rb'
  load 'morpheus/cli/processes_command.rb'
  load 'morpheus/cli/packages_command.rb'
  load 'morpheus/cli/reports_command.rb'
  load 'morpheus/cli/environments_command.rb'
  load 'morpheus/cli/wiki_command.rb'

  # Your new commands go here...

end

.windows?Boolean

check if this is a Windows environment.

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/morpheus/cli.rb', line 29

def self.windows?
  if defined?(@@is_windows)
    return @@is_windows
  end
  @@is_windows = false
  begin
    require 'rbconfig'
    @@is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
  rescue => ex
    # $stderr.puts "unable to determine if this is a Windows machine."
  end
  return @@is_windows
end