Sha256: 5937a6f3970c49ff927cc08d195de5bafa6a8eebcac7018969132ceeed9a5b94

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

require_relative "application"
require_relative "logger"
require_relative "displayer/concept_displayer"
require_relative "displayer/stats_displayer"
require_relative "exporter/export_action"
require_relative "loader/project_loader"
require_relative "loader/input_loader"

class Start
  def call(filepath)
    project_data, data = load_input(filepath)
    ConceptDisplayer.new.call(data[:concepts])
    create_output(project_data, data)
  end

  private

  def load_input(args)
    init_project_data
    project_data = ProjectLoader.load(args)
    Logger.create(project_data.get(:logpath))
    Logger.set_verbose(Application.instance.config["global"]["verbose"])

    inputdirs = project_data.get(:inputdirs).split(",")
    internet = Application.instance.config["global"]["internet"] == "yes"
    data = InputLoader.new.call(inputdirs, internet)
    [project_data, data]
  end

  def init_project_data
    project_data = ProjectData.instance
    outputdir = Application.instance.config["output"]["folder"]
    project_data.set(:outputdir, outputdir)

    formula_weights = Application.instance.config["ai"]["formula_weights"]
    project_data.set(:weights, formula_weights)
  end

  def create_output(project, data)
    ExportAction.new.call(data, project)
    StatsDisplayer.show(data)
    Logger.close
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
asker-tool-2.9.4 lib/asker/start.rb
asker-tool-2.9.3 lib/asker/start.rb
asker-tool-2.9.2 lib/asker/start.rb
asker-tool-2.9.1 lib/asker/start.rb
asker-tool-2.9.0 lib/asker/start.rb