simplygenius-atmos 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/exe/atmos +2 -2
  4. data/lib/{atmos.rb → simplygenius/atmos.rb} +9 -7
  5. data/lib/simplygenius/atmos/cli.rb +116 -0
  6. data/lib/simplygenius/atmos/commands/account.rb +69 -0
  7. data/lib/simplygenius/atmos/commands/apply.rb +24 -0
  8. data/lib/simplygenius/atmos/commands/auth_exec.rb +34 -0
  9. data/lib/simplygenius/atmos/commands/base_command.rb +16 -0
  10. data/lib/simplygenius/atmos/commands/bootstrap.rb +76 -0
  11. data/lib/simplygenius/atmos/commands/container.rb +62 -0
  12. data/lib/simplygenius/atmos/commands/destroy.rb +22 -0
  13. data/lib/simplygenius/atmos/commands/generate.rb +187 -0
  14. data/lib/simplygenius/atmos/commands/init.rb +22 -0
  15. data/lib/simplygenius/atmos/commands/new.rb +22 -0
  16. data/lib/simplygenius/atmos/commands/otp.rb +58 -0
  17. data/lib/simplygenius/atmos/commands/plan.rb +24 -0
  18. data/lib/simplygenius/atmos/commands/secret.rb +91 -0
  19. data/lib/simplygenius/atmos/commands/terraform.rb +56 -0
  20. data/lib/simplygenius/atmos/commands/user.rb +78 -0
  21. data/lib/simplygenius/atmos/config.rb +279 -0
  22. data/lib/simplygenius/atmos/exceptions.rb +13 -0
  23. data/lib/simplygenius/atmos/generator.rb +232 -0
  24. data/lib/simplygenius/atmos/ipc.rb +136 -0
  25. data/lib/simplygenius/atmos/ipc_actions/notify.rb +31 -0
  26. data/lib/simplygenius/atmos/ipc_actions/ping.rb +23 -0
  27. data/lib/simplygenius/atmos/logging.rb +164 -0
  28. data/lib/simplygenius/atmos/otp.rb +62 -0
  29. data/lib/simplygenius/atmos/plugin.rb +27 -0
  30. data/lib/simplygenius/atmos/plugin_manager.rb +120 -0
  31. data/lib/simplygenius/atmos/plugins/output_filter.rb +29 -0
  32. data/lib/simplygenius/atmos/plugins/prompt_notify.rb +21 -0
  33. data/lib/simplygenius/atmos/provider_factory.rb +23 -0
  34. data/lib/simplygenius/atmos/providers/aws/account_manager.rb +83 -0
  35. data/lib/simplygenius/atmos/providers/aws/auth_manager.rb +220 -0
  36. data/lib/simplygenius/atmos/providers/aws/container_manager.rb +118 -0
  37. data/lib/simplygenius/atmos/providers/aws/provider.rb +53 -0
  38. data/lib/simplygenius/atmos/providers/aws/s3_secret_manager.rb +51 -0
  39. data/lib/simplygenius/atmos/providers/aws/user_manager.rb +213 -0
  40. data/lib/simplygenius/atmos/settings_hash.rb +93 -0
  41. data/lib/simplygenius/atmos/source_path.rb +186 -0
  42. data/lib/simplygenius/atmos/template.rb +117 -0
  43. data/lib/simplygenius/atmos/terraform_executor.rb +297 -0
  44. data/lib/simplygenius/atmos/ui.rb +173 -0
  45. data/lib/simplygenius/atmos/utils.rb +54 -0
  46. data/lib/simplygenius/atmos/version.rb +5 -0
  47. data/templates/new/config/atmos.yml +21 -13
  48. data/templates/new/config/atmos/recipes.yml +16 -0
  49. data/templates/new/config/atmos/runtime.yml +9 -0
  50. metadata +46 -40
  51. data/lib/atmos/cli.rb +0 -105
  52. data/lib/atmos/commands/account.rb +0 -65
  53. data/lib/atmos/commands/apply.rb +0 -20
  54. data/lib/atmos/commands/auth_exec.rb +0 -29
  55. data/lib/atmos/commands/base_command.rb +0 -12
  56. data/lib/atmos/commands/bootstrap.rb +0 -72
  57. data/lib/atmos/commands/container.rb +0 -58
  58. data/lib/atmos/commands/destroy.rb +0 -18
  59. data/lib/atmos/commands/generate.rb +0 -90
  60. data/lib/atmos/commands/init.rb +0 -18
  61. data/lib/atmos/commands/new.rb +0 -18
  62. data/lib/atmos/commands/otp.rb +0 -54
  63. data/lib/atmos/commands/plan.rb +0 -20
  64. data/lib/atmos/commands/secret.rb +0 -87
  65. data/lib/atmos/commands/terraform.rb +0 -52
  66. data/lib/atmos/commands/user.rb +0 -74
  67. data/lib/atmos/config.rb +0 -208
  68. data/lib/atmos/exceptions.rb +0 -9
  69. data/lib/atmos/generator.rb +0 -199
  70. data/lib/atmos/generator_factory.rb +0 -93
  71. data/lib/atmos/ipc.rb +0 -132
  72. data/lib/atmos/ipc_actions/notify.rb +0 -27
  73. data/lib/atmos/ipc_actions/ping.rb +0 -19
  74. data/lib/atmos/logging.rb +0 -160
  75. data/lib/atmos/otp.rb +0 -61
  76. data/lib/atmos/provider_factory.rb +0 -19
  77. data/lib/atmos/providers/aws/account_manager.rb +0 -82
  78. data/lib/atmos/providers/aws/auth_manager.rb +0 -208
  79. data/lib/atmos/providers/aws/container_manager.rb +0 -116
  80. data/lib/atmos/providers/aws/provider.rb +0 -51
  81. data/lib/atmos/providers/aws/s3_secret_manager.rb +0 -49
  82. data/lib/atmos/providers/aws/user_manager.rb +0 -211
  83. data/lib/atmos/settings_hash.rb +0 -90
  84. data/lib/atmos/terraform_executor.rb +0 -267
  85. data/lib/atmos/ui.rb +0 -159
  86. data/lib/atmos/utils.rb +0 -50
  87. data/lib/atmos/version.rb +0 -3
@@ -0,0 +1,173 @@
1
+ require_relative '../atmos'
2
+ require 'highline'
3
+ require 'rainbow'
4
+ require 'yaml'
5
+ require 'open3'
6
+ require 'os'
7
+ require 'hashie'
8
+
9
+ module SimplyGenius
10
+ module Atmos
11
+
12
+ module OSDockerDetection
13
+ refine OS.singleton_class do
14
+ def docker?
15
+ @docker ||= File.exist?('/.dockerenv')
16
+ end
17
+ end
18
+ end
19
+
20
+ module UI
21
+ extend ActiveSupport::Concern
22
+ include GemLogger::LoggerSupport
23
+ using OSDockerDetection
24
+
25
+ def self.color_enabled=(val)
26
+ Rainbow.enabled = val
27
+ end
28
+
29
+ def self.color_enabled
30
+ Rainbow.enabled
31
+ end
32
+
33
+ class Markup
34
+
35
+ def initialize(color = nil)
36
+ @color = color
37
+ @atmos_ui = HighLine.new
38
+ end
39
+
40
+ def say(statement)
41
+ statement = @color ? Rainbow(statement).send(@color) : statement
42
+ @atmos_ui.say(statement)
43
+ end
44
+
45
+ def ask(question, answer_type=nil, &details)
46
+ question = @color ? Rainbow(question).send(@color) : question
47
+ @atmos_ui.ask(question, answer_type, &details)
48
+ end
49
+
50
+ def agree(question, character=nil, &details)
51
+ question = @color ? Rainbow(question).send(@color) : question
52
+ @atmos_ui.agree(question, character, &details)
53
+ end
54
+
55
+ def choose(*items, &details)
56
+ # TODO: figure out how to color menu
57
+ return @atmos_ui.choose(*items, &details)
58
+ end
59
+
60
+ end
61
+
62
+ def warn
63
+ return Markup.new(:yellow)
64
+ end
65
+
66
+ def error
67
+ return Markup.new(:red)
68
+ end
69
+
70
+ def say(statement)
71
+ return Markup.new().say(statement)
72
+ end
73
+
74
+ def ask(question, answer_type=nil, &details)
75
+ return Markup.new().ask(question, answer_type, &details)
76
+ end
77
+
78
+ def agree(question, character=nil, &details)
79
+ return Markup.new().agree(question, character, &details)
80
+ end
81
+
82
+ def choose(*items, &details)
83
+ return Markup.new().choose(*items, &details)
84
+ end
85
+
86
+ # Pretty display of hashes
87
+ def display(data)
88
+ data = Hashie.stringify_keys(data)
89
+ display = YAML.dump(data).sub(/\A---\n/, "").gsub(/^/, " ")
90
+ end
91
+
92
+ def notify(message:nil, title: nil, modal: false, **opts)
93
+
94
+ result = {
95
+ 'stdout' => '',
96
+ 'success' => ''
97
+ }
98
+
99
+ message = message.to_s
100
+ title = title.present? ? title.to_s : "Atmos Notification"
101
+ modal = ["true", "1"].include?(modal.to_s)
102
+ modal = false if Atmos.config["ui.notify.disable_modal"]
103
+
104
+ return result if Atmos.config["ui.notify.disable"].to_s == "true"
105
+
106
+ force_inline = opts[:inline].to_s == "true" || Atmos.config["ui.notify.force_inline"].to_s == "true"
107
+
108
+ command = Atmos.config["ui.notify.command"]
109
+
110
+ if command.present? && ! force_inline
111
+
112
+ raise ArgumentError.new("notify command must be a list") if ! command.is_a?(Array)
113
+
114
+ command = command.collect do |c|
115
+ c = c.gsub("{{title}}", title)
116
+ c = c.gsub("{{message}}", message)
117
+ c = c.gsub("{{modal}}", modal.to_s)
118
+ end
119
+ result.merge! run_ui_process(*command)
120
+
121
+ elsif OS.mac? && ! force_inline
122
+ display_method = modal ? "displayDialog" : "displayNotification"
123
+
124
+ dialogScript = <<~EOF
125
+ var app = Application.currentApplication();
126
+ app.includeStandardAdditions = true;
127
+ app.#{display_method}(
128
+ #{JSON.generate(message)}, {
129
+ withTitle: #{JSON.generate(title)},
130
+ buttons: ['OK'],
131
+ defaultButton: 1
132
+ })
133
+ EOF
134
+
135
+ result.merge! run_ui_process("osascript", "-l", "JavaScript", "-e", dialogScript)
136
+
137
+ elsif OS.linux? && ! OS.docker? && ! force_inline
138
+ # TODO: add a modal option
139
+ result.merge! run_ui_process("notify-send", title, message)
140
+
141
+ # TODO windows notifications?
142
+ # elseif OS.windows? && ! force_inline
143
+
144
+ else
145
+
146
+ logger.debug("Notifications are unsupported on this OS") unless force_inline
147
+ logger.info(Rainbow("\n***** #{title} *****\n#{message}\n").orange)
148
+ if modal
149
+ logger.info(Rainbow("Hit enter to continue\n").orange)
150
+ $stdin.gets
151
+ end
152
+
153
+ end
154
+
155
+ return result
156
+ end
157
+
158
+ private
159
+
160
+ def run_ui_process(*args)
161
+ stdout, status = Open3.capture2e(*args)
162
+ result = {'stdout' => stdout, 'success' => status.success?.to_s}
163
+ if ! status.success?
164
+ result['error'] = "Notification process failed"
165
+ logger.debug("Failed to run notification utility: #{stdout}")
166
+ end
167
+ return result
168
+ end
169
+
170
+ end
171
+
172
+ end
173
+ end
@@ -0,0 +1,54 @@
1
+ require_relative '../atmos'
2
+
3
+ module SimplyGenius
4
+ module Atmos
5
+
6
+ module Utils
7
+
8
+ extend ActiveSupport::Concern
9
+ include GemLogger::LoggerSupport
10
+
11
+ class SymbolizedMash < ::Hashie::Mash
12
+ include Hashie::Extensions::Mash::SymbolizeKeys
13
+ end
14
+
15
+ # remove leading whitespace using first non-empty line to determine how
16
+ # much space to remove from the rest. Skips empty lines
17
+ def clean_indent(str)
18
+ first = true
19
+ first_size = 0
20
+ str.lines.collect do |line|
21
+ if line =~ /^(\s*)\S/ # line has at least one non-whitespace character
22
+ if first
23
+ first_size = Regexp.last_match(0).size
24
+ first = false
25
+ end
26
+ line[(first_size - 1)..-1]
27
+ else
28
+ line
29
+ end
30
+ end.join()
31
+ end
32
+
33
+ # wraps to an 80 character limit by adding newlines
34
+ def wrap(str)
35
+ result = ""
36
+ count = 0
37
+ str.each do |c|
38
+ result << c
39
+ if count >= 78
40
+ result << "\n"
41
+ count = 0
42
+ else
43
+ count += 1
44
+ end
45
+ end
46
+ return result
47
+ end
48
+
49
+ extend self
50
+
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,5 @@
1
+ module SimplyGenius
2
+ module Atmos
3
+ VERSION = "0.8.0"
4
+ end
5
+ end
@@ -16,20 +16,10 @@ global_name_prefix: "#{org}-#{atmos_env}-"
16
16
  #
17
17
  local_name_prefix:
18
18
 
19
- # The recipes to use for all environments, override at environment level if
20
- # need be. The recipes to use when bootstrapping each environment will be
21
- # under the bootstrap key. These are kept separate to make it easy to tear
22
- # down an environment without breaking terraform mid-destroy. Most new
23
- # deployments will have all recipes under a single key (Default), but the use
24
- # of multiple keys to segment your infrastructure is useful as it grows larger
25
- #
26
- recipes:
27
- bootstrap:
28
- default:
29
-
30
19
  # Environment specific overrides. When adding new environments place them
31
20
  # after the existing ones so that you don't end up with permission issues when
32
- # bootstrapping the new account
21
+ # bootstrapping the new account. You can also add overrides for each
22
+ # environment in their corresponding yml file in config/atmos/environments/<env_name>.yml
33
23
  #
34
24
  environments:
35
25
  ops:
@@ -41,6 +31,13 @@ environments:
41
31
  #
42
32
  is_dev: "#{ /dev|test|demo/.match?(atmos_env) }"
43
33
 
34
+ # A list of glob patterns for finding atmos yml files
35
+ # Patterns can be absolute (beginning with /), but if not are applied relative
36
+ # to the directory containing atmos.yml
37
+ #
38
+ config_sources:
39
+ - atmos/*.y{,a}ml
40
+
44
41
  # Sources for atmos templates
45
42
  # To circumvent the version lock and get the latest git master recipes, use the git
46
43
  # location, e.g.:
@@ -50,4 +47,15 @@ template_sources:
50
47
  - name: atmos-recipes
51
48
  location: https://github.com/simplygenius/atmos-recipes/archive/v#{atmos_version}.zip#atmos-recipes-#{atmos_version}
52
49
  #- name: atmos-pro-recipes
53
- # location: https://github.com/simplygenius/atmos-pro-recipes/archive/v#{atmos_version}.zip#atmos-pro-recipes-#{atmos_version}
50
+ # location: https://YOUR_API_KEY@releases.simplygenius.com/recipes/v#{atmos_version}#atmos-pro-recipes-#{atmos_version}
51
+
52
+ # To get the atmos-pro gem, add the gem source like:
53
+ # gem sources -a https://YOUR_API_KEY@releases.simplygenius.com/gems/
54
+ # then install the gem:
55
+ # gem install simplygenius-atmos-pro
56
+ # then add simplygenius-atmos-pro to the plugins key below
57
+ #
58
+ # The list of plugin gems to load when running atmos
59
+ #
60
+ plugins:
61
+ # - simplygenius-atmos-pro
@@ -0,0 +1,16 @@
1
+ # The recipes to use for all environments, override at environment level if
2
+ # need be. The recipes to use when bootstrapping each environment will be
3
+ # under the bootstrap key. These are kept separate to make it easy to tear
4
+ # down an environment without breaking terraform mid-destroy. Most new
5
+ # deployments will have all recipes under a single key (Default), but the use
6
+ # of multiple keys to segment your infrastructure is useful as it grows larger
7
+ #
8
+ recipes:
9
+ bootstrap:
10
+ default:
11
+
12
+ # Environment specific overrides for recipes. You can also put these where you put other
13
+ # overrides, but they are here as a convenience to keep recipe overrides close
14
+ # to the defaults defined above
15
+ #
16
+ environments:
@@ -6,6 +6,10 @@ var_prefix:
6
6
  # Disable module fetch from convenience plan/apply commandss
7
7
  disable_auto_modules: false
8
8
 
9
+ # Allows one to add a custom ruby load path list for extending atmos without
10
+ # having to publish a gem
11
+ load_path:
12
+
9
13
  # Configure the mechanism that allows terraform to callback into atmos
10
14
  ipc:
11
15
  # Disables all IPC callbacks into atmos from terraform
@@ -20,6 +24,11 @@ otp:
20
24
  # The file where otp secrets are stored
21
25
  secret_file: ~/.atmos.yml
22
26
 
27
+ # Configure the template generator
28
+ generate:
29
+ # The file storing the record of each generated template
30
+ state_file: .atmos-templates.yml
31
+
23
32
  # Configure the UI components
24
33
  ui:
25
34
  # Configures UI notifications
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplygenius-atmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -459,45 +459,51 @@ files:
459
459
  - TODO.md
460
460
  - exe/atmos
461
461
  - exe/atmos-docker
462
- - lib/atmos.rb
463
- - lib/atmos/cli.rb
464
- - lib/atmos/commands/account.rb
465
- - lib/atmos/commands/apply.rb
466
- - lib/atmos/commands/auth_exec.rb
467
- - lib/atmos/commands/base_command.rb
468
- - lib/atmos/commands/bootstrap.rb
469
- - lib/atmos/commands/container.rb
470
- - lib/atmos/commands/destroy.rb
471
- - lib/atmos/commands/generate.rb
472
- - lib/atmos/commands/init.rb
473
- - lib/atmos/commands/new.rb
474
- - lib/atmos/commands/otp.rb
475
- - lib/atmos/commands/plan.rb
476
- - lib/atmos/commands/secret.rb
477
- - lib/atmos/commands/terraform.rb
478
- - lib/atmos/commands/user.rb
479
- - lib/atmos/config.rb
480
- - lib/atmos/exceptions.rb
481
- - lib/atmos/generator.rb
482
- - lib/atmos/generator_factory.rb
483
- - lib/atmos/ipc.rb
484
- - lib/atmos/ipc_actions/notify.rb
485
- - lib/atmos/ipc_actions/ping.rb
486
- - lib/atmos/logging.rb
487
- - lib/atmos/otp.rb
488
- - lib/atmos/provider_factory.rb
489
- - lib/atmos/providers/aws/account_manager.rb
490
- - lib/atmos/providers/aws/auth_manager.rb
491
- - lib/atmos/providers/aws/container_manager.rb
492
- - lib/atmos/providers/aws/provider.rb
493
- - lib/atmos/providers/aws/s3_secret_manager.rb
494
- - lib/atmos/providers/aws/user_manager.rb
495
- - lib/atmos/settings_hash.rb
496
- - lib/atmos/terraform_executor.rb
497
- - lib/atmos/ui.rb
498
- - lib/atmos/utils.rb
499
- - lib/atmos/version.rb
462
+ - lib/simplygenius/atmos.rb
463
+ - lib/simplygenius/atmos/cli.rb
464
+ - lib/simplygenius/atmos/commands/account.rb
465
+ - lib/simplygenius/atmos/commands/apply.rb
466
+ - lib/simplygenius/atmos/commands/auth_exec.rb
467
+ - lib/simplygenius/atmos/commands/base_command.rb
468
+ - lib/simplygenius/atmos/commands/bootstrap.rb
469
+ - lib/simplygenius/atmos/commands/container.rb
470
+ - lib/simplygenius/atmos/commands/destroy.rb
471
+ - lib/simplygenius/atmos/commands/generate.rb
472
+ - lib/simplygenius/atmos/commands/init.rb
473
+ - lib/simplygenius/atmos/commands/new.rb
474
+ - lib/simplygenius/atmos/commands/otp.rb
475
+ - lib/simplygenius/atmos/commands/plan.rb
476
+ - lib/simplygenius/atmos/commands/secret.rb
477
+ - lib/simplygenius/atmos/commands/terraform.rb
478
+ - lib/simplygenius/atmos/commands/user.rb
479
+ - lib/simplygenius/atmos/config.rb
480
+ - lib/simplygenius/atmos/exceptions.rb
481
+ - lib/simplygenius/atmos/generator.rb
482
+ - lib/simplygenius/atmos/ipc.rb
483
+ - lib/simplygenius/atmos/ipc_actions/notify.rb
484
+ - lib/simplygenius/atmos/ipc_actions/ping.rb
485
+ - lib/simplygenius/atmos/logging.rb
486
+ - lib/simplygenius/atmos/otp.rb
487
+ - lib/simplygenius/atmos/plugin.rb
488
+ - lib/simplygenius/atmos/plugin_manager.rb
489
+ - lib/simplygenius/atmos/plugins/output_filter.rb
490
+ - lib/simplygenius/atmos/plugins/prompt_notify.rb
491
+ - lib/simplygenius/atmos/provider_factory.rb
492
+ - lib/simplygenius/atmos/providers/aws/account_manager.rb
493
+ - lib/simplygenius/atmos/providers/aws/auth_manager.rb
494
+ - lib/simplygenius/atmos/providers/aws/container_manager.rb
495
+ - lib/simplygenius/atmos/providers/aws/provider.rb
496
+ - lib/simplygenius/atmos/providers/aws/s3_secret_manager.rb
497
+ - lib/simplygenius/atmos/providers/aws/user_manager.rb
498
+ - lib/simplygenius/atmos/settings_hash.rb
499
+ - lib/simplygenius/atmos/source_path.rb
500
+ - lib/simplygenius/atmos/template.rb
501
+ - lib/simplygenius/atmos/terraform_executor.rb
502
+ - lib/simplygenius/atmos/ui.rb
503
+ - lib/simplygenius/atmos/utils.rb
504
+ - lib/simplygenius/atmos/version.rb
500
505
  - templates/new/config/atmos.yml
506
+ - templates/new/config/atmos/recipes.yml
501
507
  - templates/new/config/atmos/runtime.yml
502
508
  - templates/new/templates.yml
503
509
  homepage: https://github.com/simplygenius/atmos
data/lib/atmos/cli.rb DELETED
@@ -1,105 +0,0 @@
1
- require_relative '../atmos'
2
- require_relative '../atmos/ui'
3
- require 'clamp'
4
- require 'sigdump/setup'
5
-
6
- Dir.glob(File.join(File.join(__dir__, 'commands'), '*.rb')) do |f|
7
- require_relative "commands/#{File.basename(f).sub(/\.rb$/, "")}"
8
- end
9
-
10
- module Atmos
11
-
12
- # The command line interface to atmos
13
- class CLI < Clamp::Command
14
-
15
- include GemLogger::LoggerSupport
16
-
17
- def self.description
18
- desc = <<-DESC
19
- Atmos version #{Atmos::VERSION}
20
-
21
- Runs The atmos command line application
22
-
23
- e.g.
24
-
25
- atmos --help
26
- DESC
27
- desc.split("\n").collect(&:strip).join("\n")
28
- end
29
-
30
- option ["-d", "--debug"],
31
- :flag, "debug output\n",
32
- default: false
33
-
34
- option ["-c", "--[no-]color"],
35
- :flag, "colorize output (or not)\n (default: $stdout.tty?)"
36
-
37
- option ["-e", "--atmos-env"],
38
- 'ENV', "The atmos environment\n",
39
- environment_variable: 'ATMOS_ENV', default: 'ops'
40
-
41
- def default_color?
42
- $stdout.tty?
43
- end
44
-
45
- option ["-l", "--[no-]log"],
46
- :flag, "log to file in addition to terminal (or not)\n",
47
- default: true
48
-
49
-
50
- subcommand "new", "Sets up a new atmos project",
51
- Atmos::Commands::New
52
- subcommand "generate", "Generate recipes for the repository",
53
- Atmos::Commands::Generate
54
- subcommand "bootstrap", "Init cloud provider for use with atmos",
55
- Atmos::Commands::Bootstrap
56
- subcommand "init", "Run terraform init",
57
- Atmos::Commands::Init
58
- subcommand "plan", "Run terraform plan",
59
- Atmos::Commands::Plan
60
- subcommand "apply", "Run terraform apply",
61
- Atmos::Commands::Apply
62
- subcommand "destroy", "Run terraform destroy",
63
- Atmos::Commands::Destroy
64
- subcommand "terraform", "Run all other terraform commands",
65
- Atmos::Commands::Terraform
66
- subcommand "account", "Account management commands",
67
- Atmos::Commands::Account
68
- subcommand "user", "User management commands",
69
- Atmos::Commands::User
70
- subcommand "otp", "Otp tools",
71
- Atmos::Commands::Otp
72
- subcommand "secret", "Secret management commands",
73
- Atmos::Commands::Secret
74
- subcommand "auth_exec", "Authenticated exec",
75
- Atmos::Commands::AuthExec
76
- subcommand "container", "Container tools",
77
- Atmos::Commands::Container
78
-
79
- subcommand "version", "Display version" do
80
- def execute
81
- logger.info "Atmos Version #{Atmos::VERSION}"
82
- end
83
- end
84
-
85
- subcommand "config", "Display expanded config for atmos_env" do
86
- def execute
87
- logger.info YAML.dump(Atmos.config.to_h)
88
- end
89
- end
90
-
91
- # hook into clamp lifecycle to force logging setup even when we are calling
92
- # a subcommand
93
- def parse(arguments)
94
- super
95
- if Atmos.config.nil?
96
- Atmos.config = Atmos::Config.new(atmos_env)
97
- log = Atmos.config.is_atmos_repo? && log? ? "atmos.log" : nil
98
- Atmos::Logging.setup_logging(debug?, color?, log)
99
- Atmos::UI.color_enabled = color?
100
- end
101
- end
102
-
103
- end
104
-
105
- end