Class: Maintainer::Setup
- Inherits:
-
Object
- Object
- Maintainer::Setup
- Defined in:
- lib/maintainer_core/setup.rb
Constant Summary collapse
- FILE =
'Setup'
Class Method Summary collapse
- .parse_into_inst(line) ⇒ Object
- .proccess_file(path) ⇒ Object
- .process_instruction(inst) ⇒ Object
- .setup! ⇒ Object
Class Method Details
.parse_into_inst(line) ⇒ Object
18 19 20 |
# File 'lib/maintainer_core/setup.rb', line 18 def parse_into_inst(line) return Maintainer::InstructionParser.parse(line) end |
.proccess_file(path) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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.}" else # Error puts "#{inst.}" if inst.crash_on_error! # CRASH end end end end end |
.process_instruction(inst) ⇒ Object
22 23 24 25 26 |
# File 'lib/maintainer_core/setup.rb', line 22 def process_instruction(inst) puts "[Next Instruction]" result = inst.run! return result end |
.setup! ⇒ Object
9 10 11 12 13 14 15 16 |
# 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 |