Class: Flotte::CLI::Main

Inherits:
Thor
  • Object
show all
Includes:
SSHKit::DSL
Defined in:
lib/flotte/cli/main.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/flotte/cli/main.rb', line 6

def self.exit_on_failure?
  true
end

Instance Method Details

#logsObject



35
36
37
38
39
40
41
# File 'lib/flotte/cli/main.rb', line 35

def logs
  host = "root@test"
  on([host]) do |host|
    SSHKit.config.output_verbosity = Logger::DEBUG
    execute :docker, "logs", "-f", "goofy_meitner"
  end
end

#runitObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/flotte/cli/main.rb', line 16

def runit
  captured = {}
  image = "alpine"
  container_name = "test-#{SecureRandom.alphanumeric(5)}"
  host = "root@test"
  on(host) do |host|
    output = capture(*Command::Docker::Container::Run.build(image: image, name: container_name, remove: false, interactive: true), {verbosity: Logger::INFO})

    captured[host] = output
  end

  run_locally do
    command = Flotte::Command::SSH.wrap(host, [:docker, :container, :attach, container_name, ";", "echo", "'42424242'"])
    info "Running #{command.join(" ")}"
    Kernel.exec(*command)
  end
end

#versionObject



11
12
13
# File 'lib/flotte/cli/main.rb', line 11

def version
  Flotte.output.puts Flotte::VERSION
end