class Maintainer::Setup

Constants

FILE

Public Class Methods

parse_into_inst(line) click to toggle source
# File lib/maintainer_core/setup.rb, line 18
def parse_into_inst(line)
    return Maintainer::InstructionParser.parse(line)
end
proccess_file(path) click to toggle source
# File lib/maintainer_core/setup.rb, line 27
def proccess_file(path)
    File.open(path, "r") do |f|
        f.each_line do |line|
            inst = parse_into_inst(line)
            result = process_instruction(inst)
            if result
                # Success
                puts "#{inst.success_message!}"
            else
                # Error
                puts "#{inst.error_message!}"
                if inst.crash_on_error!
                    # CRASH
                end
            end
        end
    end
end
process_instruction(inst) click to toggle source
# File lib/maintainer_core/setup.rb, line 22
def process_instruction(inst)
    puts "[Next Instruction]"
    result = inst.run!
    return result
end
setup!() click to toggle source
# File lib/maintainer_core/setup.rb, line 9
def setup!()
    ## Find path to maintainfile
    path = Dir.glob("./**/#{FILE}")
    if path.length == 1
        puts "Found Setup file at #{path[0]}"
        proccess_file(path[0])
    end
end