Module: Morpheus::Cli

Defined in:
lib/morpheus/cli.rb,
lib/morpheus/cli/errors.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, BackupsHelper, CliCommand, DeploymentsHelper, ExecutionRequestHelper, ExpressionParser, InfrastructureHelper, JobsHelper, LibraryHelper, LoadBalancersHelper, LogsHelper, MonitoringHelper, OperationsHelper, OptionSourceHelper, OptionTypes, PrintHelper, ProcessesHelper, ProvisioningHelper, RemoteHelper, RestCommand, SecondaryRestCommand, StorageServersHelper, StorageVolumesHelper, VdiHelper, WhoamiHelper Classes: AccessTokenCommand, AccountGroupsCommand, ActivityCommand, AliasCommand, ApplianceSettingsCommand, ApprovalsCommand, Apps, ArchivesCommand, Audit, AuthorizationRequiredError, BackupJobsCommand, BackupServices, BackupSettingsCommand, BackupsCommand, BenchmarkCommand, BlueprintsCommand, BootScriptsCommand, BudgetsCommand, CatCommand, CatalogCommand, CatalogItemTypesCommand, CertificatesCommand, ChangePasswordCommand, CliRegistry, ClientsCommand, CloudDatastoresCommand, CloudFoldersCommand, CloudResourcePoolsCommand, Clouds, Clusters, ColoringCommand, CommandAborted, CommandArgumentsError, CommandError, CommandNotFoundError, ContainersCommand, CredentialTypesCommand, Credentials, CredentialsCommand, CurlCommand, CypherCommand, DashboardCommand, DebugCommand, Deploy, Deployments, Deploys, Doc, DotFile, Echo, EditProfileCommand, EditRcCommand, EnvironmentsCommand, ErrorHandler, ExecuteSchedulesCommand, ExecutionRequestCommand, ExitCommand, FileCopyRequestCommand, ForgotPassword, GetPromptCommand, Groups, GuidanceCommand, GuidanceSettings, HealthCommand, HistoryCommand, Hosts, ImageBuilderCommand, InstanceTypes, Instances, IntegrationsCommand, InvoicesCommand, JobsCommand, KeyPairs, LibraryClusterLayoutsCommand, LibraryContainerScriptsCommand, LibraryContainerTemplatesCommand, LibraryContainerTypesCommand, LibraryInstanceTypesCommand, LibraryLayoutsCommand, LibraryOptionListsCommand, LibraryOptionTypesCommand, LibrarySpecTemplatesCommand, LibraryUpgradesCommand, License, LoadBalancerMonitors, LoadBalancerPools, LoadBalancerProfiles, LoadBalancerTypes, LoadBalancerVirtualServers, LoadBalancers, LogLevelCommand, LogSettingsCommand, Login, Logout, LogsCommand, ManCommand, MonitoringAlertsCommand, MonitoringAppsCommand, MonitoringChecksCommand, MonitoringContactsCommand, MonitoringGroupsCommand, MonitoringIncidentsCommand, MonitoringSettings, NetworkDhcpRelaysCommand, NetworkDhcpServersCommand, NetworkDomainsCommand, NetworkEdgeClustersCommand, NetworkFirewallsCommand, NetworkFloatingIps, NetworkGroupsCommand, NetworkPoolServerTypes, NetworkPoolServersCommand, NetworkPoolsCommand, NetworkProxiesCommand, NetworkRoutersCommand, NetworkServerGroups, NetworkServicesCommand, NetworkStaticRoutesCommand, NetworkTransportZonesCommand, NetworksCommand, OpenCommand, OptionParser, Options, PackagesCommand, Ping, PluginsCommand, PoliciesCommand, PowerSchedulesCommand, PreseedScriptsCommand, PriceSetsCommand, PricesCommand, Processes, Projects, ProvisioningLicensesCommand, ProvisioningSettingsCommand, RecentActivityCommand, Remote, RemoveFileCommand, ReportsCommand, ResourcePoolGroupsCommand, Roles, ScaleThresholds, SearchCommand, SecurityGroupRules, SecurityGroups, SecurityPackageTypesCommand, SecurityPackagesCommand, SecurityScansCommand, ServicePlanCommand, SetPromptCommand, Setup, Shell, Sleep, Snapshots, SourceCommand, SslVerificationCommand, StorageProvidersCommand, StorageServerTypes, StorageServers, StorageVolumeTypes, StorageVolumes, SubnetsCommand, Tasks, TeeCommand, TenantsCommand, UpdateCommand, UsageCommand, UserGroupsCommand, UserSettingsCommand, UserSourcesCommand, Users, VdiAllocationsCommand, VdiAppsCommand, VdiCommand, VdiGatewaysCommand, VdiPoolsCommand, VersionCommand, View, VirtualImages, WhitelabelSettingsCommand, Whoami, WikiCommand, Workflows

Constant Summary collapse

VERSION =
"6.0.2"
@@home_directory =
ENV['MORPHEUS_CLI_HOME'] || File.join(Dir.home, ".morpheus")
@@testing =

hack needed for unit tests right now

false

Class Method Summary collapse

Class Method Details

.enable_test_modeObject

hack needed for unit tests right now



84
85
86
# File 'lib/morpheus/cli.rb', line 84

def self.enable_test_mode
  @@testing = true
end

.home_directoryObject

get the home directory, where morpheus-cli stores things



21
22
23
# File 'lib/morpheus/cli.rb', line 21

def self.home_directory
  @@home_directory
end

.home_directory=(fn) ⇒ Object

set the home directory



26
27
28
# File 'lib/morpheus/cli.rb', line 26

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

.load!Object

load! does the initial loading of all the CLI utilities and commands



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/morpheus/cli.rb', line 46

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

  # utilites
  # Dir[File.dirname(__FILE__)  + "/cli/*.rb"].each { |file| require file }
  require 'morpheus/cli/cli_registry.rb'
  require 'morpheus/cli/expression_parser.rb'
  require 'morpheus/cli/dot_file.rb'
  require 'morpheus/cli/errors'
  require 'morpheus/cli/cli_command.rb'
  require 'morpheus/cli/option_types.rb'
  require 'morpheus/cli/credentials.rb'

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

end

.reload!Object

reload! can be used for live reloading changes while developing



71
72
73
74
75
76
77
78
# File 'lib/morpheus/cli.rb', line 71

def self.reload!()
  # api interfaces
  Dir[File.dirname(__FILE__)  + "/api/**/*.rb"].each { |file| load file }
  # mixins
  Dir[File.dirname(__FILE__)  + "/cli/mixins/**/*.rb"].each {|file| load file }
  # commands
  Dir[File.dirname(__FILE__)  + "/cli/commands/**/*.rb"].each {|file| load file }
end

.testing?Boolean

hack needed for unit tests right now

Returns:

  • (Boolean)


89
90
91
# File 'lib/morpheus/cli.rb', line 89

def self.testing?
  defined?(@@testing) && @@testing == true
end

.windows?Boolean

check if this is a Windows environment.

Returns:

  • (Boolean)


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

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
    # $stderr.puts "unable to determine if this is a Windows machine."
  end
  return @@is_windows
end