Module: UberDoc::Util

Defined in:
lib/uberdoc/utils.rb

Class Method Summary collapse

Class Method Details

.execute_command(command, verbose) ⇒ Object

Exectues the given command and optionally dumps the command and its output



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/uberdoc/utils.rb', line 15

def self.execute_command(command, verbose)
    stdin, stdout, stderr, wait_thr = Open3.popen3(command)

    res = stdout.read

    if verbose
        puts ">>>>>>>>>>>>>>>>>>>>>>>>>"
        puts "Command '#{command}'"
        puts res
        puts "<<<<<<<<<<<<<<<<<<<<<<<<<"
    end

    stdin.close
    stdout.close
    stderr.close

    return res
end

.template_file_path(file) ⇒ Object



8
9
10
# File 'lib/uberdoc/utils.rb', line 8

def self.template_file_path(file)
    File.absolute_path("#{File.dirname(File.dirname(File.dirname(__FILE__)))}/templates/#{file}") 
end