Module: TorQML

Defined in:
lib/torqml.rb,
lib/torqml/plugins.rb,
lib/torqml/version.rb,
lib/torqml/datasources.rb,
lib/torqml/datasources/datasource.rb,
lib/torqml/datasources/csvdatasource.rb,
lib/torqml/datasources/lineardatasource.rb,
lib/torqml/datasources/matrixdatasource.rb

Overview

TorQML module.

Defined Under Namespace

Modules: DataSources, Plugins

Constant Summary collapse

VERSION =

Version of TorQML.

"0.1.1"

Class Method Summary collapse

Class Method Details

.runObject

Main routine.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/torqml.rb', line 16

def run
  if ARGV.length < 1 then usage; exit end

  torqml_root_dir = Pathname.new(__dir__).parent
  plugin_dir = Pathname.new(Plugins::default_path)
  qml_realpath = Pathname.new(ARGV[0]).realpath

  # preload ruby modules of plugins
  Plugins::preload(plugin_dir.dirname)
  Plugins::preload(qml_realpath.dirname + 'plugins')

  # change current directory to use relative paths in both ruby and QML
  Dir.chdir(qml_realpath.dirname) do
    QML.run do |app|
      # load QML/C++ components of plugins
      Plugins::load(app, plugin_dir.dirname)
      Plugins::load(app, qml_realpath.dirname + 'plugins')

      # add QML import paths
      app.engine.add_import_path("#{torqml_root_dir.realpath}/qml")
      app.engine.add_import_path("#{torqml_root_dir.realpath}/ext")

      app.load_path qml_realpath.basename
    end
  end
end

.usageObject

Displays usage.



10
11
12
13
# File 'lib/torqml.rb', line 10

def usage
  puts "torqml ver." + VERSION
  puts "usage: torqml <main.qml>"
end