Module: Dotman::Shell

Defined in:
lib/dotman/shell.rb,
lib/dotman/shell/block.rb,
lib/dotman/shell/command.rb,
lib/dotman/shell/condition.rb,
lib/dotman/shell/statement.rb,
lib/dotman/shell/comparison.rb

Defined Under Namespace

Classes: Block, Command, Comparison, Condition, Statement

Class Method Summary collapse

Class Method Details

.block(*args) ⇒ Object



23
24
25
# File 'lib/dotman/shell.rb', line 23

def self.block(*args)
    Block.new(*args)
end

.command(*args) ⇒ Object



27
28
29
# File 'lib/dotman/shell.rb', line 27

def self.command(*args)
    Command.new(*args)
end

.comparison(*args) ⇒ Object



31
32
33
# File 'lib/dotman/shell.rb', line 31

def self.comparison(*args)
    Comparison.new(*args)
end

.condition(*args) ⇒ Object



35
36
37
# File 'lib/dotman/shell.rb', line 35

def self.condition(*args)
    Condition.new(*args)
end

.echo(colour, msg) ⇒ Object



11
12
13
# File 'lib/dotman/shell.rb', line 11

def self.echo(colour, msg)
    command('echo "%s"' % msg.send(colour))
end

.exit(code) ⇒ Object



15
16
17
# File 'lib/dotman/shell.rb', line 15

def self.exit(code)
    command('exit ' + code.to_s)
end

.indent(level) ⇒ Object



19
20
21
# File 'lib/dotman/shell.rb', line 19

def self.indent(level)
    ' ' * (level * 4)
end

.satisfies_args(aliases, only: [], except: []) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/dotman/shell.rb', line 3

def self.satisfies_args(aliases, only: [], except: [])
    if only.length > 0
        Check::Host.new(aliases, only, include: true).to_comparison
    elsif except.length > 0
        Check::Host.new(aliases, except, include: false).to_comparison
    end
end

.statement(*args) ⇒ Object



39
40
41
# File 'lib/dotman/shell.rb', line 39

def self.statement(*args)
    Statement.new(*args)
end