Module: DreamOps
- Extended by:
- Mixin::Logging
- Defined in:
- lib/dream-ops.rb,
lib/dream-ops/cli.rb,
lib/dream-ops/shell.rb,
lib/dream-ops/errors.rb,
lib/dream-ops/logger.rb,
lib/dream-ops/version.rb,
lib/dream-ops/init/base.rb,
lib/dream-ops/init/solo.rb,
lib/dream-ops/mixin/logging.rb,
lib/dream-ops/deployment/base.rb,
lib/dream-ops/deployment/solo.rb,
lib/dream-ops/formatters/base.rb,
lib/dream-ops/formatters/human.rb,
lib/dream-ops/deployment/opsworks.rb
Defined Under Namespace
Modules: Mixin Classes: BaseDeployer, BaseFormatter, BaseInitializer, ChefJsonNotFoundError, ChefSoloFailedError, ChefSoloNotInstalledError, Cli, DreamOpsError, GitNotInstalledError, HumanFormatter, InvalidSshKeyError, Logger, NoRunningInstancesError, NoSshKeyError, OpsWorksCommandFailedError, OpsWorksDeployer, RoleNotFoundError, SoloDeployer, SoloInitializer
Constant Summary collapse
- Shell =
Subclass the current shell (which is different based on the OS)
Class.new(Thor::Base.shell) do # Mute the output of this instance of UI until {#unmute!} is called def mute! @mute = true end # Unmute the output of this instance of UI until {#mute!} is called def unmute! @mute = false end def say(*args) return if quiet? super(*args) end alias_method :info, :say def warn(, color = :yellow) say(, color) end def error(, color = :red) = set_color(, *color) if color super() end end
- VERSION =
"0.8.1"
Instance Attribute Summary
Attributes included from Mixin::Logging
Class Method Summary collapse
-
.force_setup ⇒ ~boolean
Get whether to always run setup.
-
.formatter ⇒ ~Formatter
Get the appropriate Formatter object based on the formatter classes that have been registered.
-
.set_force_setup(force) ⇒ ~boolean
Specify whether to always run setup.
-
.set_format(name) ⇒ ~Formatter
Specify the format for output.
-
.set_ssh_key(key) ⇒ ~String
Specify path to use for the SSH key.
-
.ssh_key ⇒ ~String
Get path for the SSH key.
- .ui ⇒ DreamOps::Shell
-
.use_aws_profile(profile) ⇒ Object
Specify AWS profile to use.
Class Method Details
.force_setup ⇒ ~boolean
Get whether to always run setup
108 109 110 |
# File 'lib/dream-ops.rb', line 108 def force_setup @force_setup ||= false end |
.formatter ⇒ ~Formatter
Get the appropriate Formatter object based on the formatter classes that have been registered.
51 52 53 |
# File 'lib/dream-ops.rb', line 51 def formatter @formatter ||= HumanFormatter.new end |
.set_force_setup(force) ⇒ ~boolean
Specify whether to always run setup
115 116 117 |
# File 'lib/dream-ops.rb', line 115 def set_force_setup(force) @force_setup = force end |
.set_format(name) ⇒ ~Formatter
Specify the format for output
63 64 65 66 |
# File 'lib/dream-ops.rb', line 63 def set_format(name) id = name.to_s.capitalize @formatter = DreamOps.const_get("#{id}Formatter").new end |
.set_ssh_key(key) ⇒ ~String
Specify path to use for the SSH key
78 79 80 |
# File 'lib/dream-ops.rb', line 78 def set_ssh_key(key) @ssh_key = key end |
.ssh_key ⇒ ~String
Get path for the SSH key
71 72 73 |
# File 'lib/dream-ops.rb', line 71 def ssh_key @ssh_key ||= '' end |
.ui ⇒ DreamOps::Shell
43 44 45 |
# File 'lib/dream-ops.rb', line 43 def ui @ui ||= DreamOps::Shell.new end |
.use_aws_profile(profile) ⇒ Object
Specify AWS profile to use
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/dream-ops.rb', line 83 def use_aws_profile(profile) begin shared_creds = Aws::SharedCredentials.new(profile_name: profile) Aws.config.update(credentials: shared_creds) rescue Aws::Errors::NoSuchProfileError => error DreamOps.ui.error error exit(1) end # Unfortunately, Aws::OpsWorks::Client only loads the default profile's # region. This parses the INI files and honors the profile region if set. ini = IniFile.load("#{ENV['HOME']}/.aws/config") if ini.nil? || !ini.has_section(profile) ini = IniFile.load("#{ENV['HOME']}/.aws/credentials") end region = ini.to_h[profile]['region'] if !region.nil? && !region.empty? Aws.config.update(region: region) end end |