Class: Sanctuary::Planter::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/sanctuary/planter/cli.rb

Class Method Summary collapse

Class Method Details

.startObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sanctuary/planter/cli.rb', line 8

def self.start
  if ARGV.include?("-i")
    classes_array = Sanctuary::Planter::Parser.parse_plant_uml(ARGV[1])
    plant_array = Sanctuary::Planter::Parser.generate_plant_data_objects(classes_array)
    plant_array.each do |plant|
      Sanctuary::Planter::Generator.generate_file_from_plant(plant)
    end
  else
    system("vim", "tmp.puml")
    classes_array = Sanctuary::Planter::Parser.parse_plant_uml("./tmp.puml")
    plant_array = Sanctuary::Planter::Parser.generate_plant_data_objects(classes_array)
    plant_array.each do |plant|
      Sanctuary::Planter::Generator.generate_file_from_plant(plant)
    end
    File.delete("./tmp.puml") if File.exists? ("./tmp.puml")
  end
end