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, CloudDatastoresCommand, CloudFoldersCommand, CloudResourcePoolsCommand, Clouds, Clusters, ColoringCommand, 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, 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, NetworkDhcpRelaysCommand, NetworkDhcpServersCommand, NetworkEdgeClustersCommand, NetworkFirewallsCommand, NetworkGroupsCommand, NetworkPoolServersCommand, NetworkPoolsCommand, NetworkProxiesCommand, NetworkRoutersCommand, NetworkServicesCommand, NetworkStaticRoutesCommand, NetworkTransportZonesCommand, NetworksCommand, OpenCommand, OptionParser, Options, PackagesCommand, Ping, PoliciesCommand, PowerSchedulesCommand, PreseedScriptsCommand, PriceSetsCommand, PricesCommand, Processes, Projects, ProvisioningLicensesCommand, ProvisioningSettingsCommand, RecentActivityCommand, Remote, RemoveFileCommand, ReportsCommand, Roles, ScaleThresholds, SearchCommand, SecurityGroupRules, SecurityGroups, 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 =
"5.5.1.4"
@@home_directory =
ENV['MORPHEUS_CLI_HOME'] || File.join(Dir.home, ".morpheus")

Class Method Summary collapse

Class Method Details

.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 all the well known commands and utilties they need



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

def self.load!()
  # load interfaces
  require 'morpheus/api/api_client.rb'
  require 'morpheus/api/rest_interface.rb'
  require 'morpheus/api/read_interface.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 utilites
  require 'morpheus/cli/cli_registry.rb'
  require 'morpheus/cli/expression_parser.rb'
  require 'morpheus/cli/dot_file.rb'
  require 'morpheus/cli/errors'

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

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