Sha256: 41b8ef044183a69e2454a4b2875cab392f2f57461e4cde379c87472612917846

Contents?: true

Size: 686 Bytes

Versions: 5

Compression:

Stored size: 686 Bytes

Contents

require 'guignol/commands/base'
require 'guignol/models/instance'

Guignol::Shell.class_eval do
  desc 'stop PATTERNS', 'Stop all instances matching PATTERNS, and remove DNS records'
  def stop(*patterns)
    if patterns.empty?
      raise Thor::Error.new('You must specify at least one PATTERN.')
    end
    Guignol::Commands::Stop.new(patterns).run
  end
end


module Guignol::Commands
  class Stop < Base
    def before_run(configs)
      return true if configs.empty?
      names = configs.keys.join(", ")
      shell.yes? "Are you sure you want to stop servers #{names}? [y/N]", :cyan
    end

    def run_on_server(instance, options = {})
      instance.stop
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
guignol-0.3.4 lib/guignol/commands/stop.rb
guignol-0.3.3 lib/guignol/commands/stop.rb
guignol-0.3.2 lib/guignol/commands/stop.rb
guignol-0.3.1 lib/guignol/commands/stop.rb
guignol-0.3.0 lib/guignol/commands/stop.rb