Sha256: 46d365905b1bfae4799d0bd6b16e0c71c74727858bdbd8fb3ed787f73345f629

Contents?: true

Size: 696 Bytes

Versions: 8

Compression:

Stored size: 696 Bytes

Contents

require 'cap-util'

module CapUtil

  # the class should be use as a superclass for fetching server roles yaml.

  class ServerRolesYaml
    include CapUtil
    attr_reader :desc, :source

    def initialize(cap, opts=nil)
      opts ||= {}

      @cap    = cap
      @desc   = opts[:desc]   ? "#{opts[:desc]} server roles" : "server roles"
      @source = opts[:source] ? " from #{opts[:source]}" : ""
    end

    def get
      say "Applying #{color @desc, :bold, :cyan}#{@source}."

      validate
      valid? ? read : halt
    end

    def validate; raise NotImplementedError; end
    def valid?;   raise NotImplementedError; end
    def read;     raise NotImplementedError; end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cap-util-1.4.0 lib/cap-util/server_roles_yaml.rb
cap-util-1.3.0 lib/cap-util/server_roles_yaml.rb
cap-util-1.2.0 lib/cap-util/server_roles_yaml.rb
cap-util-1.1.0 lib/cap-util/server_roles_yaml.rb
cap-util-1.0.1 lib/cap-util/server_roles_yaml.rb
cap-util-1.0.0 lib/cap-util/server_roles_yaml.rb
cap-util-1.0.0.rc1 lib/cap-util/server_roles_yaml.rb
cap-util-0.4.0 lib/cap-util/server_roles_yaml.rb