Class: Gamefic::Sdk::Shell::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/gamefic-sdk/shell/test.rb

Instance Method Summary collapse

Constructor Details

#initialize(directory:) ⇒ Test

Returns a new instance of Test.



7
8
9
10
# File 'lib/gamefic-sdk/shell/test.rb', line 7

def initialize(directory:)
  @path = directory
  raise "Invalid path: #{@path}" unless File.exist?(@path)
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gamefic-sdk/shell/test.rb', line 12

def run
  puts "Loading..."
  config = Gamefic::Sdk::Config.new(@path)
  if config.auto_import?
    puts "Importing scripts..."
    Shell.start ['import', @path, '--quiet']
  end
  paths = [config.script_path, config.import_path, Gamefic::Sdk::GLOBAL_SCRIPT_PATH]
  plot = Gamefic::Sdk::Debug::Plot.new Source::File.new(*paths)
  plot.script 'main'
  # @todo Debug is temporarily disabled.
  #plot.script 'debug'
  engine = Engine::Tty.new plot
  engine.connect
  puts "\n"
  engine.run
end