### Home Classes Methods

### In Files

- lib/rye/dsl.rb

### Parent

BasicObject

### Methods

- #colors
- #command_group
- #debug
- #err
- #exit_status_check
- #host
- #hostset
- #info
- #parallel
- #results
- #strwrap

### Files

- LICENSE.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Rye
- Rye::Box
- Rye::Box::InstanceExecHelper
- Rye::Cmd
- Rye::CommandNotFound
- Rye::Err
- Rye::Hop
- Rye::Key
- Rye::Key::BadFile
- Rye::Key::BadPerm
- Rye::NoBoxes
- Rye::NoHost
- Rye::NoPassword
- Rye::NoPty
- Rye::NotConnected
- Rye::Rap
- Rye::RyeError
- Rye::Set
- Rye::Tpl
- Rye::VERSION
- Object

No matching classes.

# Object

### Public Instance Methods

colors(state;) click to toggle source

    # File lib/rye/dsl.rb, line 18
    def colors   state; @@colors  = state; end

command_group(name, &block) click to toggle source

    # File lib/rye/dsl.rb, line 41
    def command_group(name, &block)
      @@command[name] = Proc.new &block
    end

debug(msg, *opts) click to toggle source

    # File lib/rye/dsl.rb, line 97
    def debug msg, *opts
      STDOUT.puts strwrap(msg, *opts)
    end

err(msg, *opts) click to toggle source

    # File lib/rye/dsl.rb, line 93
    def err msg, *opts
      STDOUT.puts strwrap(msg, *opts)
    end

exit_status_check(cmd, opts={}) click to toggle source

    # File lib/rye/dsl.rb, line 45
    def exit_status_check(cmd, opts={})
      enable_quiet_mode
      @pass = opts[:pass_str] || cmd.to_s + ' Passed Status Check'
      @fail = opts[:fail_str] || cmd.to_s + ' Failed Status Check'
      def results(obj, out)
        if obj.exit_status == 0
          info out, :altstring => @pass
        else
          err out, :altstring => @fail
        end
      end
      out = execute cmd
      if out[0].class == Rye::Rap
        out.each do |rap|
          results(rap, out)
        end
      elsif out.exit_status == 0
        results(out, out)
      end
      disable_quiet_mode
    end

host(hostname, *args, &block) click to toggle source

    # File lib/rye/dsl.rb, line 20
    def host(hostname, *args, &block)
      @hosts[hostname] = Rye::Box.new(hostname, *args) unless @hosts.key? hostname
      Docile.dsl_eval(Rye::Set.new.add_box(@hosts[hostname]), &block) if block_given?
    end

hostset(setname, *args, &block) click to toggle source

    # File lib/rye/dsl.rb, line 25
    def hostset(setname, *args, &block)
      @hostsets[setname] = Rye::Set.new(setname) unless @hostsets.key? setname
      args.each do |host|
        @hosts[host] = Rye::Box.new(host) unless @hosts.key? host
        @hostsets[setname].add_box @hosts[host] unless @hostsets[setname].boxes.include? @hosts[host]
      end
      if @parallel
        @hostsets[setname].parallel = true
        Docile.dsl_eval(@hostsets[setname], &block) if block_given?
      else
        @hostsets[setname].boxes.each do |host|
          Docile.dsl_eval(Rye::Set.new.add_box(host), &block) if block_given?
        end
      end
    end

info(msg, *opts) click to toggle source

    # File lib/rye/dsl.rb, line 89
    def info msg, *opts
      STDOUT.puts strwrap(msg, *opts)
    end

parallel(state;) click to toggle source

    # File lib/rye/dsl.rb, line 17
    def parallel state; @parallel = state; end

results(obj, out) click to toggle source

    # File lib/rye/dsl.rb, line 49
    def results(obj, out)
      if obj.exit_status == 0
        info out, :altstring => @pass
      else
        err out, :altstring => @fail
      end
    end

strwrap(msg, opts={}) click to toggle source

    # File lib/rye/dsl.rb, line 67
    def strwrap(msg, opts={})
      out = ''
      unless @@colors
        msg.each do |str|
          unless opts.key? :altstring
            out += str.to_s.gsub!(/^/, "[#{str.obj.hostname}] ") + "\n"
          else
            out += "[#{str.obj.hostname}] #{opts[:altstring]}\n"
          end
        end
      else
        msg.each do |str|
          unless opts.key? :altstring
            out += str.to_s.gsub!(/^(.*)$/, str.obj.hostname)
          else
            out += "#{str.obj.hostname} " + opts[:altstring]
          end
        end
      end
      out
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.