Sha256: abf4f483c2e448415b6e497c5b80e3c718ef7ba6e8fb5e58473485c35cff2049

Contents?: true

Size: 765 Bytes

Versions: 14

Compression:

Stored size: 765 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'
  add_force_option
  def stop(*patterns)
    if patterns.empty?
      raise Thor::Error.new('You must specify at least one PATTERN.')
    end
    Guignol::Commands::Stop.new(patterns, options).run
  end
end


module Guignol::Commands
  class Stop < Base
    def before_run(configs, options = {})
      return true if configs.empty?
      return true if options[:force]
      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

14 entries across 14 versions & 1 rubygems

Version Path
guignol-0.3.16 lib/guignol/commands/stop.rb
guignol-0.3.15 lib/guignol/commands/stop.rb
guignol-0.3.14 lib/guignol/commands/stop.rb
guignol-0.3.13 lib/guignol/commands/stop.rb
guignol-0.3.12 lib/guignol/commands/stop.rb
guignol-0.3.10 lib/guignol/commands/stop.rb
guignol-0.3.9 lib/guignol/commands/stop.rb
guignol-0.3.8 lib/guignol/commands/stop.rb
guignol-0.3.7 lib/guignol/commands/stop.rb
guignol-0.3.6.2 lib/guignol/commands/stop.rb
guignol-0.3.6.1 lib/guignol/commands/stop.rb
guignol-0.3.6 lib/guignol/commands/stop.rb
guignol-0.3.5.1 lib/guignol/commands/stop.rb
guignol-0.3.5 lib/guignol/commands/stop.rb