Sha256: 58d7b334bebe615807c0f1721e9cb303f07f46bd7805a9f2f494ff59a51d03aa

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

require 'gamefic-sdk/plot_config'
require 'gamefic/engine/tty'

module Gamefic
  module Sdk
    class Shell
      class Test
        def initialize(directory:)
          @path = directory
          raise "Invalid path: #{@path}" unless File.exist?(@path)
          puts "Loading..."
        end

        def run
          paths = config_path.script_paths + [Gamefic::Sdk::GLOBAL_SCRIPT_PATH]
          plot = Gamefic::Sdk::Debug::Plot.new Source::File.new(*paths)
          plot.script 'main'
          plot.script 'debug'
          engine = Engine::Tty.new plot
          engine.connect
          puts "\n"
          engine.run
        end

        private

        def config_path
          if File.directory?(@path)
            PlotConfig.new File.join(@path, 'config.yaml')
          else
            PlotConfig.new
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gamefic-sdk-1.6.0 lib/gamefic-sdk/shell/test.rb
gamefic-sdk-1.5.0 lib/gamefic-sdk/shell/test.rb
gamefic-sdk-1.4.1 lib/gamefic-sdk/shell/test.rb
gamefic-sdk-1.4.0 lib/gamefic-sdk/shell/test.rb