Sha256: a6b28a1bea48a026e2517a0d87d41ec8fe6b3da6aaac2b895a8cc64fb70c3faf

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'reap/tool'

module Reap
module Hosts

  def self.registry
    @registry ||= {}
  end

  # = Host
  #
  # Base class for Hosts.

  class Host < Tool

    def self.registry
      Hosts.registry
    end

    def self.register(*uris)
      uris.each do |uri|
        registry[uri] = self
      end
    end

    def self.inherited(base)
      scm = base.basename.downcase
      registry[scm] = base
    end

    def self.factory(name)
      registry[name]
    end

    # Generic announce confirmation.

    def announce_confirm?(options={})
      return true if force?
      ans = ask("Announce to #{self.class.basename.downcase}?", "yN")
      case ans.downcase
      when 'y', 'yes'
        true
      else
        false
      end
    end

    # Generic announce confirmation.

    def release_confirm?(options={})
      return true if force?
      ans = ask("Release to #{self.class.basename.downcase}?", "yN")
      case ans.downcase
      when 'y', 'yes'
        true
      else
        false
      end
    end

    def inspect
      "<#{self.class}>"
    end

  end

end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reap-9.4.0 lib/reap/hosts/host.rb